[pallet-revive-eth-rpc] persist eth transaction hash (#6836)
Add an option to persist EVM transaction hash to a SQL db.
This should make it possible to run a full archive ETH RPC node
(assuming the substrate node is also a full archive node)
Some queries such as eth_getTransactionByHash,
eth_getBlockTransactionCountByHash, and other need to work with a
transaction hash indexes, which are not stored in Substrate and need to
be stored by the eth-rpc proxy.
The refactoring break down the Client into a `BlockInfoProvider` and
`ReceiptProvider`
- BlockInfoProvider does not need any persistence data, as we can fetch
all block info from the source substrate chain
- ReceiptProvider comes in two flavor,
- An in memory cache implementation - This is the one we had so far.
- A DB implementation - This one persist rows with the block_hash, the
transaction_index and the transaction_hash, so that we can later fetch
the block and extrinsic for that receipt and reconstruct the ReceiptInfo
object.
This PR also adds a new binary eth-indexer, that iterate past and new
blocks and write the receipt hashes to the DB using the new
ReceiptProvider.
---------
Co-authored-by:
GitHub Action <action@github.com>
Co-authored-by: command-bot <>
Showing
- .cargo/config.toml 1 addition, 0 deletions.cargo/config.toml
- .github/workflows/build-publish-eth-rpc.yml 28 additions, 9 deletions.github/workflows/build-publish-eth-rpc.yml
- Cargo.lock 438 additions, 38 deletionsCargo.lock
- prdoc/pr_6836.prdoc 17 additions, 0 deletionsprdoc/pr_6836.prdoc
- substrate/frame/revive/rpc/.sqlx/query-027a434a38822c2ba4439e8f9f9c1135227c1150f2c5083d1c7c6086b717ada0.json 12 additions, 0 deletions...2c2ba4439e8f9f9c1135227c1150f2c5083d1c7c6086b717ada0.json
- substrate/frame/revive/rpc/.sqlx/query-2348bd412ca114197996e4395fd68c427245f94b80d37ec3aef04cd96fb36298.json 20 additions, 0 deletions...14197996e4395fd68c427245f94b80d37ec3aef04cd96fb36298.json
- substrate/frame/revive/rpc/.sqlx/query-29af64347f700919dc2ee12463f332be50096d4e37be04ed8b6f46ac5c242043.json 26 additions, 0 deletions...0919dc2ee12463f332be50096d4e37be04ed8b6f46ac5c242043.json
- substrate/frame/revive/rpc/Cargo.toml 11 additions, 0 deletionssubstrate/frame/revive/rpc/Cargo.toml
- substrate/frame/revive/rpc/dockerfiles/eth-indexer/Dockerfile 28 additions, 0 deletions...trate/frame/revive/rpc/dockerfiles/eth-indexer/Dockerfile
- substrate/frame/revive/rpc/dockerfiles/eth-rpc/Dockerfile 0 additions, 0 deletionssubstrate/frame/revive/rpc/dockerfiles/eth-rpc/Dockerfile
- substrate/frame/revive/rpc/examples/js/bun.lockb 0 additions, 0 deletionssubstrate/frame/revive/rpc/examples/js/bun.lockb
- substrate/frame/revive/rpc/examples/js/package.json 7 additions, 7 deletionssubstrate/frame/revive/rpc/examples/js/package.json
- substrate/frame/revive/rpc/examples/js/src/build-contracts.ts 2 additions, 5 deletions...trate/frame/revive/rpc/examples/js/src/build-contracts.ts
- substrate/frame/revive/rpc/examples/js/src/geth-diff.test.ts 65 additions, 1 deletionsubstrate/frame/revive/rpc/examples/js/src/geth-diff.test.ts
- substrate/frame/revive/rpc/examples/js/src/lib.ts 0 additions, 1 deletionsubstrate/frame/revive/rpc/examples/js/src/lib.ts
- substrate/frame/revive/rpc/examples/js/src/piggy-bank.ts 1 addition, 3 deletionssubstrate/frame/revive/rpc/examples/js/src/piggy-bank.ts
- substrate/frame/revive/rpc/examples/js/src/spammer.ts 104 additions, 0 deletionssubstrate/frame/revive/rpc/examples/js/src/spammer.ts
- substrate/frame/revive/rpc/examples/js/src/util.ts 15 additions, 59 deletionssubstrate/frame/revive/rpc/examples/js/src/util.ts
- substrate/frame/revive/rpc/examples/westend_local_network.toml 2 additions, 6 deletions...rate/frame/revive/rpc/examples/westend_local_network.toml
- substrate/frame/revive/rpc/migrations/20241205165418_create_transaction_hashes.sql 15 additions, 0 deletions...c/migrations/20241205165418_create_transaction_hashes.sql
Please register or sign in to comment