fix(isthmus): include storage updates in l2 withdrawals root computation (#14307)

This commit is contained in:
Emilia Hane
2025-02-14 13:11:51 +01:00
committed by GitHub
parent 72fdb7f9ec
commit 1c09351a93
3 changed files with 17 additions and 6 deletions

1
Cargo.lock generated
View File

@ -8600,6 +8600,7 @@ dependencies = [
"reth-provider", "reth-provider",
"reth-revm", "reth-revm",
"reth-transaction-pool", "reth-transaction-pool",
"reth-trie",
"revm", "revm",
"sha2 0.10.8", "sha2 0.10.8",
"thiserror 2.0.11", "thiserror 2.0.11",

View File

@ -27,6 +27,7 @@ reth-payload-util.workspace = true
reth-payload-primitives = { workspace = true, features = ["op"] } reth-payload-primitives = { workspace = true, features = ["op"] }
reth-basic-payload-builder.workspace = true reth-basic-payload-builder.workspace = true
reth-chain-state.workspace = true reth-chain-state.workspace = true
reth-trie.workspace = true
# op-reth # op-reth
reth-optimism-consensus.workspace = true reth-optimism-consensus.workspace = true

View File

@ -46,6 +46,7 @@ use reth_revm::{
cancelled::CancelOnDrop, database::StateProviderDatabase, witness::ExecutionWitnessRecord, cancelled::CancelOnDrop, database::StateProviderDatabase, witness::ExecutionWitnessRecord,
}; };
use reth_transaction_pool::{BestTransactionsAttributes, PoolTransaction, TransactionPool}; use reth_transaction_pool::{BestTransactionsAttributes, PoolTransaction, TransactionPool};
use reth_trie::HashedStorage;
use revm::{ use revm::{
db::{states::bundle_state::BundleRetention, State}, db::{states::bundle_state::BundleRetention, State},
primitives::{ExecutionResult, ResultAndState}, primitives::{ExecutionResult, ResultAndState},
@ -377,14 +378,22 @@ impl<Txs> OpBuilder<'_, Txs> {
state.merge_transitions(BundleRetention::Reverts); state.merge_transitions(BundleRetention::Reverts);
let withdrawals_root = if ctx.is_isthmus_active() { let withdrawals_root = if ctx.is_isthmus_active() {
let hashed_storage_updates =
state.bundle_state.state().get(&ADDRESS_L2_TO_L1_MESSAGE_PASSER).map(|account| {
// block contained withdrawals transactions, use predeploy storage updates from
// execution
HashedStorage::from_plain_storage(
account.status,
account.storage.iter().map(|(slot, value)| (slot, &value.present_value)),
)
});
// withdrawals root field in block header is used for storage root of L2 predeploy // withdrawals root field in block header is used for storage root of L2 predeploy
// `l2tol1-message-passer` // `l2tol1-message-passer`
Some( Some(state.database.as_ref().storage_root(
state ADDRESS_L2_TO_L1_MESSAGE_PASSER,
.database hashed_storage_updates.unwrap_or_default(),
.as_ref() )?)
.storage_root(ADDRESS_L2_TO_L1_MESSAGE_PASSER, Default::default())?,
)
} else if ctx.is_canyon_active() { } else if ctx.is_canyon_active() {
Some(EMPTY_WITHDRAWALS) Some(EMPTY_WITHDRAWALS)
} else { } else {