Skip to content

Commit fbc8e41

Browse files
committed
address comments
1 parent 53908c1 commit fbc8e41

File tree

2 files changed

+41
-19
lines changed

2 files changed

+41
-19
lines changed

Makefile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,12 @@ lint: fmt lint-toml clippy udeps codespell zepter
6464

6565
.PHONY: test
6666
test:
67-
cargo test \
67+
cargo nextest run \
6868
--workspace \
6969
--locked \
7070
--all-features \
71-
--no-fail-fast
71+
--no-fail-fast \
72+
-E 'not test(docker)'
7273

7374
# Used to update the mainnet-sample.sql data. Provide the path to the sqlite database that should be read from
7475
# using `DB_PATH`.

crates/node/src/args.rs

Lines changed: 38 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)