From b962d032b95e89ec3ff5e1a2874ec42b8848e5d0 Mon Sep 17 00:00:00 2001 From: Omar Abdulla Date: Thu, 18 Sep 2025 20:03:33 +0300 Subject: [PATCH] Remoe all references to leader and follower --- crates/compiler/tests/lib.rs | 6 +++--- crates/config/src/lib.rs | 32 +++++++++++++++---------------- crates/core/src/main.rs | 27 ++++++++++++++++---------- crates/node/src/geth.rs | 6 +++--- crates/node/src/substrate.rs | 8 ++++---- crates/report/src/aggregator.rs | 4 ++-- crates/report/src/common.rs | 2 +- crates/report/src/runner_event.rs | 4 ++-- 8 files changed, 48 insertions(+), 41 deletions(-) diff --git a/crates/compiler/tests/lib.rs b/crates/compiler/tests/lib.rs index 7eeef4d..6d9176b 100644 --- a/crates/compiler/tests/lib.rs +++ b/crates/compiler/tests/lib.rs @@ -2,13 +2,13 @@ use std::path::PathBuf; use revive_dt_common::types::VersionOrRequirement; use revive_dt_compiler::{Compiler, SolidityCompiler, revive_resolc::Resolc, solc::Solc}; -use revive_dt_config::ExecutionContext; +use revive_dt_config::TestExecutionContext; use semver::Version; #[tokio::test] async fn contracts_can_be_compiled_with_solc() { // Arrange - let args = ExecutionContext::default(); + let args = TestExecutionContext::default(); let solc = Solc::new(&args, VersionOrRequirement::Version(Version::new(0, 8, 30))) .await .unwrap(); @@ -49,7 +49,7 @@ async fn contracts_can_be_compiled_with_solc() { #[tokio::test] async fn contracts_can_be_compiled_with_resolc() { // Arrange - let args = ExecutionContext::default(); + let args = TestExecutionContext::default(); let resolc = Resolc::new(&args, VersionOrRequirement::Version(Version::new(0, 8, 30))) .await .unwrap(); diff --git a/crates/config/src/lib.rs b/crates/config/src/lib.rs index b8866e6..e7757a8 100644 --- a/crates/config/src/lib.rs +++ b/crates/config/src/lib.rs @@ -27,8 +27,8 @@ use temp_dir::TempDir; #[derive(Clone, Debug, Parser, Serialize)] #[command(name = "retester")] pub enum Context { - /// Executes tests in the MatterLabs format differentially against a leader and a follower. - ExecuteTests(Box), + /// Executes tests in the MatterLabs format differentially on multiple targets concurrently. + ExecuteTests(Box), /// Exports the JSON schema of the MatterLabs test format used by the tool. ExportJsonSchema, } @@ -152,7 +152,7 @@ impl AsRef for Context { } #[derive(Clone, Debug, Parser, Serialize)] -pub struct ExecutionContext { +pub struct TestExecutionContext { /// The working directory that the program will use for all of the temporary artifacts needed at /// runtime. /// @@ -219,79 +219,79 @@ pub struct ExecutionContext { pub report_configuration: ReportConfiguration, } -impl Default for ExecutionContext { +impl Default for TestExecutionContext { fn default() -> Self { Self::parse_from(["execution-context"]) } } -impl AsRef for ExecutionContext { +impl AsRef for TestExecutionContext { fn as_ref(&self) -> &WorkingDirectoryConfiguration { &self.working_directory } } -impl AsRef for ExecutionContext { +impl AsRef for TestExecutionContext { fn as_ref(&self) -> &SolcConfiguration { &self.solc_configuration } } -impl AsRef for ExecutionContext { +impl AsRef for TestExecutionContext { fn as_ref(&self) -> &ResolcConfiguration { &self.resolc_configuration } } -impl AsRef for ExecutionContext { +impl AsRef for TestExecutionContext { fn as_ref(&self) -> &GethConfiguration { &self.geth_configuration } } -impl AsRef for ExecutionContext { +impl AsRef for TestExecutionContext { fn as_ref(&self) -> &KitchensinkConfiguration { &self.kitchensink_configuration } } -impl AsRef for ExecutionContext { +impl AsRef for TestExecutionContext { fn as_ref(&self) -> &ReviveDevNodeConfiguration { &self.revive_dev_node_configuration } } -impl AsRef for ExecutionContext { +impl AsRef for TestExecutionContext { fn as_ref(&self) -> &EthRpcConfiguration { &self.eth_rpc_configuration } } -impl AsRef for ExecutionContext { +impl AsRef for TestExecutionContext { fn as_ref(&self) -> &GenesisConfiguration { &self.genesis_configuration } } -impl AsRef for ExecutionContext { +impl AsRef for TestExecutionContext { fn as_ref(&self) -> &WalletConfiguration { &self.wallet_configuration } } -impl AsRef for ExecutionContext { +impl AsRef for TestExecutionContext { fn as_ref(&self) -> &ConcurrencyConfiguration { &self.concurrency_configuration } } -impl AsRef for ExecutionContext { +impl AsRef for TestExecutionContext { fn as_ref(&self) -> &CompilationConfiguration { &self.compilation_configuration } } -impl AsRef for ExecutionContext { +impl AsRef for TestExecutionContext { fn as_ref(&self) -> &ReportConfiguration { &self.report_configuration } diff --git a/crates/core/src/main.rs b/crates/core/src/main.rs index 48da0a8..583ea0a 100644 --- a/crates/core/src/main.rs +++ b/crates/core/src/main.rs @@ -112,7 +112,7 @@ fn main() -> anyhow::Result<()> { #[instrument(level = "debug", name = "Collecting Corpora", skip_all)] fn collect_corpora( - context: &ExecutionContext, + context: &TestExecutionContext, ) -> anyhow::Result>> { let mut corpora = HashMap::new(); @@ -134,7 +134,7 @@ fn collect_corpora( } async fn run_driver( - context: ExecutionContext, + context: TestExecutionContext, metadata_files: &[MetadataFile], reporter: Reporter, report_aggregator_task: impl Future>, @@ -143,7 +143,14 @@ async fn run_driver( let mut nodes = Vec::<(&dyn DynPlatform, NodePool)>::new(); for platform in platforms.into_iter() { let pool = NodePool::new(Context::ExecuteTests(Box::new(context.clone())), platform) - .context("Failed to initialize follower node pool")?; + .inspect_err(|err| { + error!( + %err, + platform_identifier = %platform.platform_identifier(), + "Failed to initialize the node pool for the platform." + ) + }) + .context("Failed to initialize the node pool")?; nodes.push((platform, pool)); } @@ -166,7 +173,7 @@ async fn run_driver( } async fn tests_stream<'a>( - args: &ExecutionContext, + args: &TestExecutionContext, metadata_files: impl IntoIterator + Clone, nodes: &'a [(&dyn DynPlatform, NodePool)], reporter: Reporter, @@ -284,7 +291,7 @@ async fn tests_stream<'a>( } async fn start_driver_task<'a>( - context: &ExecutionContext, + context: &TestExecutionContext, tests: impl Stream>, ) -> anyhow::Result> { info!("Starting driver task"); @@ -489,7 +496,7 @@ async fn handle_case_driver<'a>( contract_ident: library_ident, } = contract_sources.remove(library_instance)?; - let (code, leader_abi) = compiler_output + let (code, abi) = compiler_output .contracts .get(&library_source_path) .and_then(|contracts| contracts.get(library_ident.as_str()))?; @@ -537,7 +544,7 @@ async fn handle_case_driver<'a>( deployed_libraries.get_or_insert_default().insert( library_instance.clone(), - (library_ident.clone(), library_address, leader_abi.clone()), + (library_ident.clone(), library_address, abi.clone()), ); } @@ -601,7 +608,7 @@ async fn handle_case_driver<'a>( } async fn execute_corpus( - context: ExecutionContext, + context: TestExecutionContext, tests: &[MetadataFile], reporter: Reporter, report_aggregator_task: impl Future>, @@ -703,7 +710,7 @@ impl<'a> Test<'a> { } } - // Checks for the compatibility of the EVM version with the leader and follower nodes. + // Checks for the compatibility of the EVM version with the platforms specified. fn check_evm_version_compatibility(&self) -> TestCheckFunctionResult { let Some(evm_version_requirement) = self.metadata.required_evm_version else { return Ok(()); @@ -732,7 +739,7 @@ impl<'a> Test<'a> { } } - /// Checks if the leader and follower compilers support the mode that the test is for. + /// Checks if the platforms compilers support the mode that the test is for. fn check_compiler_compatibility(&self) -> TestCheckFunctionResult { let mut error_map = indexmap! { "test_desired_evm_version" => json!(self.metadata.required_evm_version), diff --git a/crates/node/src/geth.rs b/crates/node/src/geth.rs index a1827e9..a942ddf 100644 --- a/crates/node/src/geth.rs +++ b/crates/node/src/geth.rs @@ -855,11 +855,11 @@ impl Drop for GethNode { mod tests { use super::*; - fn test_config() -> ExecutionContext { - ExecutionContext::default() + fn test_config() -> TestExecutionContext { + TestExecutionContext::default() } - fn new_node() -> (ExecutionContext, GethNode) { + fn new_node() -> (TestExecutionContext, GethNode) { let context = test_config(); let mut node = GethNode::new(&context); node.init(context.genesis_configuration.genesis().unwrap().clone()) diff --git a/crates/node/src/substrate.rs b/crates/node/src/substrate.rs index 6ee747f..22a996f 100644 --- a/crates/node/src/substrate.rs +++ b/crates/node/src/substrate.rs @@ -1300,13 +1300,13 @@ mod tests { use super::*; use crate::Node; - fn test_config() -> ExecutionContext { - let mut context = ExecutionContext::default(); + fn test_config() -> TestExecutionContext { + let mut context = TestExecutionContext::default(); context.kitchensink_configuration.use_kitchensink = true; context } - fn new_node() -> (ExecutionContext, SubstrateNode) { + fn new_node() -> (TestExecutionContext, SubstrateNode) { // Note: When we run the tests in the CI we found that if they're all // run in parallel then the CI is unable to start all of the nodes in // time and their start up times-out. Therefore, we want all of the @@ -1340,7 +1340,7 @@ mod tests { /// A shared node that multiple tests can use. It starts up once. fn shared_node() -> &'static SubstrateNode { - static NODE: LazyLock<(ExecutionContext, SubstrateNode)> = LazyLock::new(|| { + static NODE: LazyLock<(TestExecutionContext, SubstrateNode)> = LazyLock::new(|| { let (context, node) = new_node(); (context, node) }); diff --git a/crates/report/src/aggregator.rs b/crates/report/src/aggregator.rs index 280238d..b3a693d 100644 --- a/crates/report/src/aggregator.rs +++ b/crates/report/src/aggregator.rs @@ -466,7 +466,7 @@ pub enum TestCaseStatus { }, } -/// Information related to the leader or follower node that's being used to execute the step. +/// Information related to the platform node that's being used to execute the step. #[derive(Clone, Debug, Serialize)] pub struct TestCaseNodeInformation { /// The ID of the node that this case is being executed on. @@ -477,7 +477,7 @@ pub struct TestCaseNodeInformation { pub connection_string: String, } -/// Execution information tied to the leader or the follower. +/// Execution information tied to the platform. #[derive(Clone, Debug, Default, Serialize)] pub struct ExecutionInformation { /// Information related to the node assigned to this test case. diff --git a/crates/report/src/common.rs b/crates/report/src/common.rs index b653198..af08632 100644 --- a/crates/report/src/common.rs +++ b/crates/report/src/common.rs @@ -22,7 +22,7 @@ pub struct TestSpecifier { } /// An absolute path for a test that also includes information about the node that it's assigned to -/// and whether it's the leader or follower. +/// and what platform it belongs to. #[derive(Clone, Debug, PartialEq, Eq, Hash)] pub struct ExecutionSpecifier { pub test_specifier: Arc, diff --git a/crates/report/src/runner_event.rs b/crates/report/src/runner_event.rs index 4595212..361555c 100644 --- a/crates/report/src/runner_event.rs +++ b/crates/report/src/runner_event.rs @@ -434,7 +434,7 @@ macro_rules! define_event { } /// A reporter that's tied to a specific execution of the test case such as execution on - /// a specific node like the leader or follower. + /// a specific node from a specific platform. #[derive(Clone, Debug)] pub struct [< $ident ExecutionSpecificReporter >] { $vis reporter: [< $ident Reporter >], @@ -520,7 +520,7 @@ define_event! { /// A reason for the failure of the test. reason: String, }, - /// An event emitted when the test case is assigned a leader node. + /// An event emitted when the test case is assigned a platform node. NodeAssigned { /// A specifier for the test that the assignment is for. test_specifier: Arc,