@@ -137,6 +137,10 @@ impl ScrollRollupNodeConfig {
137137 RollupManagerHandle ,
138138 Option < Sender < Arc < L1Notification > > > ,
139139 ) > {
140+ tracing:: info!( target: "rollup_node::args" ,
141+ "Building rollup node with config:\n {:#?}" ,
142+ self
143+ ) ;
140144 // Instantiate the network manager
141145 let scroll_network_manager = ScrollNetworkManager :: from_parts ( network. clone ( ) , events) ;
142146
@@ -223,24 +227,16 @@ impl ScrollRollupNodeConfig {
223227 ) ;
224228
225229 // Create the consensus.
226- let consensus: Box < dyn Consensus > = match self . consensus_args . algorithm {
227- ConsensusAlgorithm :: Noop => Box :: new ( NoopConsensus :: default ( ) ) ,
228- ConsensusAlgorithm :: SystemContract => {
229- let authorized_signer = if let Some ( address) = self . consensus_args . authorized_signer
230- {
231- address
232- } else if let Some ( provider) = l1_provider. as_ref ( ) {
233- provider
234- . authorized_signer ( node_config. address_book . system_contract_address )
235- . await ?
236- } else {
237- return Err ( eyre:: eyre!(
238- "System contract consensus requires either an authorized signer or a L1 provider URL"
239- ) ) ;
240- } ;
241- Box :: new ( SystemContractConsensus :: new ( authorized_signer) )
242- }
230+ let authorized_signer = if let Some ( provider) = l1_provider. as_ref ( ) {
231+ Some (
232+ provider
233+ . authorized_signer ( node_config. address_book . system_contract_address )
234+ . await ?,
235+ )
236+ } else {
237+ None
243238 } ;
239+ let consensus = self . consensus_args . consensus ( authorized_signer) ?;
244240
245241 let ( l1_notification_tx, l1_notification_rx) : ( Option < Sender < Arc < L1Notification > > > , _ ) =
246242 if let Some ( provider) = l1_provider. filter ( |_| !self . test ) {
@@ -349,6 +345,31 @@ impl ConsensusArgs {
349345 pub const fn noop ( ) -> Self {
350346 Self { algorithm : ConsensusAlgorithm :: Noop , authorized_signer : None }
351347 }
348+
349+ /// Creates a consensus instance based on the configured algorithm and authorized signer.
350+ ///
351+ /// The `authorized_signer` field of `ConsensusArgs` takes precedence over the
352+ /// `authorized_signer` parameter passed to this method.
353+ pub fn consensus (
354+ & self ,
355+ authorized_signer : Option < Address > ,
356+ ) -> eyre:: Result < Box < dyn Consensus > > {
357+ match self . algorithm {
358+ ConsensusAlgorithm :: Noop => Ok ( Box :: new ( NoopConsensus :: default ( ) ) ) ,
359+ ConsensusAlgorithm :: SystemContract => {
360+ let authorized_signer = if let Some ( address) = self . authorized_signer {
361+ address
362+ } else if let Some ( address) = authorized_signer {
363+ address
364+ } else {
365+ return Err ( eyre:: eyre!(
366+ "System contract consensus requires either an authorized signer or a L1 provider URL"
367+ ) ) ;
368+ } ;
369+ Ok ( Box :: new ( SystemContractConsensus :: new ( authorized_signer) ) )
370+ }
371+ }
372+ }
352373}
353374
354375/// The consensus algorithm to use.
0 commit comments