From 06a66f5b9d29060c80d3aa7ae12fb5ba5de1e282 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lech=20G=C5=82owiak?= Date: Wed, 18 Dec 2024 16:15:46 +0100 Subject: [PATCH] Cleanup unused kupo and pc-contracts-cli, query ogmios for network --- toolkit/partner-chains-cli/src/config.rs | 49 +------ .../partner-chains-cli/src/deregister/mod.rs | 6 +- .../src/deregister/tests.rs | 9 +- toolkit/partner-chains-cli/src/main.rs | 2 - .../partner-chains-cli/src/ogmios/config.rs | 82 ++++++++++++ toolkit/partner-chains-cli/src/ogmios/mod.rs | 115 ++++++++++++++++ .../src/pc_contracts_cli_resources.rs | 126 ------------------ .../prepare_cardano_params.rs | 117 ++-------------- .../prepare_chain_params.rs | 15 ++- .../prepare_main_chain_config.rs | 11 +- .../src/register/register1.rs | 96 ++++++------- .../src/register/register3.rs | 45 +++---- .../src/setup_main_chain_state/mod.rs | 2 +- .../src/setup_main_chain_state/tests.rs | 3 +- .../partner-chains-cli/src/smart_contracts.rs | 21 --- .../partner-chains-cli/src/start_node/mod.rs | 1 - 16 files changed, 287 insertions(+), 413 deletions(-) create mode 100644 toolkit/partner-chains-cli/src/ogmios/config.rs delete mode 100644 toolkit/partner-chains-cli/src/pc_contracts_cli_resources.rs delete mode 100644 toolkit/partner-chains-cli/src/smart_contracts.rs diff --git a/toolkit/partner-chains-cli/src/config.rs b/toolkit/partner-chains-cli/src/config.rs index 0eb4a6640..b821635f1 100644 --- a/toolkit/partner-chains-cli/src/config.rs +++ b/toolkit/partner-chains-cli/src/config.rs @@ -1,13 +1,11 @@ use crate::config::config_fields::{ CARDANO_ACTIVE_SLOTS_COEFF, CARDANO_EPOCH_DURATION_MILLIS, CARDANO_FIRST_EPOCH_NUMBER, - CARDANO_FIRST_EPOCH_TIMESTAMP_MILLIS, CARDANO_FIRST_SLOT_NUMBER, CARDANO_NETWORK, - CARDANO_SECURITY_PARAMETER, + CARDANO_FIRST_EPOCH_TIMESTAMP_MILLIS, CARDANO_FIRST_SLOT_NUMBER, CARDANO_SECURITY_PARAMETER, }; use crate::io::IOContext; -use anyhow::anyhow; use clap::{arg, Parser}; use serde::{de::DeserializeOwned, Deserialize, Serialize}; -use sidechain_domain::{NetworkType, UtxoId}; +use sidechain_domain::UtxoId; use sp_core::offchain::{Duration, Timestamp}; use std::fmt::{Display, Formatter}; use std::str::FromStr; @@ -275,12 +273,10 @@ pub struct CardanoParameters { pub first_slot_number: u64, pub epoch_duration_millis: u64, pub first_epoch_timestamp_millis: u64, - pub network: NetworkType, } impl CardanoParameters { pub fn save(&self, context: &impl IOContext) { - CARDANO_NETWORK.save_to_file(&self.network, context); CARDANO_SECURITY_PARAMETER.save_to_file(&self.security_parameter, context); CARDANO_ACTIVE_SLOTS_COEFF.save_to_file(&self.active_slots_coeff, context); CARDANO_FIRST_EPOCH_NUMBER.save_to_file(&self.first_epoch_number, context); @@ -299,7 +295,6 @@ impl CardanoParameters { epoch_duration_millis: CARDANO_EPOCH_DURATION_MILLIS.load_from_file(context)?, first_epoch_timestamp_millis: CARDANO_FIRST_EPOCH_TIMESTAMP_MILLIS .load_from_file(context)?, - network: CARDANO_NETWORK.load_from_file(context)?, }) } } @@ -364,12 +359,6 @@ pub fn load_chain_config(context: &impl IOContext) -> anyhow::Result anyhow::Result { - CARDANO_NETWORK.load_from_file(context).ok_or(anyhow!( - "Cardano network not configured. Please run prepare-main-chain-config command first." - )) -} - pub mod config_fields { use super::*; use sidechain_domain::UtxoId; @@ -446,15 +435,6 @@ pub mod config_fields { _marker: PhantomData, }; - pub const CARDANO_NETWORK: ConfigFieldDefinition<'static, NetworkType> = - ConfigFieldDefinition { - config_file: CHAIN_CONFIG_FILE_PATH, - path: &["cardano", "network"], - name: "cardano network", - default: None, - _marker: PhantomData, - }; - pub const GENESIS_UTXO: ConfigFieldDefinition<'static, UtxoId> = ConfigFieldDefinition { config_file: CHAIN_CONFIG_FILE_PATH, path: &["chain_parameters", "genesis_utxo"], @@ -491,31 +471,6 @@ pub mod config_fields { _marker: PhantomData, }; - pub const KUPO_PROTOCOL: ConfigFieldDefinition<'static, NetworkProtocol> = - ConfigFieldDefinition { - config_file: RESOURCES_CONFIG_FILE_PATH, - path: &["kupo", "protocol"], - name: "Kupo protocol (http/https)", - default: Some("http"), - _marker: PhantomData, - }; - - pub const KUPO_HOSTNAME: ConfigFieldDefinition<'static, String> = ConfigFieldDefinition { - config_file: RESOURCES_CONFIG_FILE_PATH, - path: &["kupo", "hostname"], - name: "Kupo hostname", - default: Some("localhost"), - _marker: PhantomData, - }; - - pub const KUPO_PORT: ConfigFieldDefinition<'static, u16> = ConfigFieldDefinition { - config_file: RESOURCES_CONFIG_FILE_PATH, - path: &["kupo", "port"], - name: "Kupo port", - default: Some("1442"), - _marker: PhantomData, - }; - pub const OGMIOS_PROTOCOL: ConfigFieldDefinition<'static, NetworkProtocol> = ConfigFieldDefinition { config_file: RESOURCES_CONFIG_FILE_PATH, diff --git a/toolkit/partner-chains-cli/src/deregister/mod.rs b/toolkit/partner-chains-cli/src/deregister/mod.rs index 95c319a09..76bb1c26f 100644 --- a/toolkit/partner-chains-cli/src/deregister/mod.rs +++ b/toolkit/partner-chains-cli/src/deregister/mod.rs @@ -7,7 +7,7 @@ use crate::config::config_fields::{ }; use crate::config::CHAIN_CONFIG_FILE_PATH; use crate::io::IOContext; -use crate::pc_contracts_cli_resources::establish_pc_contracts_cli_configuration; +use crate::ogmios::config::establish_ogmios_configuration; use crate::CmdRun; use anyhow::anyhow; use partner_chains_cardano_offchain::register::Deregister; @@ -30,8 +30,8 @@ impl CmdRun for DeregisterCmd { let cold_vkey_path = CARDANO_COLD_VERIFICATION_KEY_FILE.prompt_with_default_from_file_and_save(context); let stake_ownership_pub_key = get_mc_pubkey_from_file(&cold_vkey_path, context)?; - let pc_contracts_cli_resources = establish_pc_contracts_cli_configuration(context)?; - let offchain = context.offchain_impl(&pc_contracts_cli_resources.ogmios)?; + let ogmios_config = establish_ogmios_configuration(context)?; + let offchain = context.offchain_impl(&ogmios_config)?; let runtime = tokio::runtime::Runtime::new().map_err(|e| anyhow::anyhow!(e))?; runtime diff --git a/toolkit/partner-chains-cli/src/deregister/tests.rs b/toolkit/partner-chains-cli/src/deregister/tests.rs index 9441a45d1..87ace07c6 100644 --- a/toolkit/partner-chains-cli/src/deregister/tests.rs +++ b/toolkit/partner-chains-cli/src/deregister/tests.rs @@ -1,7 +1,8 @@ use crate::config::{CHAIN_CONFIG_FILE_PATH, RESOURCES_CONFIG_FILE_PATH}; use crate::deregister::DeregisterCmd; -use crate::pc_contracts_cli_resources::tests::establish_pc_contracts_cli_configuration_io; -use crate::pc_contracts_cli_resources::PcContractsCliResources; +use crate::ogmios::config::tests::{ + default_ogmios_service_config, establish_ogmios_configuration_io, +}; use crate::tests::{MockIO, MockIOContext, OffchainMock, OffchainMocks}; use crate::CmdRun; use hex_literal::hex; @@ -32,7 +33,7 @@ fn happy_path() { MockIO::file_read(CHAIN_CONFIG_FILE_PATH), print_info_io(), read_keys_io(), - establish_pc_contracts_cli_configuration_io(None, PcContractsCliResources::default()), + establish_ogmios_configuration_io(None, default_ogmios_service_config()), ]); let result = DeregisterCmd.run(&mock_context); assert!(result.is_ok()); @@ -56,7 +57,7 @@ fn errors_if_smart_contracts_dont_output_transaction_id() { MockIO::file_read(CHAIN_CONFIG_FILE_PATH), print_info_io(), read_keys_io(), - establish_pc_contracts_cli_configuration_io(None, PcContractsCliResources::default()), + establish_ogmios_configuration_io(None, default_ogmios_service_config()), ]); let result = DeregisterCmd.run(&mock_context); assert_eq!( diff --git a/toolkit/partner-chains-cli/src/main.rs b/toolkit/partner-chains-cli/src/main.rs index 0d8490a44..7480c54cb 100644 --- a/toolkit/partner-chains-cli/src/main.rs +++ b/toolkit/partner-chains-cli/src/main.rs @@ -10,13 +10,11 @@ pub mod io; pub mod keystore; pub(crate) mod main_chain_follower; pub(crate) mod ogmios; -pub(crate) mod pc_contracts_cli_resources; pub(crate) mod permissioned_candidates; mod prepare_configuration; pub mod register; pub(crate) mod select_utxo; mod setup_main_chain_state; -pub(crate) mod smart_contracts; pub mod start_node; #[cfg(test)] diff --git a/toolkit/partner-chains-cli/src/ogmios/config.rs b/toolkit/partner-chains-cli/src/ogmios/config.rs new file mode 100644 index 000000000..0fabaff25 --- /dev/null +++ b/toolkit/partner-chains-cli/src/ogmios/config.rs @@ -0,0 +1,82 @@ +use crate::config::config_fields::*; +use crate::config::ServiceConfig; +use crate::io::IOContext; + +pub(crate) const OGMIOS_REQUIRED: &str = + "Partner Chains Smart Contracts require access to Ogmios. Please provide its configuration."; + +pub(crate) fn establish_ogmios_configuration( + context: &C, +) -> anyhow::Result { + context.print(OGMIOS_REQUIRED); + prompt_ogmios_configuration(context) +} + +pub(crate) fn prompt_ogmios_configuration( + context: &C, +) -> anyhow::Result { + let ogmios_protocol = OGMIOS_PROTOCOL + .select_options_with_default_from_file_and_save(OGMIOS_PROTOCOL.name, context) + .map_err(anyhow::Error::msg)?; + let ogmios_hostname = OGMIOS_HOSTNAME.prompt_with_default_from_file_and_save(context); + let ogmios_port = OGMIOS_PORT.prompt_with_default_from_file_parse_and_save(context)?; + Ok(ServiceConfig { protocol: ogmios_protocol, hostname: ogmios_hostname, port: ogmios_port }) +} + +#[cfg(test)] +pub(crate) mod tests { + use super::*; + use crate::config::NetworkProtocol; + use crate::prepare_configuration::tests::{ + prompt_multi_option_with_default_and_save_to_existing_file, + prompt_with_default_and_save_to_existing_file, + }; + use crate::tests::MockIO; + use std::str::FromStr; + + pub(crate) fn default_ogmios_service_config() -> ServiceConfig { + ServiceConfig { + protocol: OGMIOS_PROTOCOL + .default + .and_then(|p| NetworkProtocol::from_str(p).ok()) + .unwrap_or(NetworkProtocol::Http), + hostname: OGMIOS_HOSTNAME.default.unwrap_or("localhost").to_string(), + port: OGMIOS_PORT.default.unwrap_or("1337").parse().unwrap(), + } + } + + /// Assumption for this function is that resources config file exists, so tests context should have it. + pub(crate) fn establish_ogmios_configuration_io( + existing_config: Option, + config_to_set: ServiceConfig, + ) -> MockIO { + let default_config = existing_config.unwrap_or(default_ogmios_service_config()); + MockIO::Group(vec![ + MockIO::print(OGMIOS_REQUIRED), + prompt_ogmios_configuration_io(&default_config, &config_to_set), + ]) + } + + pub(crate) fn prompt_ogmios_configuration_io( + default_config: &ServiceConfig, + config_to_set: &ServiceConfig, + ) -> MockIO { + MockIO::Group(vec![ + prompt_multi_option_with_default_and_save_to_existing_file( + OGMIOS_PROTOCOL, + Some(&default_config.protocol.to_string()), + &config_to_set.protocol.to_string(), + ), + prompt_with_default_and_save_to_existing_file( + OGMIOS_HOSTNAME, + Some(&default_config.hostname), + &config_to_set.hostname, + ), + prompt_with_default_and_save_to_existing_file( + OGMIOS_PORT, + Some(&default_config.port.to_string()), + &config_to_set.port.to_string(), + ), + ]) + } +} diff --git a/toolkit/partner-chains-cli/src/ogmios/mod.rs b/toolkit/partner-chains-cli/src/ogmios/mod.rs index bc5959c46..864e4857a 100644 --- a/toolkit/partner-chains-cli/src/ogmios/mod.rs +++ b/toolkit/partner-chains-cli/src/ogmios/mod.rs @@ -1,3 +1,4 @@ +use crate::IOContext; use anyhow::anyhow; use jsonrpsee::http_client::HttpClient; use ogmios_client::{ @@ -5,6 +6,8 @@ use ogmios_client::{ }; use sidechain_domain::NetworkType; +pub(crate) mod config; + #[derive(Debug, Eq, PartialEq)] pub enum OgmiosRequest { QueryLedgerStateEraSummaries, @@ -139,3 +142,115 @@ impl TryFrom }) } } + +pub(crate) fn get_shelley_config( + addr: &str, + context: &C, +) -> anyhow::Result { + let response = context.ogmios_rpc(addr, OgmiosRequest::QueryNetworkShelleyGenesis)?; + match response { + OgmiosResponse::QueryNetworkShelleyGenesis(shelley_config) => Ok(shelley_config), + other => Err(anyhow::anyhow!(format!("Unexpected response from Ogmios when quering for shelley genesis configuration: {other:?}"))), + } +} + +#[cfg(test)] +pub(crate) mod test_values { + use crate::ogmios::EpochParameters; + + use super::ShelleyGenesisConfiguration; + use super::{EpochBoundary, EraSummary}; + use sidechain_domain::NetworkType; + + pub(crate) fn preprod_eras_summaries() -> Vec { + vec![ + EraSummary { + start: EpochBoundary { time_seconds: 0, slot: 0, epoch: 0 }, + parameters: EpochParameters { epoch_length: 21600, slot_length_millis: 20000 }, + }, + EraSummary { + start: EpochBoundary { time_seconds: 1728000, slot: 86400, epoch: 4 }, + parameters: EpochParameters { epoch_length: 432000, slot_length_millis: 1000 }, + }, + EraSummary { + start: EpochBoundary { time_seconds: 2160000, slot: 518400, epoch: 5 }, + parameters: EpochParameters { epoch_length: 432000, slot_length_millis: 1000 }, + }, + EraSummary { + start: EpochBoundary { time_seconds: 2592000, slot: 950400, epoch: 6 }, + parameters: EpochParameters { epoch_length: 432000, slot_length_millis: 1000 }, + }, + EraSummary { + start: EpochBoundary { time_seconds: 3024000, slot: 1382400, epoch: 7 }, + parameters: EpochParameters { epoch_length: 432000, slot_length_millis: 1000 }, + }, + EraSummary { + start: EpochBoundary { time_seconds: 5184000, slot: 3542400, epoch: 12 }, + parameters: EpochParameters { epoch_length: 432000, slot_length_millis: 1000 }, + }, + EraSummary { + start: EpochBoundary { time_seconds: 5184000, slot: 3542400, epoch: 12 }, + parameters: EpochParameters { epoch_length: 432000, slot_length_millis: 1000 }, + }, + EraSummary { + start: EpochBoundary { time_seconds: 70416000, slot: 68774400, epoch: 163 }, + parameters: EpochParameters { epoch_length: 432000, slot_length_millis: 1000 }, + }, + ] + } + + pub(crate) fn preprod_shelley_config() -> ShelleyGenesisConfiguration { + ShelleyGenesisConfiguration { + security_parameter: 2160, + active_slots_coefficient: 0.05, + epoch_length: 432000, + slot_length_millis: 1000, + start_time: 1654041600, + network: NetworkType::Testnet, + } + } + + pub(crate) fn preview_eras_summaries() -> Vec { + vec![ + EraSummary { + start: EpochBoundary { time_seconds: 0, slot: 0, epoch: 0 }, + parameters: EpochParameters { epoch_length: 4320, slot_length_millis: 20000 }, + }, + EraSummary { + start: EpochBoundary { time_seconds: 0, slot: 0, epoch: 0 }, + parameters: EpochParameters { epoch_length: 86400, slot_length_millis: 1000 }, + }, + EraSummary { + start: EpochBoundary { time_seconds: 0, slot: 0, epoch: 0 }, + parameters: EpochParameters { epoch_length: 86400, slot_length_millis: 1000 }, + }, + EraSummary { + start: EpochBoundary { time_seconds: 0, slot: 0, epoch: 0 }, + parameters: EpochParameters { epoch_length: 86400, slot_length_millis: 1000 }, + }, + EraSummary { + start: EpochBoundary { time_seconds: 0, slot: 0, epoch: 0 }, + parameters: EpochParameters { epoch_length: 86400, slot_length_millis: 1000 }, + }, + EraSummary { + start: EpochBoundary { time_seconds: 259200, slot: 259200, epoch: 3 }, + parameters: EpochParameters { epoch_length: 86400, slot_length_millis: 1000 }, + }, + EraSummary { + start: EpochBoundary { time_seconds: 55814400, slot: 55814400, epoch: 646 }, + parameters: EpochParameters { epoch_length: 86400, slot_length_millis: 1000 }, + }, + ] + } + + pub(crate) fn preview_shelley_config() -> ShelleyGenesisConfiguration { + ShelleyGenesisConfiguration { + security_parameter: 432, + active_slots_coefficient: 0.05, + epoch_length: 86400, + slot_length_millis: 1000, + start_time: 1666656000, + network: NetworkType::Testnet, + } + } +} diff --git a/toolkit/partner-chains-cli/src/pc_contracts_cli_resources.rs b/toolkit/partner-chains-cli/src/pc_contracts_cli_resources.rs deleted file mode 100644 index b8408a22d..000000000 --- a/toolkit/partner-chains-cli/src/pc_contracts_cli_resources.rs +++ /dev/null @@ -1,126 +0,0 @@ -use crate::config::config_fields::*; -use crate::config::{NetworkProtocol, ServiceConfig}; -use crate::io::IOContext; -use std::str::FromStr; - -#[derive(Debug, Clone)] -pub(crate) struct PcContractsCliResources { - pub(crate) kupo: ServiceConfig, - pub(crate) ogmios: ServiceConfig, -} - -impl Default for PcContractsCliResources { - fn default() -> Self { - Self { - kupo: ServiceConfig { - protocol: KUPO_PROTOCOL - .default - .and_then(|p| NetworkProtocol::from_str(p).ok()) - .unwrap_or(NetworkProtocol::Http), - hostname: KUPO_HOSTNAME.default.unwrap_or("localhost").to_string(), - port: KUPO_PORT.default.unwrap_or("1442").parse().unwrap(), - }, - ogmios: default_ogmios_service_config(), - } - } -} - -pub(crate) fn default_ogmios_service_config() -> ServiceConfig { - ServiceConfig { - protocol: OGMIOS_PROTOCOL - .default - .and_then(|p| NetworkProtocol::from_str(p).ok()) - .unwrap_or(NetworkProtocol::Http), - hostname: OGMIOS_HOSTNAME.default.unwrap_or("localhost").to_string(), - port: OGMIOS_PORT.default.unwrap_or("1337").parse().unwrap(), - } -} - -pub(crate) const KUPO_AND_OGMIOS_REQUIRED: &str = "Partner Chains Smart Contracts require access to Kupo and Ogmios. Please provide their configuration."; - -pub(crate) fn establish_pc_contracts_cli_configuration( - context: &C, -) -> anyhow::Result { - context.print(KUPO_AND_OGMIOS_REQUIRED); - let kupo_protocol = KUPO_PROTOCOL - .select_options_with_default_from_file_and_save(KUPO_PROTOCOL.name, context) - .map_err(anyhow::Error::msg)?; - let kupo_hostname = KUPO_HOSTNAME.prompt_with_default_from_file_and_save(context); - let kupo_port = KUPO_PORT.prompt_with_default_from_file_parse_and_save(context)?; - let ogmios = prompt_ogmios_configuration(context)?; - Ok(PcContractsCliResources { - kupo: ServiceConfig { protocol: kupo_protocol, hostname: kupo_hostname, port: kupo_port }, - ogmios, - }) -} - -pub(crate) fn prompt_ogmios_configuration( - context: &C, -) -> anyhow::Result { - let ogmios_protocol = OGMIOS_PROTOCOL - .select_options_with_default_from_file_and_save(OGMIOS_PROTOCOL.name, context) - .map_err(anyhow::Error::msg)?; - let ogmios_hostname = OGMIOS_HOSTNAME.prompt_with_default_from_file_and_save(context); - let ogmios_port = OGMIOS_PORT.prompt_with_default_from_file_parse_and_save(context)?; - Ok(ServiceConfig { protocol: ogmios_protocol, hostname: ogmios_hostname, port: ogmios_port }) -} - -#[cfg(test)] -pub(crate) mod tests { - use crate::pc_contracts_cli_resources::*; - use crate::prepare_configuration::tests::{ - prompt_multi_option_with_default_and_save_to_existing_file, - prompt_with_default_and_save_to_existing_file, - }; - use crate::tests::MockIO; - - /// Assumption for this function is that resources config file exists, so tests context should have it. - pub(crate) fn establish_pc_contracts_cli_configuration_io( - existing_config: Option, - config_to_set: PcContractsCliResources, - ) -> MockIO { - let default_config = existing_config.unwrap_or_default(); - MockIO::Group(vec![ - MockIO::print(KUPO_AND_OGMIOS_REQUIRED), - prompt_multi_option_with_default_and_save_to_existing_file( - KUPO_PROTOCOL, - Some(&default_config.kupo.protocol.to_string()), - &config_to_set.kupo.protocol.to_string(), - ), - prompt_with_default_and_save_to_existing_file( - KUPO_HOSTNAME, - Some(&default_config.kupo.hostname), - &config_to_set.kupo.hostname, - ), - prompt_with_default_and_save_to_existing_file( - KUPO_PORT, - Some(&default_config.kupo.port.to_string()), - &config_to_set.kupo.port.to_string(), - ), - prompt_ogmios_configuration_io(&default_config.ogmios, &config_to_set.ogmios), - ]) - } - - pub(crate) fn prompt_ogmios_configuration_io( - default_config: &ServiceConfig, - config_to_set: &ServiceConfig, - ) -> MockIO { - MockIO::Group(vec![ - prompt_multi_option_with_default_and_save_to_existing_file( - OGMIOS_PROTOCOL, - Some(&default_config.protocol.to_string()), - &config_to_set.protocol.to_string(), - ), - prompt_with_default_and_save_to_existing_file( - OGMIOS_HOSTNAME, - Some(&default_config.hostname), - &config_to_set.hostname, - ), - prompt_with_default_and_save_to_existing_file( - OGMIOS_PORT, - Some(&default_config.port.to_string()), - &config_to_set.port.to_string(), - ), - ]) - } -} diff --git a/toolkit/partner-chains-cli/src/prepare_configuration/prepare_cardano_params.rs b/toolkit/partner-chains-cli/src/prepare_configuration/prepare_cardano_params.rs index 64101ce2b..196533d2b 100644 --- a/toolkit/partner-chains-cli/src/prepare_configuration/prepare_cardano_params.rs +++ b/toolkit/partner-chains-cli/src/prepare_configuration/prepare_cardano_params.rs @@ -1,6 +1,8 @@ use crate::config::{CardanoParameters, ServiceConfig}; use crate::io::IOContext; -use crate::ogmios::{EraSummary, OgmiosRequest, OgmiosResponse, ShelleyGenesisConfiguration}; +use crate::ogmios::{ + get_shelley_config, EraSummary, OgmiosRequest, OgmiosResponse, ShelleyGenesisConfiguration, +}; pub fn prepare_cardano_params( ogmios_config: &ServiceConfig, @@ -22,17 +24,6 @@ fn get_eras_summaries(addr: &str, context: &C) -> anyhow::Result( - addr: &str, - context: &C, -) -> anyhow::Result { - let response = context.ogmios_rpc(addr, OgmiosRequest::QueryNetworkShelleyGenesis)?; - match response { - OgmiosResponse::QueryNetworkShelleyGenesis(shelley_config) => Ok(shelley_config), - other => Err(anyhow::anyhow!(format!("Unexpected response from Ogmios when quering for shelley genesis configuration: {other:?}"))), - } -} - fn caradano_parameters( eras_summaries: Vec, shelley_config: ShelleyGenesisConfiguration, @@ -51,7 +42,6 @@ fn caradano_parameters( .checked_add(first_epoch_era.start.time_seconds) .and_then(|seconds| seconds.checked_mul(1000)) .ok_or_else(|| anyhow::anyhow!("First epoch timestamp overflow"))?, - network: shelley_config.network, }) } @@ -78,11 +68,14 @@ fn get_first_epoch_era(eras_summaries: Vec) -> Result Vec { - vec![ - EraSummary { - start: EpochBoundary { time_seconds: 0, slot: 0, epoch: 0 }, - parameters: EpochParameters { epoch_length: 21600, slot_length_millis: 20000 }, - }, - EraSummary { - start: EpochBoundary { time_seconds: 1728000, slot: 86400, epoch: 4 }, - parameters: EpochParameters { epoch_length: 432000, slot_length_millis: 1000 }, - }, - EraSummary { - start: EpochBoundary { time_seconds: 2160000, slot: 518400, epoch: 5 }, - parameters: EpochParameters { epoch_length: 432000, slot_length_millis: 1000 }, - }, - EraSummary { - start: EpochBoundary { time_seconds: 2592000, slot: 950400, epoch: 6 }, - parameters: EpochParameters { epoch_length: 432000, slot_length_millis: 1000 }, - }, - EraSummary { - start: EpochBoundary { time_seconds: 3024000, slot: 1382400, epoch: 7 }, - parameters: EpochParameters { epoch_length: 432000, slot_length_millis: 1000 }, - }, - EraSummary { - start: EpochBoundary { time_seconds: 5184000, slot: 3542400, epoch: 12 }, - parameters: EpochParameters { epoch_length: 432000, slot_length_millis: 1000 }, - }, - EraSummary { - start: EpochBoundary { time_seconds: 5184000, slot: 3542400, epoch: 12 }, - parameters: EpochParameters { epoch_length: 432000, slot_length_millis: 1000 }, - }, - EraSummary { - start: EpochBoundary { time_seconds: 70416000, slot: 68774400, epoch: 163 }, - parameters: EpochParameters { epoch_length: 432000, slot_length_millis: 1000 }, - }, - ] - } - - pub(crate) fn preprod_shelley_config() -> ShelleyGenesisConfiguration { - ShelleyGenesisConfiguration { - network: NetworkType::Testnet, - security_parameter: 2160, - active_slots_coefficient: 0.05, - epoch_length: 432000, - slot_length_millis: 1000, - start_time: 1654041600, - } - } - - pub(crate) fn preview_eras_summaries() -> Vec { - vec![ - EraSummary { - start: EpochBoundary { time_seconds: 0, slot: 0, epoch: 0 }, - parameters: EpochParameters { epoch_length: 4320, slot_length_millis: 20000 }, - }, - EraSummary { - start: EpochBoundary { time_seconds: 0, slot: 0, epoch: 0 }, - parameters: EpochParameters { epoch_length: 86400, slot_length_millis: 1000 }, - }, - EraSummary { - start: EpochBoundary { time_seconds: 0, slot: 0, epoch: 0 }, - parameters: EpochParameters { epoch_length: 86400, slot_length_millis: 1000 }, - }, - EraSummary { - start: EpochBoundary { time_seconds: 0, slot: 0, epoch: 0 }, - parameters: EpochParameters { epoch_length: 86400, slot_length_millis: 1000 }, - }, - EraSummary { - start: EpochBoundary { time_seconds: 0, slot: 0, epoch: 0 }, - parameters: EpochParameters { epoch_length: 86400, slot_length_millis: 1000 }, - }, - EraSummary { - start: EpochBoundary { time_seconds: 259200, slot: 259200, epoch: 3 }, - parameters: EpochParameters { epoch_length: 86400, slot_length_millis: 1000 }, - }, - EraSummary { - start: EpochBoundary { time_seconds: 55814400, slot: 55814400, epoch: 646 }, - parameters: EpochParameters { epoch_length: 86400, slot_length_millis: 1000 }, - }, - ] - } - - pub(crate) fn preview_shelley_config() -> ShelleyGenesisConfiguration { - ShelleyGenesisConfiguration { - network: NetworkType::Testnet, - security_parameter: 432, - active_slots_coefficient: 0.05, - epoch_length: 86400, - slot_length_millis: 1000, - start_time: 1666656000, - } - } } diff --git a/toolkit/partner-chains-cli/src/prepare_configuration/prepare_chain_params.rs b/toolkit/partner-chains-cli/src/prepare_configuration/prepare_chain_params.rs index 6a7352623..a5027fac3 100644 --- a/toolkit/partner-chains-cli/src/prepare_configuration/prepare_chain_params.rs +++ b/toolkit/partner-chains-cli/src/prepare_configuration/prepare_chain_params.rs @@ -1,18 +1,18 @@ +use crate::cardano_key; use crate::config::config_fields::{self, GENESIS_UTXO}; use crate::config::{ConfigFieldDefinition, ServiceConfig}; use crate::io::IOContext; +use crate::ogmios::config::prompt_ogmios_configuration; +use crate::ogmios::get_shelley_config; use crate::select_utxo::{query_utxos, select_from_utxos}; -use crate::{cardano_key, pc_contracts_cli_resources}; use anyhow::anyhow; use partner_chains_cardano_offchain::csl::NetworkTypeExt; use serde::de::DeserializeOwned; use sidechain_domain::{NetworkType, UtxoId}; -use super::prepare_cardano_params::get_shelley_config; - pub fn prepare_chain_params(context: &C) -> anyhow::Result<(UtxoId, ServiceConfig)> { context.eprint(INTRO); - let ogmios_configuration = pc_contracts_cli_resources::prompt_ogmios_configuration(context)?; + let ogmios_configuration = prompt_ogmios_configuration(context)?; let shelley_config = get_shelley_config(&ogmios_configuration.to_string(), context)?; let address = derive_address(context, shelley_config.network)?; let utxo_query_result = query_utxos(context, &ogmios_configuration, &address)?; @@ -62,10 +62,11 @@ const CAUTION: &str = mod tests { use crate::config::config_fields::GENESIS_UTXO; use crate::config::RESOURCES_CONFIG_FILE_PATH; + use crate::ogmios::config::tests::{ + default_ogmios_service_config, prompt_ogmios_configuration_io, + }; + use crate::ogmios::test_values::preview_shelley_config; use crate::ogmios::{OgmiosRequest, OgmiosResponse}; - use crate::pc_contracts_cli_resources::default_ogmios_service_config; - use crate::pc_contracts_cli_resources::tests::prompt_ogmios_configuration_io; - use crate::prepare_configuration::prepare_cardano_params::tests::preview_shelley_config; use crate::prepare_configuration::prepare_chain_params::{ prepare_chain_params, CAUTION, INTRO, }; diff --git a/toolkit/partner-chains-cli/src/prepare_configuration/prepare_main_chain_config.rs b/toolkit/partner-chains-cli/src/prepare_configuration/prepare_main_chain_config.rs index b8d87f7b9..e677d9dea 100644 --- a/toolkit/partner-chains-cli/src/prepare_configuration/prepare_main_chain_config.rs +++ b/toolkit/partner-chains-cli/src/prepare_configuration/prepare_main_chain_config.rs @@ -119,16 +119,15 @@ After setting up the permissioned candidates, execute the 'create-chain-spec' co #[cfg(test)] mod tests { use super::*; - use crate::config::config_fields::{GENESIS_UTXO, KUPO_PROTOCOL, OGMIOS_PROTOCOL}; + use crate::config::config_fields::{GENESIS_UTXO, OGMIOS_PROTOCOL}; use crate::config::NetworkProtocol; use crate::ogmios::{OgmiosRequest, OgmiosResponse}; - use crate::prepare_configuration::prepare_cardano_params::tests::{ - preprod_eras_summaries, preprod_shelley_config, PREPROD_CARDANO_PARAMS, - }; + use crate::prepare_configuration::prepare_cardano_params::tests::PREPROD_CARDANO_PARAMS; use crate::prepare_configuration::tests::save_to_existing_file; use crate::tests::{MockIO, MockIOContext, OffchainMock, OffchainMocks}; use config_fields::CARDANO_PAYMENT_SIGNING_KEY_FILE; use hex_literal::hex; + use ogmios::test_values::{preprod_eras_summaries, preprod_shelley_config}; use ogmios_client::types::OgmiosTx; use partner_chains_cardano_offchain::scripts_data::{Addresses, PolicyIds, ScriptsData}; use serde_json::json; @@ -161,7 +160,6 @@ mod tests { pub fn save_cardano_params() -> MockIO { MockIO::Group(vec![ - save_to_existing_file(CARDANO_NETWORK, &PREPROD_CARDANO_PARAMS.network.to_string()), save_to_existing_file( CARDANO_SECURITY_PARAMETER, &PREPROD_CARDANO_PARAMS.security_parameter.to_string(), @@ -305,7 +303,7 @@ mod tests { }), ) .with_json_file("payment.skey", payment_key_content()) - .with_json_file(KUPO_PROTOCOL.config_file, serde_json::json!({})) + .with_json_file(OGMIOS_PROTOCOL.config_file, serde_json::json!({})) .with_offchain_mocks(preprod_offchain_mocks()) .with_expected_io(vec![ MockIO::ogmios_request( @@ -409,7 +407,6 @@ mod tests { fn test_chain_config() -> Value { serde_json::json!({ "cardano": { - "network": "testnet", "security_parameter": PREPROD_CARDANO_PARAMS.security_parameter, "active_slots_coeff": PREPROD_CARDANO_PARAMS.active_slots_coeff, "first_epoch_number": PREPROD_CARDANO_PARAMS.first_epoch_number, diff --git a/toolkit/partner-chains-cli/src/register/register1.rs b/toolkit/partner-chains-cli/src/register/register1.rs index d60374a99..924a46a1e 100644 --- a/toolkit/partner-chains-cli/src/register/register1.rs +++ b/toolkit/partner-chains-cli/src/register/register1.rs @@ -7,6 +7,8 @@ use crate::{config::config_fields, *}; use anyhow::anyhow; use cli_commands::registration_signatures::RegisterValidatorMessage; use cli_commands::signing::sc_public_key_and_signature_for_datum; +use ogmios::config::prompt_ogmios_configuration; +use ogmios::get_shelley_config; use partner_chains_cardano_offchain::csl::NetworkTypeExt; use select_utxo::{query_utxos, select_from_utxos}; use serde::de::DeserializeOwned; @@ -22,10 +24,6 @@ impl CmdRun for Register1Cmd { fn run(&self, context: &C) -> anyhow::Result<()> { context.print("⚙️ Registering as a committee candidate (step 1/3)"); let genesis_utxo = load_chain_config_field(context, &config_fields::GENESIS_UTXO)?; - let cardano_network = config_fields::CARDANO_NETWORK.load_from_file(context).ok_or_else(|| { - context.eprint("⚠️ Cardano network is not specified in the chain configuration file `partner-chains-cli-chain-config.json`"); - anyhow!("failed to read cardano network") - })?; let node_data_base_path = config_fields::SUBSTRATE_NODE_DATA_BASE_PATH .load_from_file(context) @@ -40,9 +38,10 @@ impl CmdRun for Register1Cmd { })?; context.print("This wizard will query your UTXOs using address derived from the payment verification key and Ogmios service"); - let address = derive_address(context, cardano_network)?; - let ogmios_configuration = - pc_contracts_cli_resources::prompt_ogmios_configuration(context)?; + let ogmios_configuration = prompt_ogmios_configuration(context)?; + let shelley_genesis_config = + get_shelley_config(&format!("{ogmios_configuration}"), context)?; + let address = derive_address(context, shelley_genesis_config.network)?; let utxo_query_result = query_utxos(context, &ogmios_configuration, &address)?; if utxo_query_result.is_empty() { @@ -162,9 +161,11 @@ fn derive_address( mod tests { use super::*; use crate::tests::{MockIO, MockIOContext}; - use ogmios::OgmiosRequest; - use pc_contracts_cli_resources::default_ogmios_service_config; - use pc_contracts_cli_resources::tests::prompt_ogmios_configuration_io; + use ogmios::{ + config::tests::{default_ogmios_service_config, prompt_ogmios_configuration_io}, + test_values::preview_shelley_config, + OgmiosRequest, + }; use select_utxo::tests::{mock_7_valid_utxos_rows, mock_result_7_valid}; const PAYMENT_VKEY_PATH: &str = "payment.vkey"; @@ -261,35 +262,6 @@ mod tests { assert!(result.is_ok()); } - #[test] - fn fail_if_cardano_network_is_not_specified() { - let chain_config_without_cardano_network: serde_json::Value = serde_json::json!({ - "chain_parameters": { - "genesis_utxo": "0000000000000000000000000000000000000000000000000000000000000001#0", - }, - }); - - let mock_context = MockIOContext::new() - .with_json_file(CHAIN_CONFIG_PATH, chain_config_without_cardano_network) - .with_json_file(RESOURCE_CONFIG_PATH, resource_config_content()) - .with_json_file(KEYS_FILE_PATH, generated_keys_file_content()) - .with_expected_io( - vec![ - intro_msg_io(), - read_chain_config_io(), - vec![ - MockIO::eprint("⚠️ Cardano network is not specified in the chain configuration file `partner-chains-cli-chain-config.json`"), - ] - ] - .into_iter() - .flatten() - .collect::>(), - ); - - let result = Register1Cmd {}.run(&mock_context); - assert!(result.is_err()); - } - #[test] fn report_error_if_payment_file_is_invalid() { let mock_context = MockIOContext::new() @@ -329,11 +301,9 @@ mod tests { intro_msg_io(), read_chain_config_io(), read_resource_config_io(), + derive_address_io(), vec![ - address_and_utxo_msg_io(), - prompt_cardano_payment_verification_key_file_io(), - read_payment_verification_key_file_io(), - prompt_ogmios_configuration_io(&default_ogmios_service_config(), &default_ogmios_service_config()), + MockIO::print("⚙️ Querying UTXOs of addr_test1vqezxrh24ts0775hulcg3ejcwj7hns8792vnn8met6z9gwsxt87zy from Ogmios at http://localhost:1337..."), MockIO::ogmios_request( "http://localhost:1337", @@ -483,7 +453,6 @@ mod tests { fn read_chain_config_io() -> Vec { vec![ MockIO::file_read(CHAIN_CONFIG_PATH), // genesis utxo - MockIO::file_read(CHAIN_CONFIG_PATH), // cardano network ] } @@ -500,6 +469,14 @@ mod tests { ]) } + fn ogmios_network_request_io() -> MockIO { + MockIO::ogmios_request( + "http://localhost:1337", + OgmiosRequest::QueryNetworkShelleyGenesis, + Ok(ogmios::OgmiosResponse::QueryNetworkShelleyGenesis(preview_shelley_config())), + ) + } + fn prompt_cardano_payment_verification_key_file_io() -> MockIO { MockIO::Group(vec![ MockIO::file_read(RESOURCE_CONFIG_PATH), @@ -511,7 +488,15 @@ mod tests { MockIO::file_read(RESOURCE_CONFIG_PATH), MockIO::file_write_json( RESOURCE_CONFIG_PATH, - serde_json::json!({"substrate_node_base_path": "/path/to/data", "cardano_payment_verification_key_file": PAYMENT_VKEY_PATH}), + serde_json::json!({ + "substrate_node_base_path": "/path/to/data", + "cardano_payment_verification_key_file": PAYMENT_VKEY_PATH, + "ogmios": { + "hostname": "localhost", + "port": 1337, + "protocol": "http" + } + }), ), ]) } @@ -523,23 +508,22 @@ mod tests { fn derive_address_io() -> Vec { vec![ address_and_utxo_msg_io(), + prompt_ogmios_configuration_io( + &default_ogmios_service_config(), + &default_ogmios_service_config(), + ), + ogmios_network_request_io(), prompt_cardano_payment_verification_key_file_io(), read_payment_verification_key_file_io(), ] } fn query_utxos_io() -> Vec { - vec![ - prompt_ogmios_configuration_io( - &default_ogmios_service_config(), - &default_ogmios_service_config(), - ), - crate::select_utxo::tests::query_utxos_io( - "addr_test1vqezxrh24ts0775hulcg3ejcwj7hns8792vnn8met6z9gwsxt87zy", - "http://localhost:1337", - mock_result_7_valid(), - ), - ] + vec![crate::select_utxo::tests::query_utxos_io( + "addr_test1vqezxrh24ts0775hulcg3ejcwj7hns8792vnn8met6z9gwsxt87zy", + "http://localhost:1337", + mock_result_7_valid(), + )] } fn select_utxo_io() -> Vec { diff --git a/toolkit/partner-chains-cli/src/register/register3.rs b/toolkit/partner-chains-cli/src/register/register3.rs index ef1d68ecb..8aefd0692 100644 --- a/toolkit/partner-chains-cli/src/register/register3.rs +++ b/toolkit/partner-chains-cli/src/register/register3.rs @@ -4,7 +4,7 @@ use crate::config::config_fields; use crate::config::CHAIN_CONFIG_FILE_PATH; use crate::io::IOContext; use crate::main_chain_follower::set_main_chain_follower_env; -use crate::pc_contracts_cli_resources::establish_pc_contracts_cli_configuration; +use crate::ogmios::config::establish_ogmios_configuration; use crate::CmdRun; use clap::Parser; use partner_chains_cardano_offchain::register::Register; @@ -49,10 +49,9 @@ impl CmdRun for Register3Cmd { let cardano_payment_signing_key_path = context.prompt("Path to mainchain payment signing key file", Some("payment.skey")); - let pc_contracts_cli_resources = establish_pc_contracts_cli_configuration(context)?; let payment_signing_key = get_mc_pkey_from_file(&cardano_payment_signing_key_path, context)?; - + let ogmios_configuration = establish_ogmios_configuration(context)?; let candidate_registration = CandidateRegistration { stake_ownership: AdaBasedStaking { pub_key: self.spo_public_key.clone(), @@ -65,7 +64,7 @@ impl CmdRun for Register3Cmd { aura_pub_key: self.aura_pub_key.clone(), grandpa_pub_key: self.grandpa_pub_key.clone(), }; - let offchain = context.offchain_impl(&pc_contracts_cli_resources.ogmios)?; + let offchain = context.offchain_impl(&ogmios_configuration)?; let runtime = tokio::runtime::Runtime::new().map_err(|e| anyhow::anyhow!(e))?; runtime @@ -154,9 +153,7 @@ mod tests { config_fields::POSTGRES_CONNECTION_STRING, CHAIN_CONFIG_FILE_PATH, RESOURCES_CONFIG_FILE_PATH, }, - pc_contracts_cli_resources::{ - tests::establish_pc_contracts_cli_configuration_io, PcContractsCliResources, - }, + ogmios::config::tests::{default_ogmios_service_config, establish_ogmios_configuration_io}, tests::{MockIO, MockIOContext, OffchainMock, OffchainMocks}, }; use hex_literal::hex; @@ -185,11 +182,8 @@ mod tests { vec![ intro_msg_io(), prompt_mc_payment_key_path_io(), - vec![establish_pc_contracts_cli_configuration_io( - None, - PcContractsCliResources::default(), - )], - run_registration_io(), + read_payment_skey(), + get_ogmios_config(), prompt_for_registration_status_y(), show_registration_status_io(), ] @@ -222,11 +216,8 @@ mod tests { vec![ intro_msg_io(), prompt_mc_payment_key_path_io(), - vec![establish_pc_contracts_cli_configuration_io( - None, - PcContractsCliResources::default(), - )], - run_registration_fail_io(), + read_payment_skey(), + get_ogmios_config(), ] .into_iter() .flatten() @@ -257,11 +248,8 @@ mod tests { vec![ intro_msg_io(), prompt_mc_payment_key_path_io(), - vec![establish_pc_contracts_cli_configuration_io( - None, - PcContractsCliResources::default(), - )], - run_registration_io(), + read_payment_skey(), + get_ogmios_config(), prompt_for_registration_status_n(), ] .into_iter() @@ -290,6 +278,13 @@ mod tests { )] } + fn get_ogmios_config() -> Vec { + vec![establish_ogmios_configuration_io( + Some(default_ogmios_service_config()), + default_ogmios_service_config(), + )] + } + fn prompt_for_registration_status_y() -> Vec { vec![MockIO::prompt_yes_no("Show registration status?", true, true)] } @@ -326,11 +321,7 @@ mod tests { ] } - fn run_registration_io() -> Vec { - vec![MockIO::file_read("/path/to/payment.skey")] - } - - fn run_registration_fail_io() -> Vec { + fn read_payment_skey() -> Vec { vec![MockIO::file_read("/path/to/payment.skey")] } diff --git a/toolkit/partner-chains-cli/src/setup_main_chain_state/mod.rs b/toolkit/partner-chains-cli/src/setup_main_chain_state/mod.rs index ddd89966b..c2ceb9a8f 100644 --- a/toolkit/partner-chains-cli/src/setup_main_chain_state/mod.rs +++ b/toolkit/partner-chains-cli/src/setup_main_chain_state/mod.rs @@ -1,7 +1,7 @@ use crate::config::config_fields::{CARDANO_PAYMENT_SIGNING_KEY_FILE, POSTGRES_CONNECTION_STRING}; use crate::config::{config_fields, ChainConfig, ConfigFieldDefinition, CHAIN_CONFIG_FILE_PATH}; use crate::io::IOContext; -use crate::pc_contracts_cli_resources::prompt_ogmios_configuration; +use crate::ogmios::config::prompt_ogmios_configuration; use crate::permissioned_candidates::{ParsedPermissionedCandidatesKeys, PermissionedCandidateKeys}; use crate::{cardano_key, CmdRun}; use anyhow::anyhow; diff --git a/toolkit/partner-chains-cli/src/setup_main_chain_state/tests.rs b/toolkit/partner-chains-cli/src/setup_main_chain_state/tests.rs index ec81750e7..1db6b072b 100644 --- a/toolkit/partner-chains-cli/src/setup_main_chain_state/tests.rs +++ b/toolkit/partner-chains-cli/src/setup_main_chain_state/tests.rs @@ -1,8 +1,7 @@ use crate::config::config_fields; use crate::config::config_fields::CARDANO_PAYMENT_SIGNING_KEY_FILE; use crate::config::{CHAIN_CONFIG_FILE_PATH, RESOURCES_CONFIG_FILE_PATH}; -use crate::pc_contracts_cli_resources::default_ogmios_service_config; -use crate::pc_contracts_cli_resources::tests::prompt_ogmios_configuration_io; +use crate::ogmios::config::tests::{default_ogmios_service_config, prompt_ogmios_configuration_io}; use crate::prepare_configuration::tests::{ prompt_and_save_to_existing_file, prompt_with_default_and_save_to_existing_file, }; diff --git a/toolkit/partner-chains-cli/src/smart_contracts.rs b/toolkit/partner-chains-cli/src/smart_contracts.rs deleted file mode 100644 index 3af2629b0..000000000 --- a/toolkit/partner-chains-cli/src/smart_contracts.rs +++ /dev/null @@ -1,21 +0,0 @@ -use crate::pc_contracts_cli_resources::PcContractsCliResources; -use sidechain_domain::UtxoId; - -pub fn sidechain_params_arguments(genesis_utxo: UtxoId) -> String { - format!("--genesis-utxo {}", genesis_utxo) -} - -pub fn runtime_config_arguments( - runtime_config: &PcContractsCliResources, - payment_signing_key_path: &str, -) -> String { - format!("--kupo-host {} --kupo-port {} {} --ogmios-host {} --ogmios-port {} {} --payment-signing-key-file {}", - runtime_config.kupo.hostname, - runtime_config.kupo.port, - if runtime_config.kupo.protocol.is_secure() { "--kupo-secure" } else { "" }, - runtime_config.ogmios.hostname, - runtime_config.ogmios.port, - if runtime_config.ogmios.protocol.is_secure() { "--ogmios-secure" } else { "" }, - payment_signing_key_path - ) -} diff --git a/toolkit/partner-chains-cli/src/start_node/mod.rs b/toolkit/partner-chains-cli/src/start_node/mod.rs index 76817a878..f0fd13f3f 100644 --- a/toolkit/partner-chains-cli/src/start_node/mod.rs +++ b/toolkit/partner-chains-cli/src/start_node/mod.rs @@ -195,7 +195,6 @@ pub fn start_node( first_slot_number, epoch_duration_millis, first_epoch_timestamp_millis, - network: _network, }, bootnodes, }: StartNodeChainConfig,