Skip to content

Commit

Permalink
use registration in wizard
Browse files Browse the repository at this point in the history
  • Loading branch information
kpinter-iohk committed Dec 13, 2024
1 parent 81a1f5f commit 6a9d4b0
Show file tree
Hide file tree
Showing 9 changed files with 183 additions and 103 deletions.
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,
#[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 @@ -359,8 +359,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

0 comments on commit 6a9d4b0

Please sign in to comment.