Skip to content

Commit 1752d6f

Browse files
zeroprooffmattsse
andauthored
chore(optimism): move predeploy constant to op-alloy (paradigmxyz#20181)
Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>
1 parent ac891a7 commit 1752d6f

7 files changed

Lines changed: 15 additions & 23 deletions

File tree

crates/optimism/chainspec/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ use reth_chainspec::{
7070
};
7171
use reth_ethereum_forks::{ChainHardforks, EthereumHardfork, ForkCondition};
7272
use reth_network_peers::NodeRecord;
73-
use reth_optimism_primitives::ADDRESS_L2_TO_L1_MESSAGE_PASSER;
73+
use reth_optimism_primitives::L2_TO_L1_MESSAGE_PASSER_ADDRESS;
7474
use reth_primitives_traits::{sync::LazyLock, SealedHeader};
7575

7676
/// Chain spec builder for a OP stack chain.
@@ -499,7 +499,7 @@ pub fn make_op_genesis_header(genesis: &Genesis, hardforks: &ChainHardforks) ->
499499
// If Isthmus is active, overwrite the withdrawals root with the storage root of predeploy
500500
// `L2ToL1MessagePasser.sol`
501501
if hardforks.fork(OpHardfork::Isthmus).active_at_timestamp(header.timestamp) &&
502-
let Some(predeploy) = genesis.alloc.get(&ADDRESS_L2_TO_L1_MESSAGE_PASSER) &&
502+
let Some(predeploy) = genesis.alloc.get(&L2_TO_L1_MESSAGE_PASSER_ADDRESS) &&
503503
let Some(storage) = &predeploy.storage
504504
{
505505
header.withdrawals_root =

crates/optimism/chainspec/src/superchain/configs.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,23 +98,23 @@ mod tests {
9898
OP_SEPOLIA_CANYON_TIMESTAMP, OP_SEPOLIA_ECOTONE_TIMESTAMP, OP_SEPOLIA_ISTHMUS_TIMESTAMP,
9999
OP_SEPOLIA_JOVIAN_TIMESTAMP,
100100
};
101-
use reth_optimism_primitives::ADDRESS_L2_TO_L1_MESSAGE_PASSER;
101+
use reth_optimism_primitives::L2_TO_L1_MESSAGE_PASSER_ADDRESS;
102102
use tar_no_std::TarArchiveRef;
103103

104104
#[test]
105105
fn test_read_superchain_genesis() {
106106
let genesis = read_superchain_genesis("unichain", "mainnet").unwrap();
107107
assert_eq!(genesis.config.chain_id, 130);
108108
assert_eq!(genesis.timestamp, 1730748359);
109-
assert!(genesis.alloc.contains_key(&ADDRESS_L2_TO_L1_MESSAGE_PASSER));
109+
assert!(genesis.alloc.contains_key(&L2_TO_L1_MESSAGE_PASSER_ADDRESS));
110110
}
111111

112112
#[test]
113113
fn test_read_superchain_genesis_with_workaround() {
114114
let genesis = read_superchain_genesis("funki", "mainnet").unwrap();
115115
assert_eq!(genesis.config.chain_id, 33979);
116116
assert_eq!(genesis.timestamp, 1721211095);
117-
assert!(genesis.alloc.contains_key(&ADDRESS_L2_TO_L1_MESSAGE_PASSER));
117+
assert!(genesis.alloc.contains_key(&L2_TO_L1_MESSAGE_PASSER_ADDRESS));
118118
}
119119

120120
#[test]

crates/optimism/consensus/src/validation/isthmus.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use crate::OpConsensusError;
44
use alloy_consensus::BlockHeader;
55
use alloy_primitives::B256;
66
use alloy_trie::EMPTY_ROOT_HASH;
7-
use reth_optimism_primitives::ADDRESS_L2_TO_L1_MESSAGE_PASSER;
7+
use reth_optimism_primitives::L2_TO_L1_MESSAGE_PASSER_ADDRESS;
88
use reth_storage_api::{errors::ProviderResult, StorageRootProvider};
99
use reth_trie_common::HashedStorage;
1010
use revm::database::BundleState;
@@ -32,7 +32,7 @@ pub fn withdrawals_root<DB: StorageRootProvider>(
3232
withdrawals_root_prehashed(
3333
state_updates
3434
.state()
35-
.get(&ADDRESS_L2_TO_L1_MESSAGE_PASSER)
35+
.get(&L2_TO_L1_MESSAGE_PASSER_ADDRESS)
3636
.map(|acc| {
3737
HashedStorage::from_plain_storage(
3838
acc.status,
@@ -52,7 +52,7 @@ pub fn withdrawals_root_prehashed<DB: StorageRootProvider>(
5252
hashed_storage_updates: HashedStorage,
5353
state: DB,
5454
) -> ProviderResult<B256> {
55-
state.storage_root(ADDRESS_L2_TO_L1_MESSAGE_PASSER, hashed_storage_updates)
55+
state.storage_root(L2_TO_L1_MESSAGE_PASSER_ADDRESS, hashed_storage_updates)
5656
}
5757

5858
/// Verifies block header field `withdrawals_root` against storage root of
@@ -146,7 +146,7 @@ mod test {
146146

147147
#[test]
148148
fn l2tol1_message_passer_no_withdrawals() {
149-
let hashed_address = keccak256(ADDRESS_L2_TO_L1_MESSAGE_PASSER);
149+
let hashed_address = keccak256(L2_TO_L1_MESSAGE_PASSER_ADDRESS);
150150

151151
// create account storage
152152
let init_storage = HashedStorage::from_iter(

crates/optimism/node/src/engine.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ use reth_node_api::{
1818
use reth_optimism_consensus::isthmus;
1919
use reth_optimism_forks::OpHardforks;
2020
use reth_optimism_payload_builder::{OpExecutionPayloadValidator, OpPayloadTypes};
21-
use reth_optimism_primitives::{OpBlock, ADDRESS_L2_TO_L1_MESSAGE_PASSER};
21+
use reth_optimism_primitives::{OpBlock, L2_TO_L1_MESSAGE_PASSER_ADDRESS};
2222
use reth_primitives_traits::{Block, RecoveredBlock, SealedBlock, SignedTransaction};
2323
use reth_provider::StateProviderFactory;
2424
use reth_trie_common::{HashedPostState, KeyHasher};
@@ -76,7 +76,7 @@ pub struct OpEngineValidator<P, Tx, ChainSpec> {
7676
impl<P, Tx, ChainSpec> OpEngineValidator<P, Tx, ChainSpec> {
7777
/// Instantiates a new validator.
7878
pub fn new<KH: KeyHasher>(chain_spec: Arc<ChainSpec>, provider: P) -> Self {
79-
let hashed_addr_l2tol1_msg_passer = KH::hash_key(ADDRESS_L2_TO_L1_MESSAGE_PASSER);
79+
let hashed_addr_l2tol1_msg_passer = KH::hash_key(L2_TO_L1_MESSAGE_PASSER_ADDRESS);
8080
Self {
8181
inner: OpExecutionPayloadValidator::new(chain_spec),
8282
provider,

crates/optimism/payload/src/builder.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ use reth_evm::{
2020
};
2121
use reth_execution_types::ExecutionOutcome;
2222
use reth_optimism_forks::OpHardforks;
23-
use reth_optimism_primitives::{transaction::OpTransaction, ADDRESS_L2_TO_L1_MESSAGE_PASSER};
23+
use reth_optimism_primitives::{transaction::OpTransaction, L2_TO_L1_MESSAGE_PASSER_ADDRESS};
2424
use reth_optimism_txpool::{
2525
estimated_da_size::DataAvailabilitySized,
2626
interop::{is_valid_interop, MaybeInteropTransaction},
@@ -435,7 +435,7 @@ impl<Txs> OpBuilder<'_, Txs> {
435435
if ctx.chain_spec.is_isthmus_active_at_timestamp(ctx.attributes().timestamp()) {
436436
// force load `L2ToL1MessagePasser.sol` so l2 withdrawals root can be computed even if
437437
// no l2 withdrawals in block
438-
_ = db.load_cache_account(ADDRESS_L2_TO_L1_MESSAGE_PASSER)?;
438+
_ = db.load_cache_account(L2_TO_L1_MESSAGE_PASSER_ADDRESS)?;
439439
}
440440

441441
let ExecutionWitnessRecord { hashed_state, codes, keys, lowest_block_number: _ } =

crates/optimism/primitives/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ extern crate alloc;
1313

1414
pub mod bedrock;
1515

16-
pub mod predeploys;
17-
pub use predeploys::ADDRESS_L2_TO_L1_MESSAGE_PASSER;
16+
// Re-export predeploys from op-alloy-consensus
17+
pub use op_alloy_consensus::L2_TO_L1_MESSAGE_PASSER_ADDRESS;
1818

1919
pub mod transaction;
2020
pub use transaction::*;

crates/optimism/primitives/src/predeploys.rs

Lines changed: 0 additions & 8 deletions
This file was deleted.

0 commit comments

Comments
 (0)