forked from paradigmxyz/reth
-
Notifications
You must be signed in to change notification settings - Fork 7
feat: scroll state provider #31
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
Closed
greged93
wants to merge
6
commits into
scroll-tech:scroll
from
greged93:greged93/feat/scroll-state-provider
Closed
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
57594a7
introduce Scroll revm crate
greged93 e7b5944
fix clippy nightly changes and fix deny run
greged93 c11bbd4
update from state provider PR
greged93 9b3ae46
Introduce scroll storage crate
greged93 18990d8
add test for the `ScrollStateProviderDatabase`
greged93 2a46a48
extend the context in ScrollBundleState conversion
greged93 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| [package] | ||
| name = "reth-scroll-primitives" | ||
| version.workspace = true | ||
| edition.workspace = true | ||
| rust-version.workspace = true | ||
| license.workspace = true | ||
| homepage.workspace = true | ||
| repository.workspace = true | ||
| exclude.workspace = true | ||
|
|
||
| [lints] | ||
| workspace = true | ||
|
|
||
| [dependencies] | ||
| # revm | ||
| revm.workspace = true | ||
|
|
||
| # scroll | ||
| poseidon-bn254 = { git = "https://github.com/scroll-tech/poseidon-bn254", branch = "master", features = ["bn254"] } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| use revm::primitives::{map::HashMap, B256}; | ||
|
|
||
| /// A Keccak code hash. | ||
| type KeccakHash = B256; | ||
| /// A Poseidon code hash. | ||
| type PoseidonHash = B256; | ||
| /// Size of a contract's code in bytes. | ||
| type CodeSize = u64; | ||
|
|
||
| /// Scroll post execution context maps a Keccak code hash of a contract's bytecode to its code size | ||
| /// and Poseidon code hash. | ||
| pub type ScrollPostExecutionContext = HashMap<KeccakHash, (CodeSize, PoseidonHash)>; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| //! Primitive types for the Scroll extension of `Reth`. | ||
|
|
||
| pub use execution_context::ScrollPostExecutionContext; | ||
| mod execution_context; | ||
|
|
||
| pub use poseidon::{poseidon, POSEIDON_EMPTY}; | ||
| mod poseidon; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| use revm::primitives::{b256, B256}; | ||
|
|
||
| /// The Poseidon hash of the empty string `""`. | ||
| pub const POSEIDON_EMPTY: B256 = | ||
| b256!("2098f5fb9e239eab3ceac3f27b81e481dc3124d55ffed523a839ee8446b64864"); | ||
|
|
||
| /// Poseidon code hash | ||
| pub fn poseidon(code: &[u8]) -> B256 { | ||
| poseidon_bn254::hash_code(code).into() | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| [package] | ||
| name = "reth-scroll-revm" | ||
| version.workspace = true | ||
| edition.workspace = true | ||
| rust-version.workspace = true | ||
| license.workspace = true | ||
| homepage.workspace = true | ||
| repository.workspace = true | ||
| exclude.workspace = true | ||
|
|
||
| [lints] | ||
| workspace = true | ||
|
|
||
| [dependencies] | ||
| # revm | ||
| revm.workspace = true | ||
|
|
||
| # scroll | ||
| reth-scroll-primitives.workspace = true | ||
|
|
||
| [features] | ||
| default = ["std"] | ||
|
|
||
| arbitrary = ["revm/arbitrary"] | ||
|
|
||
| serde = ["revm/serde"] | ||
|
|
||
| std = ["revm/std"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| //! Scroll `revm` types redefinitions. Account types are redefined with two additional fields | ||
| //! `code_size` and `poseidon_code_hash`, which are used during computation of the state root. | ||
|
|
||
| pub mod states; | ||
|
|
||
| pub mod primitives; | ||
|
|
||
| pub use primitives::ScrollAccountInfo; | ||
| pub use revm::primitives::*; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is added as an intermediate solution in order for the
clippycheck to pass. Once the whole code base is migrated to use ourScrollAccountInfo, this can be removed.