Skip to content

Commit

Permalink
Add a script to analyze given eth getLogs requests (#534)
Browse files Browse the repository at this point in the history
* Add a script to perform configured eth getLogs calls

* Add get logs requests with blockhash near head

* Add get logs requests with blockrange near head

* Add get logs requests with older blockrange

* Update get logs requests

* Export curl requests for given params to a file

* Support making requests in parallel

* Refactor duplicate code and rename files
  • Loading branch information
prathamesh0 authored Aug 29, 2024
1 parent d0f8875 commit ea5ff93
Show file tree
Hide file tree
Showing 7 changed files with 597 additions and 0 deletions.
8 changes: 8 additions & 0 deletions packages/test/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,3 +74,11 @@
```bash
yarn get-storage-at -e http://127.0.0.1:8545 -c 0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f -s 0x1 -b 0xB5FFFF
```

## Get Logs Requests

* Run:

```bash
yarn eth-get-logs -i <input-requests-json-file> -o <output-results-json-file> -c <output-curl-requests-file> -e http://127.0.0.1:1234/rpc/v1 --parallel <true | false>
```
66 changes: 66 additions & 0 deletions packages/test/data/requests-blockhash-4217942.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
[
{
"blockHash": "0xfcac7d16db53c4a3dedd4f6cad3c2c5c74311b602c9c812672bca1f0cad3b207",
"address": [],
"topics": [[]]
},
{
"blockHash": "0xfcac7d16db53c4a3dedd4f6cad3c2c5c74311b602c9c812672bca1f0cad3b207",
"address": [
"0x60e1773636cf5e4a227d9ac24f20feca034ee25a",
"0x57e3bb9f790185cfe70cc2c15ed5d6b84dcf4adb",
"0x443a6243a36ef0ae1c46523d563c15abd787f4e9",
"0xaaa93ac72becfbbc9149f293466bbdaa4b5ef68c"
],
"topics": [[]]
},
{
"blockHash": "0xfcac7d16db53c4a3dedd4f6cad3c2c5c74311b602c9c812672bca1f0cad3b207",
"address": [],
"topics":[[
"0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
"0xe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c",
"0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925",
"0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
"0xc42079f94a6350d7e6235f29174924f928cc2ac818eb64fed8004e115fbcca67",
"0x9d9c909296d9c674451c0c24f02cb64981eb3b727f99865939192f880a755dcb",
"0xa4b3513a5f822f3e098a6a12338b3f07613cb130b75c90a250ab181402f4bb87"
]]
},
{
"blockHash": "0xfcac7d16db53c4a3dedd4f6cad3c2c5c74311b602c9c812672bca1f0cad3b207",
"address": [
"0x60e1773636cf5e4a227d9ac24f20feca034ee25a",
"0x57e3bb9f790185cfe70cc2c15ed5d6b84dcf4adb",
"0x443a6243a36ef0ae1c46523d563c15abd787f4e9",
"0xaaa93ac72becfbbc9149f293466bbdaa4b5ef68c"
],
"topics":[[
"0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
"0xe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c",
"0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925",
"0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
"0xc42079f94a6350d7e6235f29174924f928cc2ac818eb64fed8004e115fbcca67",
"0x9d9c909296d9c674451c0c24f02cb64981eb3b727f99865939192f880a755dcb",
"0xa4b3513a5f822f3e098a6a12338b3f07613cb130b75c90a250ab181402f4bb87"
]]
},
{
"blockHash": "0xfcac7d16db53c4a3dedd4f6cad3c2c5c74311b602c9c812672bca1f0cad3b207",
"address": [
"0x60e1773636cf5e4a227d9ac24f20feca034ee25a"
],
"topics":[[
"0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"
]]
},
{
"blockHash": "0xfcac7d16db53c4a3dedd4f6cad3c2c5c74311b602c9c812672bca1f0cad3b207",
"address": [
"0x497f5f88e0bad1a184e110514142dd9d94728ed5"
],
"topics":[[
"0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925"
]]
}
]
72 changes: 72 additions & 0 deletions packages/test/data/requests-blockrange-4201680-4201780.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
[
{
"fromBlock": "0x401CD0",
"toBlock": "0x401D34",
"address": [],
"topics": [[]]
},
{
"fromBlock": "0x401CD0",
"toBlock": "0x401D34",
"address": [
"0x60e1773636cf5e4a227d9ac24f20feca034ee25a",
"0x57e3bb9f790185cfe70cc2c15ed5d6b84dcf4adb",
"0x443a6243a36ef0ae1c46523d563c15abd787f4e9",
"0xaaa93ac72becfbbc9149f293466bbdaa4b5ef68c"
],
"topics": [[]]
},
{
"fromBlock": "0x401CD0",
"toBlock": "0x401D34",
"address": [],
"topics":[[
"0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
"0xe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c",
"0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925",
"0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
"0xc42079f94a6350d7e6235f29174924f928cc2ac818eb64fed8004e115fbcca67",
"0x9d9c909296d9c674451c0c24f02cb64981eb3b727f99865939192f880a755dcb",
"0xa4b3513a5f822f3e098a6a12338b3f07613cb130b75c90a250ab181402f4bb87"
]]
},
{
"fromBlock": "0x401CD0",
"toBlock": "0x401D34",
"address": [
"0x60e1773636cf5e4a227d9ac24f20feca034ee25a",
"0x57e3bb9f790185cfe70cc2c15ed5d6b84dcf4adb",
"0x443a6243a36ef0ae1c46523d563c15abd787f4e9",
"0xaaa93ac72becfbbc9149f293466bbdaa4b5ef68c"
],
"topics":[[
"0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
"0xe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c",
"0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925",
"0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
"0xc42079f94a6350d7e6235f29174924f928cc2ac818eb64fed8004e115fbcca67",
"0x9d9c909296d9c674451c0c24f02cb64981eb3b727f99865939192f880a755dcb",
"0xa4b3513a5f822f3e098a6a12338b3f07613cb130b75c90a250ab181402f4bb87"
]]
},
{
"fromBlock": "0x401CD0",
"toBlock": "0x401D34",
"address": [
"0x60e1773636cf5e4a227d9ac24f20feca034ee25a"
],
"topics":[[
"0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"
]]
},
{
"fromBlock": "0x401CD0",
"toBlock": "0x401D34",
"address": [
"0x497f5f88e0bad1a184e110514142dd9d94728ed5"
],
"topics":[[
"0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925"
]]
}
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
[
{
"address": [
"0x497f5f88e0bad1a184e110514142dd9d94728ed5"
],
"topics": [
[
"0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925"
]
],
"fromBlock": "0x405C02",
"toBlock": "0x405C66"
},
{
"address": [
"0x60e1773636cf5e4a227d9ac24f20feca034ee25a"
],
"topics": [
[
"0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"
]
],
"fromBlock": "0x405C02",
"toBlock": "0x405C66"
},
{
"address": [
"0x60e1773636cf5e4a227d9ac24f20feca034ee25a"
],
"topics": [
[
"0xe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c"
]
],
"fromBlock": "0x405C02",
"toBlock": "0x405C66"
},
{
"address": [
"0x60e1773636cf5e4a227d9ac24f20feca034ee25a"
],
"topics": [
[
"0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925"
]
],
"fromBlock": "0x405C02",
"toBlock": "0x405C66"
},
{
"address": [
"0x57e3bb9f790185cfe70cc2c15ed5d6b84dcf4adb"
],
"topics": [
[
"0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"
]
],
"fromBlock": "0x405C02",
"toBlock": "0x405C66"
},
{
"address": [
"0x443a6243a36ef0ae1c46523d563c15abd787f4e9"
],
"topics": [
[
"0xc42079f94a6350d7e6235f29174924f928cc2ac818eb64fed8004e115fbcca67"
]
],
"fromBlock": "0x405C02",
"toBlock": "0x405C66"
},
{
"address": [
"0xaaa93ac72becfbbc9149f293466bbdaa4b5ef68c"
],
"topics": [
[
"0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"
]
],
"fromBlock": "0x405C02",
"toBlock": "0x405C66"
},
{
"address": [
"0xaaa93ac72becfbbc9149f293466bbdaa4b5ef68c"
],
"topics": [
[
"0x9d9c909296d9c674451c0c24f02cb64981eb3b727f99865939192f880a755dcb"
]
],
"fromBlock": "0x405C02",
"toBlock": "0x405C66"
},
{
"address": [
"0x763b29b97e75fb54923325d46bab2807ac8c43c5"
],
"topics": [
[
"0xf154a899b3b867021c992026539485521c86f83735a958729ab118b9ce7a6407"
]
],
"fromBlock": "0x405C02",
"toBlock": "0x405C66"
},
{
"address": [
"0xd51cb0fa9a91f156a80188a18f039140704b8df7"
],
"topics": [
[
"0xa4b3513a5f822f3e098a6a12338b3f07613cb130b75c90a250ab181402f4bb87"
]
],
"fromBlock": "0x405C02",
"toBlock": "0x405C66"
}
]
72 changes: 72 additions & 0 deletions packages/test/data/requests-blockrange-4217858-4217958.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
[
{
"fromBlock": "0x405C02",
"toBlock": "0x405C66",
"address": [],
"topics": [[]]
},
{
"fromBlock": "0x405C02",
"toBlock": "0x405C66",
"address": [
"0x60e1773636cf5e4a227d9ac24f20feca034ee25a",
"0x57e3bb9f790185cfe70cc2c15ed5d6b84dcf4adb",
"0x443a6243a36ef0ae1c46523d563c15abd787f4e9",
"0xaaa93ac72becfbbc9149f293466bbdaa4b5ef68c"
],
"topics": [[]]
},
{
"fromBlock": "0x405C02",
"toBlock": "0x405C66",
"address": [],
"topics":[[
"0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
"0xe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c",
"0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925",
"0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
"0xc42079f94a6350d7e6235f29174924f928cc2ac818eb64fed8004e115fbcca67",
"0x9d9c909296d9c674451c0c24f02cb64981eb3b727f99865939192f880a755dcb",
"0xa4b3513a5f822f3e098a6a12338b3f07613cb130b75c90a250ab181402f4bb87"
]]
},
{
"fromBlock": "0x405C02",
"toBlock": "0x405C66",
"address": [
"0x60e1773636cf5e4a227d9ac24f20feca034ee25a",
"0x57e3bb9f790185cfe70cc2c15ed5d6b84dcf4adb",
"0x443a6243a36ef0ae1c46523d563c15abd787f4e9",
"0xaaa93ac72becfbbc9149f293466bbdaa4b5ef68c"
],
"topics":[[
"0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
"0xe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c",
"0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925",
"0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
"0xc42079f94a6350d7e6235f29174924f928cc2ac818eb64fed8004e115fbcca67",
"0x9d9c909296d9c674451c0c24f02cb64981eb3b727f99865939192f880a755dcb",
"0xa4b3513a5f822f3e098a6a12338b3f07613cb130b75c90a250ab181402f4bb87"
]]
},
{
"fromBlock": "0x405C02",
"toBlock": "0x405C66",
"address": [
"0x60e1773636cf5e4a227d9ac24f20feca034ee25a"
],
"topics":[[
"0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"
]]
},
{
"fromBlock": "0x405C02",
"toBlock": "0x405C66",
"address": [
"0x497f5f88e0bad1a184e110514142dd9d94728ed5"
],
"topics":[[
"0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925"
]]
}
]
1 change: 1 addition & 0 deletions packages/test/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"lint": "eslint .",
"build": "tsc",
"eth-call": "DEBUG=vulcanize:* ts-node src/eth-call.ts",
"eth-get-logs": "DEBUG=vulcanize:* ts-node src/eth-get-logs.ts",
"get-storage-at": "DEBUG=vulcanize:* ts-node src/get-storage-at.ts",
"test:snapshot": "DEBUG=vulcanize:* mocha src/snapshot.test.ts"
},
Expand Down
Loading

0 comments on commit ea5ff93

Please sign in to comment.