Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ETCM-8754: use registration in wizard #327

Merged
merged 3 commits into from
Dec 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion node/node/src/command/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ pub fn run() -> sc_cli::Result<()> {
match &cli.subcommand {
Some(Subcommand::Key(cmd)) => cmd.run(&cli),
Some(Subcommand::PartnerChains(cmd)) => {
partner_chains_node_commands::setup_log4rs()?;
let make_dependencies = |config| {
let components = service::new_partial(&config)?;
Ok((
Expand Down
5 changes: 4 additions & 1 deletion toolkit/cli/node-commands/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,10 @@ where
})
},
PartnerChainsSubcommand::RegistrationSignatures(cmd) => Ok(println!("{}", cmd.execute())),
PartnerChainsSubcommand::SmartContracts(cmd) => Ok(cmd.execute_blocking()?),
PartnerChainsSubcommand::SmartContracts(cmd) => {
crate::setup_log4rs()?;
Ok(cmd.execute_blocking()?)
},
}
}

Expand Down
12 changes: 6 additions & 6 deletions toolkit/cli/smart-contracts-commands/src/register.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ pub struct RegisterCmd {
alias = "sidechain-public-keys",
value_parser = parse_partnerchain_public_keys
)]
partnerchain_public_keys: PermissionedCandidateData,
partner_chain_public_keys: PermissionedCandidateData,
#[arg(long, alias = "sidechain-signature")]
partnerchain_signature: SidechainSignature,
partner_chain_signature: SidechainSignature,
kpinter-iohk marked this conversation as resolved.
Show resolved Hide resolved
#[arg(long)]
spo_public_key: MainchainPublicKey,
#[arg(long)]
Expand All @@ -44,12 +44,12 @@ impl RegisterCmd {
pub_key: self.spo_public_key,
signature: self.spo_signature,
},
partnerchain_pub_key: self.partnerchain_public_keys.sidechain_public_key,
partnerchain_signature: self.partnerchain_signature,
partner_chain_pub_key: self.partner_chain_public_keys.sidechain_public_key,
partner_chain_signature: self.partner_chain_signature,
own_pkh: payment_key.to_pub_key_hash(),
registration_utxo: self.registration_utxo,
aura_pub_key: self.partnerchain_public_keys.aura_public_key,
grandpa_pub_key: self.partnerchain_public_keys.grandpa_public_key,
aura_pub_key: self.partner_chain_public_keys.aura_public_key,
grandpa_pub_key: self.partner_chain_public_keys.grandpa_public_key,
};

run_register(
Expand Down
4 changes: 2 additions & 2 deletions toolkit/offchain/src/register.rs
Original file line number Diff line number Diff line change
Expand Up @@ -357,8 +357,8 @@ mod tests {
pub_key: test_values::mainchain_pub_key(),
signature: MainchainSignature(Vec::new()),
},
partnerchain_pub_key: SidechainPublicKey(Vec::new()),
partnerchain_signature: SidechainSignature(Vec::new()),
partner_chain_pub_key: SidechainPublicKey(Vec::new()),
partner_chain_signature: SidechainSignature(Vec::new()),
registration_utxo,
own_pkh: own_pkh(),
aura_pub_key: AuraPublicKey(Vec::new()),
Expand Down
5 changes: 2 additions & 3 deletions toolkit/offchain/tests/integration_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ use ogmios_client::{
query_ledger_state::{QueryLedgerState, QueryUtxoByUtxoId},
query_network::QueryNetwork,
transactions::Transactions,
types::OgmiosTx,
OgmiosClientError,
};
use partner_chains_cardano_offchain::{
Expand Down Expand Up @@ -194,8 +193,8 @@ async fn run_register<T: QueryLedgerState + Transactions + QueryNetwork + QueryU
pub_key: EVE_PUBLIC_KEY,
signature: MainchainSignature(vec![19u8; 32]),
},
partnerchain_pub_key: SidechainPublicKey([20u8; 32].to_vec()),
partnerchain_signature,
partner_chain_pub_key: SidechainPublicKey([20u8; 32].to_vec()),
partner_chain_signature: partnerchain_signature,
own_pkh: EVE_PUBLIC_KEY_HASH,
registration_utxo,
aura_pub_key: AuraPublicKey([22u8; 32].to_vec()),
Expand Down
3 changes: 2 additions & 1 deletion toolkit/partner-chains-cli/src/io.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ use anyhow::{anyhow, Context};
use jsonrpsee::http_client::HttpClient;
use partner_chains_cardano_offchain::d_param::UpsertDParam;
use partner_chains_cardano_offchain::init_governance::InitGovernance;
use partner_chains_cardano_offchain::register::Register;
use partner_chains_cardano_offchain::scripts_data::GetScriptsData;
use sp_core::offchain::Timestamp;
use std::path::PathBuf;
Expand All @@ -16,7 +17,7 @@ use tempfile::{TempDir, TempPath};

pub trait IOContext {
/// It should implement all the required traits for offchain operations
type Offchain: GetScriptsData + InitGovernance + UpsertDParam;
type Offchain: GetScriptsData + InitGovernance + UpsertDParam + Register;

fn run_command(&self, cmd: &str) -> anyhow::Result<String>;
fn print(&self, msg: &str);
Expand Down
4 changes: 2 additions & 2 deletions toolkit/partner-chains-cli/src/register/register2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ impl CmdRun for Register2Cmd {

context.print("To finish the registration process, run the following command on the machine with the partner chain dependencies running:\n");
context.print(&format!(
"./partner-chains-cli register3 \\\n--genesis-utxo {} \\\n--registration-utxo {} \\\n--aura-pub-key {} \\\n--grandpa-pub-key {} \\\n--sidechain-pub-key {} \\\n--sidechain-signature {} \\\n--spo-public-key {} \\\n--spo-signature {}",
"./partner-chains-cli register3 \\\n--genesis-utxo {} \\\n--registration-utxo {} \\\n--aura-pub-key {} \\\n--grandpa-pub-key {} \\\n--partner-chain-pub-key {} \\\n--partner-chain-signature {} \\\n--spo-public-key {} \\\n--spo-signature {}",
self.genesis_utxo, self.registration_utxo, self.aura_pub_key, self.grandpa_pub_key, self.sidechain_pub_key, self.sidechain_signature, spo_public_key, spo_signature));
Ok(())
}
Expand Down Expand Up @@ -124,7 +124,7 @@ mod tests {
fn output_result_io() -> Vec<MockIO> {
vec![
MockIO::print("To finish the registration process, run the following command on the machine with the partner chain dependencies running:\n"),
MockIO::print("./partner-chains-cli register3 \\\n--genesis-utxo 0000000000000000000000000000000000000000000000000000000000000001#0 \\\n--registration-utxo 7e9ebd0950ae1bec5606f0cd7ac88b3c60b1103d7feb6ffa36402edae4d1b617#0 \\\n--aura-pub-key 0xdf883ee0648f33b6103017b61be702017742d501b8fe73b1d69ca0157460b777 \\\n--grandpa-pub-key 0x5a091a06abd64f245db11d2987b03218c6bd83d64c262fe10e3a2a1230e90327 \\\n--sidechain-pub-key 0x031e75acbf45ef8df98bbe24b19b28fff807be32bf88838c30c0564d7bec5301f6 \\\n--sidechain-signature 7a7e3e585a5dc248d4a2772814e1b58c90313443dd99369f994e960ecc4931442a08305743db7ab42ab9b8672e00250e1cc7c08bc018b0630a8197c4f95528a301 \\\n--spo-public-key cef2d1630c034d3b9034eb7903d61f419a3074a1ad01d4550cc72f2b733de6e7 \\\n--spo-signature aaa39fbf163ed77c69820536f5dc22854e7e13f964f1e077efde0844a09bde64c1aab4d2b401e0fe39b43c91aa931cad26fa55c8766378462c06d86c85134801"),
MockIO::print("./partner-chains-cli register3 \\\n--genesis-utxo 0000000000000000000000000000000000000000000000000000000000000001#0 \\\n--registration-utxo 7e9ebd0950ae1bec5606f0cd7ac88b3c60b1103d7feb6ffa36402edae4d1b617#0 \\\n--aura-pub-key 0xdf883ee0648f33b6103017b61be702017742d501b8fe73b1d69ca0157460b777 \\\n--grandpa-pub-key 0x5a091a06abd64f245db11d2987b03218c6bd83d64c262fe10e3a2a1230e90327 \\\n--partner-chain-pub-key 0x031e75acbf45ef8df98bbe24b19b28fff807be32bf88838c30c0564d7bec5301f6 \\\n--partner-chain-signature 7a7e3e585a5dc248d4a2772814e1b58c90313443dd99369f994e960ecc4931442a08305743db7ab42ab9b8672e00250e1cc7c08bc018b0630a8197c4f95528a301 \\\n--spo-public-key cef2d1630c034d3b9034eb7903d61f419a3074a1ad01d4550cc72f2b733de6e7 \\\n--spo-signature aaa39fbf163ed77c69820536f5dc22854e7e13f964f1e077efde0844a09bde64c1aab4d2b401e0fe39b43c91aa931cad26fa55c8766378462c06d86c85134801"),
]
}
// non 0 genesis utxo 8ea10040249ad3033ae7c4d4b69e0b2e2b50a90741b783491cb5ddf8ced0d861
Expand Down
Loading
Loading