11use crate :: {
22 add_ons:: IsDevChain ,
33 constants:: { self } ,
4+ context:: RollupNodeContext ,
45} ;
56use std:: { fs, path:: PathBuf , sync:: Arc , time:: Duration } ;
67
@@ -17,7 +18,7 @@ use reth_network::NetworkProtocols;
1718use reth_network_api:: FullNetwork ;
1819use reth_node_builder:: rpc:: RethRpcServerHandles ;
1920use reth_node_core:: primitives:: BlockHeader ;
20- use reth_scroll_chainspec:: SCROLL_FEE_VAULT_ADDRESS ;
21+ use reth_scroll_chainspec:: { ChainConfig , ScrollChainConfig , SCROLL_FEE_VAULT_ADDRESS } ;
2122use reth_scroll_node:: ScrollNetworkPrimitives ;
2223use rollup_node_chain_orchestrator:: ChainOrchestrator ;
2324use rollup_node_manager:: {
@@ -113,22 +114,11 @@ impl ScrollRollupNodeConfig {
113114
114115impl ScrollRollupNodeConfig {
115116 /// Consumes the [`ScrollRollupNodeConfig`] and builds a [`RollupNodeManager`].
116- pub async fn build <
117- N : FullNetwork < Primitives = ScrollNetworkPrimitives > + NetworkProtocols ,
118- CS : ScrollHardforks
119- + EthChainSpec < Header : BlockHeader >
120- + IsDevChain
121- + Clone
122- + Send
123- + Sync
124- + ' static ,
125- > (
117+ pub async fn build < N , CS > (
126118 self ,
127- network : N ,
119+ ctx : RollupNodeContext < N , CS > ,
128120 events : UnboundedReceiver < ScrollWireEvent > ,
129121 rpc_server_handles : RethRpcServerHandles ,
130- chain_spec : CS ,
131- db_path : PathBuf ,
132122 ) -> eyre:: Result < (
133123 RollupNodeManager <
134124 N ,
@@ -140,11 +130,21 @@ impl ScrollRollupNodeConfig {
140130 > ,
141131 RollupManagerHandle ,
142132 Option < Sender < Arc < L1Notification > > > ,
143- ) > {
133+ ) >
134+ where
135+ N : FullNetwork < Primitives = ScrollNetworkPrimitives > + NetworkProtocols ,
136+ CS : EthChainSpec < Header : BlockHeader >
137+ + ChainConfig < Config = ScrollChainConfig >
138+ + ScrollHardforks
139+ + IsDevChain
140+ + ' static ,
141+ {
144142 tracing:: info!( target: "rollup_node::args" ,
145143 "Building rollup node with config:\n {:#?}" ,
146144 self
147145 ) ;
146+ // Get the chain spec.
147+ let chain_spec = ctx. chain_spec ;
148148
149149 // Get the rollup node config.
150150 let named_chain = chain_spec. chain ( ) . named ( ) . expect ( "expected named chain" ) ;
@@ -175,6 +175,7 @@ impl ScrollRollupNodeConfig {
175175 let l2_provider = Arc :: new ( l2_provider) ;
176176
177177 // Instantiate the database
178+ let db_path = ctx. datadir ;
178179 let database_path = if let Some ( database_path) = self . database_args . path {
179180 database_path. to_string_lossy ( ) . to_string ( )
180181 } else {
@@ -208,10 +209,10 @@ impl ScrollRollupNodeConfig {
208209 let eth_wire_listener = self
209210 . network_args
210211 . enable_eth_scroll_wire_bridge
211- . then_some ( network. eth_wire_block_listener ( ) . await ?) ;
212+ . then_some ( ctx . network . eth_wire_block_listener ( ) . await ?) ;
212213 let scroll_network_manager = ScrollNetworkManager :: from_parts (
213214 chain_spec. clone ( ) ,
214- network. clone ( ) ,
215+ ctx . network . clone ( ) ,
215216 events,
216217 eth_wire_listener,
217218 self . network_args . eth_wire_gossip ,
@@ -282,12 +283,14 @@ impl ScrollRollupNodeConfig {
282283 let l1_provider = FullL1Provider :: new ( blob_provider, l1_messages_provider. clone ( ) ) . await ;
283284
284285 // Construct the Sequencer.
286+ let chain_config = chain_spec. chain_config ( ) ;
285287 let ( sequencer, block_time) = if self . sequencer_args . sequencer_enabled {
286288 let args = & self . sequencer_args ;
287289 let sequencer = Sequencer :: new (
288290 Arc :: new ( l1_messages_provider) ,
289291 args. fee_recipient ,
290- args. max_l1_messages_per_block ,
292+ ctx. block_gas_limit ,
293+ chain_config. l1_config . num_l1_messages_per_block ,
291294 0 ,
292295 self . sequencer_args . l1_message_inclusion_mode ,
293296 ) ;
@@ -536,9 +539,6 @@ pub struct SequencerArgs {
536539 /// The payload building duration for the sequencer (milliseconds)
537540 #[ arg( long = "sequencer.payload-building-duration" , id = "sequencer_payload_building_duration" , value_name = "SEQUENCER_PAYLOAD_BUILDING_DURATION" , default_value_t = constants:: DEFAULT_PAYLOAD_BUILDING_DURATION ) ]
538541 pub payload_building_duration : u64 ,
539- /// The max L1 messages per block for the sequencer.
540- #[ arg( long = "sequencer.max-l1-messages-per-block" , id = "sequencer_max_l1_messages_per_block" , value_name = "SEQUENCER_MAX_L1_MESSAGES_PER_BLOCK" , default_value_t = constants:: DEFAULT_MAX_L1_MESSAGES_PER_BLOCK ) ]
541- pub max_l1_messages_per_block : u64 ,
542542 /// The fee recipient for the sequencer.
543543 #[ arg( long = "sequencer.fee-recipient" , id = "sequencer_fee_recipient" , value_name = "SEQUENCER_FEE_RECIPIENT" , default_value_t = SCROLL_FEE_VAULT_ADDRESS ) ]
544544 pub fee_recipient : Address ,
0 commit comments