From 4f2d0fed84f0b2287ea6bc859c2d536625d0e03f Mon Sep 17 00:00:00 2001 From: Ferran Borreguero Date: Tue, 13 May 2025 20:45:03 +0100 Subject: [PATCH 1/3] Integration test uses genesis file --- .github/workflows/checks.yaml | 3 --- crates/op-rbuilder/src/integration/mod.rs | 13 ++++++++----- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/checks.yaml b/.github/workflows/checks.yaml index 35dee21f9..2190174ac 100644 --- a/.github/workflows/checks.yaml +++ b/.github/workflows/checks.yaml @@ -105,9 +105,6 @@ jobs: - name: Build the rbuilder run: cargo build -p op-rbuilder --bin op-rbuilder - - name: Generate test genesis file - run: cargo run -p op-rbuilder --bin tester -- genesis --output genesis.json - - name: Run integration tests run: cargo test --package op-rbuilder --lib --features integration -- integration::integration_test::tests diff --git a/crates/op-rbuilder/src/integration/mod.rs b/crates/op-rbuilder/src/integration/mod.rs index 11cd6d75c..20fa44555 100644 --- a/crates/op-rbuilder/src/integration/mod.rs +++ b/crates/op-rbuilder/src/integration/mod.rs @@ -1,6 +1,6 @@ use alloy_consensus::TxEip1559; use alloy_eips::{eip1559::MIN_PROTOCOL_BASE_FEE, eip2718::Encodable2718, BlockNumberOrTag}; -use alloy_primitives::hex; +use alloy_primitives::{hex, Address}; use alloy_provider::{ Identity, PendingTransactionBuilder, Provider, ProviderBuilder, RootProvider, }; @@ -9,6 +9,7 @@ use op_alloy_network::Optimism; use op_rbuilder::OpRbuilderConfig; use op_reth::OpRethConfig; use parking_lot::Mutex; +use serde_json::Value; use std::{ cmp::max, collections::HashSet, @@ -240,10 +241,12 @@ impl TestHarnessBuilder { pub async fn build(self) -> eyre::Result { let mut framework = IntegrationFramework::new(&self.name).unwrap(); - // we are going to use a genesis file pre-generated before the test - let mut genesis_path = PathBuf::from(env!("CARGO_MANIFEST_DIR")); - genesis_path.push("../../genesis.json"); - assert!(genesis_path.exists()); + // we are going to use the fixture genesis and copy it to each test folder + let genesis = include_str!("../tester/fixtures/genesis.json.tmpl"); + + let mut genesis_path = PathBuf::from(framework.test_dir.clone()); + genesis_path.push("genesis.json"); + std::fs::write(&genesis_path, genesis)?; // create the builder let builder_data_dir = std::env::temp_dir().join(Uuid::new_v4().to_string()); From 9350913d5d9b75926422b97a349fb8bd839a5887 Mon Sep 17 00:00:00 2001 From: Ferran Borreguero Date: Tue, 13 May 2025 20:50:47 +0100 Subject: [PATCH 2/3] Fix lint --- crates/op-rbuilder/src/integration/mod.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/crates/op-rbuilder/src/integration/mod.rs b/crates/op-rbuilder/src/integration/mod.rs index 20fa44555..14ce32704 100644 --- a/crates/op-rbuilder/src/integration/mod.rs +++ b/crates/op-rbuilder/src/integration/mod.rs @@ -1,6 +1,6 @@ use alloy_consensus::TxEip1559; use alloy_eips::{eip1559::MIN_PROTOCOL_BASE_FEE, eip2718::Encodable2718, BlockNumberOrTag}; -use alloy_primitives::{hex, Address}; +use alloy_primitives::hex; use alloy_provider::{ Identity, PendingTransactionBuilder, Provider, ProviderBuilder, RootProvider, }; @@ -9,7 +9,6 @@ use op_alloy_network::Optimism; use op_rbuilder::OpRbuilderConfig; use op_reth::OpRethConfig; use parking_lot::Mutex; -use serde_json::Value; use std::{ cmp::max, collections::HashSet, @@ -244,7 +243,7 @@ impl TestHarnessBuilder { // we are going to use the fixture genesis and copy it to each test folder let genesis = include_str!("../tester/fixtures/genesis.json.tmpl"); - let mut genesis_path = PathBuf::from(framework.test_dir.clone()); + let mut genesis_path = framework.test_dir.clone(); genesis_path.push("genesis.json"); std::fs::write(&genesis_path, genesis)?; From 33e0cf1290269d566aea422846a35cbee12f99df Mon Sep 17 00:00:00 2001 From: Ferran Borreguero Date: Tue, 13 May 2025 20:51:34 +0100 Subject: [PATCH 3/3] Revert --- .github/workflows/checks.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/checks.yaml b/.github/workflows/checks.yaml index 2190174ac..35dee21f9 100644 --- a/.github/workflows/checks.yaml +++ b/.github/workflows/checks.yaml @@ -105,6 +105,9 @@ jobs: - name: Build the rbuilder run: cargo build -p op-rbuilder --bin op-rbuilder + - name: Generate test genesis file + run: cargo run -p op-rbuilder --bin tester -- genesis --output genesis.json + - name: Run integration tests run: cargo test --package op-rbuilder --lib --features integration -- integration::integration_test::tests