Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pallet-revive-eth-rpc] persist eth transaction hash #6836

Merged
merged 80 commits into from
Jan 14, 2025
Merged

Conversation

pgherveou
Copy link
Contributor

@pgherveou pgherveou commented Dec 10, 2024

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.

@pgherveou
Copy link
Contributor Author

/cmd prdoc --audience runtime_dev --bump minor

@pgherveou pgherveou added T7-smart_contracts This PR/Issue is related to smart contracts. R0-silent Changes should not be mentioned in any release notes labels Dec 11, 2024
Base automatically changed from pg/fix-gas-encoding to master January 13, 2025 15:37
@paritytech-workflow-stopper
Copy link

All GitHub workflows were cancelled due to failure one of the required jobs.
Failed workflow url: https://github.com/paritytech/polkadot-sdk/actions/runs/12751694689
Failed job name: test-linux-stable

@pgherveou pgherveou requested a review from athei January 13, 2025 19:46
@pgherveou pgherveou enabled auto-merge January 14, 2025 12:52
@pgherveou pgherveou added this pull request to the merge queue Jan 14, 2025
Merged via the queue into master with commit 023763d Jan 14, 2025
202 of 204 checks passed
@pgherveou pgherveou deleted the pg/hack-indexer branch January 14, 2025 14:38
ordian added a commit that referenced this pull request Jan 16, 2025
* master: (33 commits)
  Implement `pallet-asset-rewards` (#3926)
  [pallet-revive] Add host function `to_account_id` (#7091)
  [pallet-revive] Remove revive events (#7164)
  [pallet-revive] Remove debug buffer (#7163)
  litep2p: Provide partial results to speedup GetRecord queries (#7099)
  [pallet-revive] Bump asset-hub westend spec version (#7176)
  Remove 0 as a special case in gas/storage meters (#6890)
  [pallet-revive] Fix `caller_is_root` return value (#7086)
  req-resp/litep2p: Reject inbound requests from banned peers (#7158)
  Add "run to block" tools (#7109)
  Fix reversed error message in DispatchInfo (#7170)
  approval-voting: Make importing of duplicate assignment idempotent (#6971)
  Parachains: Use relay chain slot for velocity measurement (#6825)
  PRDOC: Document `validate: false` (#7117)
  xcm: convert properly assets in xcmpayment apis (#7134)
  CI: Only format umbrella crate during umbrella check (#7139)
  approval-voting: Fix sending of assignments after restart (#6973)
  Retry approval on availability failure if the check is still needed (#6807)
  [pallet-revive-eth-rpc] persist eth transaction hash (#6836)
  litep2p: Sufix litep2p to the identify agent version for visibility (#7133)
  ...
Nathy-bajo pushed a commit to Nathy-bajo/polkadot-sdk that referenced this pull request Jan 21, 2025
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 <[email protected]>
Co-authored-by: command-bot <>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
R0-silent Changes should not be mentioned in any release notes T7-smart_contracts This PR/Issue is related to smart contracts.
Projects
Status: Minimal Feature Launch
Development

Successfully merging this pull request may close these issues.

4 participants