Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
d80987f
tests: add test fixture for easier abstraction
greged93 Nov 3, 2025
0e79430
Merge branch 'main' into tests/improve-framework
greged93 Nov 3, 2025
395add0
fix: lints
greged93 Nov 3, 2025
3c6f416
fix: smol rework
greged93 Nov 3, 2025
e7da229
fix: fmt
greged93 Nov 3, 2025
81c5db8
tests: extend helpers and migrate
greged93 Nov 5, 2025
2d48822
tests: answer comments + finish migration
greged93 Nov 6, 2025
fe784c1
tests: migrate remaining tests
greged93 Nov 6, 2025
066609d
Merge branch 'main' into tests/improve-framework
greged93 Nov 6, 2025
8c2bfc7
tests: migration after merge
greged93 Nov 6, 2025
a64812f
tests: cleaning + fix
greged93 Nov 6, 2025
02bbc3e
tests: disable eth wire bridge
greged93 Nov 6, 2025
537b6a9
tests: use expect_tx
greged93 Nov 6, 2025
a94f09b
fix: clippy
greged93 Nov 6, 2025
1a95fd3
Merge branch 'main' into tests/improve-framework
greged93 Nov 16, 2025
7d8ab02
chore: answer comments
greged93 Nov 16, 2025
c3a51d6
Merge branch 'main' into tests/improve-framework
yiweichi Nov 17, 2025
361a66e
merge main branch
yiweichi Nov 17, 2025
b50e8c0
test: add anvil to testFixture
yiweichi Nov 17, 2025
c820cbb
test: add anvil to test fixture
yiweichi Nov 18, 2025
3d0c580
Merge branch 'main' into morty-add-anvil-to-test-fixture
yiweichi Nov 18, 2025
4df57f1
feat: add test l1 reorg
yiweichi Nov 20, 2025
46638aa
feat: add test l1 reorg
yiweichi Nov 21, 2025
c703985
Merge branch 'main' into morty-add-anvil-to-test-fixture
yiweichi Nov 21, 2025
82d4178
test: add test_l1_sync_batch_commit
yiweichi Nov 25, 2025
14ccd64
test: add test_l1_sync_batch_finalized
yiweichi Nov 26, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2,704 changes: 2,469 additions & 235 deletions Cargo.lock

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ alloy-consensus = { version = "1.0.37", default-features = false }
alloy-eips = { version = "1.0.37", default-features = false }
alloy-json-rpc = { version = "1.0.37", default-features = false }
alloy-network = { version = "1.0.37", default-features = false }
alloy-node-bindings = { version = "1.0.37", default-features = false }
alloy-primitives = { version = "1.4.1", default-features = false }
alloy-provider = { version = "1.0.37", default-features = false }
alloy-rpc-client = { version = "1.0.37", default-features = false }
Expand Down
2 changes: 2 additions & 0 deletions crates/node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ aws-sdk-kms = "1.76.0"

# test-utils
alloy-eips = { workspace = true, optional = true }
anvil = { git = "https://github.com/foundry-rs/foundry.git", rev = "2c84e1c970d11ef5023a77d8002a1cb70b143888", default-features = false, optional = true }
alloy-rpc-types-eth = { workspace = true, optional = true }
alloy-rpc-types-engine = { workspace = true, optional = true }
reth-e2e-test-utils = { workspace = true, optional = true }
Expand Down Expand Up @@ -156,6 +157,7 @@ test-utils = [
"rollup-node-chain-orchestrator/test-utils",
"scroll-network/test-utils",
"alloy-eips",
"anvil",
"reth-storage-api",
"alloy-rpc-types-eth",
]
56 changes: 33 additions & 23 deletions crates/node/src/args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,23 @@ use scroll_network::ScrollNetworkManager;
use scroll_wire::ScrollWireEvent;
use tokio::sync::mpsc::{Sender, UnboundedReceiver};

/// A struct that represents the arguments for the rollup node.
#[derive(Debug, Clone, clap::Args)]
pub struct ScrollRollupNodeConfig {
/// Test-related configuration arguments.
#[derive(Debug, Clone, Default, clap::Args)]
pub struct TestArgs {
/// Whether the rollup node should be run in test mode.
#[arg(long)]
pub test: bool,
/// Test mode: skip L1 watcher Synced notifications.
#[arg(long, default_value = "false")]
pub skip_l1_synced: bool,
}

/// A struct that represents the arguments for the rollup node.
#[derive(Debug, Clone, clap::Args)]
pub struct ScrollRollupNodeConfig {
/// Test-related arguments
#[command(flatten)]
pub test_args: TestArgs,
/// Consensus args
#[command(flatten)]
pub consensus_args: ConsensusArgs,
Expand Down Expand Up @@ -226,7 +237,7 @@ impl ScrollRollupNodeConfig {
// Run the database migrations
if let Some(named) = chain_spec.chain().named() {
named
.migrate(db.inner().get_connection(), self.test)
.migrate(db.inner().get_connection(), self.test_args.test)
.await
.expect("failed to perform migration");
} else {
Expand Down Expand Up @@ -341,20 +352,19 @@ impl ScrollRollupNodeConfig {
let consensus = self.consensus_args.consensus(authorized_signer)?;

let (l1_notification_tx, l1_notification_rx): (Option<Sender<Arc<L1Notification>>>, _) =
if let Some(provider) = l1_provider.filter(|_| !self.test) {
if let Some(provider) = l1_provider
.filter(|_| !self.test_args.test || self.blob_provider_args.anvil_url.is_some())
{
tracing::info!(target: "scroll::node::args", ?l1_block_startup_info, "Starting L1 watcher");
(
None,
Some(
L1Watcher::spawn(
provider,
l1_block_startup_info,
node_config,
self.l1_provider_args.logs_query_block_range,
)
.await,
),
)
let (tx, rx) = L1Watcher::spawn(
provider,
l1_block_startup_info,
node_config,
self.l1_provider_args.logs_query_block_range,
self.test_args.test && self.test_args.skip_l1_synced,
)
.await;
(Some(tx), Some(rx))
} else {
// Create a channel for L1 notifications that we can use to inject L1 messages for
// testing
Expand Down Expand Up @@ -410,7 +420,7 @@ impl ScrollRollupNodeConfig {
let signer = if let Some(configured_signer) = self.signer_args.signer(chain_id).await? {
// Use the signer configured by SignerArgs
Some(rollup_node_signer::Signer::spawn(configured_signer))
} else if self.test {
} else if self.test_args.test {
// Use a random private key signer for testing
Some(rollup_node_signer::Signer::spawn(PrivateKeySigner::random()))
} else {
Expand Down Expand Up @@ -887,7 +897,7 @@ mod tests {
#[test]
fn test_validate_sequencer_enabled_without_any_signer_fails() {
let config = ScrollRollupNodeConfig {
test: false,
test_args: TestArgs::default(),
sequencer_args: SequencerArgs { sequencer_enabled: true, ..Default::default() },
signer_args: SignerArgs { key_file: None, aws_kms_key_id: None, private_key: None },
database_args: RollupNodeDatabaseArgs::default(),
Expand Down Expand Up @@ -915,7 +925,7 @@ mod tests {
#[test]
fn test_validate_sequencer_enabled_with_both_signers_fails() {
let config = ScrollRollupNodeConfig {
test: false,
test_args: TestArgs::default(),
sequencer_args: SequencerArgs { sequencer_enabled: true, ..Default::default() },
signer_args: SignerArgs {
key_file: Some(PathBuf::from("/path/to/key")),
Expand Down Expand Up @@ -945,7 +955,7 @@ mod tests {
#[test]
fn test_validate_sequencer_enabled_with_key_file_succeeds() {
let config = ScrollRollupNodeConfig {
test: false,
test_args: TestArgs::default(),
sequencer_args: SequencerArgs { sequencer_enabled: true, ..Default::default() },
signer_args: SignerArgs {
key_file: Some(PathBuf::from("/path/to/key")),
Expand All @@ -970,7 +980,7 @@ mod tests {
#[test]
fn test_validate_sequencer_enabled_with_aws_kms_succeeds() {
let config = ScrollRollupNodeConfig {
test: false,
test_args: TestArgs::default(),
sequencer_args: SequencerArgs { sequencer_enabled: true, ..Default::default() },
signer_args: SignerArgs {
key_file: None,
Expand All @@ -995,7 +1005,7 @@ mod tests {
#[test]
fn test_validate_sequencer_disabled_without_any_signer_succeeds() {
let config = ScrollRollupNodeConfig {
test: false,
test_args: TestArgs::default(),
sequencer_args: SequencerArgs { sequencer_enabled: false, ..Default::default() },
signer_args: SignerArgs { key_file: None, aws_kms_key_id: None, private_key: None },
database_args: RollupNodeDatabaseArgs::default(),
Expand Down
9 changes: 9 additions & 0 deletions crates/node/src/test_utils/event_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,15 @@ impl<'a> EventWaiter<'a> {
Ok(())
}

/// Wait for batch finalized event on all specified nodes.
pub async fn batch_finalized(self) -> eyre::Result<()> {
self.wait_for_event_on_all(|e| {
matches!(e, ChainOrchestratorEvent::BatchFinalized { .. }).then_some(())
})
.await?;
Ok(())
}

/// Wait for batch reverted event on all specified nodes.
pub async fn batch_reverted(self) -> eyre::Result<()> {
self.wait_for_event_on_all(|e| {
Expand Down
Loading