diff --git a/crates/derive/src/lib.rs b/crates/derive/src/lib.rs index a2cf953c4..a8da41b6b 100644 --- a/crates/derive/src/lib.rs +++ b/crates/derive/src/lib.rs @@ -8,7 +8,8 @@ extern crate alloc; mod params; pub use params::{ - ChannelID, CHANNEL_ID_LENGTH, DERIVATION_VERSION_0, FRAME_OVERHEAD, MAX_CHANNEL_BANK_SIZE, + ChannelID, CHANNEL_ID_LENGTH, CONFIG_UPDATE_EVENT_VERSION_0, CONFIG_UPDATE_TOPIC, + DERIVATION_VERSION_0, FRAME_OVERHEAD, MAX_CHANNEL_BANK_SIZE, MAX_FRAME_LEN, MAX_RLP_BYTES_PER_CHANNEL, MAX_SPAN_BATCH_BYTES, }; diff --git a/crates/derive/src/params.rs b/crates/derive/src/params.rs index f14f60d93..8c6f1f563 100644 --- a/crates/derive/src/params.rs +++ b/crates/derive/src/params.rs @@ -1,5 +1,7 @@ //! This module contains the parameters and identifying types for the derivation pipeline. +use alloy_primitives::{b256, B256}; + /// Count the tagging info as 200 in terms of buffer size. pub const FRAME_OVERHEAD: usize = 200; @@ -23,3 +25,15 @@ pub const CHANNEL_ID_LENGTH: usize = 16; /// [ChannelID] is an opaque identifier for a channel. pub type ChannelID = [u8; CHANNEL_ID_LENGTH]; + +/// `keccak256("ConfigUpdate(uint256,uint8,bytes)")` +pub const CONFIG_UPDATE_TOPIC: B256 = + b256!("1d2b0bda21d56b8bd12d4f94ebacffdfb35f5e226f84b461103bb8beab6353be"); + +/// The initial version of the system config event log. +pub const CONFIG_UPDATE_EVENT_VERSION_0: B256 = B256::ZERO; + +/// Frames cannot be larger than 1MB. +/// Data transactions that carry frames are generally not larger than 128 KB due to L1 network +/// conditions, but we leave space to grow larger anyway (gas limit allows for more data). +pub const MAX_FRAME_LEN: usize = 1000; diff --git a/crates/derive/src/stages/l1_traversal.rs b/crates/derive/src/stages/l1_traversal.rs index c4efca9df..7cab80805 100644 --- a/crates/derive/src/stages/l1_traversal.rs +++ b/crates/derive/src/stages/l1_traversal.rs @@ -126,8 +126,9 @@ impl ResettableStage for L pub(crate) mod tests { use super::*; use crate::{ + params::{CONFIG_UPDATE_EVENT_VERSION_0, CONFIG_UPDATE_TOPIC}, traits::test_utils::{TestChainProvider, TestTelemetry}, - types::{Receipt, CONFIG_UPDATE_EVENT_VERSION_0, CONFIG_UPDATE_TOPIC}, + types::Receipt, }; use alloc::vec; use alloy_primitives::{address, b256, hex, Address, Bytes, Log, LogData, B256}; diff --git a/crates/derive/src/types/frame.rs b/crates/derive/src/types/frame.rs index 0e728416d..9ef248e4d 100644 --- a/crates/derive/src/types/frame.rs +++ b/crates/derive/src/types/frame.rs @@ -1,14 +1,9 @@ //! This module contains the [Frame] type used within the derivation pipeline. -use crate::params::{ChannelID, DERIVATION_VERSION_0, FRAME_OVERHEAD}; +use crate::params::{ChannelID, DERIVATION_VERSION_0, FRAME_OVERHEAD, MAX_FRAME_LEN}; use alloc::vec::Vec; use anyhow::{anyhow, bail, Result}; -/// Frames cannot be larger than 1MB. -/// Data transactions that carry frames are generally not larger than 128 KB due to L1 network -/// conditions, but we leave space to grow larger anyway (gas limit allows for more data). -const MAX_FRAME_LEN: usize = 1000; - /// A channel frame is a segment of a channel's data. /// /// *Encoding* diff --git a/crates/derive/src/types/mod.rs b/crates/derive/src/types/mod.rs index b1ee8ae05..138fe1c19 100644 --- a/crates/derive/src/types/mod.rs +++ b/crates/derive/src/types/mod.rs @@ -5,10 +5,7 @@ use alloy_primitives::Bytes; use alloy_rlp::{Decodable, Encodable}; mod system_config; -pub use system_config::{ - SystemAccounts, SystemConfig, SystemConfigUpdateType, CONFIG_UPDATE_EVENT_VERSION_0, - CONFIG_UPDATE_TOPIC, -}; +pub use system_config::{SystemAccounts, SystemConfig, SystemConfigUpdateType}; mod rollup_config; pub use rollup_config::RollupConfig; diff --git a/crates/derive/src/types/system_config.rs b/crates/derive/src/types/system_config.rs index 758f3099b..e170d61a5 100644 --- a/crates/derive/src/types/system_config.rs +++ b/crates/derive/src/types/system_config.rs @@ -1,17 +1,11 @@ //! This module contains the [SystemConfig] type. use super::{Receipt, RollupConfig}; -use alloy_primitives::{address, b256, Address, Log, B256, U256}; +use crate::{CONFIG_UPDATE_EVENT_VERSION_0, CONFIG_UPDATE_TOPIC}; +use alloy_primitives::{address, Address, Log, U256}; use alloy_sol_types::{sol, SolType}; use anyhow::{anyhow, bail, Result}; -/// `keccak256("ConfigUpdate(uint256,uint8,bytes)")` -pub const CONFIG_UPDATE_TOPIC: B256 = - b256!("1d2b0bda21d56b8bd12d4f94ebacffdfb35f5e226f84b461103bb8beab6353be"); - -/// The initial version of the system config event log. -pub const CONFIG_UPDATE_EVENT_VERSION_0: B256 = B256::ZERO; - /// Optimism system config contract values #[derive(Debug, Clone, Copy, PartialEq, Eq, Default)] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] @@ -240,7 +234,7 @@ mod test { use super::*; use alloc::vec; - use alloy_primitives::{hex, LogData}; + use alloy_primitives::{b256, hex, LogData, B256}; extern crate std;