Skip to content
Open
Show file tree
Hide file tree
Changes from 41 commits
Commits
Show all changes
58 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
b38b802
test: add l1 reorg tests
yiweichi Nov 27, 2025
8765085
test: add l1 reorg tests
yiweichi Nov 27, 2025
0b8dd48
fix: chainspec dev l1 config
yiweichi Nov 28, 2025
d560c36
Merge branch 'main' into morty-add-anvil-to-test-fixture
yiweichi Nov 28, 2025
371bc70
fix: ci
yiweichi Nov 28, 2025
7672169
improve anvil config
yiweichi Nov 28, 2025
a66cae7
improve comments
yiweichi Nov 28, 2025
1eb8f41
fix: l1 sync test && address some comments
yiweichi Dec 1, 2025
11344f8
fix: l1 reorg test
yiweichi Dec 1, 2025
c50f330
address comment
yiweichi Dec 1, 2025
29dee41
feat: use AnvilApi
yiweichi Dec 2, 2025
6e2db8a
fix ci
yiweichi Dec 2, 2025
c7fa7e4
Merge branch 'main' into morty-add-anvil-to-test-fixture
yiweichi Dec 2, 2025
e7f00c3
fix: read test tx in one
yiweichi Dec 2, 2025
731ae47
add test-utils
yiweichi Dec 2, 2025
5a03a6b
fix ci
yiweichi Dec 2, 2025
10b540c
fix: address comment
yiweichi Dec 2, 2025
926f00e
test: add test_l1_sync_batch_revert_before_l1_synced
yiweichi Dec 2, 2025
a1aac4f
Merge branch 'main' into morty-add-anvil-to-test-fixture
yiweichi Dec 2, 2025
18c2a4c
fix: ci
yiweichi Dec 2, 2025
61ee962
add database to test fixture
yiweichi Dec 2, 2025
618bd53
fix: test_l1_sync_batch_finalized
yiweichi Dec 3, 2025
8c9f40f
update comment
yiweichi Dec 3, 2025
087ff57
fix: patch svm-rs and svm-rs-builder
yiweichi Dec 4, 2025
aad3527
Merge branch 'main' into morty-add-anvil-to-test-fixture
yiweichi Dec 4, 2025
1c168fa
clean up anvil_state.json (this is not a fix)
yiweichi Dec 4, 2025
23c0d99
clean up anvil_state.json (this is not a fix)
yiweichi Dec 4, 2025
b503a8e
feat: remove svm patch
yiweichi Dec 4, 2025
6cbd20d
put finalized_block fix behind #[cfg(feature = test-utils)]
yiweichi Dec 4, 2025
94736e7
fmt
yiweichi Dec 4, 2025
42a991c
fix: use database handle from chain-orchastrator handle
yiweichi Dec 5, 2025
fd91faf
Merge branch 'main' into morty-add-anvil-to-test-fixture
yiweichi Dec 5, 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,845 changes: 2,558 additions & 287 deletions Cargo.lock

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -129,11 +129,13 @@ 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 }
alloy-rpc-types-engine = { version = "1.0.37", default-features = false }
alloy-rpc-types-eth = { version = "1.0.37", default-features = false }
alloy-rpc-types-anvil = { version = "1.0.37", default-features = false }
alloy-sol-types = { version = "1.4.1", default-features = false }
alloy-signer = { version = "1.0.37", default-features = false }
alloy-signer-local = { version = "1.0.37", default-features = false }
Expand Down
6 changes: 6 additions & 0 deletions crates/node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,10 @@ 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 }
alloy-rpc-types-anvil = { workspace = true, optional = true }
reth-e2e-test-utils = { workspace = true, optional = true }
reth-engine-local = { workspace = true, optional = true }
reth-provider = { workspace = true, optional = true }
Expand Down Expand Up @@ -156,6 +158,10 @@ test-utils = [
"rollup-node-chain-orchestrator/test-utils",
"scroll-network/test-utils",
"alloy-eips",
"anvil",
"reth-storage-api",
"alloy-rpc-types-eth",
"alloy-rpc-types-anvil",
"alloy-provider/anvil-api",
"alloy-provider/anvil-node",
]
59 changes: 37 additions & 22 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 @@ -236,7 +247,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 @@ -351,20 +362,24 @@ 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,
),

#[cfg(feature = "test-utils")]
let skip_synced = self.test_args.test && self.test_args.skip_l1_synced;

let (tx, rx) = L1Watcher::spawn(
provider,
l1_block_startup_info,
node_config,
self.l1_provider_args.logs_query_block_range,
#[cfg(feature = "test-utils")]
skip_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 @@ -420,7 +435,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 @@ -900,7 +915,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 @@ -928,7 +943,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 @@ -958,7 +973,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 @@ -983,7 +998,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 @@ -1008,7 +1023,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
Loading