diff --git a/crates/config/src/lib.rs b/crates/config/src/lib.rs index 344910a..0f965ca 100644 --- a/crates/config/src/lib.rs +++ b/crates/config/src/lib.rs @@ -143,6 +143,17 @@ impl AsRef for Context { } } +impl AsRef for Context { + fn as_ref(&self) -> &PolkadotOmniNodeConfiguration { + match self { + Self::Test(context) => context.as_ref().as_ref(), + Self::Benchmark(context) => context.as_ref().as_ref(), + Self::ExportGenesis(context) => context.as_ref().as_ref(), + Self::ExportJsonSchema => unreachable!(), + } + } +} + impl AsRef for Context { fn as_ref(&self) -> &EthRpcConfiguration { match self { @@ -277,6 +288,10 @@ pub struct TestExecutionContext { #[clap(flatten, next_help_heading = "Revive Dev Node Configuration")] pub revive_dev_node_configuration: ReviveDevNodeConfiguration, + /// Configuration parameters for the Polkadot Omnichain Node. + #[clap(flatten, next_help_heading = "Polkadot Omnichain Node Configuration")] + pub polkadot_omnichain_node_configuration: PolkadotOmniNodeConfiguration, + /// Configuration parameters for the Eth Rpc. #[clap(flatten, next_help_heading = "Eth RPC Configuration")] pub eth_rpc_configuration: EthRpcConfiguration, @@ -420,6 +435,10 @@ pub struct BenchmarkingContext { #[clap(flatten, next_help_heading = "Revive Dev Node Configuration")] pub revive_dev_node_configuration: ReviveDevNodeConfiguration, + /// Configuration parameters for the Polkadot Omnichain Node. + #[clap(flatten, next_help_heading = "Polkadot Omnichain Node Configuration")] + pub polkadot_omnichain_node_configuration: PolkadotOmniNodeConfiguration, + /// Configuration parameters for the Eth Rpc. #[clap(flatten, next_help_heading = "Eth RPC Configuration")] pub eth_rpc_configuration: EthRpcConfiguration, @@ -498,6 +517,10 @@ pub struct ExportGenesisContext { #[clap(flatten, next_help_heading = "Revive Dev Node Configuration")] pub revive_dev_node_configuration: ReviveDevNodeConfiguration, + /// Configuration parameters for the Polkadot Omnichain Node. + #[clap(flatten, next_help_heading = "Polkadot Omnichain Node Configuration")] + pub polkadot_omnichain_node_configuration: PolkadotOmniNodeConfiguration, + /// Configuration parameters for the wallet. #[clap(flatten, next_help_heading = "Wallet Configuration")] pub wallet_configuration: WalletConfiguration, @@ -557,6 +580,12 @@ impl AsRef for TestExecutionContext { } } +impl AsRef for TestExecutionContext { + fn as_ref(&self) -> &PolkadotOmniNodeConfiguration { + &self.polkadot_omnichain_node_configuration + } +} + impl AsRef for TestExecutionContext { fn as_ref(&self) -> &EthRpcConfiguration { &self.eth_rpc_configuration @@ -653,6 +682,12 @@ impl AsRef for BenchmarkingContext { } } +impl AsRef for BenchmarkingContext { + fn as_ref(&self) -> &PolkadotOmniNodeConfiguration { + &self.polkadot_omnichain_node_configuration + } +} + impl AsRef for BenchmarkingContext { fn as_ref(&self) -> &EthRpcConfiguration { &self.eth_rpc_configuration @@ -713,6 +748,12 @@ impl AsRef for ExportGenesisContext { } } +impl AsRef for ExportGenesisContext { + fn as_ref(&self) -> &PolkadotOmniNodeConfiguration { + &self.polkadot_omnichain_node_configuration + } +} + impl AsRef for ExportGenesisContext { fn as_ref(&self) -> &WalletConfiguration { &self.wallet_configuration @@ -869,6 +910,55 @@ pub struct ReviveDevNodeConfiguration { pub existing_rpc_url: Vec, } +/// A set of configuration parameters for the polkadot-omni-node. +#[derive(Clone, Debug, Parser, Serialize, Deserialize)] +pub struct PolkadotOmniNodeConfiguration { + /// Specifies the path of the polkadot-omni-node to be used by the tool. + /// + /// If this is not specified, then the tool assumes that it should use the polkadot-omni-node + /// binary that's provided in the user's $PATH. + #[clap( + id = "polkadot-omni-node.path", + long = "polkadot-omni-node.path", + default_value = "polkadot-omni-node" + )] + pub path: PathBuf, + + /// The amount of time to wait upon startup before considering that the node timed out. + #[clap( + id = "polkadot-omni-node.start-timeout-ms", + long = "polkadot-omni-node.start-timeout-ms", + default_value = "30000", + value_parser = parse_duration + )] + pub start_timeout_ms: Duration, + + /// Defines how often blocks will be sealed by the node in milliseconds. + #[clap( + id = "polkadot-omni-node.block-time-ms", + long = "polkadot-omni-node.block-time-ms", + default_value = "200", + value_parser = parse_duration + )] + pub block_time: Duration, + + /// The path of the WASM runtime to use for the polkadot-omni-node. This argument is required if + /// the polkadot-omni-node is one of the selected platforms for running the tests or benchmarks. + #[clap( + id = "polkadot-omni-node.runtime-wasm-path", + long = "polkadot-omni-node.runtime-wasm-path" + )] + pub runtime_wasm_path: Option, + + /// The ID of the parachain that the polkadot-omni-node will spawn. This argument is required if + /// the polkadot-omni-node is one of the selected platforms for running the tests or benchmarks. + #[clap( + id = "polkadot-omni-node.parachain-id", + long = "polkadot-omni-node.parachain-id" + )] + pub parachain_id: Option, +} + /// A set of configuration parameters for the ETH RPC. #[derive(Clone, Debug, Parser, Serialize, Deserialize)] pub struct EthRpcConfiguration {