From 0c6fb337525ab1c091bbfbee53345c96e0a2fd7f Mon Sep 17 00:00:00 2001 From: Leonardo Yvens Date: Thu, 18 Dec 2025 17:49:25 -0300 Subject: [PATCH 1/5] test: add anvil, mine, and reorg YAML test steps Add new YAML test step types for anvil-based integration tests: - `anvil` step: validates anvil fixture is available - `mine` step: mines N blocks on anvil chain - `reorg` step: triggers blockchain reorg with specified depth These steps enable writing streaming join tests with dynamically generated blockchain data from anvil. Includes example test spec `streaming-join-anvil.yaml` that tests a self-join on blocks via parent_hash with incremental streaming. --- tests/specs/streaming-join-anvil.yaml | 53 +++++++++++++++++++++++++++ tests/src/steps.rs | 17 ++++++++- tests/src/steps/anvil.rs | 46 +++++++++++++++++++++++ tests/src/steps/mine.rs | 34 +++++++++++++++++ tests/src/steps/reorg.rs | 34 +++++++++++++++++ tests/src/tests/it_streaming_join.rs | 32 ++++++++++++++++ tests/src/tests/mod.rs | 1 + 7 files changed, 216 insertions(+), 1 deletion(-) create mode 100644 tests/specs/streaming-join-anvil.yaml create mode 100644 tests/src/steps/anvil.rs create mode 100644 tests/src/steps/mine.rs create mode 100644 tests/src/steps/reorg.rs create mode 100644 tests/src/tests/it_streaming_join.rs diff --git a/tests/specs/streaming-join-anvil.yaml b/tests/specs/streaming-join-anvil.yaml new file mode 100644 index 000000000..173cec2e8 --- /dev/null +++ b/tests/specs/streaming-join-anvil.yaml @@ -0,0 +1,53 @@ +# Streaming join test using Anvil +# +# This test validates that streaming queries with JOINs correctly deliver +# incremental results as new blocks are mined on Anvil. + +- anvil: {} + +# Mine initial blocks (anvil starts with block 0) +- name: mine_initial + mine: 3 + +# Dump to make data available (must happen before registering stream) +- name: dump_initial + dataset: _/anvil_rpc@0.0.0 + end: 3 + +# Register the streaming join query (self-join on blocks via parent_hash) +- name: register_streaming_join + stream: | + SELECT child.block_num, parent.block_num as parent_num + FROM anvil_rpc.blocks child + JOIN anvil_rpc.blocks parent ON child.parent_hash = parent.hash + SETTINGS stream = true + +# Take initial join results - blocks 1,2,3 each joined with their parent +- name: take_initial_join + stream: register_streaming_join + take: 3 + results: | + [ + {"block_num": 1, "parent_num": 0}, + {"block_num": 2, "parent_num": 1}, + {"block_num": 3, "parent_num": 2} + ] + +# Mine more blocks +- name: mine_more + mine: 2 + +# Dump new blocks +- name: dump_more + dataset: _/anvil_rpc@0.0.0 + end: 5 + +# Take incremental join results - blocks 4,5 joined with their parents +- name: take_incremental_join + stream: register_streaming_join + take: 2 + results: | + [ + {"block_num": 4, "parent_num": 3}, + {"block_num": 5, "parent_num": 4} + ] diff --git a/tests/src/steps.rs b/tests/src/steps.rs index b8dbfda3f..306e91ca6 100644 --- a/tests/src/steps.rs +++ b/tests/src/steps.rs @@ -10,10 +10,13 @@ use common::utils::error_with_causes; use fs_err as fs; // Submodules of the step implementations +mod anvil; mod clean_dump_location; mod dump; +mod mine; mod query; mod register; +mod reorg; mod restore; mod stream; mod stream_take; @@ -27,6 +30,12 @@ use crate::testlib::{ctx::TestCtx, fixtures::FlightClient}; #[derive(Debug, serde::Deserialize)] #[serde(untagged)] pub enum TestStep { + /// Initialize Anvil blockchain fixture. + Anvil(anvil::Step), + /// Mine blocks on Anvil. + Mine(mine::Step), + /// Trigger blockchain reorganization on Anvil. + Reorg(reorg::Step), /// Dump dataset data to storage. Dump(dump::Step), /// Register a stream with the client. @@ -47,9 +56,12 @@ impl TestStep { /// Gets the name of the test step. /// /// Returns the step name for logging and identification purposes. - /// Note that CleanDumpLocation steps use their location as the name. + /// Note that CleanDumpLocation and Anvil steps use their field values as the name. pub fn name(&self) -> &str { match self { + TestStep::Anvil(_) => "anvil", + TestStep::Mine(step) => &step.name, + TestStep::Reorg(step) => &step.name, TestStep::Dump(step) => &step.name, TestStep::StreamTake(step) => &step.name, TestStep::Query(step) => &step.name, @@ -66,6 +78,9 @@ impl TestStep { /// with comprehensive logging and error handling. pub async fn run(&self, ctx: &TestCtx, client: &mut FlightClient) -> Result<(), TestStepError> { let result = match self { + TestStep::Anvil(step) => step.run(ctx).await, + TestStep::Mine(step) => step.run(ctx).await, + TestStep::Reorg(step) => step.run(ctx).await, TestStep::Dump(step) => step.run(ctx).await, TestStep::StreamTake(step) => step.run(client).await, TestStep::Query(step) => step.run(client).await, diff --git a/tests/src/steps/anvil.rs b/tests/src/steps/anvil.rs new file mode 100644 index 000000000..1dd232270 --- /dev/null +++ b/tests/src/steps/anvil.rs @@ -0,0 +1,46 @@ +//! Test step for initializing Anvil blockchain fixture. + +use common::BoxError; + +use crate::testlib::ctx::TestCtx; + +/// Test step that validates Anvil is available for the test. +/// +/// This step serves as a marker that the test requires Anvil and validates +/// that the test context was configured with Anvil support. It should appear +/// before any `mine` or `reorg` steps in the YAML spec. +/// +/// Note: The actual Anvil instance must be configured via `TestCtxBuilder::with_anvil_ipc()` +/// or `with_anvil_http()` in the test harness. This step validates that configuration. +#[derive(Debug, serde::Deserialize)] +#[serde(deny_unknown_fields)] +pub struct Step { + /// Anvil configuration options. + pub anvil: AnvilConfig, +} + +/// Configuration options for the Anvil step. +#[derive(Debug, Default, serde::Deserialize)] +#[serde(deny_unknown_fields)] +pub struct AnvilConfig { + /// Connection mode: "ipc" (default) or "http". + #[serde(default)] + pub mode: Option, +} + +impl Step { + /// Validates that Anvil is available in the test context. + /// + /// This method checks that the test context was configured with Anvil support. + /// If Anvil is not available, it returns an error with guidance on how to fix it. + pub async fn run(&self, ctx: &TestCtx) -> Result<(), BoxError> { + tracing::debug!("Validating Anvil fixture is available"); + + // This will panic if Anvil is not configured, which is the expected behavior + // to fail fast with a clear error message + let _anvil = ctx.anvil(); + + tracing::info!("Anvil fixture validated successfully"); + Ok(()) + } +} diff --git a/tests/src/steps/mine.rs b/tests/src/steps/mine.rs new file mode 100644 index 000000000..ffabe1112 --- /dev/null +++ b/tests/src/steps/mine.rs @@ -0,0 +1,34 @@ +//! Test step for mining blocks on Anvil. + +use common::BoxError; + +use crate::testlib::ctx::TestCtx; + +/// Test step that mines blocks on the Anvil blockchain. +/// +/// This step instructs Anvil to mine a specified number of blocks, advancing +/// the blockchain state. This is useful for generating test data and simulating +/// blockchain progression. +#[derive(Debug, serde::Deserialize)] +#[serde(deny_unknown_fields)] +pub struct Step { + /// The name of this test step. + pub name: String, + /// The number of blocks to mine. + pub mine: u64, +} + +impl Step { + /// Mines the specified number of blocks on Anvil. + /// + /// Uses the Anvil fixture from the test context to mine blocks. + /// Requires that the test context was configured with Anvil support. + pub async fn run(&self, ctx: &TestCtx) -> Result<(), BoxError> { + tracing::debug!("Mining {} blocks", self.mine); + + ctx.anvil().mine(self.mine).await?; + + tracing::info!("Successfully mined {} blocks", self.mine); + Ok(()) + } +} diff --git a/tests/src/steps/reorg.rs b/tests/src/steps/reorg.rs new file mode 100644 index 000000000..6222d1899 --- /dev/null +++ b/tests/src/steps/reorg.rs @@ -0,0 +1,34 @@ +//! Test step for triggering blockchain reorganizations on Anvil. + +use common::BoxError; + +use crate::testlib::ctx::TestCtx; + +/// Test step that triggers a blockchain reorganization on Anvil. +/// +/// This step simulates a chain reorganization by replacing the last N blocks +/// with alternative blocks. This is useful for testing reorg handling in +/// streaming queries and data synchronization. +#[derive(Debug, serde::Deserialize)] +#[serde(deny_unknown_fields)] +pub struct Step { + /// The name of this test step. + pub name: String, + /// The depth of the reorganization (number of blocks to replace). + pub reorg: u64, +} + +impl Step { + /// Triggers a blockchain reorganization with the specified depth. + /// + /// Uses the Anvil fixture from the test context to trigger a reorg. + /// Requires that the test context was configured with Anvil support. + pub async fn run(&self, ctx: &TestCtx) -> Result<(), BoxError> { + tracing::debug!("Triggering reorg with depth {}", self.reorg); + + ctx.anvil().reorg(self.reorg).await?; + + tracing::info!("Successfully triggered reorg with depth {}", self.reorg); + Ok(()) + } +} diff --git a/tests/src/tests/it_streaming_join.rs b/tests/src/tests/it_streaming_join.rs new file mode 100644 index 000000000..da7bb629a --- /dev/null +++ b/tests/src/tests/it_streaming_join.rs @@ -0,0 +1,32 @@ +//! Integration tests for streaming joins with Anvil. +//! +//! These tests validate that streaming queries with JOINs correctly deliver +//! incremental results as new blocks are mined on Anvil. + +use monitoring::logging; + +use crate::{ + steps::run_spec, + testlib::ctx::TestCtxBuilder, +}; + +#[tokio::test(flavor = "multi_thread")] +async fn streaming_join_self() { + logging::init(); + + let test_ctx = TestCtxBuilder::new("streaming_join_self") + .with_anvil_ipc() + .with_dataset_manifest("anvil_rpc") + .build() + .await + .expect("Failed to create test environment"); + + let mut client = test_ctx + .new_flight_client() + .await + .expect("Failed to connect FlightClient"); + + run_spec("streaming-join-anvil", &test_ctx, &mut client, None) + .await + .expect("Failed to run streaming join spec"); +} diff --git a/tests/src/tests/mod.rs b/tests/src/tests/mod.rs index 105e8acc0..2c3cd7130 100644 --- a/tests/src/tests/mod.rs +++ b/tests/src/tests/mod.rs @@ -16,4 +16,5 @@ mod it_reorg; mod it_sql; mod it_sql_dataset_batch_size; mod it_streaming; +mod it_streaming_join; mod it_typescript; From 735dd01f1ccf494388bcda8acac6567a8bdf18d3 Mon Sep 17 00:00:00 2001 From: Leonardo Yvens Date: Thu, 18 Dec 2025 17:55:43 -0300 Subject: [PATCH 2/5] Add streaming cross-table join test Add test for INNER JOIN between blocks and transactions tables. Returns empty results since mined blocks have no transactions. --- tests/specs/streaming-join-cross-table.yaml | 51 +++++++++++++++++++++ tests/src/tests/it_streaming_join.rs | 21 +++++++++ 2 files changed, 72 insertions(+) create mode 100644 tests/specs/streaming-join-cross-table.yaml diff --git a/tests/specs/streaming-join-cross-table.yaml b/tests/specs/streaming-join-cross-table.yaml new file mode 100644 index 000000000..ddb6fb1fe --- /dev/null +++ b/tests/specs/streaming-join-cross-table.yaml @@ -0,0 +1,51 @@ +# Streaming cross-table join test using Anvil +# +# This test validates that streaming queries with JOINs across different +# tables (blocks and transactions) correctly deliver incremental results. +# +# Uses INNER JOIN between blocks and transactions - returns rows only when +# blocks have transactions. With empty anvil blocks, we need to verify +# the join mechanism works even if no rows are returned initially. + +- anvil: {} + +# Mine initial blocks +- name: mine_initial + mine: 3 + +# Dump to make data available +- name: dump_initial + dataset: _/anvil_rpc@0.0.0 + end: 3 + +# Register streaming cross-table join query (blocks INNER JOIN transactions) +# This joins blocks with their transactions on block_num +- name: register_cross_table_join + stream: | + SELECT b.block_num, t.tx_hash, t.tx_index + FROM anvil_rpc.blocks b + INNER JOIN anvil_rpc.transactions t ON b.block_num = t.block_num + SETTINGS stream = true + +# Take initial join results - empty blocks have no transactions, so 0 rows +- name: take_initial_join + stream: register_cross_table_join + take: 0 + results: | + [] + +# Mine more blocks +- name: mine_more + mine: 2 + +# Dump new blocks +- name: dump_more + dataset: _/anvil_rpc@0.0.0 + end: 5 + +# Take incremental join results - still no transactions in empty blocks +- name: take_incremental_join + stream: register_cross_table_join + take: 0 + results: | + [] diff --git a/tests/src/tests/it_streaming_join.rs b/tests/src/tests/it_streaming_join.rs index da7bb629a..fa62b19f6 100644 --- a/tests/src/tests/it_streaming_join.rs +++ b/tests/src/tests/it_streaming_join.rs @@ -30,3 +30,24 @@ async fn streaming_join_self() { .await .expect("Failed to run streaming join spec"); } + +#[tokio::test(flavor = "multi_thread")] +async fn streaming_join_cross_table() { + logging::init(); + + let test_ctx = TestCtxBuilder::new("streaming_join_cross_table") + .with_anvil_ipc() + .with_dataset_manifest("anvil_rpc") + .build() + .await + .expect("Failed to create test environment"); + + let mut client = test_ctx + .new_flight_client() + .await + .expect("Failed to connect FlightClient"); + + run_spec("streaming-join-cross-table", &test_ctx, &mut client, None) + .await + .expect("Failed to run streaming cross-table join spec"); +} From 9555c0817894a38c0ea47f155e6ef0e5709183db Mon Sep 17 00:00:00 2001 From: Leonardo Yvens Date: Thu, 18 Dec 2025 18:01:00 -0300 Subject: [PATCH 3/5] Add streaming join with reorg test Validates that streaming joins correctly handle blockchain reorganizations: - Mine 5 blocks, take initial join results - Trigger reorg (depth 2), mine 3 new blocks - Verify incremental results reflect reorganized chain --- tests/specs/streaming-join-with-reorg.yaml | 68 ++++++++++++++++++++++ tests/src/tests/it_streaming_join.rs | 21 +++++++ 2 files changed, 89 insertions(+) create mode 100644 tests/specs/streaming-join-with-reorg.yaml diff --git a/tests/specs/streaming-join-with-reorg.yaml b/tests/specs/streaming-join-with-reorg.yaml new file mode 100644 index 000000000..873796b2c --- /dev/null +++ b/tests/specs/streaming-join-with-reorg.yaml @@ -0,0 +1,68 @@ +# Streaming join test with blockchain reorganization +# +# This test validates that streaming queries with JOINs correctly handle +# blockchain reorganizations, delivering updated results after reorg. +# +# Flow: +# 1. Mine initial blocks and register streaming join +# 2. Take initial join results +# 3. Trigger reorg (removes some blocks) +# 4. Mine new blocks on the new fork +# 5. Verify join results reflect the reorganized chain + +- anvil: {} + +# Mine initial blocks (anvil starts with block 0) +- name: mine_initial + mine: 5 + +# Dump to make data available +- name: dump_initial + dataset: _/anvil_rpc@0.0.0 + end: 5 + +# Register the streaming join query (self-join on blocks via parent_hash) +- name: register_streaming_join + stream: | + SELECT child.block_num, parent.block_num as parent_num + FROM anvil_rpc.blocks child + JOIN anvil_rpc.blocks parent ON child.parent_hash = parent.hash + SETTINGS stream = true + +# Take initial join results - blocks 1-5 each joined with their parent +- name: take_initial_join + stream: register_streaming_join + take: 5 + results: | + [ + {"block_num": 1, "parent_num": 0}, + {"block_num": 2, "parent_num": 1}, + {"block_num": 3, "parent_num": 2}, + {"block_num": 4, "parent_num": 3}, + {"block_num": 5, "parent_num": 4} + ] + +# Trigger reorg - removes last 2 blocks (4 and 5) +- name: trigger_reorg + reorg: 2 + +# Mine new blocks on the reorganized chain +- name: mine_after_reorg + mine: 3 + +# Dump the reorganized chain state +- name: dump_after_reorg + dataset: _/anvil_rpc@0.0.0 + end: 6 + +# Take incremental join results after reorg +# Should see blocks 4, 5, 6 with their new parent relationships +- name: take_after_reorg + stream: register_streaming_join + take: 3 + results: | + [ + {"block_num": 4, "parent_num": 3}, + {"block_num": 5, "parent_num": 4}, + {"block_num": 6, "parent_num": 5} + ] diff --git a/tests/src/tests/it_streaming_join.rs b/tests/src/tests/it_streaming_join.rs index fa62b19f6..1168d9993 100644 --- a/tests/src/tests/it_streaming_join.rs +++ b/tests/src/tests/it_streaming_join.rs @@ -51,3 +51,24 @@ async fn streaming_join_cross_table() { .await .expect("Failed to run streaming cross-table join spec"); } + +#[tokio::test(flavor = "multi_thread")] +async fn streaming_join_with_reorg() { + logging::init(); + + let test_ctx = TestCtxBuilder::new("streaming_join_with_reorg") + .with_anvil_ipc() + .with_dataset_manifest("anvil_rpc") + .build() + .await + .expect("Failed to create test environment"); + + let mut client = test_ctx + .new_flight_client() + .await + .expect("Failed to connect FlightClient"); + + run_spec("streaming-join-with-reorg", &test_ctx, &mut client, None) + .await + .expect("Failed to run streaming join with reorg spec"); +} From d53d898259aedd49f19aa8c6a9d031b580851f10 Mon Sep 17 00:00:00 2001 From: Leonardo Yvens Date: Thu, 18 Dec 2025 18:19:46 -0300 Subject: [PATCH 4/5] Fix rustfmt --- tests/src/tests/it_streaming_join.rs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/tests/src/tests/it_streaming_join.rs b/tests/src/tests/it_streaming_join.rs index 1168d9993..d64425d58 100644 --- a/tests/src/tests/it_streaming_join.rs +++ b/tests/src/tests/it_streaming_join.rs @@ -5,10 +5,7 @@ use monitoring::logging; -use crate::{ - steps::run_spec, - testlib::ctx::TestCtxBuilder, -}; +use crate::{steps::run_spec, testlib::ctx::TestCtxBuilder}; #[tokio::test(flavor = "multi_thread")] async fn streaming_join_self() { From 0146f8e1dc781660ba33a26020654fab72794dc2 Mon Sep 17 00:00:00 2001 From: Leonardo Yvens Date: Mon, 5 Jan 2026 14:05:44 -0300 Subject: [PATCH 5/5] Rename mine/reorg steps to anvil_mine/anvil_reorg Address review feedback: since these steps are anvil-dependent, rename them to make the dependency explicit. --- tests/specs/streaming-join-anvil.yaml | 4 ++-- tests/specs/streaming-join-cross-table.yaml | 4 ++-- tests/specs/streaming-join-with-reorg.yaml | 6 +++--- tests/src/steps.rs | 16 ++++++++-------- tests/src/steps/{mine.rs => anvil_mine.rs} | 8 ++++---- tests/src/steps/{reorg.rs => anvil_reorg.rs} | 11 +++++++---- 6 files changed, 26 insertions(+), 23 deletions(-) rename tests/src/steps/{mine.rs => anvil_mine.rs} (80%) rename tests/src/steps/{reorg.rs => anvil_reorg.rs} (77%) diff --git a/tests/specs/streaming-join-anvil.yaml b/tests/specs/streaming-join-anvil.yaml index 173cec2e8..276dc3c52 100644 --- a/tests/specs/streaming-join-anvil.yaml +++ b/tests/specs/streaming-join-anvil.yaml @@ -7,7 +7,7 @@ # Mine initial blocks (anvil starts with block 0) - name: mine_initial - mine: 3 + anvil_mine: 3 # Dump to make data available (must happen before registering stream) - name: dump_initial @@ -35,7 +35,7 @@ # Mine more blocks - name: mine_more - mine: 2 + anvil_mine: 2 # Dump new blocks - name: dump_more diff --git a/tests/specs/streaming-join-cross-table.yaml b/tests/specs/streaming-join-cross-table.yaml index ddb6fb1fe..6bb241809 100644 --- a/tests/specs/streaming-join-cross-table.yaml +++ b/tests/specs/streaming-join-cross-table.yaml @@ -11,7 +11,7 @@ # Mine initial blocks - name: mine_initial - mine: 3 + anvil_mine: 3 # Dump to make data available - name: dump_initial @@ -36,7 +36,7 @@ # Mine more blocks - name: mine_more - mine: 2 + anvil_mine: 2 # Dump new blocks - name: dump_more diff --git a/tests/specs/streaming-join-with-reorg.yaml b/tests/specs/streaming-join-with-reorg.yaml index 873796b2c..2d7be6438 100644 --- a/tests/specs/streaming-join-with-reorg.yaml +++ b/tests/specs/streaming-join-with-reorg.yaml @@ -14,7 +14,7 @@ # Mine initial blocks (anvil starts with block 0) - name: mine_initial - mine: 5 + anvil_mine: 5 # Dump to make data available - name: dump_initial @@ -44,11 +44,11 @@ # Trigger reorg - removes last 2 blocks (4 and 5) - name: trigger_reorg - reorg: 2 + anvil_reorg: 2 # Mine new blocks on the reorganized chain - name: mine_after_reorg - mine: 3 + anvil_mine: 3 # Dump the reorganized chain state - name: dump_after_reorg diff --git a/tests/src/steps.rs b/tests/src/steps.rs index 306e91ca6..417d803b2 100644 --- a/tests/src/steps.rs +++ b/tests/src/steps.rs @@ -11,12 +11,12 @@ use fs_err as fs; // Submodules of the step implementations mod anvil; +mod anvil_mine; +mod anvil_reorg; mod clean_dump_location; mod dump; -mod mine; mod query; mod register; -mod reorg; mod restore; mod stream; mod stream_take; @@ -33,9 +33,9 @@ pub enum TestStep { /// Initialize Anvil blockchain fixture. Anvil(anvil::Step), /// Mine blocks on Anvil. - Mine(mine::Step), + AnvilMine(anvil_mine::Step), /// Trigger blockchain reorganization on Anvil. - Reorg(reorg::Step), + AnvilReorg(anvil_reorg::Step), /// Dump dataset data to storage. Dump(dump::Step), /// Register a stream with the client. @@ -60,8 +60,8 @@ impl TestStep { pub fn name(&self) -> &str { match self { TestStep::Anvil(_) => "anvil", - TestStep::Mine(step) => &step.name, - TestStep::Reorg(step) => &step.name, + TestStep::AnvilMine(step) => &step.name, + TestStep::AnvilReorg(step) => &step.name, TestStep::Dump(step) => &step.name, TestStep::StreamTake(step) => &step.name, TestStep::Query(step) => &step.name, @@ -79,8 +79,8 @@ impl TestStep { pub async fn run(&self, ctx: &TestCtx, client: &mut FlightClient) -> Result<(), TestStepError> { let result = match self { TestStep::Anvil(step) => step.run(ctx).await, - TestStep::Mine(step) => step.run(ctx).await, - TestStep::Reorg(step) => step.run(ctx).await, + TestStep::AnvilMine(step) => step.run(ctx).await, + TestStep::AnvilReorg(step) => step.run(ctx).await, TestStep::Dump(step) => step.run(ctx).await, TestStep::StreamTake(step) => step.run(client).await, TestStep::Query(step) => step.run(client).await, diff --git a/tests/src/steps/mine.rs b/tests/src/steps/anvil_mine.rs similarity index 80% rename from tests/src/steps/mine.rs rename to tests/src/steps/anvil_mine.rs index ffabe1112..30d409648 100644 --- a/tests/src/steps/mine.rs +++ b/tests/src/steps/anvil_mine.rs @@ -15,7 +15,7 @@ pub struct Step { /// The name of this test step. pub name: String, /// The number of blocks to mine. - pub mine: u64, + pub anvil_mine: u64, } impl Step { @@ -24,11 +24,11 @@ impl Step { /// Uses the Anvil fixture from the test context to mine blocks. /// Requires that the test context was configured with Anvil support. pub async fn run(&self, ctx: &TestCtx) -> Result<(), BoxError> { - tracing::debug!("Mining {} blocks", self.mine); + tracing::debug!("Mining {} blocks", self.anvil_mine); - ctx.anvil().mine(self.mine).await?; + ctx.anvil().mine(self.anvil_mine).await?; - tracing::info!("Successfully mined {} blocks", self.mine); + tracing::info!("Successfully mined {} blocks", self.anvil_mine); Ok(()) } } diff --git a/tests/src/steps/reorg.rs b/tests/src/steps/anvil_reorg.rs similarity index 77% rename from tests/src/steps/reorg.rs rename to tests/src/steps/anvil_reorg.rs index 6222d1899..d34846bd6 100644 --- a/tests/src/steps/reorg.rs +++ b/tests/src/steps/anvil_reorg.rs @@ -15,7 +15,7 @@ pub struct Step { /// The name of this test step. pub name: String, /// The depth of the reorganization (number of blocks to replace). - pub reorg: u64, + pub anvil_reorg: u64, } impl Step { @@ -24,11 +24,14 @@ impl Step { /// Uses the Anvil fixture from the test context to trigger a reorg. /// Requires that the test context was configured with Anvil support. pub async fn run(&self, ctx: &TestCtx) -> Result<(), BoxError> { - tracing::debug!("Triggering reorg with depth {}", self.reorg); + tracing::debug!("Triggering reorg with depth {}", self.anvil_reorg); - ctx.anvil().reorg(self.reorg).await?; + ctx.anvil().reorg(self.anvil_reorg).await?; - tracing::info!("Successfully triggered reorg with depth {}", self.reorg); + tracing::info!( + "Successfully triggered reorg with depth {}", + self.anvil_reorg + ); Ok(()) } }