-
Notifications
You must be signed in to change notification settings - Fork 2.3k
feat(anvil): support for op-stack deposit transactions #6073
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
Conversation
|
gm! what's the status here? this is gonna need a rebase. sorry about that! |
|
@Evalir thanks for the ping, I just rebased. Hoping to get to the tests this week sometime. |
576599f to
fb394fb
Compare
cdc95f7 to
68d2857
Compare
68d2857 to
b0da3f2
Compare
mattsse
left a comment
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 looks pretty good already, a few nits
crates/anvil/core/Cargo.toml
Outdated
| impersonated-tx = [] | ||
| fastrlp = ["dep:open-fastrlp"] | ||
| serde = ["dep:serde"] | ||
| optimism = ["dep:ethers-core", "dep:ethers-contract", "dep:ethers-providers", "dep:ethers-middleware"] |
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 should just be optimism = ["ethers-core/optimism"]
| } | ||
|
|
||
| /// Returns true if op-stack deposits are active | ||
| pub fn is_op_deposits(&self) -> bool { |
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.
| pub fn is_op_deposits(&self) -> bool { | |
| pub fn is_optimism(&self) -> bool { |
| let mut deposit_nonce: Option<u64> = None; | ||
| if transaction_type.unwrap_or_default() == 0x7E { | ||
| deposit_nonce = Some(info.nonce); | ||
| } |
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.
deposit_nonce = transaction_type.and_then(|ty| (x == 0x7E).then_some(info.nonce))
bf8a9bb to
e8ae0dd
Compare
mattsse
left a comment
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 great!
love the tests.
I bumped lock file so that it compiles, only have a few nitpicks.
there's a failing test that can be attributed to the activated feature can_read_cache which I will fix
mattsse
left a comment
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.
lgtm, ptal @Evalir
Evalir
left a comment
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.
thanks! this looks quite good!
mattsse
left a comment
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.
fantastic!
Motivation
This PR adds anvil support for op-stack's deposit transaction. This is a requirement for
mocktimism(see ethereum-optimism/mocktimism#4), which is an anvil wrapper for testing and forking op-stack chains.Fortunately, deposit tx support has already been added to
ethers-rs(gakonst/ethers-rs#2434) andrevm(bluealloy/revm#682), so adding to anvil is mostly just plumbing the tx types through.Solution
This PR adds all the required fields and types for deposit transactions. Support for optimism can be enabled by passing the
--optimismflag toanvil.TODO
cargo.tomloverrides after Re-enable the transaction.other field for optimism feature gakonst/ethers-rs#2622 has been merged