Skip to content

Commit

Permalink
chore(registry): Dogfood Test Rollup Config (#308)
Browse files Browse the repository at this point in the history
### Description

Dogfoods the hardcoded test rollup config and uses the new
`From<&RollupConfig> for HardForkConfiguration`.
  • Loading branch information
refcell authored Nov 25, 2024
1 parent 4ce0024 commit 4cbdb6a
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 33 deletions.
14 changes: 13 additions & 1 deletion crates/genesis/src/rollup.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! Rollup Config Types

use crate::{base_fee_params, ChainGenesis};
use crate::{base_fee_params, ChainGenesis, HardForkConfiguration};
use alloy_eips::eip1559::BaseFeeParams;
use alloy_primitives::Address;

Expand Down Expand Up @@ -263,6 +263,18 @@ impl RollupConfig {
}
}

/// Returns the [HardForkConfiguration] using [RollupConfig] timestamps.
pub const fn hardfork_config(&self) -> HardForkConfiguration {
HardForkConfiguration {
canyon_time: self.canyon_time,
delta_time: self.delta_time,
ecotone_time: self.ecotone_time,
fjord_time: self.fjord_time,
granite_time: self.granite_time,
holocene_time: self.holocene_time,
}
}

/// Checks the scalar value in Ecotone.
pub fn check_ecotone_l1_system_config_scalar(scalar: [u8; 32]) -> Result<(), &'static str> {
let version_byte = scalar[0];
Expand Down
36 changes: 4 additions & 32 deletions crates/registry/src/superchain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,12 +114,8 @@ impl Registry {
#[cfg(test)]
mod tests {
use super::*;
use alloy_eips::BlockNumHash;
use alloy_primitives::{address, b256, uint};
use op_alloy_genesis::{
AddressList, ChainGenesis, HardForkConfiguration, SuperchainLevel, SystemConfig,
OP_MAINNET_BASE_FEE_PARAMS,
};
use alloy_primitives::address;
use op_alloy_genesis::{AddressList, SuperchainLevel, OP_MAINNET_BASE_FEE_PARAMS};

#[test]
fn test_read_chain_configs() {
Expand All @@ -138,38 +134,14 @@ mod tests {
batch_inbox_addr: address!("ff00000000000000000000000000000000008453"),
superchain: String::from("mainnet"),
chain: String::new(),
hardfork_configuration: HardForkConfiguration {
canyon_time: Some(1704992401),
delta_time: Some(1708560000),
ecotone_time: Some(1710374401),
fjord_time: Some(1720627201),
granite_time: Some(1726070401),
holocene_time: None,
},
hardfork_configuration: crate::test_utils::BASE_MAINNET_CONFIG.hardfork_config(),
block_time: 2,
seq_window_size: 3600,
max_sequencer_drift: 600,
data_availability_type: "eth-da".to_string(),
optimism: Some(OP_MAINNET_BASE_FEE_PARAMS),
alt_da: None,
genesis: ChainGenesis {
l1: BlockNumHash {
number: 17481768,
hash: b256!("5c13d307623a926cd31415036c8b7fa14572f9dac64528e857a470511fc30771"),
},
l2: BlockNumHash {
number: 0,
hash: b256!("f712aa9241cc24369b143cf6dce85f0902a9731e70d66818a3a5845b296c73dd"),
},
l2_time: 1686789347,
system_config: Some(SystemConfig {
batcher_address: address!("5050F69a9786F081509234F1a7F4684b5E5b76C9"),
overhead: uint!(0xbc_U256),
scalar: uint!(0xa6fe0_U256),
gas_limit: 30000000_u64,
..Default::default()
}),
},
genesis: crate::test_utils::BASE_MAINNET_CONFIG.genesis,
addresses: Some(AddressList {
address_manager: address!("8EfB6B5c4767B09Dc9AA6Af4eAA89F749522BaE2"),
l1_cross_domain_messenger_proxy: address!(
Expand Down

0 comments on commit 4cbdb6a

Please sign in to comment.