Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Implement reth StateProviderFactory to forward requests to an RPC using Alloy

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT
NotificationsYou must be signed in to change notification settings

cakevm/alloy-reth-provider

Repository files navigation

This repository illustrates how theStateProviderFactory fromreth can be implemented withalloy-rs to fetch all state using RPC. This can be useful to not be dependent on a real database when testing reth ExEx.

Remarks

There is nodebug_codeByHash implemented currently (seefeat(rpc): debug_codeByHash #14479). But since revm will first callbasic_account, we can cache it and return it whenbytecode_by_hash is called.

Currently, this repos purpose as copy/paste reference and not as library. Not all functions are implemented.

Example

See tests insrc/alloy_reth_provider.rs for an example.

// Init the providerlet provider =ProviderBuilder::new().on_http("https://eth.merkle.io".parse().unwrap());// Init the db providerlet db_provider =AlloyRethProvider::new(provider);// Use the StateProviderFactorylet state = db_provider.state_by_block_id(BlockId::number(16148323)).unwrap();

Acknowledgements

Many, many thanks to the team ofreth andalloy-rs for the awesome work they do. Some parts of the trait implementation are taken from reth. Also, many thanks torevm. Thealloy_db part is a copy/paste from revm because this part is not included in the latest revm version, and it makes it easier to be in sync with the latest Alloy version.

License

This project is licensed under theApache 2.0 orMIT. The part inalloy_db is licensed asrevm only underMIT.

About

Implement reth StateProviderFactory to forward requests to an RPC using Alloy

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Stars

Watchers

Forks

Releases

No releases published

[8]ページ先頭

©2009-2025 Movatter.jp