sei-protocol / sei-chain

Apache License 2.0
2.67k stars 797 forks source link

Update getBlockReceipts to accept block hash #1733

Closed Kbhat1 closed 2 weeks ago

Kbhat1 commented 2 weeks ago

Describe your changes and provide context

(1) Query receipt by block height: curl http://localhost:8545/ -X POST -H "Content-Type: application/json" --data '{"method":"eth_getBlockReceipts","params":["0x4f1838f"],"id":1,"jsonrpc":"2.0"}'

{"jsonrpc":"2.0","id":1,"result":[{"blockHash":"0x919af336f37dffe608316648a9e970e02eb3ec4e531469567003e1534bfd3cc3","blockNumber":"0x4f1838f","contractAddress":null,"cumulativeGasUsed":"0x0","effectiveGasPrice":"0x47868c00","from":"0x339d413ccefd986b1b3647a9cfa9cbbe70a30749","gasUsed":"0x947d","logs":[],"logsBloom":"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000","status":"0x1","to":"0x3c2269811836af69497e5f486a85d7316753cf62","transactionHash":"0xb34638943eb6162e56a026ccfad4be7bd0988ef6ca6794ba750746db5531dbea","transactionIndex":"0x0","type":"0x0"}]}

(2) Query receipt by block hash curl http://localhost:8545/ -X POST -H "Content-Type: application/json" --data '{"method":"eth_getBlockReceipts","params":["0x919af336f37dffe608316648a9e970e02eb3ec4e531469567003e1534bfd3cc3"],"id":1,"jsonrpc":"2.0"}'

{"jsonrpc":"2.0","id":1,"result":[{"blockHash":"0x919af336f37dffe608316648a9e970e02eb3ec4e531469567003e1534bfd3cc3","blockNumber":"0x4f1838f","contractAddress":null,"cumulativeGasUsed":"0x0","effectiveGasPrice":"0x47868c00","from":"0x339d413ccefd986b1b3647a9cfa9cbbe70a30749","gasUsed":"0x947d","logs":[],"logsBloom":"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000","status":"0x1","to":"0x3c2269811836af69497e5f486a85d7316753cf62","transactionHash":"0xb34638943eb6162e56a026ccfad4be7bd0988ef6ca6794ba750746db5531dbea","transactionIndex":"0x0","type":"0x0"}]}

Confirmed running with latest tag works as well: (ran a script running following command curl http://localhost:8545/ -X POST -H "Content-Type: application/json" --data '{"method":"eth_getBlockReceipts","params":["latest"],"id":1,"jsonrpc":"2.0"}')

Testing performed to validate your change

codecov[bot] commented 2 weeks ago

Codecov Report

Attention: Patch coverage is 60.00000% with 2 lines in your changes missing coverage. Please review.

Project coverage is 60.94%. Comparing base (e8e4b3b) to head (8ff550d). Report is 81 commits behind head on main.

Additional details and impacted files [![Impacted file tree graph](https://app.codecov.io/gh/sei-protocol/sei-chain/pull/1733/graphs/tree.svg?width=650&height=150&src=pr&token=DG7ZZJ3PVV&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=sei-protocol)](https://app.codecov.io/gh/sei-protocol/sei-chain/pull/1733?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=sei-protocol) ```diff @@ Coverage Diff @@ ## main #1733 +/- ## ========================================== - Coverage 61.64% 60.94% -0.71% ========================================== Files 365 371 +6 Lines 26178 27472 +1294 ========================================== + Hits 16138 16742 +604 - Misses 8967 9586 +619 - Partials 1073 1144 +71 ``` | [Files](https://app.codecov.io/gh/sei-protocol/sei-chain/pull/1733?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=sei-protocol) | Coverage Δ | | |---|---|---| | [evmrpc/block.go](https://app.codecov.io/gh/sei-protocol/sei-chain/pull/1733?src=pr&el=tree&filepath=evmrpc%2Fblock.go&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=sei-protocol#diff-ZXZtcnBjL2Jsb2NrLmdv) | `67.23% <60.00%> (-0.80%)` | :arrow_down: | ... and [26 files with indirect coverage changes](https://app.codecov.io/gh/sei-protocol/sei-chain/pull/1733/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=sei-protocol)