From ddc1b9c0d36ac1911e13b8ae461e622e45bd861c Mon Sep 17 00:00:00 2001 From: Omar Abdulla Date: Thu, 9 Oct 2025 04:58:42 +0300 Subject: [PATCH] Allow for the consensus to be specified for the revive dev node --- crates/config/src/lib.rs | 8 ++++++++ crates/core/src/lib.rs | 20 +++++++++++++------ .../src/node_implementations/substrate.rs | 13 +++++++++--- .../src/node_implementations/zombienet.rs | 4 ++++ 4 files changed, 36 insertions(+), 9 deletions(-) diff --git a/crates/config/src/lib.rs b/crates/config/src/lib.rs index 7e8814b..46b978c 100644 --- a/crates/config/src/lib.rs +++ b/crates/config/src/lib.rs @@ -680,6 +680,14 @@ pub struct ReviveDevNodeConfiguration { value_parser = parse_duration )] pub start_timeout_ms: Duration, + + /// The consensus to use for the spawned revive-dev-node. + #[clap( + id = "revive-dev-node.consensus", + long = "revive-dev-node.consensus", + default_value = "instant-seal" + )] + pub consensus: String, } /// A set of configuration parameters for the ETH RPC. diff --git a/crates/core/src/lib.rs b/crates/core/src/lib.rs index 2ac8caf..005d2ef 100644 --- a/crates/core/src/lib.rs +++ b/crates/core/src/lib.rs @@ -184,6 +184,7 @@ impl Platform for KitchensinkPolkavmResolcPlatform { let node = SubstrateNode::new( kitchensink_path, SubstrateNode::KITCHENSINK_EXPORT_CHAINSPEC_COMMAND, + None, context, ); let node = spawn_node(node, genesis)?; @@ -236,6 +237,7 @@ impl Platform for KitchensinkRevmSolcPlatform { let node = SubstrateNode::new( kitchensink_path, SubstrateNode::KITCHENSINK_EXPORT_CHAINSPEC_COMMAND, + None, context, ); let node = spawn_node(node, genesis)?; @@ -280,14 +282,17 @@ impl Platform for ReviveDevNodePolkavmResolcPlatform { context: Context, ) -> anyhow::Result>>> { let genesis_configuration = AsRef::::as_ref(&context); - let revive_dev_node_path = AsRef::::as_ref(&context) - .path - .clone(); + let revive_dev_node_configuration = AsRef::::as_ref(&context); + + let revive_dev_node_path = revive_dev_node_configuration.path.clone(); + let revive_dev_node_consensus = revive_dev_node_configuration.consensus.clone(); + let genesis = genesis_configuration.genesis()?.clone(); Ok(thread::spawn(move || { let node = SubstrateNode::new( revive_dev_node_path, SubstrateNode::REVIVE_DEV_NODE_EXPORT_CHAINSPEC_COMMAND, + Some(revive_dev_node_consensus), context, ); let node = spawn_node(node, genesis)?; @@ -332,14 +337,17 @@ impl Platform for ReviveDevNodeRevmSolcPlatform { context: Context, ) -> anyhow::Result>>> { let genesis_configuration = AsRef::::as_ref(&context); - let revive_dev_node_path = AsRef::::as_ref(&context) - .path - .clone(); + let revive_dev_node_configuration = AsRef::::as_ref(&context); + + let revive_dev_node_path = revive_dev_node_configuration.path.clone(); + let revive_dev_node_consensus = revive_dev_node_configuration.consensus.clone(); + let genesis = genesis_configuration.genesis()?.clone(); Ok(thread::spawn(move || { let node = SubstrateNode::new( revive_dev_node_path, SubstrateNode::REVIVE_DEV_NODE_EXPORT_CHAINSPEC_COMMAND, + Some(revive_dev_node_consensus), context, ); let node = spawn_node(node, genesis)?; diff --git a/crates/node/src/node_implementations/substrate.rs b/crates/node/src/node_implementations/substrate.rs index 8a4d99e..ccf1e75 100644 --- a/crates/node/src/node_implementations/substrate.rs +++ b/crates/node/src/node_implementations/substrate.rs @@ -81,6 +81,7 @@ pub struct SubstrateNode { wallet: Arc, nonce_manager: CachedNonceManager, provider: OnceCell>>, + consensus: Option, } impl SubstrateNode { @@ -103,6 +104,7 @@ impl SubstrateNode { pub fn new( node_path: PathBuf, export_chainspec_command: &str, + consensus: Option, context: impl AsRef + AsRef + AsRef, @@ -132,6 +134,7 @@ impl SubstrateNode { wallet: wallet.clone(), nonce_manager: Default::default(), provider: Default::default(), + consensus, } } @@ -229,7 +232,7 @@ impl SubstrateNode { self.logs_directory.as_path(), self.node_binary.as_path(), |command, stdout_file, stderr_file| { - command + let cmd = command .arg("--dev") .arg("--chain") .arg(chainspec_path) @@ -246,8 +249,6 @@ impl SubstrateNode { .arg("all") .arg("--rpc-max-connections") .arg(u32::MAX.to_string()) - .arg("--consensus") - .arg("manual-seal-12000") .arg("--pool-limit") .arg(u32::MAX.to_string()) .arg("--pool-kbytes") @@ -255,6 +256,9 @@ impl SubstrateNode { .env("RUST_LOG", Self::SUBSTRATE_LOG_ENV) .stdout(stdout_file) .stderr(stderr_file); + if let Some(consensus) = self.consensus.as_ref() { + cmd.arg("--consensus").arg(consensus.clone()); + } }, ProcessReadinessWaitBehavior::TimeBoundedWaitFunction { max_wait_duration: Duration::from_secs(30), @@ -1186,6 +1190,7 @@ mod tests { let mut node = SubstrateNode::new( context.kitchensink_configuration.path.clone(), SubstrateNode::KITCHENSINK_EXPORT_CHAINSPEC_COMMAND, + None, &context, ); node.init(context.genesis_configuration.genesis().unwrap().clone()) @@ -1251,6 +1256,7 @@ mod tests { let mut dummy_node = SubstrateNode::new( context.kitchensink_configuration.path.clone(), SubstrateNode::KITCHENSINK_EXPORT_CHAINSPEC_COMMAND, + None, &context, ); @@ -1303,6 +1309,7 @@ mod tests { let node = SubstrateNode::new( context.kitchensink_configuration.path.clone(), SubstrateNode::KITCHENSINK_EXPORT_CHAINSPEC_COMMAND, + None, &context, ); diff --git a/crates/node/src/node_implementations/zombienet.rs b/crates/node/src/node_implementations/zombienet.rs index 498e1ff..ecdc7b5 100644 --- a/crates/node/src/node_implementations/zombienet.rs +++ b/crates/node/src/node_implementations/zombienet.rs @@ -204,6 +204,10 @@ impl ZombienetNode { .with_name("Collator") .with_command(polkadot_parachain_path) .with_rpc_port(node_rpc_port) + .with_args(vec![ + ("--pool-limit", u32::MAX.to_string().as_str()).into(), + ("--pool-kbytes", u32::MAX.to_string().as_str()).into(), + ]) }) }) .build()