Skip to content

Commit

Permalink
flood setup
Browse files Browse the repository at this point in the history
  • Loading branch information
ermalkaleci committed Dec 5, 2023
1 parent aeef828 commit a346305
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -70,3 +70,6 @@ jspm_packages/
dist
lib
*.tsbuildinfo

flood
flood-result
1 change: 1 addition & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ services:
# ------------------------------------ #
mandala-node:
image: ghcr.io/acalanetwork/mandala-node:sha-37d9e36
platform: linux/amd64
ports:
- 9944:9944
healthcheck:
Expand Down
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,10 @@
"e2e:truffle": "yarn start:eth-rpc-adapter-subql; cd examples/truffle-tutorials; yarn install --immutable; yarn test:mandala",
"e2e:hardhat": "yarn start:eth-rpc-adapter; cd examples/hardhat-tutorials; yarn install --immutable; yarn test:mandala",
"bump": "yarn workspaces foreach -vit --include '@acala-network/*' --exclude '@acala-network/evm-subql' version",
"postinstall": "husky install"
"postinstall": "husky install",
"build-bodhi-runner": "docker build . -t bodhi-runner -f docker/bodhi-runner.Dockerfile",
"flood:setup": "yarn build-bodhi-runner; yarn start:eth-rpc-adapter-subql; yarn e2e:feed-tx; yarn e2e:feed-tx-2; yarn e2e:waffle",
"flood": "npx ts-node scripts/flood.ts"
},
"devDependencies": {
"@swc/core": "^1.3.56",
Expand Down
49 changes: 49 additions & 0 deletions scripts/flood.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#!/bin/env node

import { execSync } from 'child_process';
import { existsSync } from 'fs'

(async () => {
// set max block number
const head = await fetch('http://localhost:8545', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
jsonrpc: "2.0",
id: 1,
method: "eth_getBlockByNumber",
params: ["latest", false]
})
}).then(res => res.json());

const latestBlock = Number(head.result.number);
console.log(`Latest block: ${latestBlock}`);

process.env.MAX_BLOCK_NUMBER = latestBlock.toString();

if (!existsSync('flood')) {
execSync('git clone --branch acala-bodhi --depth 0 [email protected]:ermalkaleci/flood.git');
}

const tests = [
"eth_call",
"eth_getBalance",
"eth_getBlockByNumber",
"eth_getCode",
"eth_getLogs",
"eth_getStorageAt",
"eth_getTransactionByHash",
"eth_getTransactionCount",
"eth_getTransactionReceipt",
];

for (const test of tests) {
execSync(`cd flood; python3 -m flood ${test} http://localhost:8545 -o ../flood-result/${test} --deep-check`, {
stdio: 'inherit',
env: process.env
});
await new Promise(resolve => setTimeout(resolve, 10_000));
}
})();

0 comments on commit a346305

Please sign in to comment.