From 4ed7abd1a197d57aa92e9c7ddaa6ad416a1b6443 Mon Sep 17 00:00:00 2001 From: Dan Cline <6798349+Rjected@users.noreply.github.com> Date: Wed, 19 Jul 2023 10:44:35 -0400 Subject: [PATCH] fix: use empty pipeline and executor by default (#3845) --- crates/consensus/beacon/src/engine/mod.rs | 33 +++++++++++++++++++---- 1 file changed, 28 insertions(+), 5 deletions(-) diff --git a/crates/consensus/beacon/src/engine/mod.rs b/crates/consensus/beacon/src/engine/mod.rs index 8be81f2bbd..aa894d180f 100644 --- a/crates/consensus/beacon/src/engine/mod.rs +++ b/crates/consensus/beacon/src/engine/mod.rs @@ -1821,25 +1821,33 @@ mod tests { } /// Represents either test pipeline outputs, or real pipeline configuration. - #[derive(Default)] enum TestPipelineConfig { /// Test pipeline outputs. Test(VecDeque>), /// Real pipeline configuration. - #[default] Real, } + impl Default for TestPipelineConfig { + fn default() -> Self { + Self::Test(VecDeque::new()) + } + } + /// Represents either test executor results, or real executor configuration. - #[derive(Default)] enum TestExecutorConfig { /// Test executor results. Test(Vec), /// Real executor configuration. - #[default] Real, } + impl Default for TestExecutorConfig { + fn default() -> Self { + Self::Test(Vec::new()) + } + } + /// A type that represents one of two possible executor factories. #[derive(Debug, Clone)] enum EitherExecutorFactory { @@ -1963,6 +1971,18 @@ mod tests { self } + /// Uses the real pipeline instead of a pipeline with empty exec outputs. + fn with_real_pipeline(mut self) -> Self { + self.pipeline_config = TestPipelineConfig::Real; + self + } + + /// Uses the real executor instead of a executor with empty results. + fn with_real_executor(mut self) -> Self { + self.executor_config = TestExecutorConfig::Real; + self + } + /// Sets the client to use for network operations. #[allow(dead_code)] fn with_client(mut self, client: Client) -> Self { @@ -2655,7 +2675,10 @@ mod tests { ); let (consensus_engine, env) = - TestConsensusEngineBuilder::::new(chain_spec.clone()).build(); + TestConsensusEngineBuilder::::new(chain_spec.clone()) + .with_real_pipeline() + .with_real_executor() + .build(); let genesis = SealedBlock { header: chain_spec.sealed_genesis_header(), ..Default::default() };