-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
chore: Move optimism root checks into crates/optimism #10932
Conversation
Hey @mattsse where should Receipts::optimism_root_slow() be moved to? Do you have a preference? |
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.
make sense for it to live next to this function
reth/crates/optimism/consensus/src/proof.rs
Lines 8 to 37 in 000b412
/// Calculates the receipt root for a header. | |
pub(crate) fn calculate_receipt_root_optimism( | |
receipts: &[ReceiptWithBloom], | |
chain_spec: &ChainSpec, | |
timestamp: u64, | |
) -> B256 { | |
// There is a minor bug in op-geth and op-erigon where in the Regolith hardfork, | |
// the receipt root calculation does not include the deposit nonce in the receipt | |
// encoding. In the Regolith Hardfork, we must strip the deposit nonce from the | |
// receipts before calculating the receipt root. This was corrected in the Canyon | |
// hardfork. | |
if chain_spec.is_fork_active_at_timestamp(OptimismHardfork::Regolith, timestamp) && | |
!chain_spec.is_fork_active_at_timestamp(OptimismHardfork::Canyon, timestamp) | |
{ | |
let receipts = receipts | |
.iter() | |
.cloned() | |
.map(|mut r| { | |
r.receipt.deposit_nonce = None; | |
r | |
}) | |
.collect::<Vec<_>>(); | |
return ordered_trie_root_with_encoder(receipts.as_slice(), |r, buf| { | |
r.encode_inner(buf, false) | |
}) | |
} | |
ordered_trie_root_with_encoder(receipts, |r, buf| r.encode_inner(buf, false)) | |
} |
although, @garwahl, this is a method on |
To clarify, is there any benefit in continuing to extract things out into |
not quite, just that this pr will be blocked at some point. either the whole consensus auto seal code has to move into op crate + needs to be used via the op crate too, or we need to do smthg like #10997 and add a trait method |
No worries at all, let me know if I can lend a hand, would love to jump into the alloy repo as well if you see anything |
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.
sorry for not reviewing this in time...
this has since been done and wasn't that easy
WIP for #10713
Moves
calculate_receipt_root_no_memo_optimism
and associated usages fromcrates/primitive
tocrates/optimism