From c1ecf03be56dad22e21fd6f5cbe9c8556afd2ab0 Mon Sep 17 00:00:00 2001 From: refcell Date: Thu, 8 Aug 2024 21:31:43 -0600 Subject: [PATCH] fix: regen fixture with rollup config --- bin/opd8n/src/cmd/from_l1.rs | 8 +++- bin/opd8n/src/cmd/from_l2.rs | 8 +++- crates/op-test-vectors/src/derivation.rs | 11 ++++- .../src/testdata/derivation_fixture.json | 27 +++++++++++ fixtures/derivation/Block123690000.json | 46 +++++++++++++++++++ 5 files changed, 97 insertions(+), 3 deletions(-) diff --git a/bin/opd8n/src/cmd/from_l1.rs b/bin/opd8n/src/cmd/from_l1.rs index 80d0c0b..f83bcd6 100644 --- a/bin/opd8n/src/cmd/from_l1.rs +++ b/bin/opd8n/src/cmd/from_l1.rs @@ -177,7 +177,13 @@ impl FromL1 { ) .await?; - let fixture = DerivationFixture::new(fixture_blocks, payloads, configs, l2_block_infos); + let fixture = DerivationFixture::new( + Arc::unwrap_or_clone(cfg), + fixture_blocks, + payloads, + configs, + l2_block_infos, + ); info!(target: "from-l1", "Successfully built derivation test fixture"); // Write the derivation fixture to the specified output location. diff --git a/bin/opd8n/src/cmd/from_l2.rs b/bin/opd8n/src/cmd/from_l2.rs index 016702e..d978541 100644 --- a/bin/opd8n/src/cmd/from_l2.rs +++ b/bin/opd8n/src/cmd/from_l2.rs @@ -180,7 +180,13 @@ impl FromL2 { &mut blob_provider, ) .await?; - let fixture = DerivationFixture::new(blocks, payloads, configs, l2_block_infos); + let fixture = DerivationFixture::new( + Arc::unwrap_or_clone(cfg), + blocks, + payloads, + configs, + l2_block_infos, + ); info!(target: TARGET, "Successfully built derivation test fixture"); // Write the derivation fixture to the specified output location. diff --git a/crates/op-test-vectors/src/derivation.rs b/crates/op-test-vectors/src/derivation.rs index 65449b4..b6c90e1 100644 --- a/crates/op-test-vectors/src/derivation.rs +++ b/crates/op-test-vectors/src/derivation.rs @@ -3,7 +3,7 @@ use alloy_consensus::{Header, Receipt}; use alloy_primitives::Bytes; use hashbrown::HashMap; -use kona_derive::types::{Blob, L2BlockInfo, L2PayloadAttributes, SystemConfig}; +use kona_derive::types::{Blob, L2BlockInfo, L2PayloadAttributes, RollupConfig, SystemConfig}; use serde::{Deserialize, Serialize}; /// The derivation fixture is the top-level object that contains @@ -11,6 +11,8 @@ use serde::{Deserialize, Serialize}; #[derive(Serialize, Deserialize, Clone, Debug, Default, Eq, PartialEq)] #[serde(rename_all = "camelCase")] pub struct DerivationFixture { + /// The rollup config. + pub rollup_config: RollupConfig, /// A list of L1 Blocks to derive from. pub l1_blocks: Vec, /// A map of L2 block number to l2 payload attributes. @@ -24,12 +26,14 @@ pub struct DerivationFixture { impl DerivationFixture { /// Constructs a new [DerivationFixture] with the given L1 blocks and L2 Payload Attributes. pub fn new( + rollup_config: RollupConfig, l1_blocks: Vec, l2_payloads: HashMap, configs: HashMap, l2_infos: HashMap, ) -> Self { Self { + rollup_config, l1_blocks, l2_payloads, l2_system_configs: configs, @@ -334,11 +338,16 @@ mod tests { infos } + fn ref_rollup_config() -> RollupConfig { + RollupConfig::default() + } + #[test] fn test_derivation_fixture() { let fixture_str = include_str!("./testdata/derivation_fixture.json"); let fixture: DerivationFixture = serde_json::from_str(fixture_str).unwrap(); let expected = DerivationFixture { + rollup_config: ref_rollup_config(), l1_blocks: ref_blocks(), l2_payloads: ref_payload_attributes(), l2_system_configs: ref_system_configs(), diff --git a/crates/op-test-vectors/src/testdata/derivation_fixture.json b/crates/op-test-vectors/src/testdata/derivation_fixture.json index 9d4b921..b0477cb 100644 --- a/crates/op-test-vectors/src/testdata/derivation_fixture.json +++ b/crates/op-test-vectors/src/testdata/derivation_fixture.json @@ -1,4 +1,31 @@ { + "rollupConfig": { + "genesis": { + "l1": { + "hash": "0x0000000000000000000000000000000000000000000000000000000000000000", + "number": 0 + }, + "l2": { + "hash": "0x0000000000000000000000000000000000000000000000000000000000000000", + "number": 0 + }, + "l2_time": 0 + }, + "block_time": 0, + "max_sequencer_drift": 0, + "seq_window_size": 0, + "channel_timeout": 0, + "l1_chain_id": 0, + "l2_chain_id": 0, + "base_fee_params": { + "max_change_denominator": 50, + "elasticity_multiplier": 6 + }, + "batch_inbox_address": "0x0000000000000000000000000000000000000000", + "deposit_contract_address": "0x0000000000000000000000000000000000000000", + "l1_system_config_address": "0x0000000000000000000000000000000000000000", + "protocol_versions_address": "0x0000000000000000000000000000000000000000" + }, "l2Payloads": { "1": { "timestamp": 1722550777, diff --git a/fixtures/derivation/Block123690000.json b/fixtures/derivation/Block123690000.json index 900b5a3..d601e65 100644 --- a/fixtures/derivation/Block123690000.json +++ b/fixtures/derivation/Block123690000.json @@ -1,4 +1,50 @@ { + "rollupConfig": { + "genesis": { + "l1": { + "hash": "0x438335a20d98863a4c0c97999eb2481921ccd28553eac6f913af7c12aec04108", + "number": 17422590 + }, + "l2": { + "hash": "0xdbf6a80fef073de06add9b0d14026d6e5a86c85f6d102c36d3d8e9cf89c2afd3", + "number": 105235063 + }, + "l2_time": 1686068903, + "extra_data": null, + "system_config": { + "batcherAddress": "0x6887246668a3b87f54deb3b94ba47a6f63f32985", + "overhead": "0xbc", + "scalar": "0xa6fe0", + "gasLimit": 30000000, + "baseFeeScalar": null, + "blobBaseFeeScalar": null + } + }, + "block_time": 2, + "max_sequencer_drift": 600, + "seq_window_size": 3600, + "channel_timeout": 300, + "l1_chain_id": 1, + "l2_chain_id": 10, + "base_fee_params": { + "max_change_denominator": "0x32", + "elasticity_multiplier": "0x6" + }, + "canyon_base_fee_params": { + "max_change_denominator": "0xfa", + "elasticity_multiplier": "0x6" + }, + "regolith_time": 0, + "canyon_time": 1704992401, + "delta_time": 1708560000, + "ecotone_time": 1710374401, + "fjord_time": 1720627201, + "batch_inbox_address": "0xff00000000000000000000000000000000000010", + "deposit_contract_address": "0xbeb5fc579115071764c7423a4f12edde41f106ed", + "l1_system_config_address": "0x229047fed2591dbec1ef1118d64f7af3db9eb290", + "protocol_versions_address": "0x8062abc286f5e7d9428a0ccb9abd71e50d93b935", + "superchain_config_address": "0x95703e0982140d16f8eba6d158fccede42f04a4c" + }, "l1Blocks": [ { "header": {