From f14492f035dc69141694d65ab3123be9798559b1 Mon Sep 17 00:00:00 2001 From: Dastan <88332432+dastansam@users.noreply.github.com> Date: Mon, 17 Nov 2025 19:52:39 +0600 Subject: [PATCH 01/14] Update metadata --- src/chain/quantus_subxt.rs | 49 +++++++++++++++++-------------------- src/quantus_metadata.scale | Bin 165253 -> 165263 bytes 2 files changed, 23 insertions(+), 26 deletions(-) diff --git a/src/chain/quantus_subxt.rs b/src/chain/quantus_subxt.rs index a94a0d2..eb76445 100644 --- a/src/chain/quantus_subxt.rs +++ b/src/chain/quantus_subxt.rs @@ -8103,7 +8103,7 @@ pub mod api { [::core::primitive::u8; 32usize], runtime_types::frame_support::traits::preimages::Bounded< runtime_types::quantus_runtime::RuntimeCall, - runtime_types::qp_poseidon::PoseidonHasher, + runtime_types::quantus_runtime::PoseidonHeaderHasher, >, ::core::primitive::u32, runtime_types::quantus_runtime::OriginCaller, @@ -9174,7 +9174,7 @@ pub mod api { pub type ProposalOrigin = runtime_types::quantus_runtime::OriginCaller; pub type Proposal = runtime_types::frame_support::traits::preimages::Bounded< runtime_types::quantus_runtime::RuntimeCall, - runtime_types::qp_poseidon::PoseidonHasher, + runtime_types::quantus_runtime::PoseidonHeaderHasher, >; pub type EnactmentMoment = runtime_types::frame_support::traits::schedule::DispatchTime< @@ -9665,7 +9665,7 @@ pub mod api { pub type Track = ::core::primitive::u16; pub type Proposal = runtime_types::frame_support::traits::preimages::Bounded< runtime_types::quantus_runtime::RuntimeCall, - runtime_types::qp_poseidon::PoseidonHasher, + runtime_types::quantus_runtime::PoseidonHeaderHasher, >; } impl ::subxt::ext::subxt_core::events::StaticEvent for Submitted { @@ -9759,7 +9759,7 @@ pub mod api { pub type Track = ::core::primitive::u16; pub type Proposal = runtime_types::frame_support::traits::preimages::Bounded< runtime_types::quantus_runtime::RuntimeCall, - runtime_types::qp_poseidon::PoseidonHasher, + runtime_types::quantus_runtime::PoseidonHeaderHasher, >; pub type Tally = runtime_types::pallet_conviction_voting::types::Tally<::core::primitive::u128>; @@ -10016,7 +10016,7 @@ pub mod api { ::core::primitive::u32, runtime_types::frame_support::traits::preimages::Bounded< runtime_types::quantus_runtime::RuntimeCall, - runtime_types::qp_poseidon::PoseidonHasher, + runtime_types::quantus_runtime::PoseidonHeaderHasher, >, ::core::primitive::u128, runtime_types::pallet_conviction_voting::types::Tally< @@ -10916,7 +10916,7 @@ pub mod api { ::core::primitive::u128, runtime_types::frame_support::traits::preimages::Bounded< runtime_types::quantus_runtime::RuntimeCall, - runtime_types::qp_poseidon::PoseidonHasher, + runtime_types::quantus_runtime::PoseidonHeaderHasher, >, >; pub type Param0 = ::subxt::ext::subxt_core::utils::H256; @@ -13176,7 +13176,7 @@ pub mod api { pub type ProposalOrigin = runtime_types::quantus_runtime::OriginCaller; pub type Proposal = runtime_types::frame_support::traits::preimages::Bounded< runtime_types::quantus_runtime::RuntimeCall, - runtime_types::qp_poseidon::PoseidonHasher, + runtime_types::quantus_runtime::PoseidonHeaderHasher, >; pub type EnactmentMoment = runtime_types::frame_support::traits::schedule::DispatchTime< @@ -13667,7 +13667,7 @@ pub mod api { pub type Track = ::core::primitive::u16; pub type Proposal = runtime_types::frame_support::traits::preimages::Bounded< runtime_types::quantus_runtime::RuntimeCall, - runtime_types::qp_poseidon::PoseidonHasher, + runtime_types::quantus_runtime::PoseidonHeaderHasher, >; } impl ::subxt::ext::subxt_core::events::StaticEvent for Submitted { @@ -13761,7 +13761,7 @@ pub mod api { pub type Track = ::core::primitive::u16; pub type Proposal = runtime_types::frame_support::traits::preimages::Bounded< runtime_types::quantus_runtime::RuntimeCall, - runtime_types::qp_poseidon::PoseidonHasher, + runtime_types::quantus_runtime::PoseidonHeaderHasher, >; pub type Tally = runtime_types::pallet_ranked_collective::Tally; } @@ -14012,7 +14012,7 @@ pub mod api { ::core::primitive::u32, runtime_types::frame_support::traits::preimages::Bounded< runtime_types::quantus_runtime::RuntimeCall, - runtime_types::qp_poseidon::PoseidonHasher, + runtime_types::quantus_runtime::PoseidonHeaderHasher, >, ::core::primitive::u128, runtime_types::pallet_ranked_collective::Tally, @@ -24993,7 +24993,7 @@ pub mod api { >, proposal: runtime_types::frame_support::traits::preimages::Bounded< runtime_types::quantus_runtime::RuntimeCall, - runtime_types::qp_poseidon::PoseidonHasher, + runtime_types::quantus_runtime::PoseidonHeaderHasher, >, enactment_moment: runtime_types::frame_support::traits::schedule::DispatchTime< @@ -25150,7 +25150,7 @@ pub mod api { track: ::core::primitive::u16, proposal: runtime_types::frame_support::traits::preimages::Bounded< runtime_types::quantus_runtime::RuntimeCall, - runtime_types::qp_poseidon::PoseidonHasher, + runtime_types::quantus_runtime::PoseidonHeaderHasher, >, }, #[codec(index = 1)] @@ -25180,7 +25180,7 @@ pub mod api { track: ::core::primitive::u16, proposal: runtime_types::frame_support::traits::preimages::Bounded< runtime_types::quantus_runtime::RuntimeCall, - runtime_types::qp_poseidon::PoseidonHasher, + runtime_types::quantus_runtime::PoseidonHeaderHasher, >, tally: runtime_types::pallet_conviction_voting::types::Tally< ::core::primitive::u128, @@ -25273,7 +25273,7 @@ pub mod api { track: ::core::primitive::u16, proposal: runtime_types::frame_support::traits::preimages::Bounded< runtime_types::quantus_runtime::RuntimeCall, - runtime_types::qp_poseidon::PoseidonHasher, + runtime_types::quantus_runtime::PoseidonHeaderHasher, >, }, #[codec(index = 1)] @@ -25303,7 +25303,7 @@ pub mod api { track: ::core::primitive::u16, proposal: runtime_types::frame_support::traits::preimages::Bounded< runtime_types::quantus_runtime::RuntimeCall, - runtime_types::qp_poseidon::PoseidonHasher, + runtime_types::quantus_runtime::PoseidonHeaderHasher, >, tally: runtime_types::pallet_ranked_collective::Tally, }, @@ -27287,17 +27287,6 @@ pub mod api { } } } - pub mod qp_poseidon { - use super::runtime_types; - #[derive( - :: subxt :: ext :: subxt_core :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: subxt_core :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] - pub struct PoseidonHasher; - } pub mod qp_scheduler { use super::runtime_types; #[derive( @@ -27407,6 +27396,14 @@ pub mod api { )] #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] + pub struct PoseidonHeaderHasher; + #[derive( + :: subxt :: ext :: subxt_core :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: subxt_core :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] + #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] pub struct Runtime; #[derive( :: subxt :: ext :: subxt_core :: ext :: scale_decode :: DecodeAsType, diff --git a/src/quantus_metadata.scale b/src/quantus_metadata.scale index 0e8740a72063206e0373c3ad06b37ff657e98131..ca82fd5affea3364a3f85313a2456d88412f75bd 100644 GIT binary patch delta 53 zcmZqe=IZa}YS_Za Date: Mon, 17 Nov 2025 19:59:29 +0600 Subject: [PATCH 02/14] Remove referenda --- src/cli/mod.rs | 13 - src/cli/referenda.rs | 814 ------------------------------------ src/cli/referenda_decode.rs | 243 ----------- src/cli/tech_referenda.rs | 718 ------------------------------- 4 files changed, 1788 deletions(-) delete mode 100644 src/cli/referenda.rs delete mode 100644 src/cli/referenda_decode.rs delete mode 100644 src/cli/tech_referenda.rs diff --git a/src/cli/mod.rs b/src/cli/mod.rs index f505027..162b1f7 100644 --- a/src/cli/mod.rs +++ b/src/cli/mod.rs @@ -12,8 +12,6 @@ pub mod high_security; pub mod metadata; pub mod preimage; pub mod recovery; -pub mod referenda; -pub mod referenda_decode; pub mod reversible; pub mod runtime; pub mod scheduler; @@ -21,7 +19,6 @@ pub mod send; pub mod storage; pub mod system; pub mod tech_collective; -pub mod tech_referenda; pub mod treasury; pub mod wallet; @@ -94,12 +91,6 @@ pub enum Commands { /// Tech Referenda management commands (for runtime upgrade proposals) #[command(subcommand)] Preimage(preimage::PreimageCommands), - #[command(subcommand)] - TechReferenda(tech_referenda::TechReferendaCommands), - - /// Standard Referenda management commands (public governance) - #[command(subcommand)] - Referenda(referenda::ReferendaCommands), /// Treasury management commands #[command(subcommand)] @@ -277,10 +268,6 @@ pub async fn execute_command( tech_collective::handle_tech_collective_command(tech_collective_cmd, node_url).await, Commands::Preimage(preimage_cmd) => preimage::handle_preimage_command(preimage_cmd, node_url, finalized).await, - Commands::TechReferenda(tech_referenda_cmd) => - tech_referenda::handle_tech_referenda_command(tech_referenda_cmd, node_url).await, - Commands::Referenda(referenda_cmd) => - referenda::handle_referenda_command(referenda_cmd, node_url).await, Commands::Treasury(treasury_cmd) => treasury::handle_treasury_command(treasury_cmd, node_url).await, Commands::Runtime(runtime_cmd) => diff --git a/src/cli/referenda.rs b/src/cli/referenda.rs deleted file mode 100644 index 5071cb3..0000000 --- a/src/cli/referenda.rs +++ /dev/null @@ -1,814 +0,0 @@ -//! `quantus referenda` subcommand - manage standard Referenda proposals -use crate::{ - chain::quantus_subxt, cli::common::submit_transaction, error::QuantusError, log_error, - log_print, log_success, log_verbose, -}; -use clap::Subcommand; -use colored::Colorize; -use std::str::FromStr; - -/// Standard Referenda management commands -#[derive(Subcommand, Debug)] -pub enum ReferendaCommands { - /// Submit a simple proposal (System::remark) to test Referenda - SubmitRemark { - /// Message to include in the remark - #[arg(long)] - message: String, - - /// Wallet name to sign with - #[arg(short, long)] - from: String, - - /// Password for the wallet - #[arg(short, long)] - password: Option, - - /// Read password from file - #[arg(long)] - password_file: Option, - - /// Origin type: signed (default), none (for signaling track), root - #[arg(long, default_value = "signed")] - origin: String, - }, - - /// Submit a proposal using existing preimage hash - Submit { - /// Preimage hash (must already exist on chain) - #[arg(long)] - preimage_hash: String, - - /// Wallet name to sign with - #[arg(short, long)] - from: String, - - /// Password for the wallet - #[arg(short, long)] - password: Option, - - /// Read password from file - #[arg(long)] - password_file: Option, - - /// Origin type: signed (default), none (for signaling track), root - #[arg(long, default_value = "signed")] - origin: String, - }, - - /// List all active Referenda proposals - List, - - /// Get details of a specific Referendum - Get { - /// Referendum index - #[arg(short, long)] - index: u32, - - /// Decode and display the proposal call in human-readable format - #[arg(long)] - decode: bool, - }, - - /// Check the status of a Referendum - Status { - /// Referendum index - #[arg(short, long)] - index: u32, - }, - - /// Place a decision deposit for a Referendum - PlaceDecisionDeposit { - /// Referendum index - #[arg(short, long)] - index: u32, - - /// Wallet name to sign with - #[arg(short, long)] - from: String, - - /// Password for the wallet - #[arg(short, long)] - password: Option, - - /// Read password from file - #[arg(long)] - password_file: Option, - }, - - /// Vote on a Referendum (uses conviction voting) - Vote { - /// Referendum index - #[arg(short, long)] - index: u32, - - /// Vote aye (true) or nay (false) - #[arg(long)] - aye: bool, - - /// Conviction (0=None, 1=Locked1x, 2=Locked2x, up to 6=Locked6x) - #[arg(long, default_value = "0")] - conviction: u8, - - /// Amount to vote with - #[arg(long)] - amount: String, - - /// Wallet name to sign with - #[arg(short, long)] - from: String, - - /// Password for the wallet - #[arg(short, long)] - password: Option, - - /// Read password from file - #[arg(long)] - password_file: Option, - }, - - /// Refund submission deposit for a completed Referendum - RefundSubmissionDeposit { - /// Referendum index - #[arg(short, long)] - index: u32, - - /// Wallet name that submitted the referendum - #[arg(short, long)] - from: String, - - /// Password for the wallet - #[arg(short, long)] - password: Option, - - /// Read password from file - #[arg(long)] - password_file: Option, - }, - - /// Refund decision deposit for a completed Referendum - RefundDecisionDeposit { - /// Referendum index - #[arg(short, long)] - index: u32, - - /// Wallet name that placed the decision deposit - #[arg(short, long)] - from: String, - - /// Password for the wallet - #[arg(short, long)] - password: Option, - - /// Read password from file - #[arg(long)] - password_file: Option, - }, - - /// Get Referenda configuration - Config, -} - -/// Handle referenda commands -pub async fn handle_referenda_command( - command: ReferendaCommands, - node_url: &str, -) -> crate::error::Result<()> { - let quantus_client = crate::chain::client::QuantusClient::new(node_url).await?; - - match command { - ReferendaCommands::SubmitRemark { message, from, password, password_file, origin } => - submit_remark_proposal( - &quantus_client, - &message, - &from, - password, - password_file, - &origin, - ) - .await, - ReferendaCommands::Submit { preimage_hash, from, password, password_file, origin } => - submit_proposal( - &quantus_client, - &preimage_hash, - &from, - password, - password_file, - &origin, - ) - .await, - ReferendaCommands::List => list_proposals(&quantus_client).await, - ReferendaCommands::Get { index, decode } => - get_proposal_details(&quantus_client, index, decode).await, - ReferendaCommands::Status { index } => get_proposal_status(&quantus_client, index).await, - ReferendaCommands::PlaceDecisionDeposit { index, from, password, password_file } => - place_decision_deposit(&quantus_client, index, &from, password, password_file).await, - ReferendaCommands::Vote { - index, - aye, - conviction, - amount, - from, - password, - password_file, - } => - vote_on_referendum( - &quantus_client, - index, - aye, - conviction, - &amount, - &from, - password, - password_file, - ) - .await, - ReferendaCommands::RefundSubmissionDeposit { index, from, password, password_file } => - refund_submission_deposit(&quantus_client, index, &from, password, password_file).await, - ReferendaCommands::RefundDecisionDeposit { index, from, password, password_file } => - refund_decision_deposit(&quantus_client, index, &from, password, password_file).await, - ReferendaCommands::Config => get_config(&quantus_client).await, - } -} - -/// Submit a simple System::remark proposal -async fn submit_remark_proposal( - quantus_client: &crate::chain::client::QuantusClient, - message: &str, - from: &str, - password: Option, - password_file: Option, - origin_type: &str, -) -> crate::error::Result<()> { - use qp_poseidon::PoseidonHasher; - - log_print!("📝 Submitting System::remark Proposal to Referenda"); - log_print!(" đŸ’Ŧ Message: {}", message.bright_cyan()); - log_print!(" 🔑 Submitted by: {}", from.bright_yellow()); - log_print!(" đŸŽ¯ Origin type: {}", origin_type.bright_magenta()); - - // Load wallet keypair - let keypair = crate::wallet::load_keypair_from_wallet(from, password, password_file)?; - - // Build System::remark call and encode it - let remark_bytes = message.as_bytes().to_vec(); - let remark_payload = quantus_subxt::api::tx().system().remark(remark_bytes.clone()); - let metadata = quantus_client.client().metadata(); - let encoded_call = <_ as subxt::tx::Payload>::encode_call_data(&remark_payload, &metadata) - .map_err(|e| QuantusError::Generic(format!("Failed to encode call data: {:?}", e)))?; - - log_verbose!("📝 Encoded call size: {} bytes", encoded_call.len()); - - // Compute preimage hash using Poseidon - let preimage_hash: sp_core::H256 = - ::hash(&encoded_call); - - log_print!("🔗 Preimage hash: {:?}", preimage_hash); - - // Submit Preimage::note_preimage - type PreimageBytes = quantus_subxt::api::preimage::calls::types::note_preimage::Bytes; - let bounded_bytes: PreimageBytes = encoded_call.clone(); - - log_print!("📝 Submitting preimage..."); - let note_preimage_tx = quantus_subxt::api::tx().preimage().note_preimage(bounded_bytes); - let preimage_tx_hash = - submit_transaction(quantus_client, &keypair, note_preimage_tx, None).await?; - log_print!("✅ Preimage transaction submitted: {:?}", preimage_tx_hash); - - // Wait for preimage transaction confirmation - log_print!("âŗ Waiting for preimage transaction confirmation..."); - - // Build Referenda::submit call using Lookup preimage reference - type ProposalBounded = - quantus_subxt::api::runtime_types::frame_support::traits::preimages::Bounded< - quantus_subxt::api::runtime_types::quantus_runtime::RuntimeCall, - quantus_subxt::api::runtime_types::qp_poseidon::PoseidonHasher, - >; - - let preimage_hash_subxt: subxt::utils::H256 = preimage_hash; - let proposal: ProposalBounded = - ProposalBounded::Lookup { hash: preimage_hash_subxt, len: encoded_call.len() as u32 }; - - // Create origin based on origin_type parameter - let account_id_sp = keypair.to_account_id_32(); - let account_id_subxt: subxt::ext::subxt_core::utils::AccountId32 = - subxt::ext::subxt_core::utils::AccountId32(*account_id_sp.as_ref()); - - let origin_caller = match origin_type.to_lowercase().as_str() { - "signed" => { - let raw_origin = - quantus_subxt::api::runtime_types::frame_support::dispatch::RawOrigin::Signed( - account_id_subxt, - ); - quantus_subxt::api::runtime_types::quantus_runtime::OriginCaller::system(raw_origin) - }, - "none" => { - let raw_origin = - quantus_subxt::api::runtime_types::frame_support::dispatch::RawOrigin::None; - quantus_subxt::api::runtime_types::quantus_runtime::OriginCaller::system(raw_origin) - }, - "root" => { - let raw_origin = - quantus_subxt::api::runtime_types::frame_support::dispatch::RawOrigin::Root; - quantus_subxt::api::runtime_types::quantus_runtime::OriginCaller::system(raw_origin) - }, - _ => - return Err(QuantusError::Generic(format!( - "Invalid origin type: {}. Must be 'signed', 'none', or 'root'", - origin_type - ))), - }; - - let enactment = - quantus_subxt::api::runtime_types::frame_support::traits::schedule::DispatchTime::After( - 10u32, // Execute 10 blocks after approval - ); - - log_print!("🔧 Creating Referenda::submit call..."); - let submit_call = - quantus_subxt::api::tx().referenda().submit(origin_caller, proposal, enactment); - - let tx_hash = submit_transaction(quantus_client, &keypair, submit_call, None).await?; - log_print!( - "✅ {} Referendum proposal submitted! Hash: {:?}", - "SUCCESS".bright_green().bold(), - tx_hash - ); - - log_print!("💡 Use 'quantus referenda list' to see active proposals"); - Ok(()) -} - -/// Submit a proposal using existing preimage hash -async fn submit_proposal( - quantus_client: &crate::chain::client::QuantusClient, - preimage_hash: &str, - from: &str, - password: Option, - password_file: Option, - origin_type: &str, -) -> crate::error::Result<()> { - log_print!("📝 Submitting Proposal to Referenda"); - log_print!(" 🔗 Preimage hash: {}", preimage_hash.bright_cyan()); - log_print!(" 🔑 Submitted by: {}", from.bright_yellow()); - log_print!(" đŸŽ¯ Origin type: {}", origin_type.bright_magenta()); - - // Parse preimage hash - let hash_str = preimage_hash.trim_start_matches("0x"); - let preimage_hash_parsed: sp_core::H256 = sp_core::H256::from_str(hash_str) - .map_err(|_| QuantusError::Generic("Invalid preimage hash format".to_string()))?; - - // Load wallet keypair - let keypair = crate::wallet::load_keypair_from_wallet(from, password, password_file)?; - - // Check if preimage exists and get its length - log_print!("🔍 Checking preimage status..."); - let latest_block_hash = quantus_client.get_latest_block().await?; - let storage_at = quantus_client.client().storage().at(latest_block_hash); - - let preimage_status = storage_at - .fetch( - &quantus_subxt::api::storage() - .preimage() - .request_status_for(preimage_hash_parsed), - ) - .await - .map_err(|e| QuantusError::Generic(format!("Failed to fetch preimage status: {:?}", e)))? - .ok_or_else(|| QuantusError::Generic("Preimage not found on chain".to_string()))?; - - let preimage_len = match preimage_status { - quantus_subxt::api::runtime_types::pallet_preimage::RequestStatus::Unrequested { - ticket: _, - len, - } => len, - quantus_subxt::api::runtime_types::pallet_preimage::RequestStatus::Requested { - maybe_ticket: _, - count: _, - maybe_len, - } => match maybe_len { - Some(len) => len, - None => return Err(QuantusError::Generic("Preimage length not available".to_string())), - }, - }; - - log_print!("✅ Preimage found! Length: {} bytes", preimage_len); - - // Build Referenda::submit call - type ProposalBounded = - quantus_subxt::api::runtime_types::frame_support::traits::preimages::Bounded< - quantus_subxt::api::runtime_types::quantus_runtime::RuntimeCall, - quantus_subxt::api::runtime_types::qp_poseidon::PoseidonHasher, - >; - - let preimage_hash_subxt: subxt::utils::H256 = preimage_hash_parsed; - let proposal: ProposalBounded = - ProposalBounded::Lookup { hash: preimage_hash_subxt, len: preimage_len }; - - // Create origin based on origin_type parameter - let account_id_sp = keypair.to_account_id_32(); - let account_id_subxt: subxt::ext::subxt_core::utils::AccountId32 = - subxt::ext::subxt_core::utils::AccountId32(*account_id_sp.as_ref()); - - let origin_caller = match origin_type.to_lowercase().as_str() { - "signed" => { - let raw_origin = - quantus_subxt::api::runtime_types::frame_support::dispatch::RawOrigin::Signed( - account_id_subxt, - ); - quantus_subxt::api::runtime_types::quantus_runtime::OriginCaller::system(raw_origin) - }, - "none" => { - let raw_origin = - quantus_subxt::api::runtime_types::frame_support::dispatch::RawOrigin::None; - quantus_subxt::api::runtime_types::quantus_runtime::OriginCaller::system(raw_origin) - }, - "root" => { - let raw_origin = - quantus_subxt::api::runtime_types::frame_support::dispatch::RawOrigin::Root; - quantus_subxt::api::runtime_types::quantus_runtime::OriginCaller::system(raw_origin) - }, - _ => - return Err(QuantusError::Generic(format!( - "Invalid origin type: {}. Must be 'signed', 'none', or 'root'", - origin_type - ))), - }; - - let enactment = - quantus_subxt::api::runtime_types::frame_support::traits::schedule::DispatchTime::After( - 10u32, - ); - - log_print!("🔧 Creating Referenda::submit call..."); - let submit_call = - quantus_subxt::api::tx().referenda().submit(origin_caller, proposal, enactment); - - let tx_hash = submit_transaction(quantus_client, &keypair, submit_call, None).await?; - log_print!( - "✅ {} Referendum proposal submitted! Hash: {:?}", - "SUCCESS".bright_green().bold(), - tx_hash - ); - - log_print!("💡 Use 'quantus referenda list' to see active proposals"); - Ok(()) -} - -/// List recent Referenda proposals -async fn list_proposals( - quantus_client: &crate::chain::client::QuantusClient, -) -> crate::error::Result<()> { - log_print!("📜 Active Referenda Proposals"); - log_print!(""); - - let addr = quantus_subxt::api::storage().referenda().referendum_count(); - - let latest_block_hash = quantus_client.get_latest_block().await?; - let storage_at = quantus_client.client().storage().at(latest_block_hash); - - let count = storage_at.fetch(&addr).await?; - - if let Some(total) = count { - log_print!("📊 Total referenda created: {}", total); - if total == 0 { - log_print!("📭 No active proposals found"); - return Ok(()); - } - log_print!("🔍 Fetching recent referenda..."); - for i in (0..total).rev().take(10) { - get_proposal_status(quantus_client, i).await?; - log_print!("----------------------------------------"); - } - } else { - log_print!("📭 No referenda found - Referenda may be empty"); - } - - Ok(()) -} - -/// Get details of a specific Referendum -async fn get_proposal_details( - quantus_client: &crate::chain::client::QuantusClient, - index: u32, - decode: bool, -) -> crate::error::Result<()> { - use quantus_subxt::api::runtime_types::pallet_referenda::types::ReferendumInfo; - - log_print!("📄 Referendum #{} Details", index); - log_print!(""); - - let addr = quantus_subxt::api::storage().referenda().referendum_info_for(index); - - let latest_block_hash = quantus_client.get_latest_block().await?; - let storage_at = quantus_client.client().storage().at(latest_block_hash); - - let info = storage_at.fetch(&addr).await?; - - if let Some(referendum_info) = info { - if decode { - // Try to decode the proposal - match &referendum_info { - ReferendumInfo::Ongoing(status) => { - log_print!("📊 {} Referendum #{}", "Ongoing".bright_green(), index); - log_print!(" đŸ›¤ī¸ Track: {}", status.track); - log_print!(" 📅 Submitted: Block #{}", status.submitted); - log_print!( - " đŸ—ŗī¸ Tally: Ayes: {}, Nays: {}, Support: {}", - status.tally.ayes, - status.tally.nays, - status.tally.support - ); - log_print!(""); - - // Extract preimage hash and length from proposal - if let quantus_subxt::api::runtime_types::frame_support::traits::preimages::Bounded::Lookup { - hash, - len, - } = &status.proposal - { - log_print!("📝 Proposal Details:"); - log_print!(" 🔗 Preimage Hash: {:?}", hash); - log_print!(" 📏 Length: {} bytes", len); - log_print!(""); - - // Fetch and decode the preimage - match crate::cli::referenda_decode::decode_preimage(quantus_client, hash, *len).await { - Ok(decoded) => { - log_print!("✅ Decoded Proposal:"); - log_print!("{}", decoded); - }, - Err(e) => { - log_print!("âš ī¸ Could not decode proposal: {}", e); - log_print!(" Run 'quantus preimage get --hash {:?} --len {}' to see raw data", hash, len); - }, - } - } else { - log_print!("âš ī¸ Proposal is inline (not a preimage lookup)"); - } - }, - ReferendumInfo::Approved(..) => { - log_print!("📊 {} Referendum #{}", "Approved".green(), index); - log_print!( - " â„šī¸ Proposal details no longer available (referendum finalized)" - ); - }, - ReferendumInfo::Rejected(..) => { - log_print!("📊 {} Referendum #{}", "Rejected".red(), index); - log_print!( - " â„šī¸ Proposal details no longer available (referendum finalized)" - ); - }, - ReferendumInfo::Cancelled(..) => { - log_print!("📊 {} Referendum #{}", "Cancelled".yellow(), index); - log_print!( - " â„šī¸ Proposal details no longer available (referendum finalized)" - ); - }, - ReferendumInfo::TimedOut(..) => { - log_print!("📊 {} Referendum #{}", "TimedOut".dimmed(), index); - log_print!( - " â„šī¸ Proposal details no longer available (referendum finalized)" - ); - }, - ReferendumInfo::Killed(..) => { - log_print!("📊 {} Referendum #{}", "Killed".red().bold(), index); - log_print!(" â„šī¸ Proposal details no longer available (referendum killed)"); - }, - } - } else { - // Raw output (original behavior) - log_print!("📋 Referendum Information (raw):"); - log_print!("{:#?}", referendum_info); - } - } else { - log_print!("📭 Referendum #{} not found", index); - } - Ok(()) -} - -/// Get the status of a Referendum -async fn get_proposal_status( - quantus_client: &crate::chain::client::QuantusClient, - index: u32, -) -> crate::error::Result<()> { - use quantus_subxt::api::runtime_types::pallet_referenda::types::ReferendumInfo; - - log_verbose!("📊 Fetching status for Referendum #{}...", index); - - let addr = quantus_subxt::api::storage().referenda().referendum_info_for(index); - - let latest_block_hash = quantus_client.get_latest_block().await?; - let storage_at = quantus_client.client().storage().at(latest_block_hash); - - let info_res = storage_at.fetch(&addr).await; - - match info_res { - Ok(Some(info)) => { - log_print!("📊 Status for Referendum #{}", index.to_string().bright_yellow()); - match info { - ReferendumInfo::Ongoing(status) => { - log_print!(" - Status: {}", "Ongoing".bright_green()); - log_print!(" - Track: {}", status.track); - log_print!(" - Submitted at: block {}", status.submitted); - log_print!( - " - Tally: Ayes: {}, Nays: {}", - status.tally.ayes, - status.tally.nays - ); - log_verbose!(" - Full status: {:#?}", status); - }, - ReferendumInfo::Approved(submitted, ..) => { - log_print!(" - Status: {}", "Approved".green()); - log_print!(" - Submitted at block: {}", submitted); - }, - ReferendumInfo::Rejected(submitted, ..) => { - log_print!(" - Status: {}", "Rejected".red()); - log_print!(" - Submitted at block: {}", submitted); - }, - ReferendumInfo::Cancelled(submitted, ..) => { - log_print!(" - Status: {}", "Cancelled".yellow()); - log_print!(" - Submitted at block: {}", submitted); - }, - ReferendumInfo::TimedOut(submitted, ..) => { - log_print!(" - Status: {}", "TimedOut".dimmed()); - log_print!(" - Submitted at block: {}", submitted); - }, - ReferendumInfo::Killed(submitted) => { - log_print!(" - Status: {}", "Killed".red().bold()); - log_print!(" - Killed at block: {}", submitted); - }, - } - }, - Ok(None) => log_print!("📭 Referendum #{} not found", index), - Err(e) => log_error!("❌ Failed to fetch referendum #{}: {:?}", index, e), - } - - Ok(()) -} - -/// Place a decision deposit for a Referendum -async fn place_decision_deposit( - quantus_client: &crate::chain::client::QuantusClient, - index: u32, - from: &str, - password: Option, - password_file: Option, -) -> crate::error::Result<()> { - log_print!("📋 Placing decision deposit for Referendum #{}", index); - log_print!(" 🔑 Placed by: {}", from.bright_yellow()); - - let keypair = crate::wallet::load_keypair_from_wallet(from, password, password_file)?; - - let deposit_call = quantus_subxt::api::tx().referenda().place_decision_deposit(index); - let tx_hash = submit_transaction(quantus_client, &keypair, deposit_call, None).await?; - log_success!("✅ Decision deposit placed! Hash: {:?}", tx_hash.to_string().bright_yellow()); - Ok(()) -} - -/// Vote on a Referendum -async fn vote_on_referendum( - quantus_client: &crate::chain::client::QuantusClient, - index: u32, - aye: bool, - conviction: u8, - amount: &str, - from: &str, - password: Option, - password_file: Option, -) -> crate::error::Result<()> { - log_print!("đŸ—ŗī¸ Voting on Referendum #{}", index); - log_print!(" 📊 Vote: {}", if aye { "AYE ✅".bright_green() } else { "NAY ❌".bright_red() }); - log_print!(" 💰 Amount: {}", amount.bright_cyan()); - log_print!(" 🔒 Conviction: {}", conviction); - log_print!(" 🔑 Signed by: {}", from.bright_yellow()); - - let keypair = crate::wallet::load_keypair_from_wallet(from, password, password_file)?; - - // Parse amount - let amount_value: u128 = (amount - .parse::() - .map_err(|_| QuantusError::Generic("Invalid amount format".to_string()))? - .max(0.0) * - 1_000_000_000_000_000_000.0) as u128; - - // Validate conviction - if conviction > 6 { - return Err(QuantusError::Generic("Invalid conviction (must be 0-6)".to_string())); - } - - // Build vote - let vote = - quantus_subxt::api::runtime_types::pallet_conviction_voting::vote::AccountVote::Standard { - vote: quantus_subxt::api::runtime_types::pallet_conviction_voting::vote::Vote( - if aye { 128 } else { 0 } | conviction, - ), - balance: amount_value, - }; - - let vote_call = quantus_subxt::api::tx().conviction_voting().vote(index, vote); - let tx_hash = submit_transaction(quantus_client, &keypair, vote_call, None).await?; - - log_print!( - "✅ {} Vote transaction submitted! Hash: {:?}", - "SUCCESS".bright_green().bold(), - tx_hash - ); - - log_success!("🎉 {} Vote submitted!", "FINISHED".bright_green().bold()); - Ok(()) -} - -/// Get Referenda configuration -async fn get_config( - quantus_client: &crate::chain::client::QuantusClient, -) -> crate::error::Result<()> { - log_print!("âš™ī¸ Referenda Configuration"); - log_print!(""); - - let constants = quantus_client.client().constants(); - let tracks_addr = quantus_subxt::api::constants().referenda().tracks(); - - match constants.at(&tracks_addr) { - Ok(tracks) => { - log_print!("{}", "📊 Track Configuration:".bold()); - for (id, info) in tracks.iter() { - log_print!(" ------------------------------------"); - log_print!( - " â€ĸ {} #{}: {}", - "Track".bold(), - id, - info.name.to_string().bright_cyan() - ); - log_print!(" â€ĸ Max Deciding: {}", info.max_deciding); - log_print!(" â€ĸ Decision Deposit: {}", info.decision_deposit); - log_print!(" â€ĸ Prepare Period: {} blocks", info.prepare_period); - log_print!(" â€ĸ Decision Period: {} blocks", info.decision_period); - log_print!(" â€ĸ Confirm Period: {} blocks", info.confirm_period); - log_print!(" â€ĸ Min Enactment Period: {} blocks", info.min_enactment_period); - } - log_print!(" ------------------------------------"); - }, - Err(e) => { - log_error!("❌ Failed to decode Tracks constant: {:?}", e); - log_print!("💡 It's possible the Tracks constant is not in the expected format."); - }, - } - - Ok(()) -} - -/// Refund submission deposit for a completed Referendum -async fn refund_submission_deposit( - quantus_client: &crate::chain::client::QuantusClient, - index: u32, - from: &str, - password: Option, - password_file: Option, -) -> crate::error::Result<()> { - log_print!("💰 Refunding submission deposit for Referendum #{}", index); - log_print!(" 🔑 Refund to: {}", from.bright_yellow()); - - // Load wallet keypair - let keypair = crate::wallet::load_keypair_from_wallet(from, password, password_file)?; - - // Create refund_submission_deposit call - let refund_call = quantus_subxt::api::tx().referenda().refund_submission_deposit(index); - - let tx_hash = submit_transaction(quantus_client, &keypair, refund_call, None).await?; - log_print!( - "✅ {} Refund transaction submitted! Hash: {:?}", - "SUCCESS".bright_green().bold(), - tx_hash - ); - - log_print!("💡 Check your balance to confirm the refund"); - Ok(()) -} - -/// Refund decision deposit for a completed Referendum -async fn refund_decision_deposit( - quantus_client: &crate::chain::client::QuantusClient, - index: u32, - from: &str, - password: Option, - password_file: Option, -) -> crate::error::Result<()> { - log_print!("💰 Refunding decision deposit for Referendum #{}", index); - log_print!(" 🔑 Refund to: {}", from.bright_yellow()); - - // Load wallet keypair - let keypair = crate::wallet::load_keypair_from_wallet(from, password, password_file)?; - - // Create refund_decision_deposit call - let refund_call = quantus_subxt::api::tx().referenda().refund_decision_deposit(index); - - let tx_hash = submit_transaction(quantus_client, &keypair, refund_call, None).await?; - log_print!( - "✅ {} Refund transaction submitted! Hash: {:?}", - "SUCCESS".bright_green().bold(), - tx_hash - ); - - log_print!("💡 Check your balance to confirm the refund"); - Ok(()) -} diff --git a/src/cli/referenda_decode.rs b/src/cli/referenda_decode.rs deleted file mode 100644 index 7140fa7..0000000 --- a/src/cli/referenda_decode.rs +++ /dev/null @@ -1,243 +0,0 @@ -//! Decoding utilities for referendum proposals - -use crate::error::QuantusError; -use codec::Decode; -use colored::Colorize; - -/// Decode preimage call data into human-readable format -pub async fn decode_preimage( - quantus_client: &crate::chain::client::QuantusClient, - hash: &subxt::utils::H256, - len: u32, -) -> crate::error::Result { - // Fetch preimage from storage - let latest_block_hash = quantus_client.get_latest_block().await?; - let storage_at = quantus_client.client().storage().at(latest_block_hash); - - let preimage_addr = crate::chain::quantus_subxt::api::storage() - .preimage() - .preimage_for((*hash, len)); - - let preimage_result = storage_at.fetch(&preimage_addr).await; - - let content = match preimage_result { - Ok(Some(bounded_vec)) => bounded_vec.0, - Ok(None) => - return Err(QuantusError::Generic(format!("Preimage not found for hash {:?}", hash))), - Err(e) => return Err(QuantusError::Generic(format!("Error fetching preimage: {:?}", e))), - }; - - // Decode using direct Decode trait (RuntimeCall implements it via DecodeAsType derive) - decode_runtime_call_direct(&content) -} - -/// Decode RuntimeCall directly using Decode trait -fn decode_runtime_call_direct(data: &[u8]) -> crate::error::Result { - // First, let's try to understand the call structure by reading indices - if data.len() < 3 { - return Err(QuantusError::Generic("Call data too short".to_string())); - } - - let pallet_index = data[0]; - let inner_index = data[1]; - let call_index = data[2]; - - match (pallet_index, inner_index, call_index) { - // System pallet (0, 0, X) - // Special case: if call_index looks like Compact (high value like 0xe8), - // it might be remark (call 0) where the call index byte is omitted - (0, 0, idx) if idx > 100 => { - // Likely remark (call 0) with Compact-encoded Vec starting at byte 2 - decode_system_remark_no_index(&data[2..]) - }, - (0, 0, _) => decode_system_call(&data[2..]), - - // TreasuryPallet (18, 5, X) where X is any spend variant (11, 15, 19, etc.) - // Different indices represent different value ranges/encodings - (18, 5, _) => decode_treasury_spend_call(&data[3..]), - - // Unknown - _ => Ok(format!( - " {} {} {} {}\n {} {} bytes\n {}:\n {}", - "Call Indices:".dimmed(), - pallet_index, - inner_index, - call_index, - "Args:".dimmed(), - data.len() - 3, - "Raw Hex".dimmed(), - hex::encode(&data[3..]).bright_green() - )), - } -} - -/// Decode System::remark when call index byte is omitted (call 0) -fn decode_system_remark_no_index(args: &[u8]) -> crate::error::Result { - // args starts directly with Compact-encoded Vec - let mut cursor = args; - let remark_bytes: Vec = Vec::decode(&mut cursor) - .map_err(|e| QuantusError::Generic(format!("Failed to decode remark: {:?}", e)))?; - let remark_str = String::from_utf8_lossy(&remark_bytes); - - Ok(format!( - " {} {}\n {} {}\n {}:\n {} \"{}\"", - "Pallet:".dimmed(), - "System".bright_cyan(), - "Call:".dimmed(), - "remark".bright_yellow(), - "Parameters".dimmed(), - "message:".dimmed(), - remark_str.bright_green() - )) -} - -/// Decode System pallet calls -fn decode_system_call(data_from_call: &[u8]) -> crate::error::Result { - if data_from_call.is_empty() { - return Err(QuantusError::Generic("Empty system call data".to_string())); - } - - let call_index = data_from_call[0]; - let args = &data_from_call[1..]; - - match call_index { - 0 => { - // remark - standard Vec - let mut cursor = args; - let remark_bytes: Vec = Vec::decode(&mut cursor) - .map_err(|e| QuantusError::Generic(format!("Failed to decode remark: {:?}", e)))?; - let remark_str = String::from_utf8_lossy(&remark_bytes); - - Ok(format!( - " {} {}\n {} {}\n {}:\n {} \"{}\"", - "Pallet:".dimmed(), - "System".bright_cyan(), - "Call:".dimmed(), - "remark".bright_yellow(), - "Parameters".dimmed(), - "message:".dimmed(), - remark_str.bright_green() - )) - }, - 1 => { - // remark_with_event - has different encoding, try decoding from byte 1 - let remark_str = if args.len() > 1 { - String::from_utf8_lossy(&args[1..]) - } else { - String::from_utf8_lossy(args) - }; - - Ok(format!( - " {} {}\n {} {}\n {}:\n {} \"{}\"", - "Pallet:".dimmed(), - "System".bright_cyan(), - "Call:".dimmed(), - "remark_with_event".bright_yellow(), - "Parameters".dimmed(), - "message:".dimmed(), - remark_str.bright_green() - )) - }, - 7 => { - // set_code - Ok(format!( - " {} {}\n {} {} {}\n {} {}", - "Pallet:".dimmed(), - "System".bright_cyan(), - "Call:".dimmed(), - "set_code".bright_yellow(), - "(Runtime Upgrade)".dimmed(), - "Parameters:".dimmed(), - "".bright_green() - )) - }, - _ => Ok(format!( - " {} {}\n {} {} (index {})", - "Pallet:".dimmed(), - "System".bright_cyan(), - "Call:".dimmed(), - "unknown".yellow(), - call_index - )), - } -} - -/// Decode TreasuryPallet::spend call arguments -/// The amount is stored as variable-length u128 in little-endian -fn decode_treasury_spend_call(args: &[u8]) -> crate::error::Result { - use sp_core::crypto::Ss58Codec; - - crate::log_verbose!("Decoding treasury spend, args length: {} bytes", args.len()); - crate::log_verbose!("Args hex: {}", hex::encode(args)); - - if args.len() < 34 { - return Err(QuantusError::Generic(format!( - "Args too short for treasury spend: {} bytes (expected 40-42)", - args.len() - ))); - } - - // Structure (discovered through empirical analysis): - // - asset_kind: Box<()> = 0 bytes (unit type has no encoding) - // - amount: u128 = variable bytes (7-8 bytes typically) as little-endian - // - beneficiary: Box = 32 bytes (no variant byte!) - // - valid_from: Option = 1 byte (0x00 for None) - - // The amount length varies based on the value: - // - Small values (< 256TB): 7 bytes - // - Larger values: 8+ bytes - // Total length is typically 40 bytes (7+32+1) or 42 bytes (8+32+1) or similar - - // Calculate amount bytes length: total - 32 (beneficiary) - 1 (valid_from) - let amount_bytes_len = args.len() - 32 - 1; - if !(1..=16).contains(&amount_bytes_len) { - return Err(QuantusError::Generic(format!( - "Invalid amount bytes length: {}", - amount_bytes_len - ))); - } - - // Decode amount: first N bytes as little-endian u128 - let mut amount_bytes_extended = [0u8; 16]; - amount_bytes_extended[..amount_bytes_len].copy_from_slice(&args[..amount_bytes_len]); - let amount = u128::from_le_bytes(amount_bytes_extended); - - // Decode beneficiary: starts after amount bytes, 32 bytes - let beneficiary_start = amount_bytes_len; - let account_bytes: [u8; 32] = args[beneficiary_start..beneficiary_start + 32] - .try_into() - .map_err(|_| QuantusError::Generic("Failed to extract beneficiary bytes".to_string()))?; - let sp_account = sp_core::crypto::AccountId32::from(account_bytes); - let ss58 = sp_account.to_ss58check_with_version(sp_core::crypto::Ss58AddressFormat::custom(42)); - let beneficiary_str = format!("{} ({}...{})", ss58, &ss58[..8], &ss58[ss58.len() - 6..]); - - // Decode valid_from: last byte - let valid_from_byte = args[args.len() - 1]; - let valid_from_str = if valid_from_byte == 0 { - "None (immediate)".to_string() - } else { - format!("Some (byte: 0x{:02x})", valid_from_byte) - }; - - // Format amount in QUAN (1 QUAN = 10^12) - let quan = amount as f64 / 1_000_000_000_000.0; - - Ok(format!( - " {} {}\n {} {}\n {}:\n {} {} {} ({} raw)\n {} {}\n {} {}\n\n {} {}", - "Pallet:".dimmed(), - "TreasuryPallet".bright_cyan(), - "Call:".dimmed(), - "spend".bright_yellow(), - "Parameters".dimmed(), - "amount:".dimmed(), - quan.to_string().bright_green().bold(), - "QUAN".bright_green(), - amount, - "beneficiary:".dimmed(), - beneficiary_str.bright_green(), - "valid_from:".dimmed(), - valid_from_str.bright_green(), - "💡 Info:".cyan(), - "Vote YES if you approve this Treasury spend, NO to reject.".cyan() - )) -} diff --git a/src/cli/tech_referenda.rs b/src/cli/tech_referenda.rs deleted file mode 100644 index 03e5e04..0000000 --- a/src/cli/tech_referenda.rs +++ /dev/null @@ -1,718 +0,0 @@ -//! `quantus tech-referenda` subcommand - manage Tech Referenda proposals -use crate::{ - chain::quantus_subxt, cli::common::submit_transaction, error::QuantusError, log_error, - log_print, log_success, log_verbose, -}; -use clap::Subcommand; -use colored::Colorize; -use std::{path::PathBuf, str::FromStr}; - -/// Tech Referenda management commands -#[derive(Subcommand, Debug)] -pub enum TechReferendaCommands { - /// Submit a runtime upgrade proposal to Tech Referenda (requires existing preimage) - Submit { - /// Preimage hash (must already exist on chain) - #[arg(long)] - preimage_hash: String, - - /// Wallet name to sign with (must be a Tech Collective member or root) - #[arg(short, long)] - from: String, - - /// Password for the wallet - #[arg(short, long)] - password: Option, - - /// Read password from file - #[arg(long)] - password_file: Option, - }, - - /// Submit a runtime upgrade proposal to Tech Referenda (creates preimage first) - SubmitWithPreimage { - /// Path to the runtime WASM file - #[arg(short, long)] - wasm_file: PathBuf, - - /// Wallet name to sign with (must be a Tech Collective member or root) - #[arg(short, long)] - from: String, - - /// Password for the wallet - #[arg(short, long)] - password: Option, - - /// Read password from file - #[arg(long)] - password_file: Option, - }, - - /// List all active Tech Referenda proposals - List, - - /// Get details of a specific Tech Referendum - Get { - /// Referendum index - #[arg(short, long)] - index: u32, - }, - - /// Check the status of a Tech Referendum - Status { - /// Referendum index - #[arg(short, long)] - index: u32, - }, - - /// Place a decision deposit for a Tech Referendum - PlaceDecisionDeposit { - /// Referendum index - #[arg(short, long)] - index: u32, - - /// Wallet name to sign with - #[arg(short, long)] - from: String, - - /// Password for the wallet - #[arg(short, long)] - password: Option, - - /// Read password from file - #[arg(long)] - password_file: Option, - }, - - /// Cancel a Tech Referendum (requires root permissions) - Cancel { - /// Referendum index to cancel - #[arg(short, long)] - index: u32, - - /// Wallet name to sign with (must have root permissions) - #[arg(short, long)] - from: String, - - /// Password for the wallet - #[arg(short, long)] - password: Option, - - /// Read password from file - #[arg(long)] - password_file: Option, - }, - - /// Kill a Tech Referendum (requires root permissions) - Kill { - /// Referendum index to kill - #[arg(short, long)] - index: u32, - - /// Wallet name to sign with (must have root permissions) - #[arg(short, long)] - from: String, - - /// Password for the wallet - #[arg(short, long)] - password: Option, - - /// Read password from file - #[arg(long)] - password_file: Option, - }, - - /// Nudge a Tech Referendum to next phase (sudo origin) - Nudge { - /// Referendum index to nudge - #[arg(short, long)] - index: u32, - - /// Wallet name to sign with - #[arg(short, long)] - from: String, - - /// Password for the wallet - #[arg(short, long)] - password: Option, - - /// Read password from file - #[arg(long)] - password_file: Option, - }, - - /// Refund submission deposit for a completed Tech Referendum - RefundSubmissionDeposit { - /// Referendum index - #[arg(short, long)] - index: u32, - - /// Wallet name that submitted the referendum - #[arg(short, long)] - from: String, - - /// Password for the wallet - #[arg(short, long)] - password: Option, - - /// Read password from file - #[arg(long)] - password_file: Option, - }, - - /// Refund decision deposit for a completed Tech Referendum - RefundDecisionDeposit { - /// Referendum index - #[arg(short, long)] - index: u32, - - /// Wallet name that placed the decision deposit - #[arg(short, long)] - from: String, - - /// Password for the wallet - #[arg(short, long)] - password: Option, - - /// Read password from file - #[arg(long)] - password_file: Option, - }, - - /// Get Tech Referenda configuration - Config, -} - -/// Handle tech referenda commands -pub async fn handle_tech_referenda_command( - command: TechReferendaCommands, - node_url: &str, -) -> crate::error::Result<()> { - let quantus_client = crate::chain::client::QuantusClient::new(node_url).await?; - - match command { - TechReferendaCommands::Submit { preimage_hash, from, password, password_file } => - submit_runtime_upgrade(&quantus_client, &preimage_hash, &from, password, password_file) - .await, - TechReferendaCommands::SubmitWithPreimage { wasm_file, from, password, password_file } => - submit_runtime_upgrade_with_preimage( - &quantus_client, - &wasm_file, - &from, - password, - password_file, - ) - .await, - TechReferendaCommands::List => list_proposals(&quantus_client).await, - TechReferendaCommands::Get { index } => get_proposal_details(&quantus_client, index).await, - TechReferendaCommands::Status { index } => - get_proposal_status(&quantus_client, index).await, - TechReferendaCommands::PlaceDecisionDeposit { index, from, password, password_file } => - place_decision_deposit(&quantus_client, index, &from, password, password_file).await, - TechReferendaCommands::Cancel { index, from, password, password_file } => - cancel_proposal(&quantus_client, index, &from, password, password_file).await, - TechReferendaCommands::Kill { index, from, password, password_file } => - kill_proposal(&quantus_client, index, &from, password, password_file).await, - TechReferendaCommands::Nudge { index, from, password, password_file } => - nudge_proposal(&quantus_client, index, &from, password, password_file).await, - TechReferendaCommands::RefundSubmissionDeposit { index, from, password, password_file } => - refund_submission_deposit(&quantus_client, index, &from, password, password_file).await, - TechReferendaCommands::RefundDecisionDeposit { index, from, password, password_file } => - refund_decision_deposit(&quantus_client, index, &from, password, password_file).await, - TechReferendaCommands::Config => get_config(&quantus_client).await, - } -} - -/// Submit a runtime upgrade proposal to Tech Referenda (uses existing preimage) -async fn submit_runtime_upgrade( - quantus_client: &crate::chain::client::QuantusClient, - preimage_hash: &str, - from: &str, - password: Option, - password_file: Option, -) -> crate::error::Result<()> { - log_print!("📝 Submitting Runtime Upgrade Proposal to Tech Referenda"); - log_print!(" 🔗 Preimage hash: {}", preimage_hash.bright_cyan()); - log_print!(" 🔑 Submitted by: {}", from.bright_yellow()); - - // Parse preimage hash (trim 0x) - let hash_str = preimage_hash.trim_start_matches("0x"); - let preimage_hash_parsed: sp_core::H256 = sp_core::H256::from_str(hash_str) - .map_err(|_| QuantusError::Generic("Invalid preimage hash format".to_string()))?; - - // Load wallet keypair - let keypair = crate::wallet::load_keypair_from_wallet(from, password, password_file)?; - - // Check if preimage exists and get its length - log_print!("🔍 Checking preimage status..."); - let latest_block_hash = quantus_client.get_latest_block().await?; - let storage_at = quantus_client.client().storage().at(latest_block_hash); - - let preimage_status = storage_at - .fetch( - &quantus_subxt::api::storage() - .preimage() - .request_status_for(preimage_hash_parsed), - ) - .await - .map_err(|e| QuantusError::Generic(format!("Failed to fetch preimage status: {:?}", e)))? - .ok_or_else(|| QuantusError::Generic("Preimage not found on chain".to_string()))?; - - let preimage_len = match preimage_status { - quantus_subxt::api::runtime_types::pallet_preimage::RequestStatus::Unrequested { - ticket: _, - len, - } => len, - quantus_subxt::api::runtime_types::pallet_preimage::RequestStatus::Requested { - maybe_ticket: _, - count: _, - maybe_len, - } => match maybe_len { - Some(len) => len, - None => return Err(QuantusError::Generic("Preimage length not available".to_string())), - }, - }; - - log_print!("✅ Preimage found! Length: {} bytes", preimage_len); - - // Build TechReferenda::submit call using Lookup preimage reference - type ProposalBounded = - quantus_subxt::api::runtime_types::frame_support::traits::preimages::Bounded< - quantus_subxt::api::runtime_types::quantus_runtime::RuntimeCall, - quantus_subxt::api::runtime_types::qp_poseidon::PoseidonHasher, - >; - - let preimage_hash_subxt: subxt::utils::H256 = preimage_hash_parsed; - let proposal: ProposalBounded = - ProposalBounded::Lookup { hash: preimage_hash_subxt, len: preimage_len }; - - let raw_origin_root = - quantus_subxt::api::runtime_types::frame_support::dispatch::RawOrigin::Root; - let origin_caller = - quantus_subxt::api::runtime_types::quantus_runtime::OriginCaller::system(raw_origin_root); - - let enactment = - quantus_subxt::api::runtime_types::frame_support::traits::schedule::DispatchTime::After( - 0u32, - ); - - log_print!("🔧 Creating TechReferenda::submit call..."); - let submit_call = - quantus_subxt::api::tx() - .tech_referenda() - .submit(origin_caller, proposal, enactment); - - let tx_hash = submit_transaction(quantus_client, &keypair, submit_call, None).await?; - log_print!( - "✅ {} Runtime upgrade proposal submitted! Hash: {:?}", - "SUCCESS".bright_green().bold(), - tx_hash - ); - - log_print!("💡 Use 'quantus tech-referenda list' to see active proposals"); - Ok(()) -} - -/// Submit a runtime upgrade proposal to Tech Referenda (creates preimage first) -async fn submit_runtime_upgrade_with_preimage( - quantus_client: &crate::chain::client::QuantusClient, - wasm_file: &PathBuf, - from: &str, - password: Option, - password_file: Option, -) -> crate::error::Result<()> { - use qp_poseidon::PoseidonHasher; - - log_print!("📝 Submitting Runtime Upgrade Proposal to Tech Referenda"); - log_print!(" 📂 WASM file: {}", wasm_file.display().to_string().bright_cyan()); - log_print!(" 🔑 Submitted by: {}", from.bright_yellow()); - - if !wasm_file.exists() { - return Err(QuantusError::Generic(format!("WASM file not found: {}", wasm_file.display()))); - } - - if let Some(ext) = wasm_file.extension() { - if ext != "wasm" { - log_verbose!("âš ī¸ Warning: File doesn't have .wasm extension"); - } - } - - // Read WASM file - let wasm_code = std::fs::read(wasm_file) - .map_err(|e| QuantusError::Generic(format!("Failed to read WASM file: {}", e)))?; - - log_print!("📊 WASM file size: {} bytes", wasm_code.len()); - - // Load wallet keypair - let keypair = crate::wallet::load_keypair_from_wallet(from, password, password_file)?; - - // Build a static payload for System::set_code and encode full call data (pallet + call + args) - let set_code_payload = quantus_subxt::api::tx().system().set_code(wasm_code.clone()); - let metadata = quantus_client.client().metadata(); - let encoded_call = <_ as subxt::tx::Payload>::encode_call_data(&set_code_payload, &metadata) - .map_err(|e| QuantusError::Generic(format!("Failed to encode call data: {:?}", e)))?; - - log_verbose!("📝 Encoded call size: {} bytes", encoded_call.len()); - - // Compute preimage hash using Poseidon (runtime uses PoseidonHasher) - let preimage_hash: sp_core::H256 = - ::hash(&encoded_call); - - log_print!("🔗 Preimage hash: {:?}", preimage_hash); - - // Submit Preimage::note_preimage with bounded bytes - type PreimageBytes = quantus_subxt::api::preimage::calls::types::note_preimage::Bytes; - let bounded_bytes: PreimageBytes = encoded_call.clone(); - - log_print!("📝 Submitting preimage..."); - let note_preimage_tx = quantus_subxt::api::tx().preimage().note_preimage(bounded_bytes); - let preimage_tx_hash = - submit_transaction(quantus_client, &keypair, note_preimage_tx, None).await?; - log_print!("✅ Preimage transaction submitted: {:?}", preimage_tx_hash); - - // Wait for preimage transaction confirmation - log_print!("âŗ Waiting for preimage transaction confirmation..."); - - // Build TechReferenda::submit call using Lookup preimage reference - type ProposalBounded = - quantus_subxt::api::runtime_types::frame_support::traits::preimages::Bounded< - quantus_subxt::api::runtime_types::quantus_runtime::RuntimeCall, - quantus_subxt::api::runtime_types::qp_poseidon::PoseidonHasher, - >; - - let preimage_hash_subxt: subxt::utils::H256 = preimage_hash; - let proposal: ProposalBounded = - ProposalBounded::Lookup { hash: preimage_hash_subxt, len: encoded_call.len() as u32 }; - - let raw_origin_root = - quantus_subxt::api::runtime_types::frame_support::dispatch::RawOrigin::Root; - let origin_caller = - quantus_subxt::api::runtime_types::quantus_runtime::OriginCaller::system(raw_origin_root); - - let enactment = - quantus_subxt::api::runtime_types::frame_support::traits::schedule::DispatchTime::After( - 0u32, - ); - - log_print!("🔧 Creating TechReferenda::submit call..."); - let submit_call = - quantus_subxt::api::tx() - .tech_referenda() - .submit(origin_caller, proposal, enactment); - - let tx_hash = submit_transaction(quantus_client, &keypair, submit_call, None).await?; - log_print!( - "✅ {} Runtime upgrade proposal submitted! Hash: {:?}", - "SUCCESS".bright_green().bold(), - tx_hash - ); - - log_print!("💡 Use 'quantus tech-referenda list' to see active proposals"); - Ok(()) -} - -/// List recent Tech Referenda proposals -async fn list_proposals( - quantus_client: &crate::chain::client::QuantusClient, -) -> crate::error::Result<()> { - log_print!("📜 Active Tech Referenda Proposals"); - log_print!(""); - - let addr = quantus_subxt::api::storage().tech_referenda().referendum_count(); - - // Get the latest block hash to read from the latest state (not finalized) - let latest_block_hash = quantus_client.get_latest_block().await?; - let storage_at = quantus_client.client().storage().at(latest_block_hash); - - let count = storage_at.fetch(&addr).await?; - - if let Some(total) = count { - log_print!("📊 Total referenda created: {}", total); - if total == 0 { - log_print!("📭 No active proposals found"); - return Ok(()); - } - log_print!("🔍 Fetching recent referenda..."); - for i in (0..total).rev().take(10) { - get_proposal_status(quantus_client, i).await?; - log_print!("----------------------------------------"); - } - } else { - log_print!("📭 No referenda found - Tech Referenda may be empty"); - } - - Ok(()) -} - -/// Get details of a specific Tech Referendum -async fn get_proposal_details( - quantus_client: &crate::chain::client::QuantusClient, - index: u32, -) -> crate::error::Result<()> { - log_print!("📄 Tech Referendum #{} Details", index); - log_print!(""); - - let addr = quantus_subxt::api::storage().tech_referenda().referendum_info_for(index); - - // Get the latest block hash to read from the latest state (not finalized) - let latest_block_hash = quantus_client.get_latest_block().await?; - let storage_at = quantus_client.client().storage().at(latest_block_hash); - - let info = storage_at.fetch(&addr).await?; - - if let Some(referendum_info) = info { - log_print!("📋 Referendum Information (raw):"); - log_print!("{:#?}", referendum_info); - } else { - log_print!("📭 Referendum #{} not found", index); - } - Ok(()) -} - -/// Get the status of a Tech Referendum -async fn get_proposal_status( - quantus_client: &crate::chain::client::QuantusClient, - index: u32, -) -> crate::error::Result<()> { - use quantus_subxt::api::runtime_types::pallet_referenda::types::ReferendumInfo; - - log_verbose!("📊 Fetching status for Tech Referendum #{}...", index); - - let addr = quantus_subxt::api::storage().tech_referenda().referendum_info_for(index); - - // Get the latest block hash to read from the latest state (not finalized) - let latest_block_hash = quantus_client.get_latest_block().await?; - let storage_at = quantus_client.client().storage().at(latest_block_hash); - - let info_res = storage_at.fetch(&addr).await; - - match info_res { - Ok(Some(info)) => { - log_print!("📊 Status for Referendum #{}", index.to_string().bright_yellow()); - match info { - ReferendumInfo::Ongoing(status) => { - log_print!(" - Status: {}", "Ongoing".bright_green()); - log_print!(" - Track: {}", status.track); - log_print!(" - Submitted at: block {}", status.submitted); - log_print!( - " - Tally: Ayes: {}, Nays: {}", - status.tally.ayes, - status.tally.nays - ); - log_verbose!(" - Full status: {:#?}", status); - }, - ReferendumInfo::Approved(submitted, ..) => { - log_print!(" - Status: {}", "Approved".green()); - log_print!(" - Submitted at block: {}", submitted); - }, - ReferendumInfo::Rejected(submitted, ..) => { - log_print!(" - Status: {}", "Rejected".red()); - log_print!(" - Submitted at block: {}", submitted); - }, - ReferendumInfo::Cancelled(submitted, ..) => { - log_print!(" - Status: {}", "Cancelled".yellow()); - log_print!(" - Submitted at block: {}", submitted); - }, - ReferendumInfo::TimedOut(submitted, ..) => { - log_print!(" - Status: {}", "TimedOut".dimmed()); - log_print!(" - Submitted at block: {}", submitted); - }, - ReferendumInfo::Killed(submitted) => { - log_print!(" - Status: {}", "Killed".red().bold()); - log_print!(" - Killed at block: {}", submitted); - }, - } - }, - Ok(None) => log_print!("📭 Referendum #{} not found", index), - Err(e) => log_error!("❌ Failed to fetch referendum #{}: {:?}", index, e), - } - - Ok(()) -} - -/// Place a decision deposit for a Tech Referendum -async fn place_decision_deposit( - quantus_client: &crate::chain::client::QuantusClient, - index: u32, - from: &str, - password: Option, - password_file: Option, -) -> crate::error::Result<()> { - log_print!("📋 Placing decision deposit for Tech Referendum #{}", index); - log_print!(" 🔑 Placed by: {}", from.bright_yellow()); - - let keypair = crate::wallet::load_keypair_from_wallet(from, password, password_file)?; - - let deposit_call = quantus_subxt::api::tx().tech_referenda().place_decision_deposit(index); - let tx_hash = submit_transaction(quantus_client, &keypair, deposit_call, None).await?; - log_success!("✅ Decision deposit placed! Hash: {:?}", tx_hash.to_string().bright_yellow()); - Ok(()) -} - -/// Cancel a Tech Referendum (sudo) -async fn cancel_proposal( - quantus_client: &crate::chain::client::QuantusClient, - index: u32, - from: &str, - password: Option, - password_file: Option, -) -> crate::error::Result<()> { - log_print!("❌ Cancelling Tech Referendum #{}", index); - log_print!(" 🔑 Cancelled by: {}", from.bright_yellow()); - - let keypair = crate::wallet::load_keypair_from_wallet(from, password, password_file)?; - - let inner = - quantus_subxt::api::Call::TechReferenda(quantus_subxt::api::tech_referenda::Call::cancel { - index, - }); - let sudo_call = quantus_subxt::api::tx().sudo().sudo(inner); - - let tx_hash = submit_transaction(quantus_client, &keypair, sudo_call, None).await?; - log_success!("✅ Referendum cancelled! Hash: {:?}", tx_hash.to_string().bright_yellow()); - Ok(()) -} - -/// Kill a Tech Referendum (sudo) -async fn kill_proposal( - quantus_client: &crate::chain::client::QuantusClient, - index: u32, - from: &str, - password: Option, - password_file: Option, -) -> crate::error::Result<()> { - log_print!("💀 Killing Tech Referendum #{}", index); - log_print!(" 🔑 Killed by: {}", from.bright_yellow()); - - let keypair = crate::wallet::load_keypair_from_wallet(from, password, password_file)?; - - let inner = - quantus_subxt::api::Call::TechReferenda(quantus_subxt::api::tech_referenda::Call::kill { - index, - }); - let sudo_call = quantus_subxt::api::tx().sudo().sudo(inner); - - let tx_hash = submit_transaction(quantus_client, &keypair, sudo_call, None).await?; - log_success!("✅ Referendum killed! Hash: {:?}", tx_hash.to_string().bright_yellow()); - Ok(()) -} - -/// Nudge a Tech Referendum to next phase (sudo) -async fn nudge_proposal( - quantus_client: &crate::chain::client::QuantusClient, - index: u32, - from: &str, - password: Option, - password_file: Option, -) -> crate::error::Result<()> { - log_print!("🔄 Nudging Tech Referendum #{}", index); - log_print!(" 🔑 Nudged by: {}", from.bright_yellow()); - - let keypair = crate::wallet::load_keypair_from_wallet(from, password, password_file)?; - - let inner = quantus_subxt::api::Call::TechReferenda( - quantus_subxt::api::tech_referenda::Call::nudge_referendum { index }, - ); - let sudo_call = quantus_subxt::api::tx().sudo().sudo(inner); - - let tx_hash = submit_transaction(quantus_client, &keypair, sudo_call, None).await?; - log_success!("✅ Referendum nudged! Hash: {:?}", tx_hash.to_string().bright_yellow()); - Ok(()) -} - -/// Get Tech Referenda configuration -async fn get_config( - quantus_client: &crate::chain::client::QuantusClient, -) -> crate::error::Result<()> { - log_print!("âš™ī¸ Tech Referenda Configuration"); - log_print!(""); - - let constants = quantus_client.client().constants(); - let tracks_addr = quantus_subxt::api::constants().tech_referenda().tracks(); - - match constants.at(&tracks_addr) { - Ok(tracks) => { - log_print!("{}", "📊 Track Configuration:".bold()); - for (id, info) in tracks.iter() { - log_print!(" ------------------------------------"); - log_print!( - " â€ĸ {} #{}: {}", - "Track".bold(), - id, - info.name.to_string().bright_cyan() - ); - log_print!(" â€ĸ Max Deciding: {}", info.max_deciding); - log_print!(" â€ĸ Decision Deposit: {}", info.decision_deposit); - log_print!(" â€ĸ Prepare Period: {} blocks", info.prepare_period); - log_print!(" â€ĸ Decision Period: {} blocks", info.decision_period); - log_print!(" â€ĸ Confirm Period: {} blocks", info.confirm_period); - log_print!(" â€ĸ Min Enactment Period: {} blocks", info.min_enactment_period); - } - log_print!(" ------------------------------------"); - }, - Err(e) => { - log_error!("❌ Failed to decode Tracks constant: {:?}", e); - log_print!("💡 It's possible the Tracks constant is not in the expected format."); - }, - } - - Ok(()) -} - -/// Refund submission deposit for a completed Tech Referendum -async fn refund_submission_deposit( - quantus_client: &crate::chain::client::QuantusClient, - index: u32, - from: &str, - password: Option, - password_file: Option, -) -> crate::error::Result<()> { - log_print!("💰 Refunding submission deposit for Tech Referendum #{}", index); - log_print!(" 🔑 Refund to: {}", from.bright_yellow()); - - // Load wallet keypair - let keypair = crate::wallet::load_keypair_from_wallet(from, password, password_file)?; - - // Create refund_submission_deposit call for TechReferenda instance - let refund_call = quantus_subxt::api::tx().tech_referenda().refund_submission_deposit(index); - - let tx_hash = submit_transaction(quantus_client, &keypair, refund_call, None).await?; - log_print!( - "✅ {} Refund transaction submitted! Hash: {:?}", - "SUCCESS".bright_green().bold(), - tx_hash - ); - - log_success!("🎉 {} Submission deposit refunded!", "FINISHED".bright_green().bold()); - log_print!("💡 Check your balance to confirm the refund"); - Ok(()) -} - -/// Refund decision deposit for a completed Tech Referendum -async fn refund_decision_deposit( - quantus_client: &crate::chain::client::QuantusClient, - index: u32, - from: &str, - password: Option, - password_file: Option, -) -> crate::error::Result<()> { - log_print!("💰 Refunding decision deposit for Tech Referendum #{}", index); - log_print!(" 🔑 Refund to: {}", from.bright_yellow()); - - // Load wallet keypair - let keypair = crate::wallet::load_keypair_from_wallet(from, password, password_file)?; - - // Create refund_decision_deposit call for TechReferenda instance - let refund_call = quantus_subxt::api::tx().tech_referenda().refund_decision_deposit(index); - - let tx_hash = submit_transaction(quantus_client, &keypair, refund_call, None).await?; - log_print!( - "✅ {} Refund transaction submitted! Hash: {:?}", - "SUCCESS".bright_green().bold(), - tx_hash - ); - - log_success!("🎉 {} Decision deposit refunded!", "FINISHED".bright_green().bold()); - log_print!("💡 Check your balance to confirm the refund"); - Ok(()) -} From 424236808424c358c12269ee4bd80e2954fab435 Mon Sep 17 00:00:00 2001 From: Dastan <88332432+dastansam@users.noreply.github.com> Date: Mon, 17 Nov 2025 20:59:53 +0600 Subject: [PATCH 03/14] Update poseidon deps --- Cargo.lock | 41 ++++------------------------------------- Cargo.toml | 2 +- 2 files changed, 5 insertions(+), 38 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ee03d0c..4484fde 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3363,7 +3363,7 @@ checksum = "fb2f13d8793f7a79c42d33e4ebe9d470fe938dc55592ef97ef42d4298aa6a976" dependencies = [ "log", "parity-scale-codec", - "qp-poseidon 1.0.1", + "qp-poseidon", "qp-rusty-crystals-dilithium", "qp-rusty-crystals-hdwallet", "scale-info", @@ -3373,25 +3373,6 @@ dependencies = [ "thiserror 1.0.69", ] -[[package]] -name = "qp-poseidon" -version = "0.9.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33181134496120c212a0a2098215cf45a68d50fe656de6fb30b31e73babe9383" -dependencies = [ - "log", - "p3-field", - "p3-goldilocks", - "parity-scale-codec", - "qp-poseidon-core 0.9.5", - "scale-info", - "serde", - "sp-core", - "sp-runtime", - "sp-storage", - "sp-trie", -] - [[package]] name = "qp-poseidon" version = "1.0.1" @@ -3402,7 +3383,7 @@ dependencies = [ "p3-field", "p3-goldilocks", "parity-scale-codec", - "qp-poseidon-core 1.0.1", + "qp-poseidon-core", "scale-info", "serde", "sp-core", @@ -3424,20 +3405,6 @@ dependencies = [ "rand_chacha 0.9.0", ] -[[package]] -name = "qp-poseidon-core" -version = "0.9.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec326fc2631a929de09a38af2613a3db5230882c12a2f68205693ec632751e8b" -dependencies = [ - "p3-field", - "p3-goldilocks", - "p3-poseidon2", - "p3-symmetric", - "rand 0.9.2", - "rand_chacha 0.9.0", -] - [[package]] name = "qp-poseidon-core" version = "1.0.1" @@ -3474,7 +3441,7 @@ dependencies = [ "hex", "hex-literal", "nam-tiny-hderive", - "qp-poseidon-core 1.0.1", + "qp-poseidon-core", "qp-rusty-crystals-dilithium", "rand_chacha 0.9.0", "rand_core 0.9.3", @@ -3497,7 +3464,7 @@ dependencies = [ "jsonrpsee", "parity-scale-codec", "qp-dilithium-crypto", - "qp-poseidon 0.9.5", + "qp-poseidon", "qp-rusty-crystals-dilithium", "qp-rusty-crystals-hdwallet", "rand 0.9.2", diff --git a/Cargo.toml b/Cargo.toml index bcd74ba..fccefaa 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -51,7 +51,7 @@ aes-gcm = "0.10" # AES-256-GCM (quantum-safe with 256-bit keys) # Quantus crypto dependencies qp-rusty-crystals-dilithium = { version = "2.0.0" } qp-rusty-crystals-hdwallet = { version = "1.0.0" } -qp-poseidon = { version = "0.9.5", features = [ +qp-poseidon = { version = "1.0.1", features = [ "serde", ] } qp-dilithium-crypto = { version = "0.2.0", features = ["serde"] } From 68a430f2c5c70b2de8a0b8e17a68c6072d4e2990 Mon Sep 17 00:00:00 2001 From: Dastan <88332432+dastansam@users.noreply.github.com> Date: Wed, 19 Nov 2025 13:26:49 +0600 Subject: [PATCH 04/14] Update metadata --- src/chain/quantus_subxt.rs | 485 +++++++++++++++++++++++++++++-------- src/quantus_metadata.scale | Bin 165263 -> 166458 bytes 2 files changed, 390 insertions(+), 95 deletions(-) diff --git a/src/chain/quantus_subxt.rs b/src/chain/quantus_subxt.rs index eb76445..f833791 100644 --- a/src/chain/quantus_subxt.rs +++ b/src/chain/quantus_subxt.rs @@ -6,7 +6,7 @@ pub mod api { mod root_mod { pub use super::*; } - pub static PALLETS: [&str; 22usize] = [ + pub static PALLETS: [&str; 23usize] = [ "System", "Timestamp", "Balances", @@ -29,6 +29,7 @@ pub mod api { "Recovery", "Assets", "AssetsHolder", + "Wormhole", ]; pub static RUNTIME_APIS: [&str; 11usize] = [ "Core", @@ -1472,10 +1473,9 @@ pub mod api { "query_call_info", types::QueryCallInfo { call, len }, [ - 166u8, 173u8, 176u8, 212u8, 240u8, 248u8, 215u8, 188u8, 215u8, 21u8, - 209u8, 116u8, 183u8, 186u8, 201u8, 229u8, 28u8, 26u8, 218u8, 247u8, - 99u8, 59u8, 155u8, 235u8, 205u8, 76u8, 165u8, 181u8, 148u8, 21u8, - 122u8, 86u8, + 124u8, 24u8, 108u8, 27u8, 208u8, 239u8, 216u8, 228u8, 57u8, 228u8, + 174u8, 239u8, 59u8, 192u8, 215u8, 42u8, 41u8, 201u8, 169u8, 7u8, 33u8, + 161u8, 23u8, 79u8, 0u8, 57u8, 32u8, 8u8, 13u8, 5u8, 138u8, 98u8, ], ) } @@ -1493,9 +1493,10 @@ pub mod api { "query_call_fee_details", types::QueryCallFeeDetails { call, len }, [ - 18u8, 80u8, 212u8, 196u8, 230u8, 162u8, 108u8, 100u8, 130u8, 14u8, - 44u8, 76u8, 26u8, 143u8, 202u8, 61u8, 26u8, 132u8, 34u8, 112u8, 49u8, - 183u8, 31u8, 51u8, 122u8, 49u8, 37u8, 229u8, 87u8, 43u8, 107u8, 82u8, + 250u8, 80u8, 231u8, 164u8, 228u8, 157u8, 118u8, 66u8, 94u8, 60u8, + 100u8, 68u8, 96u8, 22u8, 100u8, 185u8, 1u8, 160u8, 77u8, 30u8, 126u8, + 180u8, 230u8, 117u8, 99u8, 101u8, 101u8, 49u8, 237u8, 192u8, 219u8, + 41u8, ], ) } @@ -1868,6 +1869,9 @@ pub mod api { pub fn assets(&self) -> assets::constants::ConstantsApi { assets::constants::ConstantsApi } + pub fn wormhole(&self) -> wormhole::constants::ConstantsApi { + wormhole::constants::ConstantsApi + } } pub struct StorageApi; impl StorageApi { @@ -1931,6 +1935,9 @@ pub mod api { pub fn assets_holder(&self) -> assets_holder::storage::StorageApi { assets_holder::storage::StorageApi } + pub fn wormhole(&self) -> wormhole::storage::StorageApi { + wormhole::storage::StorageApi + } } pub struct TransactionApi; impl TransactionApi { @@ -1985,6 +1992,9 @@ pub mod api { pub fn assets(&self) -> assets::calls::TransactionApi { assets::calls::TransactionApi } + pub fn wormhole(&self) -> wormhole::calls::TransactionApi { + wormhole::calls::TransactionApi + } } pub struct ViewFunctionsApi; impl ViewFunctionsApi {} @@ -1997,9 +2007,9 @@ pub mod api { .hash(); runtime_metadata_hash == [ - 194u8, 46u8, 30u8, 103u8, 67u8, 25u8, 224u8, 42u8, 104u8, 224u8, 105u8, 213u8, - 149u8, 58u8, 199u8, 151u8, 221u8, 215u8, 141u8, 247u8, 109u8, 85u8, 204u8, 202u8, - 96u8, 104u8, 173u8, 94u8, 198u8, 124u8, 113u8, 174u8, + 0u8, 63u8, 162u8, 224u8, 195u8, 69u8, 233u8, 104u8, 127u8, 217u8, 171u8, 115u8, + 255u8, 248u8, 177u8, 84u8, 158u8, 190u8, 76u8, 185u8, 144u8, 155u8, 69u8, 210u8, + 153u8, 253u8, 206u8, 43u8, 20u8, 28u8, 169u8, 236u8, ] } pub mod system { @@ -3098,10 +3108,9 @@ pub mod api { "Events", (), [ - 153u8, 144u8, 222u8, 32u8, 219u8, 80u8, 161u8, 232u8, 120u8, 168u8, - 102u8, 147u8, 49u8, 48u8, 3u8, 26u8, 255u8, 126u8, 218u8, 117u8, 254u8, - 217u8, 170u8, 206u8, 182u8, 174u8, 251u8, 53u8, 253u8, 242u8, 26u8, - 74u8, + 19u8, 73u8, 6u8, 2u8, 209u8, 127u8, 197u8, 110u8, 228u8, 146u8, 149u8, + 129u8, 191u8, 123u8, 182u8, 64u8, 160u8, 106u8, 123u8, 149u8, 123u8, + 193u8, 14u8, 100u8, 42u8, 223u8, 34u8, 212u8, 161u8, 98u8, 44u8, 49u8, ], ) } @@ -4616,6 +4625,31 @@ pub mod api { const PALLET: &'static str = "Balances"; const EVENT: &'static str = "TotalIssuanceForced"; } + #[derive( + :: subxt :: ext :: subxt_core :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: subxt_core :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] + #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] + #[doc = "Transfer proof was stored."] + pub struct TransferProofStored { + pub transfer_count: transfer_proof_stored::TransferCount, + pub source: transfer_proof_stored::Source, + pub dest: transfer_proof_stored::Dest, + pub funding_amount: transfer_proof_stored::FundingAmount, + } + pub mod transfer_proof_stored { + use super::runtime_types; + pub type TransferCount = ::core::primitive::u64; + pub type Source = ::subxt::ext::subxt_core::utils::AccountId32; + pub type Dest = ::subxt::ext::subxt_core::utils::AccountId32; + pub type FundingAmount = ::core::primitive::u128; + } + impl ::subxt::ext::subxt_core::events::StaticEvent for TransferProofStored { + const PALLET: &'static str = "Balances"; + const EVENT: &'static str = "TransferProofStored"; + } } pub mod storage { use super::runtime_types; @@ -5463,9 +5497,9 @@ pub mod api { call: ::subxt::ext::subxt_core::alloc::boxed::Box::new(call), }, [ - 35u8, 97u8, 151u8, 80u8, 160u8, 5u8, 249u8, 161u8, 124u8, 31u8, 46u8, - 45u8, 205u8, 88u8, 85u8, 115u8, 98u8, 172u8, 229u8, 119u8, 45u8, 74u8, - 176u8, 35u8, 216u8, 58u8, 23u8, 103u8, 209u8, 201u8, 15u8, 61u8, + 86u8, 27u8, 250u8, 23u8, 151u8, 9u8, 221u8, 180u8, 232u8, 7u8, 44u8, + 235u8, 50u8, 104u8, 247u8, 184u8, 102u8, 4u8, 48u8, 196u8, 84u8, 123u8, + 30u8, 123u8, 85u8, 124u8, 151u8, 25u8, 83u8, 221u8, 50u8, 226u8, ], ) } @@ -5488,10 +5522,9 @@ pub mod api { weight, }, [ - 129u8, 254u8, 188u8, 113u8, 132u8, 176u8, 63u8, 138u8, 200u8, 84u8, - 62u8, 198u8, 140u8, 161u8, 52u8, 222u8, 184u8, 140u8, 204u8, 144u8, - 247u8, 118u8, 46u8, 126u8, 211u8, 117u8, 140u8, 227u8, 105u8, 74u8, - 162u8, 225u8, + 182u8, 73u8, 169u8, 247u8, 46u8, 137u8, 24u8, 91u8, 219u8, 22u8, 25u8, + 193u8, 10u8, 234u8, 25u8, 205u8, 215u8, 83u8, 83u8, 26u8, 250u8, 195u8, + 164u8, 108u8, 247u8, 77u8, 86u8, 233u8, 185u8, 14u8, 233u8, 6u8, ], ) } @@ -5529,10 +5562,10 @@ pub mod api { call: ::subxt::ext::subxt_core::alloc::boxed::Box::new(call), }, [ - 174u8, 114u8, 45u8, 150u8, 219u8, 165u8, 118u8, 166u8, 250u8, 85u8, - 15u8, 165u8, 148u8, 17u8, 160u8, 123u8, 198u8, 241u8, 78u8, 198u8, - 206u8, 131u8, 9u8, 107u8, 172u8, 188u8, 83u8, 6u8, 234u8, 14u8, 211u8, - 76u8, + 154u8, 244u8, 161u8, 46u8, 224u8, 242u8, 181u8, 54u8, 246u8, 56u8, + 180u8, 221u8, 178u8, 69u8, 160u8, 158u8, 238u8, 224u8, 137u8, 224u8, + 115u8, 26u8, 218u8, 51u8, 144u8, 218u8, 78u8, 236u8, 165u8, 238u8, 5u8, + 33u8, ], ) } @@ -7610,10 +7643,9 @@ pub mod api { call: ::subxt::ext::subxt_core::alloc::boxed::Box::new(call), }, [ - 171u8, 151u8, 176u8, 198u8, 154u8, 6u8, 181u8, 56u8, 10u8, 6u8, 38u8, - 136u8, 64u8, 214u8, 145u8, 96u8, 121u8, 125u8, 161u8, 234u8, 247u8, - 156u8, 152u8, 119u8, 122u8, 165u8, 125u8, 238u8, 12u8, 214u8, 135u8, - 21u8, + 125u8, 78u8, 236u8, 0u8, 94u8, 174u8, 252u8, 109u8, 210u8, 132u8, 29u8, + 112u8, 44u8, 65u8, 73u8, 253u8, 86u8, 230u8, 65u8, 52u8, 161u8, 234u8, + 74u8, 178u8, 132u8, 229u8, 110u8, 243u8, 240u8, 3u8, 34u8, 245u8, ], ) } @@ -7655,9 +7687,10 @@ pub mod api { call: ::subxt::ext::subxt_core::alloc::boxed::Box::new(call), }, [ - 99u8, 222u8, 117u8, 153u8, 121u8, 239u8, 26u8, 216u8, 66u8, 132u8, - 220u8, 8u8, 92u8, 137u8, 253u8, 47u8, 9u8, 8u8, 103u8, 1u8, 116u8, - 133u8, 237u8, 51u8, 73u8, 145u8, 141u8, 64u8, 210u8, 10u8, 74u8, 191u8, + 239u8, 122u8, 34u8, 125u8, 56u8, 62u8, 199u8, 184u8, 247u8, 111u8, + 102u8, 80u8, 111u8, 14u8, 86u8, 113u8, 222u8, 120u8, 142u8, 223u8, + 41u8, 160u8, 217u8, 210u8, 238u8, 4u8, 112u8, 244u8, 52u8, 101u8, 50u8, + 196u8, ], ) } @@ -7696,10 +7729,10 @@ pub mod api { call: ::subxt::ext::subxt_core::alloc::boxed::Box::new(call), }, [ - 236u8, 32u8, 229u8, 48u8, 43u8, 173u8, 230u8, 106u8, 109u8, 188u8, - 137u8, 151u8, 188u8, 102u8, 252u8, 210u8, 87u8, 146u8, 152u8, 251u8, - 128u8, 10u8, 230u8, 228u8, 168u8, 203u8, 77u8, 24u8, 125u8, 18u8, 52u8, - 201u8, + 254u8, 153u8, 225u8, 60u8, 41u8, 44u8, 134u8, 216u8, 75u8, 142u8, 22u8, + 162u8, 207u8, 33u8, 163u8, 39u8, 155u8, 217u8, 10u8, 86u8, 105u8, + 174u8, 110u8, 14u8, 15u8, 116u8, 55u8, 252u8, 144u8, 174u8, 122u8, + 49u8, ], ) } @@ -7724,9 +7757,9 @@ pub mod api { call: ::subxt::ext::subxt_core::alloc::boxed::Box::new(call), }, [ - 120u8, 118u8, 201u8, 138u8, 43u8, 75u8, 89u8, 65u8, 107u8, 106u8, 41u8, - 229u8, 55u8, 6u8, 141u8, 24u8, 116u8, 214u8, 215u8, 1u8, 209u8, 67u8, - 157u8, 238u8, 147u8, 31u8, 188u8, 133u8, 21u8, 7u8, 199u8, 202u8, + 220u8, 105u8, 133u8, 190u8, 222u8, 170u8, 54u8, 24u8, 52u8, 74u8, 38u8, + 40u8, 49u8, 202u8, 246u8, 238u8, 114u8, 242u8, 189u8, 247u8, 45u8, + 184u8, 23u8, 60u8, 64u8, 26u8, 173u8, 94u8, 8u8, 121u8, 4u8, 55u8, ], ) } @@ -8103,7 +8136,7 @@ pub mod api { [::core::primitive::u8; 32usize], runtime_types::frame_support::traits::preimages::Bounded< runtime_types::quantus_runtime::RuntimeCall, - runtime_types::quantus_runtime::PoseidonHeaderHasher, + runtime_types::qp_poseidon::PoseidonHasher, >, ::core::primitive::u32, runtime_types::quantus_runtime::OriginCaller, @@ -8754,10 +8787,9 @@ pub mod api { "batch", types::Batch { calls }, [ - 135u8, 106u8, 152u8, 39u8, 199u8, 163u8, 145u8, 186u8, 129u8, 115u8, - 214u8, 162u8, 12u8, 85u8, 57u8, 122u8, 211u8, 240u8, 143u8, 159u8, - 138u8, 37u8, 114u8, 8u8, 8u8, 236u8, 197u8, 23u8, 114u8, 2u8, 105u8, - 174u8, + 8u8, 14u8, 63u8, 36u8, 47u8, 180u8, 133u8, 150u8, 98u8, 46u8, 251u8, + 65u8, 127u8, 92u8, 106u8, 133u8, 181u8, 255u8, 175u8, 67u8, 153u8, + 238u8, 69u8, 73u8, 66u8, 99u8, 96u8, 13u8, 147u8, 128u8, 96u8, 201u8, ], ) } @@ -8787,9 +8819,9 @@ pub mod api { call: ::subxt::ext::subxt_core::alloc::boxed::Box::new(call), }, [ - 3u8, 102u8, 237u8, 140u8, 8u8, 207u8, 27u8, 204u8, 155u8, 162u8, 124u8, - 141u8, 172u8, 210u8, 89u8, 239u8, 113u8, 175u8, 41u8, 9u8, 150u8, - 130u8, 205u8, 125u8, 205u8, 199u8, 174u8, 85u8, 24u8, 13u8, 57u8, 19u8, + 240u8, 79u8, 20u8, 90u8, 191u8, 182u8, 34u8, 19u8, 193u8, 234u8, 213u8, + 178u8, 65u8, 218u8, 186u8, 74u8, 118u8, 209u8, 240u8, 129u8, 238u8, + 239u8, 91u8, 252u8, 78u8, 134u8, 163u8, 216u8, 147u8, 98u8, 30u8, 94u8, ], ) } @@ -8815,9 +8847,9 @@ pub mod api { "batch_all", types::BatchAll { calls }, [ - 76u8, 242u8, 205u8, 32u8, 158u8, 24u8, 255u8, 12u8, 97u8, 24u8, 211u8, - 63u8, 119u8, 183u8, 165u8, 217u8, 17u8, 178u8, 254u8, 230u8, 119u8, - 207u8, 207u8, 103u8, 39u8, 226u8, 55u8, 73u8, 233u8, 79u8, 60u8, 218u8, + 222u8, 8u8, 55u8, 135u8, 112u8, 82u8, 66u8, 76u8, 1u8, 9u8, 107u8, + 125u8, 153u8, 254u8, 59u8, 239u8, 61u8, 136u8, 189u8, 46u8, 91u8, 38u8, + 252u8, 97u8, 39u8, 215u8, 145u8, 174u8, 171u8, 47u8, 213u8, 6u8, ], ) } @@ -8840,10 +8872,9 @@ pub mod api { call: ::subxt::ext::subxt_core::alloc::boxed::Box::new(call), }, [ - 32u8, 108u8, 91u8, 136u8, 200u8, 228u8, 95u8, 44u8, 22u8, 92u8, 34u8, - 234u8, 170u8, 201u8, 4u8, 248u8, 16u8, 209u8, 103u8, 201u8, 207u8, - 160u8, 165u8, 231u8, 152u8, 222u8, 112u8, 63u8, 133u8, 61u8, 220u8, - 24u8, + 220u8, 56u8, 148u8, 222u8, 163u8, 153u8, 156u8, 238u8, 167u8, 7u8, + 58u8, 11u8, 0u8, 102u8, 165u8, 102u8, 104u8, 60u8, 212u8, 73u8, 160u8, + 29u8, 225u8, 115u8, 0u8, 55u8, 189u8, 160u8, 95u8, 119u8, 16u8, 17u8, ], ) } @@ -8869,9 +8900,9 @@ pub mod api { "force_batch", types::ForceBatch { calls }, [ - 26u8, 82u8, 61u8, 185u8, 19u8, 29u8, 151u8, 192u8, 24u8, 41u8, 115u8, - 237u8, 7u8, 38u8, 68u8, 5u8, 159u8, 117u8, 47u8, 138u8, 101u8, 126u8, - 255u8, 137u8, 144u8, 51u8, 244u8, 145u8, 113u8, 21u8, 123u8, 79u8, + 42u8, 74u8, 40u8, 136u8, 212u8, 238u8, 120u8, 35u8, 155u8, 233u8, 90u8, + 11u8, 103u8, 251u8, 234u8, 130u8, 172u8, 5u8, 219u8, 41u8, 231u8, 20u8, + 162u8, 99u8, 204u8, 189u8, 79u8, 21u8, 203u8, 90u8, 170u8, 161u8, ], ) } @@ -8894,10 +8925,10 @@ pub mod api { weight, }, [ - 131u8, 134u8, 250u8, 73u8, 141u8, 137u8, 137u8, 15u8, 206u8, 215u8, - 199u8, 239u8, 24u8, 84u8, 247u8, 50u8, 135u8, 223u8, 110u8, 205u8, - 96u8, 170u8, 74u8, 232u8, 152u8, 135u8, 235u8, 62u8, 110u8, 230u8, - 172u8, 229u8, + 203u8, 125u8, 63u8, 180u8, 29u8, 135u8, 10u8, 130u8, 245u8, 74u8, 95u8, + 40u8, 166u8, 188u8, 185u8, 246u8, 14u8, 191u8, 130u8, 108u8, 188u8, + 93u8, 163u8, 151u8, 253u8, 22u8, 181u8, 237u8, 241u8, 17u8, 245u8, + 61u8, ], ) } @@ -8937,10 +8968,10 @@ pub mod api { fallback: ::subxt::ext::subxt_core::alloc::boxed::Box::new(fallback), }, [ - 195u8, 146u8, 198u8, 20u8, 96u8, 236u8, 218u8, 101u8, 252u8, 17u8, - 41u8, 246u8, 142u8, 116u8, 243u8, 198u8, 237u8, 168u8, 11u8, 211u8, - 236u8, 184u8, 71u8, 173u8, 211u8, 0u8, 129u8, 231u8, 99u8, 189u8, - 229u8, 34u8, + 127u8, 165u8, 98u8, 125u8, 184u8, 176u8, 6u8, 2u8, 146u8, 14u8, 154u8, + 49u8, 52u8, 253u8, 35u8, 127u8, 216u8, 178u8, 115u8, 253u8, 150u8, + 191u8, 55u8, 119u8, 165u8, 206u8, 24u8, 23u8, 106u8, 204u8, 188u8, + 151u8, ], ) } @@ -8963,9 +8994,10 @@ pub mod api { call: ::subxt::ext::subxt_core::alloc::boxed::Box::new(call), }, [ - 52u8, 4u8, 122u8, 93u8, 231u8, 186u8, 88u8, 129u8, 36u8, 245u8, 176u8, - 117u8, 22u8, 203u8, 94u8, 115u8, 19u8, 27u8, 141u8, 63u8, 184u8, 171u8, - 146u8, 63u8, 124u8, 225u8, 135u8, 73u8, 51u8, 20u8, 60u8, 199u8, + 199u8, 2u8, 66u8, 203u8, 254u8, 202u8, 231u8, 19u8, 158u8, 151u8, + 157u8, 241u8, 252u8, 194u8, 188u8, 185u8, 59u8, 176u8, 72u8, 20u8, + 34u8, 248u8, 151u8, 147u8, 80u8, 251u8, 225u8, 219u8, 240u8, 79u8, + 139u8, 10u8, ], ) } @@ -9174,7 +9206,7 @@ pub mod api { pub type ProposalOrigin = runtime_types::quantus_runtime::OriginCaller; pub type Proposal = runtime_types::frame_support::traits::preimages::Bounded< runtime_types::quantus_runtime::RuntimeCall, - runtime_types::quantus_runtime::PoseidonHeaderHasher, + runtime_types::qp_poseidon::PoseidonHasher, >; pub type EnactmentMoment = runtime_types::frame_support::traits::schedule::DispatchTime< @@ -9665,7 +9697,7 @@ pub mod api { pub type Track = ::core::primitive::u16; pub type Proposal = runtime_types::frame_support::traits::preimages::Bounded< runtime_types::quantus_runtime::RuntimeCall, - runtime_types::quantus_runtime::PoseidonHeaderHasher, + runtime_types::qp_poseidon::PoseidonHasher, >; } impl ::subxt::ext::subxt_core::events::StaticEvent for Submitted { @@ -9759,7 +9791,7 @@ pub mod api { pub type Track = ::core::primitive::u16; pub type Proposal = runtime_types::frame_support::traits::preimages::Bounded< runtime_types::quantus_runtime::RuntimeCall, - runtime_types::quantus_runtime::PoseidonHeaderHasher, + runtime_types::qp_poseidon::PoseidonHasher, >; pub type Tally = runtime_types::pallet_conviction_voting::types::Tally<::core::primitive::u128>; @@ -10016,7 +10048,7 @@ pub mod api { ::core::primitive::u32, runtime_types::frame_support::traits::preimages::Bounded< runtime_types::quantus_runtime::RuntimeCall, - runtime_types::quantus_runtime::PoseidonHeaderHasher, + runtime_types::qp_poseidon::PoseidonHasher, >, ::core::primitive::u128, runtime_types::pallet_conviction_voting::types::Tally< @@ -10916,7 +10948,7 @@ pub mod api { ::core::primitive::u128, runtime_types::frame_support::traits::preimages::Bounded< runtime_types::quantus_runtime::RuntimeCall, - runtime_types::quantus_runtime::PoseidonHeaderHasher, + runtime_types::qp_poseidon::PoseidonHasher, >, >; pub type Param0 = ::subxt::ext::subxt_core::utils::H256; @@ -13176,7 +13208,7 @@ pub mod api { pub type ProposalOrigin = runtime_types::quantus_runtime::OriginCaller; pub type Proposal = runtime_types::frame_support::traits::preimages::Bounded< runtime_types::quantus_runtime::RuntimeCall, - runtime_types::quantus_runtime::PoseidonHeaderHasher, + runtime_types::qp_poseidon::PoseidonHasher, >; pub type EnactmentMoment = runtime_types::frame_support::traits::schedule::DispatchTime< @@ -13667,7 +13699,7 @@ pub mod api { pub type Track = ::core::primitive::u16; pub type Proposal = runtime_types::frame_support::traits::preimages::Bounded< runtime_types::quantus_runtime::RuntimeCall, - runtime_types::quantus_runtime::PoseidonHeaderHasher, + runtime_types::qp_poseidon::PoseidonHasher, >; } impl ::subxt::ext::subxt_core::events::StaticEvent for Submitted { @@ -13761,7 +13793,7 @@ pub mod api { pub type Track = ::core::primitive::u16; pub type Proposal = runtime_types::frame_support::traits::preimages::Bounded< runtime_types::quantus_runtime::RuntimeCall, - runtime_types::quantus_runtime::PoseidonHeaderHasher, + runtime_types::qp_poseidon::PoseidonHasher, >; pub type Tally = runtime_types::pallet_ranked_collective::Tally; } @@ -14012,7 +14044,7 @@ pub mod api { ::core::primitive::u32, runtime_types::frame_support::traits::preimages::Bounded< runtime_types::quantus_runtime::RuntimeCall, - runtime_types::quantus_runtime::PoseidonHeaderHasher, + runtime_types::qp_poseidon::PoseidonHasher, >, ::core::primitive::u128, runtime_types::pallet_ranked_collective::Tally, @@ -16571,10 +16603,9 @@ pub mod api { call: ::subxt::ext::subxt_core::alloc::boxed::Box::new(call), }, [ - 60u8, 61u8, 138u8, 19u8, 43u8, 218u8, 179u8, 117u8, 205u8, 143u8, - 128u8, 223u8, 96u8, 166u8, 90u8, 187u8, 255u8, 119u8, 238u8, 209u8, - 140u8, 58u8, 239u8, 44u8, 153u8, 196u8, 218u8, 155u8, 227u8, 228u8, - 210u8, 187u8, + 3u8, 200u8, 160u8, 7u8, 52u8, 80u8, 43u8, 2u8, 39u8, 251u8, 144u8, + 99u8, 69u8, 29u8, 179u8, 239u8, 176u8, 48u8, 100u8, 91u8, 44u8, 249u8, + 176u8, 179u8, 28u8, 21u8, 93u8, 92u8, 26u8, 220u8, 149u8, 183u8, ], ) } @@ -21110,6 +21141,174 @@ pub mod api { } } } + pub mod wormhole { + use super::{root_mod, runtime_types}; + #[doc = "The `Error` enum of this pallet."] + pub type Error = runtime_types::pallet_wormhole::pallet::Error; + #[doc = "Contains a variant per dispatchable extrinsic that this pallet has."] + pub type Call = runtime_types::pallet_wormhole::pallet::Call; + pub mod calls { + use super::{root_mod, runtime_types}; + type DispatchError = runtime_types::sp_runtime::DispatchError; + pub mod types { + use super::runtime_types; + #[derive( + :: subxt :: ext :: subxt_core :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: subxt_core :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + #[decode_as_type( + crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" + )] + #[encode_as_type( + crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode" + )] + pub struct VerifyWormholeProof { + pub proof_bytes: verify_wormhole_proof::ProofBytes, + pub block_number: verify_wormhole_proof::BlockNumber, + pub header: verify_wormhole_proof::Header, + } + pub mod verify_wormhole_proof { + use super::runtime_types; + pub type ProofBytes = + ::subxt::ext::subxt_core::alloc::vec::Vec<::core::primitive::u8>; + pub type BlockNumber = ::core::primitive::u32; + pub type Header = + runtime_types::sp_runtime::generic::header::Header<::core::primitive::u32>; + } + impl ::subxt::ext::subxt_core::blocks::StaticExtrinsic for VerifyWormholeProof { + const PALLET: &'static str = "Wormhole"; + const CALL: &'static str = "verify_wormhole_proof"; + } + } + pub struct TransactionApi; + impl TransactionApi { + pub fn verify_wormhole_proof( + &self, + proof_bytes: types::verify_wormhole_proof::ProofBytes, + block_number: types::verify_wormhole_proof::BlockNumber, + header: types::verify_wormhole_proof::Header, + ) -> ::subxt::ext::subxt_core::tx::payload::StaticPayload + { + ::subxt::ext::subxt_core::tx::payload::StaticPayload::new_static( + "Wormhole", + "verify_wormhole_proof", + types::VerifyWormholeProof { proof_bytes, block_number, header }, + [ + 162u8, 205u8, 5u8, 181u8, 62u8, 111u8, 128u8, 61u8, 0u8, 236u8, 196u8, + 137u8, 88u8, 33u8, 13u8, 36u8, 251u8, 55u8, 206u8, 185u8, 61u8, 58u8, + 132u8, 180u8, 106u8, 253u8, 232u8, 24u8, 224u8, 220u8, 216u8, 237u8, + ], + ) + } + } + } + #[doc = "The `Event` enum of this pallet"] + pub type Event = runtime_types::pallet_wormhole::pallet::Event; + pub mod events { + use super::runtime_types; + #[derive( + :: subxt :: ext :: subxt_core :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: subxt_core :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] + #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] + pub struct ProofVerified { + pub exit_amount: proof_verified::ExitAmount, + } + pub mod proof_verified { + use super::runtime_types; + pub type ExitAmount = ::core::primitive::u128; + } + impl ::subxt::ext::subxt_core::events::StaticEvent for ProofVerified { + const PALLET: &'static str = "Wormhole"; + const EVENT: &'static str = "ProofVerified"; + } + } + pub mod storage { + use super::runtime_types; + pub mod types { + use super::runtime_types; + pub mod used_nullifiers { + use super::runtime_types; + pub type UsedNullifiers = ::core::primitive::bool; + pub type Param0 = [::core::primitive::u8; 32usize]; + } + } + pub struct StorageApi; + impl StorageApi { + pub fn used_nullifiers_iter( + &self, + ) -> ::subxt::ext::subxt_core::storage::address::StaticAddress< + (), + types::used_nullifiers::UsedNullifiers, + (), + ::subxt::ext::subxt_core::utils::Yes, + ::subxt::ext::subxt_core::utils::Yes, + > { + ::subxt::ext::subxt_core::storage::address::StaticAddress::new_static( + "Wormhole", + "UsedNullifiers", + (), + [ + 111u8, 222u8, 249u8, 87u8, 31u8, 249u8, 120u8, 32u8, 221u8, 33u8, 86u8, + 103u8, 116u8, 235u8, 16u8, 191u8, 73u8, 183u8, 183u8, 77u8, 229u8, + 255u8, 221u8, 186u8, 29u8, 179u8, 110u8, 138u8, 146u8, 113u8, 241u8, + 222u8, + ], + ) + } + pub fn used_nullifiers( + &self, + _0: types::used_nullifiers::Param0, + ) -> ::subxt::ext::subxt_core::storage::address::StaticAddress< + ::subxt::ext::subxt_core::storage::address::StaticStorageKey< + types::used_nullifiers::Param0, + >, + types::used_nullifiers::UsedNullifiers, + ::subxt::ext::subxt_core::utils::Yes, + ::subxt::ext::subxt_core::utils::Yes, + (), + > { + ::subxt::ext::subxt_core::storage::address::StaticAddress::new_static( + "Wormhole", + "UsedNullifiers", + ::subxt::ext::subxt_core::storage::address::StaticStorageKey::new(_0), + [ + 111u8, 222u8, 249u8, 87u8, 31u8, 249u8, 120u8, 32u8, 221u8, 33u8, 86u8, + 103u8, 116u8, 235u8, 16u8, 191u8, 73u8, 183u8, 183u8, 77u8, 229u8, + 255u8, 221u8, 186u8, 29u8, 179u8, 110u8, 138u8, 146u8, 113u8, 241u8, + 222u8, + ], + ) + } + } + } + pub mod constants { + use super::runtime_types; + pub struct ConstantsApi; + impl ConstantsApi { + #[doc = " Account ID used as the \"from\" account when creating transfer proofs for minted tokens"] + pub fn minting_account( + &self, + ) -> ::subxt::ext::subxt_core::constants::address::StaticAddress< + ::subxt::ext::subxt_core::utils::AccountId32, + > { + ::subxt::ext::subxt_core::constants::address::StaticAddress::new_static( + "Wormhole", + "MintingAccount", + [ + 115u8, 233u8, 13u8, 223u8, 88u8, 20u8, 202u8, 139u8, 153u8, 28u8, + 155u8, 157u8, 224u8, 66u8, 3u8, 250u8, 23u8, 53u8, 88u8, 168u8, 211u8, + 204u8, 122u8, 166u8, 248u8, 23u8, 174u8, 225u8, 99u8, 108u8, 89u8, + 135u8, + ], + ) + } + } + } + } pub mod runtime_types { use super::runtime_types; pub mod bounded_collections { @@ -23388,6 +23587,14 @@ pub mod api { old: ::core::primitive::u128, new: ::core::primitive::u128, }, + #[codec(index = 22)] + #[doc = "Transfer proof was stored."] + TransferProofStored { + transfer_count: ::core::primitive::u64, + source: ::subxt::ext::subxt_core::utils::AccountId32, + dest: ::subxt::ext::subxt_core::utils::AccountId32, + funding_amount: ::core::primitive::u128, + }, } } pub mod types { @@ -24993,7 +25200,7 @@ pub mod api { >, proposal: runtime_types::frame_support::traits::preimages::Bounded< runtime_types::quantus_runtime::RuntimeCall, - runtime_types::quantus_runtime::PoseidonHeaderHasher, + runtime_types::qp_poseidon::PoseidonHasher, >, enactment_moment: runtime_types::frame_support::traits::schedule::DispatchTime< @@ -25150,7 +25357,7 @@ pub mod api { track: ::core::primitive::u16, proposal: runtime_types::frame_support::traits::preimages::Bounded< runtime_types::quantus_runtime::RuntimeCall, - runtime_types::quantus_runtime::PoseidonHeaderHasher, + runtime_types::qp_poseidon::PoseidonHasher, >, }, #[codec(index = 1)] @@ -25180,7 +25387,7 @@ pub mod api { track: ::core::primitive::u16, proposal: runtime_types::frame_support::traits::preimages::Bounded< runtime_types::quantus_runtime::RuntimeCall, - runtime_types::quantus_runtime::PoseidonHeaderHasher, + runtime_types::qp_poseidon::PoseidonHasher, >, tally: runtime_types::pallet_conviction_voting::types::Tally< ::core::primitive::u128, @@ -25273,7 +25480,7 @@ pub mod api { track: ::core::primitive::u16, proposal: runtime_types::frame_support::traits::preimages::Bounded< runtime_types::quantus_runtime::RuntimeCall, - runtime_types::quantus_runtime::PoseidonHeaderHasher, + runtime_types::qp_poseidon::PoseidonHasher, >, }, #[codec(index = 1)] @@ -25303,7 +25510,7 @@ pub mod api { track: ::core::primitive::u16, proposal: runtime_types::frame_support::traits::preimages::Bounded< runtime_types::quantus_runtime::RuntimeCall, - runtime_types::quantus_runtime::PoseidonHeaderHasher, + runtime_types::qp_poseidon::PoseidonHasher, >, tally: runtime_types::pallet_ranked_collective::Tally, }, @@ -27239,6 +27446,85 @@ pub mod api { V1, } } + pub mod pallet_wormhole { + use super::runtime_types; + pub mod pallet { + use super::runtime_types; + #[derive( + :: subxt :: ext :: subxt_core :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: subxt_core :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + #[decode_as_type( + crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" + )] + #[encode_as_type( + crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode" + )] + #[doc = "Contains a variant per dispatchable extrinsic that this pallet has."] + pub enum Call { + #[codec(index = 0)] + verify_wormhole_proof { + proof_bytes: + ::subxt::ext::subxt_core::alloc::vec::Vec<::core::primitive::u8>, + block_number: ::core::primitive::u32, + header: runtime_types::sp_runtime::generic::header::Header< + ::core::primitive::u32, + >, + }, + } + #[derive( + :: subxt :: ext :: subxt_core :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: subxt_core :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + #[decode_as_type( + crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" + )] + #[encode_as_type( + crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode" + )] + #[doc = "The `Error` enum of this pallet."] + pub enum Error { + #[codec(index = 0)] + InvalidProof, + #[codec(index = 1)] + ProofDeserializationFailed, + #[codec(index = 2)] + VerificationFailed, + #[codec(index = 3)] + InvalidPublicInputs, + #[codec(index = 4)] + NullifierAlreadyUsed, + #[codec(index = 5)] + VerifierNotAvailable, + #[codec(index = 6)] + InvalidStorageRoot, + #[codec(index = 7)] + StorageRootMismatch, + #[codec(index = 8)] + BlockNotFound, + #[codec(index = 9)] + InvalidBlockNumber, + } + #[derive( + :: subxt :: ext :: subxt_core :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: subxt_core :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + #[decode_as_type( + crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" + )] + #[encode_as_type( + crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode" + )] + #[doc = "The `Event` enum of this pallet"] + pub enum Event { + #[codec(index = 0)] + ProofVerified { exit_amount: ::core::primitive::u128 }, + } + } + } pub mod primitive_types { use super::runtime_types; #[derive( @@ -27287,6 +27573,17 @@ pub mod api { } } } + pub mod qp_poseidon { + use super::runtime_types; + #[derive( + :: subxt :: ext :: subxt_core :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: subxt_core :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] + #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] + pub struct PoseidonHasher; + } pub mod qp_scheduler { use super::runtime_types; #[derive( @@ -27396,14 +27693,6 @@ pub mod api { )] #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] - pub struct PoseidonHeaderHasher; - #[derive( - :: subxt :: ext :: subxt_core :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: subxt_core :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] pub struct Runtime; #[derive( :: subxt :: ext :: subxt_core :: ext :: scale_decode :: DecodeAsType, @@ -27447,6 +27736,8 @@ pub mod api { Recovery(runtime_types::pallet_recovery::pallet::Call), #[codec(index = 21)] Assets(runtime_types::pallet_assets::pallet::Call), + #[codec(index = 23)] + Wormhole(runtime_types::pallet_wormhole::pallet::Call), } #[derive( :: subxt :: ext :: subxt_core :: ext :: scale_decode :: DecodeAsType, @@ -27490,6 +27781,8 @@ pub mod api { Assets(runtime_types::pallet_assets::pallet::Error), #[codec(index = 22)] AssetsHolder(runtime_types::pallet_assets_holder::pallet::Error), + #[codec(index = 23)] + Wormhole(runtime_types::pallet_wormhole::pallet::Error), } #[derive( :: subxt :: ext :: subxt_core :: ext :: scale_decode :: DecodeAsType, @@ -27539,6 +27832,8 @@ pub mod api { Assets(runtime_types::pallet_assets::pallet::Event), #[codec(index = 22)] AssetsHolder(runtime_types::pallet_assets_holder::pallet::Event), + #[codec(index = 23)] + Wormhole(runtime_types::pallet_wormhole::pallet::Event), } #[derive( :: subxt :: ext :: subxt_core :: ext :: scale_decode :: DecodeAsType, diff --git a/src/quantus_metadata.scale b/src/quantus_metadata.scale index ca82fd5affea3364a3f85313a2456d88412f75bd..f17e3cba4c7431e58fa78ad61f5c5d1daeb21422 100644 GIT binary patch delta 6541 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 J%}To}{ug?|tdal# delta 5766 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 Date: Wed, 19 Nov 2025 20:21:39 +0600 Subject: [PATCH 05/14] Add wormhole command --- Cargo.lock | 256 ++++++++++++++++++++++++-- Cargo.toml | 8 + src/cli/mod.rs | 6 + src/cli/wormhole.rs | 438 ++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 693 insertions(+), 15 deletions(-) create mode 100644 src/cli/wormhole.rs diff --git a/Cargo.lock b/Cargo.lock index 4484fde..9eaa9b8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -69,6 +69,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5a15f179cd60c4584b8a8c596927aadc462e27f2ca70c04e0071964a73ba7a75" dependencies = [ "cfg-if", + "const-random", "getrandom 0.3.3", "once_cell", "version_check", @@ -989,6 +990,26 @@ version = "0.9.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" +[[package]] +name = "const-random" +version = "0.1.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87e00182fe74b066627d63b85fd550ac2998d4b0bd86bfed477a0ae4c7c71359" +dependencies = [ + "const-random-macro", +] + +[[package]] +name = "const-random-macro" +version = "0.1.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f9d839f2a20b0aee515dc581a6172f2321f96cab76c1a38a4c584a194955390e" +dependencies = [ + "getrandom 0.2.16", + "once_cell", + "tiny-keccak", +] + [[package]] name = "const_format" version = "0.2.34" @@ -1576,6 +1597,15 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7fd99930f64d146689264c637b5af2f0233a933bef0d8570e2526bf9e083192d" +[[package]] +name = "fixed-hash" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cfcf0ed7fe52a17a03854ec54a9f76d6d84508d1c0e66bc1793301c73fc8493c" +dependencies = [ + "static_assertions", +] + [[package]] name = "fixed-hash" version = "0.8.0" @@ -1931,6 +1961,7 @@ checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" dependencies = [ "ahash", "allocator-api2", + "serde", ] [[package]] @@ -2266,7 +2297,7 @@ checksum = "803d15461ab0dcc56706adf266158acbc44ccf719bf7d0af30705f58b90a4b8c" dependencies = [ "integer-sqrt", "num-traits", - "uint", + "uint 0.10.0", ] [[package]] @@ -2557,13 +2588,23 @@ dependencies = [ "cpufeatures", ] +[[package]] +name = "keccak-hash" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce2bd4c29270e724d3eaadf7bdc8700af4221fc0ed771b855eadcd1b98d52851" +dependencies = [ + "primitive-types 0.10.1", + "tiny-keccak", +] + [[package]] name = "keccak-hash" version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3e1b8590eb6148af2ea2d75f38e7d29f5ca970d5a4df456b3ef19b8b415d0264" dependencies = [ - "primitive-types", + "primitive-types 0.13.1", "tiny-keccak", ] @@ -2793,6 +2834,20 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "num" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "35bd024e8b2ff75562e5f34e7f4905839deb4b22955ef5e73d2fea1b9813cb23" +dependencies = [ + "num-bigint", + "num-complex", + "num-integer", + "num-iter", + "num-rational", + "num-traits", +] + [[package]] name = "num-bigint" version = "0.4.6" @@ -2801,6 +2856,17 @@ checksum = "a5e44f723f1133c9deac646763579fdb3ac745e418f2a7af9cd0c431da1f20b9" dependencies = [ "num-integer", "num-traits", + "rand 0.8.5", +] + +[[package]] +name = "num-complex" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73f88a1307638156682bada9d7604135552957b7818057dcef22705b4d509495" +dependencies = [ + "num-traits", + "rand 0.8.5", ] [[package]] @@ -2828,6 +2894,17 @@ dependencies = [ "num-traits", ] +[[package]] +name = "num-iter" +version = "0.1.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1429034a0490724d0075ebb2bc9e875d6503c3cf69e235a8941aa757d83ef5bf" +dependencies = [ + "autocfg", + "num-integer", + "num-traits", +] + [[package]] name = "num-rational" version = "0.4.2" @@ -3179,6 +3256,16 @@ dependencies = [ "spki", ] +[[package]] +name = "plonky2_maybe_rayon" +version = "1.0.0" +source = "git+https://github.com/Quantus-Network/qp-plonky2#a7f257a234c40d252da33efdcd5f51f1f5a5b647" + +[[package]] +name = "plonky2_util" +version = "1.0.0" +source = "git+https://github.com/Quantus-Network/qp-plonky2#a7f257a234c40d252da33efdcd5f51f1f5a5b647" + [[package]] name = "polkavm-common" version = "0.24.0" @@ -3287,18 +3374,28 @@ dependencies = [ "syn 2.0.106", ] +[[package]] +name = "primitive-types" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05e4722c697a58a99d5d06a08c30821d7c082a4632198de1eaa5a6c22ef42373" +dependencies = [ + "fixed-hash 0.7.0", + "uint 0.9.5", +] + [[package]] name = "primitive-types" version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d15600a7d856470b7d278b3fe0e311fe28c2526348549f8ef2ff7db3299c87f5" dependencies = [ - "fixed-hash", + "fixed-hash 0.8.0", "impl-codec", "impl-num-traits", "impl-serde", "scale-info", - "uint", + "uint 0.10.0", ] [[package]] @@ -3373,6 +3470,47 @@ dependencies = [ "thiserror 1.0.69", ] +[[package]] +name = "qp-plonky2" +version = "1.1.1" +source = "git+https://github.com/Quantus-Network/qp-plonky2#a7f257a234c40d252da33efdcd5f51f1f5a5b647" +dependencies = [ + "ahash", + "anyhow", + "hashbrown 0.14.5", + "itertools 0.11.0", + "keccak-hash 0.8.0", + "log", + "num", + "p3-field", + "p3-goldilocks", + "p3-poseidon2", + "p3-symmetric", + "plonky2_maybe_rayon", + "plonky2_util", + "qp-plonky2-field", + "qp-poseidon-constants 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.8.5", + "serde", + "static_assertions", + "unroll", +] + +[[package]] +name = "qp-plonky2-field" +version = "1.1.1" +source = "git+https://github.com/Quantus-Network/qp-plonky2#a7f257a234c40d252da33efdcd5f51f1f5a5b647" +dependencies = [ + "anyhow", + "itertools 0.11.0", + "num", + "plonky2_util", + "rustc_version", + "serde", + "static_assertions", + "unroll", +] + [[package]] name = "qp-poseidon" version = "1.0.1" @@ -3383,7 +3521,7 @@ dependencies = [ "p3-field", "p3-goldilocks", "parity-scale-codec", - "qp-poseidon-core", + "qp-poseidon-core 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "scale-info", "serde", "sp-core", @@ -3405,6 +3543,18 @@ dependencies = [ "rand_chacha 0.9.0", ] +[[package]] +name = "qp-poseidon-constants" +version = "1.0.1" +source = "git+https://github.com/Quantus-Network/qp-poseidon.git?branch=feat%2Fplonky2-update#57ed5087c8f9a21762ed63af64d6614e8f3194fd" +dependencies = [ + "p3-field", + "p3-goldilocks", + "p3-poseidon2", + "rand 0.9.2", + "rand_chacha 0.9.0", +] + [[package]] name = "qp-poseidon-core" version = "1.0.1" @@ -3415,7 +3565,21 @@ dependencies = [ "p3-goldilocks", "p3-poseidon2", "p3-symmetric", - "qp-poseidon-constants", + "qp-poseidon-constants 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_chacha 0.9.0", +] + +[[package]] +name = "qp-poseidon-core" +version = "1.0.1" +source = "git+https://github.com/Quantus-Network/qp-poseidon.git?branch=feat%2Fplonky2-update#57ed5087c8f9a21762ed63af64d6614e8f3194fd" +dependencies = [ + "p3-field", + "p3-goldilocks", + "p3-poseidon2", + "p3-symmetric", + "qp-plonky2", + "qp-poseidon-constants 1.0.1 (git+https://github.com/Quantus-Network/qp-poseidon.git?branch=feat%2Fplonky2-update)", "rand_chacha 0.9.0", ] @@ -3441,7 +3605,7 @@ dependencies = [ "hex", "hex-literal", "nam-tiny-hderive", - "qp-poseidon-core", + "qp-poseidon-core 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "qp-rusty-crystals-dilithium", "rand_chacha 0.9.0", "rand_core 0.9.3", @@ -3450,11 +3614,46 @@ dependencies = [ "thiserror 2.0.16", ] +[[package]] +name = "qp-wormhole-circuit" +version = "0.1.2" +source = "git+https://github.com/Quantus-Network/qp-zk-circuits.git?branch=feat%2Fblock-header-proof#8edb333d9a92a4279ae5416a5ad96a93864e4375" +dependencies = [ + "anyhow", + "hex", + "qp-plonky2", + "qp-poseidon-core 1.0.1 (git+https://github.com/Quantus-Network/qp-poseidon.git?branch=feat%2Fplonky2-update)", + "qp-zk-circuits-common", +] + +[[package]] +name = "qp-wormhole-prover" +version = "0.1.2" +source = "git+https://github.com/Quantus-Network/qp-zk-circuits.git?branch=feat%2Fblock-header-proof#8edb333d9a92a4279ae5416a5ad96a93864e4375" +dependencies = [ + "anyhow", + "qp-plonky2", + "qp-wormhole-circuit", + "qp-zk-circuits-common", +] + +[[package]] +name = "qp-zk-circuits-common" +version = "0.1.2" +source = "git+https://github.com/Quantus-Network/qp-zk-circuits.git?branch=feat%2Fblock-header-proof#8edb333d9a92a4279ae5416a5ad96a93864e4375" +dependencies = [ + "anyhow", + "qp-plonky2", + "qp-poseidon-core 1.0.1 (git+https://github.com/Quantus-Network/qp-poseidon.git?branch=feat%2Fplonky2-update)", + "serde", +] + [[package]] name = "quantus-cli" version = "0.3.0" dependencies = [ "aes-gcm", + "anyhow", "argon2", "chrono", "clap", @@ -3464,9 +3663,14 @@ dependencies = [ "jsonrpsee", "parity-scale-codec", "qp-dilithium-crypto", + "qp-plonky2", "qp-poseidon", + "qp-poseidon-core 1.0.1 (git+https://github.com/Quantus-Network/qp-poseidon.git?branch=feat%2Fplonky2-update)", "qp-rusty-crystals-dilithium", "qp-rusty-crystals-hdwallet", + "qp-wormhole-circuit", + "qp-wormhole-prover", + "qp-zk-circuits-common", "rand 0.9.2", "rpassword", "serde", @@ -3836,7 +4040,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4d78196772d25b90a98046794ce0fe2588b39ebdfbdc1e45b4c6c85dd43bebad" dependencies = [ "parity-scale-codec", - "primitive-types", + "primitive-types 0.13.1", "scale-bits", "scale-decode-derive", "scale-type-resolver", @@ -3863,7 +4067,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "64901733157f9d25ef86843bd783eda439fac7efb0ad5a615d12d2cf3a29464b" dependencies = [ "parity-scale-codec", - "primitive-types", + "primitive-types 0.13.1", "scale-bits", "scale-encode-derive", "scale-type-resolver", @@ -4433,7 +4637,7 @@ dependencies = [ "parity-scale-codec", "parking_lot", "paste", - "primitive-types", + "primitive-types 0.13.1", "rand 0.8.5", "scale-info", "schnorrkel", @@ -4580,7 +4784,7 @@ dependencies = [ "impl-trait-for-tuples", "parity-scale-codec", "polkavm-derive", - "primitive-types", + "primitive-types 0.13.1", "sp-externalities", "sp-runtime-interface-proc-macro", "sp-std", @@ -4812,7 +5016,7 @@ dependencies = [ "hex", "jsonrpsee", "parity-scale-codec", - "primitive-types", + "primitive-types 0.13.1", "scale-bits", "scale-decode", "scale-encode", @@ -4866,9 +5070,9 @@ dependencies = [ "hashbrown 0.14.5", "hex", "impl-serde", - "keccak-hash", + "keccak-hash 0.11.0", "parity-scale-codec", - "primitive-types", + "primitive-types 0.13.1", "scale-bits", "scale-decode", "scale-encode", @@ -4944,7 +5148,7 @@ dependencies = [ "impl-serde", "jsonrpsee", "parity-scale-codec", - "primitive-types", + "primitive-types 0.13.1", "serde", "serde_json", "subxt-core", @@ -5443,6 +5647,18 @@ version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1dccffe3ce07af9386bfd29e80c0ab1a8205a2fc34e4bcd40364df902cfa8f3f" +[[package]] +name = "uint" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76f64bba2c53b04fcab63c01a7d7427eadc821e3bc48c34dc9ba29c501164b52" +dependencies = [ + "byteorder", + "crunchy", + "hex", + "static_assertions", +] + [[package]] name = "uint" version = "0.10.0" @@ -5492,6 +5708,16 @@ dependencies = [ "subtle", ] +[[package]] +name = "unroll" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ad948c1cb799b1a70f836077721a92a35ac177d4daddf4c20a633786d4cf618" +dependencies = [ + "quote", + "syn 1.0.109", +] + [[package]] name = "untrusted" version = "0.9.0" diff --git a/Cargo.toml b/Cargo.toml index fccefaa..8f99434 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -68,5 +68,13 @@ jsonrpsee = { version = "0.24", features = ["client"] } # Needed for implementing custom Subxt hasher subxt-metadata = "0.43.0" +# ZK proof generation +anyhow = "1.0" +qp-wormhole-circuit = { git = "https://github.com/Quantus-Network/qp-zk-circuits.git", branch = "feat/block-header-proof", default-features = false } +qp-wormhole-prover = { git = "https://github.com/Quantus-Network/qp-zk-circuits.git", branch = "feat/block-header-proof", default-features = false } +qp-zk-circuits-common = { git = "https://github.com/Quantus-Network/qp-zk-circuits.git", branch = "feat/block-header-proof", default-features = false } +plonky2 = { package = "qp-plonky2", git = "https://github.com/Quantus-Network/qp-plonky2", default-features = false, features = ["no_random"] } +qp-poseidon-core = { git = "https://github.com/Quantus-Network/qp-poseidon.git", branch = "feat/plonky2-update", default-features = false, features = ["p3"] } + [dev-dependencies] tempfile = "3.8" diff --git a/src/cli/mod.rs b/src/cli/mod.rs index 162b1f7..9d8c6ba 100644 --- a/src/cli/mod.rs +++ b/src/cli/mod.rs @@ -21,6 +21,7 @@ pub mod system; pub mod tech_collective; pub mod treasury; pub mod wallet; +pub mod wormhole; /// Main CLI commands #[derive(Subcommand, Debug)] @@ -221,6 +222,10 @@ pub enum Commands { /// Block management and analysis commands #[command(subcommand)] Block(block::BlockCommands), + + /// Wormhole proof generation and verification + #[command(subcommand)] + Wormhole(wormhole::WormholeCommands), } /// Developer subcommands @@ -343,6 +348,7 @@ pub async fn execute_command( }, Commands::CompatibilityCheck => handle_compatibility_check(node_url).await, Commands::Block(block_cmd) => block::handle_block_command(block_cmd, node_url).await, + Commands::Wormhole(wormhole_cmd) => wormhole::handle_wormhole_command(wormhole_cmd, node_url).await, } } diff --git a/src/cli/wormhole.rs b/src/cli/wormhole.rs new file mode 100644 index 0000000..55a4281 --- /dev/null +++ b/src/cli/wormhole.rs @@ -0,0 +1,438 @@ +use crate::chain::client::{ChainConfig, QuantusClient}; +use crate::chain::quantus_subxt as quantus_node; +use crate::chain::quantus_subxt::api::balances; +use crate::cli::common::submit_transaction; +use crate::wallet::QuantumKeyPair; +use crate::{log_print, log_success, log_verbose}; +use anyhow::anyhow; +use clap::Subcommand; +use plonky2::plonk::circuit_data::CircuitConfig; +use plonky2::plonk::proof::ProofWithPublicInputs; +use qp_poseidon::PoseidonHasher; +use qp_wormhole_circuit::inputs::{CircuitInputs, PrivateCircuitInputs, PublicCircuitInputs}; +use qp_wormhole_circuit::nullifier::Nullifier; +use qp_wormhole_prover::WormholeProver; +use qp_zk_circuits_common::utils::{BytesDigest, Digest}; +use sp_core::crypto::{AccountId32, Ss58Codec}; +use sp_core::Hasher; +use subxt::backend::legacy::rpc_methods::{Bytes, ReadProof}; +use subxt::blocks::Block; +use subxt::ext::codec::Encode; +use subxt::ext::jsonrpsee::core::client::ClientT; +use subxt::ext::jsonrpsee::rpc_params; +use subxt::utils::{to_hex, AccountId32 as SubxtAccountId}; +use subxt::OnlineClient; + +#[derive(Subcommand, Debug)] +pub enum WormholeCommands { + /// Generate a wormhole proof + Generate { + /// Secret (32-byte hex string) + #[arg(long)] + secret: String, + + /// Funding amount to transfer + #[arg(long)] + amount: u128, + + /// Exit account (where funds will be withdrawn) + #[arg(long)] + exit_account: String, + + /// Wallet name to fund from + #[arg(short, long)] + from: String, + + /// Password for the wallet + #[arg(short, long)] + password: Option, + + /// Read password from file + #[arg(long)] + password_file: Option, + + /// Output file for the proof (default: proof.hex) + #[arg(short, long, default_value = "proof.hex")] + output: String, + }, +} + +pub async fn handle_wormhole_command( + command: WormholeCommands, + node_url: &str, +) -> crate::error::Result<()> { + match command { + WormholeCommands::Generate { + secret, + amount, + exit_account, + from, + password, + password_file, + output, + } => { + generate_proof( + secret, + amount, + exit_account, + from, + password, + password_file, + output, + node_url, + ) + .await + }, + } +} + +async fn generate_proof( + secret_hex: String, + funding_amount: u128, + exit_account_str: String, + from_wallet: String, + password: Option, + password_file: Option, + output_file: String, + node_url: &str, +) -> crate::error::Result<()> { + log_print!("Generating wormhole proof..."); + + // Parse secret + let secret_bytes = hex::decode(secret_hex.trim_start_matches("0x")) + .map_err(|e| crate::error::QuantusError::Generic(format!("Invalid secret hex: {}", e)))?; + if secret_bytes.len() != 32 { + return Err(crate::error::QuantusError::Generic( + "Secret must be exactly 32 bytes".to_string(), + )); + } + let secret_array: [u8; 32] = secret_bytes + .try_into() + .map_err(|_| crate::error::QuantusError::Generic("Failed to convert secret".to_string()))?; + let secret: BytesDigest = secret_array.try_into().map_err(|e| { + crate::error::QuantusError::Generic(format!("Failed to convert secret: {:?}", e)) + })?; + + // Parse exit account + let exit_account_id = if exit_account_str.starts_with("0x") { + let exit_account_bytes = hex::decode(&exit_account_str[2..]).map_err(|e| { + crate::error::QuantusError::Generic(format!("Invalid exit account hex: {}", e)) + })?; + if exit_account_bytes.len() != 32 { + return Err(crate::error::QuantusError::Generic( + "Exit account must be 32 bytes".to_string(), + )); + } + SubxtAccountId(exit_account_bytes.try_into().map_err(|_| { + crate::error::QuantusError::Generic("Failed to convert exit account".to_string()) + })?) + } else { + // Assume it's a wallet name, resolve it + let resolved = crate::cli::common::resolve_address(&exit_account_str)?; + let account_id = AccountId32::from_ss58check(&resolved).map_err(|e| { + crate::error::QuantusError::Generic(format!("Invalid SS58 address: {}", e)) + })?; + let bytes: [u8; 32] = account_id.into(); + SubxtAccountId(bytes) + }; + + // Load keypair + let keypair = crate::wallet::load_keypair_from_wallet(&from_wallet, password, password_file)?; + + // Connect to node + let quantus_client = QuantusClient::new(node_url) + .await + .map_err(|e| crate::error::QuantusError::Generic(format!("Failed to connect: {}", e)))?; + let client = quantus_client.client(); + + log_verbose!("Connected to node"); + + let funding_account = AccountId32::new(PoseidonHasher::hash(keypair.public_key.as_ref()).0); + + // Generate unspendable account + let unspendable_account = + qp_wormhole_circuit::unspendable_account::UnspendableAccount::from_secret(secret) + .account_id; + let unspendable_account_bytes_digest = + qp_zk_circuits_common::utils::digest_felts_to_bytes(unspendable_account); + let unspendable_account_bytes: [u8; 32] = unspendable_account_bytes_digest + .as_ref() + .try_into() + .expect("BytesDigest is always 32 bytes"); + let unspendable_account_id = SubxtAccountId(unspendable_account_bytes); + + log_verbose!("Unspendable account: {:?}", &unspendable_account_id); + log_verbose!("Exit account: {:?}", &exit_account_id); + + // Transfer to unspendable account + let transfer_tx = quantus_node::api::tx().balances().transfer_keep_alive( + subxt::ext::subxt_core::utils::MultiAddress::Id(unspendable_account_id.clone()), + funding_amount, + ); + + log_verbose!("Submitting transfer to unspendable account..."); + + let blocks = at_best_block(&quantus_client) + .await + .map_err(|e| crate::error::QuantusError::Generic(e.to_string()))?; + let block_hash_pre = blocks.hash(); + + let storage_api = client.storage().at(block_hash_pre); + let transfer_count_previous = storage_api + .fetch(&quantus_node::api::storage().balances().transfer_count()) + .await + .map_err(|e| crate::error::QuantusError::Generic(e.to_string()))? + .unwrap_or_default(); + + let quantum_keypair = QuantumKeyPair { + public_key: keypair.public_key.clone(), + private_key: keypair.private_key.clone(), + }; + + submit_transaction(&quantus_client, &quantum_keypair, transfer_tx, None) + .await + .map_err(|e| crate::error::QuantusError::Generic(e.to_string()))?; + + let blocks = at_best_block(&quantus_client) + .await + .map_err(|e| crate::error::QuantusError::Generic(e.to_string()))?; + let block_hash = blocks.hash(); + + log_success!("Transfer included in block: {:?}", block_hash); + + let events_api = client + .events() + .at(block_hash) + .await + .map_err(|e| crate::error::QuantusError::Generic(e.to_string()))?; + + let event = events_api + .find::() + .next() + .ok_or_else(|| { + crate::error::QuantusError::Generic("No TransferProofStored event found".to_string()) + })? + .map_err(|e| crate::error::QuantusError::Generic(e.to_string()))?; + + let storage_api = client.storage().at(block_hash); + let transfer_count = storage_api + .fetch(&quantus_node::api::storage().balances().transfer_count()) + .await + .map_err(|e| crate::error::QuantusError::Generic(e.to_string()))? + .unwrap_or_default(); + + if transfer_count <= transfer_count_previous { + return Err(crate::error::QuantusError::Generic( + "Transfer count was not incremented".to_string(), + )); + } + + // Get storage proof + let leaf_hash = qp_poseidon::PoseidonHasher::hash_storage::( + &(event.transfer_count, event.source.clone(), event.dest.clone(), event.funding_amount) + .encode(), + ); + let proof_address = quantus_node::api::storage().balances().transfer_proof(( + event.transfer_count, + event.source.clone(), + event.dest.clone(), + event.funding_amount, + )); + let mut final_key = proof_address.to_root_bytes(); + final_key.extend_from_slice(&leaf_hash); + let val = storage_api + .fetch_raw(final_key.clone()) + .await + .map_err(|e| crate::error::QuantusError::Generic(e.to_string()))?; + if val.is_none() { + return Err(crate::error::QuantusError::Generic("Storage key not found".to_string())); + } + + let proof_params = rpc_params![vec![to_hex(&final_key)], block_hash]; + let read_proof: ReadProof = quantus_client + .rpc_client() + .request("state_getReadProof", proof_params) + .await + .map_err(|e| crate::error::QuantusError::Generic(e.to_string()))?; + + let header = blocks.header(); + + let state_root = BytesDigest::try_from(header.state_root.as_bytes()) + .map_err(|e| crate::error::QuantusError::Generic(e.to_string()))?; + let parent_hash = BytesDigest::try_from(header.parent_hash.as_bytes()) + .map_err(|e| crate::error::QuantusError::Generic(e.to_string()))?; + let extrinsics_root = BytesDigest::try_from(header.extrinsics_root.as_bytes()) + .map_err(|e| crate::error::QuantusError::Generic(e.to_string()))?; + let digest = + header.digest.encode().try_into().map_err(|_| { + crate::error::QuantusError::Generic("Failed to encode digest".to_string()) + })?; + + let block_number = header.number; + + // Prepare storage proof + let processed_storage_proof = + prepare_proof_for_circuit(read_proof.proof, hex::encode(header.state_root.0), leaf_hash) + .map_err(|e| crate::error::QuantusError::Generic(e.to_string()))?; + + let inputs = CircuitInputs { + private: PrivateCircuitInputs { + secret, + transfer_count: event.transfer_count, + funding_account: BytesDigest::try_from(funding_account.as_ref() as &[u8]) + .map_err(|e| crate::error::QuantusError::Generic(e.to_string()))?, + storage_proof: processed_storage_proof, + unspendable_account: Digest::from(unspendable_account).into(), + state_root, + extrinsics_root, + digest, + }, + public: PublicCircuitInputs { + funding_amount, + nullifier: Nullifier::from_preimage(secret, event.transfer_count).hash.into(), + exit_account: BytesDigest::try_from(exit_account_id.as_ref() as &[u8]) + .map_err(|e| crate::error::QuantusError::Generic(e.to_string()))?, + block_hash: BytesDigest::try_from(block_hash.as_ref()) + .map_err(|e| crate::error::QuantusError::Generic(e.to_string()))?, + parent_hash, + block_number, + }, + }; + + log_verbose!("Generating ZK proof..."); + let config = CircuitConfig::standard_recursion_config(); + let prover = WormholeProver::new(config); + let prover_next = prover + .commit(&inputs) + .map_err(|e| crate::error::QuantusError::Generic(e.to_string()))?; + let proof: ProofWithPublicInputs<_, _, 2> = prover_next.prove().map_err(|e| { + crate::error::QuantusError::Generic(format!("Proof generation failed: {}", e)) + })?; + + let public_inputs = PublicCircuitInputs::try_from(&proof) + .map_err(|e| crate::error::QuantusError::Generic(e.to_string()))?; + + let proof_hex = hex::encode(proof.to_bytes()); + std::fs::write(&output_file, proof_hex).map_err(|e| { + crate::error::QuantusError::Generic(format!("Failed to write proof: {}", e)) + })?; + + log_success!("Proof generated successfully!"); + log_success!("Output: {}", output_file); + log_verbose!("Public inputs: {:?}", public_inputs); + + Ok(()) +} + +async fn at_best_block( + quantus_client: &QuantusClient, +) -> anyhow::Result>> { + let best_block = quantus_client.get_latest_block().await?; + let block = quantus_client.client().blocks().at(best_block).await?; + Ok(block) +} + +// Utility functions from proof-utils.rs +fn hash_node_with_poseidon_padded(node_bytes: &[u8]) -> [u8; 32] { + use qp_poseidon_core::{hash_padded_bytes, FIELD_ELEMENT_PREIMAGE_PADDING_LEN}; + hash_padded_bytes::(node_bytes) +} + +fn prepare_proof_for_circuit( + proof: Vec, + state_root: String, + leaf_hash: [u8; 32], +) -> anyhow::Result { + let mut node_map: std::collections::HashMap, String)> = + std::collections::HashMap::new(); + for (idx, node) in proof.iter().enumerate() { + let hash = hash_node_with_poseidon_padded(&node.0); + let hash_hex = hex::encode(hash); + let node_hex = hex::encode(&node.0); + node_map.insert(hash_hex.clone(), (idx, node.0.clone(), node_hex)); + } + + let state_root_hex = state_root.trim_start_matches("0x").to_string(); + + let root_hash = if node_map.contains_key(&state_root_hex) { + state_root_hex.clone() + } else { + anyhow::bail!("No node hashes to state root!"); + }; + + let root_entry = node_map + .get(&root_hash) + .ok_or_else(|| anyhow!("Failed to get root entry from map"))?; + + let mut ordered_nodes = vec![root_entry.1.clone()]; + let mut current_node_hex = root_entry.2.clone(); + + const HASH_LENGTH_PREFIX: &str = "2000000000000000"; + + loop { + let mut found_child = None; + for (child_hash, (_, child_bytes, _)) in &node_map { + let hash_with_prefix = format!("{}{}", HASH_LENGTH_PREFIX, child_hash); + if current_node_hex.contains(&hash_with_prefix) { + if !ordered_nodes.iter().any(|n| n == child_bytes) { + found_child = Some((child_hash.clone(), child_bytes.clone())); + break; + } + } + } + + if let Some((_, child_bytes)) = found_child { + ordered_nodes.push(child_bytes.clone()); + current_node_hex = hex::encode(ordered_nodes.last().unwrap()); + } else { + break; + } + } + + let mut indices = Vec::::new(); + + for i in 0..ordered_nodes.len() - 1 { + let current_hex = hex::encode(&ordered_nodes[i]); + let next_node = &ordered_nodes[i + 1]; + let next_hash = hex::encode(hash_node_with_poseidon_padded(next_node)); + + if let Some(hex_idx) = current_hex.find(&next_hash) { + indices.push(hex_idx); + } else { + anyhow::bail!("Could not find child hash in ordered node {}", i); + } + } + + let (found, last_idx) = check_leaf(&leaf_hash, ordered_nodes.last().unwrap().clone()); + if !found { + anyhow::bail!("Leaf hash suffix not found in leaf node!"); + } + + indices.push(last_idx); + + if indices.len() != ordered_nodes.len() { + log_verbose!( + "Warning: indices.len() = {}, ordered_nodes.len() = {}", + indices.len(), + ordered_nodes.len() + ); + } + + qp_wormhole_circuit::storage_proof::ProcessedStorageProof::new(ordered_nodes, indices) +} + +fn check_leaf(leaf_hash: &[u8; 32], leaf_node: Vec) -> (bool, usize) { + let hash_suffix = &leaf_hash[8..32]; + let mut last_idx = 0usize; + let mut found = false; + + for i in 0..=leaf_node.len().saturating_sub(hash_suffix.len()) { + if &leaf_node[i..i + hash_suffix.len()] == hash_suffix { + last_idx = i; + found = true; + break; + } + } + + (found, (last_idx * 2).saturating_sub(16)) +} From ee136fed5f0c2cff6584d0e5952d13c9e223f6fb Mon Sep 17 00:00:00 2001 From: Dastan <88332432+dastansam@users.noreply.github.com> Date: Wed, 19 Nov 2025 20:29:01 +0600 Subject: [PATCH 06/14] fmt --- src/cli/mod.rs | 3 ++- src/cli/wormhole.rs | 53 ++++++++++++++++++++++++++------------------- 2 files changed, 33 insertions(+), 23 deletions(-) diff --git a/src/cli/mod.rs b/src/cli/mod.rs index 9d8c6ba..f44b594 100644 --- a/src/cli/mod.rs +++ b/src/cli/mod.rs @@ -348,7 +348,8 @@ pub async fn execute_command( }, Commands::CompatibilityCheck => handle_compatibility_check(node_url).await, Commands::Block(block_cmd) => block::handle_block_command(block_cmd, node_url).await, - Commands::Wormhole(wormhole_cmd) => wormhole::handle_wormhole_command(wormhole_cmd, node_url).await, + Commands::Wormhole(wormhole_cmd) => + wormhole::handle_wormhole_command(wormhole_cmd, node_url).await, } } diff --git a/src/cli/wormhole.rs b/src/cli/wormhole.rs index 55a4281..11d5dcb 100644 --- a/src/cli/wormhole.rs +++ b/src/cli/wormhole.rs @@ -1,27 +1,37 @@ -use crate::chain::client::{ChainConfig, QuantusClient}; -use crate::chain::quantus_subxt as quantus_node; -use crate::chain::quantus_subxt::api::balances; -use crate::cli::common::submit_transaction; -use crate::wallet::QuantumKeyPair; -use crate::{log_print, log_success, log_verbose}; +use crate::{ + chain::{ + client::{ChainConfig, QuantusClient}, + quantus_subxt as quantus_node, + quantus_subxt::api::balances, + }, + cli::common::submit_transaction, + log_print, log_success, log_verbose, + wallet::QuantumKeyPair, +}; use anyhow::anyhow; use clap::Subcommand; -use plonky2::plonk::circuit_data::CircuitConfig; -use plonky2::plonk::proof::ProofWithPublicInputs; +use plonky2::plonk::{circuit_data::CircuitConfig, proof::ProofWithPublicInputs}; use qp_poseidon::PoseidonHasher; -use qp_wormhole_circuit::inputs::{CircuitInputs, PrivateCircuitInputs, PublicCircuitInputs}; -use qp_wormhole_circuit::nullifier::Nullifier; +use qp_wormhole_circuit::{ + inputs::{CircuitInputs, PrivateCircuitInputs, PublicCircuitInputs}, + nullifier::Nullifier, +}; use qp_wormhole_prover::WormholeProver; use qp_zk_circuits_common::utils::{BytesDigest, Digest}; -use sp_core::crypto::{AccountId32, Ss58Codec}; -use sp_core::Hasher; -use subxt::backend::legacy::rpc_methods::{Bytes, ReadProof}; -use subxt::blocks::Block; -use subxt::ext::codec::Encode; -use subxt::ext::jsonrpsee::core::client::ClientT; -use subxt::ext::jsonrpsee::rpc_params; -use subxt::utils::{to_hex, AccountId32 as SubxtAccountId}; -use subxt::OnlineClient; +use sp_core::{ + crypto::{AccountId32, Ss58Codec}, + Hasher, +}; +use subxt::{ + backend::legacy::rpc_methods::{Bytes, ReadProof}, + blocks::Block, + ext::{ + codec::Encode, + jsonrpsee::{core::client::ClientT, rpc_params}, + }, + utils::{to_hex, AccountId32 as SubxtAccountId}, + OnlineClient, +}; #[derive(Subcommand, Debug)] pub enum WormholeCommands { @@ -70,7 +80,7 @@ pub async fn handle_wormhole_command( password, password_file, output, - } => { + } => generate_proof( secret, amount, @@ -81,8 +91,7 @@ pub async fn handle_wormhole_command( output, node_url, ) - .await - }, + .await, } } From f9037fab4687583634c8ac4bb1123c4e108fdebb Mon Sep 17 00:00:00 2001 From: Dastan <88332432+dastansam@users.noreply.github.com> Date: Fri, 12 Dec 2025 13:51:18 +0600 Subject: [PATCH 07/14] Update metadata --- Cargo.lock | 60 ++-- Cargo.toml | 11 +- src/chain/quantus_subxt.rs | 647 +++++++++++++++++++++++-------------- src/cli/wormhole.rs | 148 ++------- src/quantus_metadata.scale | Bin 166458 -> 167060 bytes 5 files changed, 462 insertions(+), 404 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 9eaa9b8..96a188f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3259,12 +3259,14 @@ dependencies = [ [[package]] name = "plonky2_maybe_rayon" version = "1.0.0" -source = "git+https://github.com/Quantus-Network/qp-plonky2#a7f257a234c40d252da33efdcd5f51f1f5a5b647" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e1e554181dc95243b8d9948ae7bae5759c7fb2502fed28f671f95ef38079406" [[package]] name = "plonky2_util" version = "1.0.0" -source = "git+https://github.com/Quantus-Network/qp-plonky2#a7f257a234c40d252da33efdcd5f51f1f5a5b647" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c32c137808ca984ab2458b612b7eb0462d853ee041a3136e83d54b96074c7610" [[package]] name = "polkavm-common" @@ -3472,8 +3474,9 @@ dependencies = [ [[package]] name = "qp-plonky2" -version = "1.1.1" -source = "git+https://github.com/Quantus-Network/qp-plonky2#a7f257a234c40d252da33efdcd5f51f1f5a5b647" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "39530b02faa85964bba211e030afa2d54995b403b0022f88e984c4c65679c4bc" dependencies = [ "ahash", "anyhow", @@ -3489,7 +3492,7 @@ dependencies = [ "plonky2_maybe_rayon", "plonky2_util", "qp-plonky2-field", - "qp-poseidon-constants 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "qp-poseidon-constants 1.0.1", "rand 0.8.5", "serde", "static_assertions", @@ -3498,8 +3501,9 @@ dependencies = [ [[package]] name = "qp-plonky2-field" -version = "1.1.1" -source = "git+https://github.com/Quantus-Network/qp-plonky2#a7f257a234c40d252da33efdcd5f51f1f5a5b647" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e8d52dadf3bb92708c309922b62d7f3f2587d3047f9fe05a0c9f587e2890526" dependencies = [ "anyhow", "itertools 0.11.0", @@ -3521,7 +3525,7 @@ dependencies = [ "p3-field", "p3-goldilocks", "parity-scale-codec", - "qp-poseidon-core 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "qp-poseidon-core 1.0.3", "scale-info", "serde", "sp-core", @@ -3545,8 +3549,8 @@ dependencies = [ [[package]] name = "qp-poseidon-constants" -version = "1.0.1" -source = "git+https://github.com/Quantus-Network/qp-poseidon.git?branch=feat%2Fplonky2-update#57ed5087c8f9a21762ed63af64d6614e8f3194fd" +version = "1.0.2" +source = "git+https://github.com/Quantus-Network/qp-poseidon?branch=feat%2Ftransfer-proof-asset-id#9ae96dea18464d6ea43de5c78a066f9d1f17b801" dependencies = [ "p3-field", "p3-goldilocks", @@ -3557,29 +3561,30 @@ dependencies = [ [[package]] name = "qp-poseidon-core" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e658a373a7fb22babeda9ffcc8af0a894e6e3c008272ed735509eccb7769ead3" +version = "1.0.2" +source = "git+https://github.com/Quantus-Network/qp-poseidon?branch=feat%2Ftransfer-proof-asset-id#9ae96dea18464d6ea43de5c78a066f9d1f17b801" dependencies = [ "p3-field", "p3-goldilocks", "p3-poseidon2", "p3-symmetric", - "qp-poseidon-constants 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "qp-plonky2", + "qp-poseidon-constants 1.0.2", "rand_chacha 0.9.0", ] [[package]] name = "qp-poseidon-core" -version = "1.0.1" -source = "git+https://github.com/Quantus-Network/qp-poseidon.git?branch=feat%2Fplonky2-update#57ed5087c8f9a21762ed63af64d6614e8f3194fd" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f52c70df221c356b3ce63afabfae623aae632c27d3e078cd20eec4348096c2d7" dependencies = [ "p3-field", "p3-goldilocks", "p3-poseidon2", "p3-symmetric", "qp-plonky2", - "qp-poseidon-constants 1.0.1 (git+https://github.com/Quantus-Network/qp-poseidon.git?branch=feat%2Fplonky2-update)", + "qp-poseidon-constants 1.0.1", "rand_chacha 0.9.0", ] @@ -3605,7 +3610,7 @@ dependencies = [ "hex", "hex-literal", "nam-tiny-hderive", - "qp-poseidon-core 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "qp-poseidon-core 1.0.3", "qp-rusty-crystals-dilithium", "rand_chacha 0.9.0", "rand_core 0.9.3", @@ -3616,20 +3621,20 @@ dependencies = [ [[package]] name = "qp-wormhole-circuit" -version = "0.1.2" -source = "git+https://github.com/Quantus-Network/qp-zk-circuits.git?branch=feat%2Fblock-header-proof#8edb333d9a92a4279ae5416a5ad96a93864e4375" +version = "0.1.4" +source = "git+https://github.com/Quantus-Network/zk-circuits?branch=feat%2Fasset-id-wormhole#b97f33e7db8d4f07d6817883e434c86565959046" dependencies = [ "anyhow", "hex", "qp-plonky2", - "qp-poseidon-core 1.0.1 (git+https://github.com/Quantus-Network/qp-poseidon.git?branch=feat%2Fplonky2-update)", + "qp-poseidon-core 1.0.3", "qp-zk-circuits-common", ] [[package]] name = "qp-wormhole-prover" -version = "0.1.2" -source = "git+https://github.com/Quantus-Network/qp-zk-circuits.git?branch=feat%2Fblock-header-proof#8edb333d9a92a4279ae5416a5ad96a93864e4375" +version = "0.1.4" +source = "git+https://github.com/Quantus-Network/zk-circuits?branch=feat%2Fasset-id-wormhole#b97f33e7db8d4f07d6817883e434c86565959046" dependencies = [ "anyhow", "qp-plonky2", @@ -3639,12 +3644,13 @@ dependencies = [ [[package]] name = "qp-zk-circuits-common" -version = "0.1.2" -source = "git+https://github.com/Quantus-Network/qp-zk-circuits.git?branch=feat%2Fblock-header-proof#8edb333d9a92a4279ae5416a5ad96a93864e4375" +version = "0.1.4" +source = "git+https://github.com/Quantus-Network/zk-circuits?branch=feat%2Fasset-id-wormhole#b97f33e7db8d4f07d6817883e434c86565959046" dependencies = [ "anyhow", + "hex", "qp-plonky2", - "qp-poseidon-core 1.0.1 (git+https://github.com/Quantus-Network/qp-poseidon.git?branch=feat%2Fplonky2-update)", + "qp-poseidon-core 1.0.3", "serde", ] @@ -3665,7 +3671,7 @@ dependencies = [ "qp-dilithium-crypto", "qp-plonky2", "qp-poseidon", - "qp-poseidon-core 1.0.1 (git+https://github.com/Quantus-Network/qp-poseidon.git?branch=feat%2Fplonky2-update)", + "qp-poseidon-core 1.0.2", "qp-rusty-crystals-dilithium", "qp-rusty-crystals-hdwallet", "qp-wormhole-circuit", diff --git a/Cargo.toml b/Cargo.toml index 8f99434..ffb5d8f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -19,7 +19,6 @@ path = "src/lib.rs" name = "quantus" path = "src/main.rs" - [dependencies] # CLI and async runtime clap = { version = "4.5", features = ["derive"] } @@ -70,11 +69,11 @@ subxt-metadata = "0.43.0" # ZK proof generation anyhow = "1.0" -qp-wormhole-circuit = { git = "https://github.com/Quantus-Network/qp-zk-circuits.git", branch = "feat/block-header-proof", default-features = false } -qp-wormhole-prover = { git = "https://github.com/Quantus-Network/qp-zk-circuits.git", branch = "feat/block-header-proof", default-features = false } -qp-zk-circuits-common = { git = "https://github.com/Quantus-Network/qp-zk-circuits.git", branch = "feat/block-header-proof", default-features = false } -plonky2 = { package = "qp-plonky2", git = "https://github.com/Quantus-Network/qp-plonky2", default-features = false, features = ["no_random"] } -qp-poseidon-core = { git = "https://github.com/Quantus-Network/qp-poseidon.git", branch = "feat/plonky2-update", default-features = false, features = ["p3"] } +qp-wormhole-circuit = { git = "https://github.com/Quantus-Network/zk-circuits", branch = "feat/asset-id-wormhole", default-features = false } +qp-wormhole-prover = { git = "https://github.com/Quantus-Network/zk-circuits", branch = "feat/asset-id-wormhole", default-features = false } +qp-zk-circuits-common = { git = "https://github.com/Quantus-Network/zk-circuits", branch = "feat/asset-id-wormhole", default-features = false } +qp-plonky2 = { version = "1.1.3", default-features = false, features = ["no_random"] } +qp-poseidon-core = { git = "https://github.com/Quantus-Network/qp-poseidon", branch = "feat/transfer-proof-asset-id", default-features = false, features = ["p2", "p3"] } [dev-dependencies] tempfile = "3.8" diff --git a/src/chain/quantus_subxt.rs b/src/chain/quantus_subxt.rs index f833791..c8aa097 100644 --- a/src/chain/quantus_subxt.rs +++ b/src/chain/quantus_subxt.rs @@ -145,9 +145,10 @@ pub mod api { "execute_block", types::ExecuteBlock { block }, [ - 133u8, 135u8, 228u8, 65u8, 106u8, 27u8, 85u8, 158u8, 112u8, 254u8, - 93u8, 26u8, 102u8, 201u8, 118u8, 216u8, 249u8, 247u8, 91u8, 74u8, 56u8, - 208u8, 231u8, 115u8, 131u8, 29u8, 209u8, 6u8, 65u8, 57u8, 214u8, 125u8, + 81u8, 130u8, 143u8, 72u8, 156u8, 15u8, 28u8, 87u8, 117u8, 10u8, 192u8, + 249u8, 117u8, 214u8, 184u8, 13u8, 148u8, 224u8, 167u8, 170u8, 101u8, + 194u8, 229u8, 140u8, 199u8, 115u8, 73u8, 99u8, 183u8, 205u8, 98u8, + 33u8, ], ) } @@ -164,9 +165,9 @@ pub mod api { "initialize_block", types::InitializeBlock { header }, [ - 132u8, 169u8, 113u8, 112u8, 80u8, 139u8, 113u8, 35u8, 41u8, 81u8, 36u8, - 35u8, 37u8, 202u8, 29u8, 207u8, 205u8, 229u8, 145u8, 7u8, 133u8, 94u8, - 25u8, 108u8, 233u8, 86u8, 234u8, 29u8, 236u8, 57u8, 56u8, 186u8, + 112u8, 139u8, 92u8, 30u8, 37u8, 99u8, 47u8, 83u8, 221u8, 31u8, 204u8, + 129u8, 102u8, 92u8, 144u8, 80u8, 3u8, 98u8, 157u8, 5u8, 20u8, 31u8, + 110u8, 105u8, 86u8, 91u8, 173u8, 19u8, 140u8, 246u8, 60u8, 223u8, ], ) } @@ -194,7 +195,7 @@ pub mod api { pub struct Version {} pub mod execute_block { use super::runtime_types; - pub type Block = runtime_types :: sp_runtime :: generic :: block :: Block < runtime_types :: sp_runtime :: generic :: header :: Header < :: core :: primitive :: u32 > , :: subxt :: ext :: subxt_core :: utils :: UncheckedExtrinsic < :: subxt :: ext :: subxt_core :: utils :: MultiAddress < :: subxt :: ext :: subxt_core :: utils :: AccountId32 , () > , runtime_types :: quantus_runtime :: RuntimeCall , runtime_types :: qp_dilithium_crypto :: types :: DilithiumSignatureScheme , (runtime_types :: frame_system :: extensions :: check_non_zero_sender :: CheckNonZeroSender , runtime_types :: frame_system :: extensions :: check_spec_version :: CheckSpecVersion , runtime_types :: frame_system :: extensions :: check_tx_version :: CheckTxVersion , runtime_types :: frame_system :: extensions :: check_genesis :: CheckGenesis , runtime_types :: frame_system :: extensions :: check_mortality :: CheckMortality , runtime_types :: frame_system :: extensions :: check_nonce :: CheckNonce , runtime_types :: frame_system :: extensions :: check_weight :: CheckWeight , runtime_types :: pallet_transaction_payment :: ChargeTransactionPayment , runtime_types :: frame_metadata_hash_extension :: CheckMetadataHash , runtime_types :: quantus_runtime :: transaction_extensions :: ReversibleTransactionExtension ,) > > ; + pub type Block = runtime_types :: sp_runtime :: generic :: block :: Block < runtime_types :: qp_header :: Header < :: core :: primitive :: u32 > , :: subxt :: ext :: subxt_core :: utils :: UncheckedExtrinsic < :: subxt :: ext :: subxt_core :: utils :: MultiAddress < :: subxt :: ext :: subxt_core :: utils :: AccountId32 , () > , runtime_types :: quantus_runtime :: RuntimeCall , runtime_types :: qp_dilithium_crypto :: types :: DilithiumSignatureScheme , (runtime_types :: frame_system :: extensions :: check_non_zero_sender :: CheckNonZeroSender , runtime_types :: frame_system :: extensions :: check_spec_version :: CheckSpecVersion , runtime_types :: frame_system :: extensions :: check_tx_version :: CheckTxVersion , runtime_types :: frame_system :: extensions :: check_genesis :: CheckGenesis , runtime_types :: frame_system :: extensions :: check_mortality :: CheckMortality , runtime_types :: frame_system :: extensions :: check_nonce :: CheckNonce , runtime_types :: frame_system :: extensions :: check_weight :: CheckWeight , runtime_types :: pallet_transaction_payment :: ChargeTransactionPayment , runtime_types :: frame_metadata_hash_extension :: CheckMetadataHash , runtime_types :: quantus_runtime :: transaction_extensions :: ReversibleTransactionExtension , runtime_types :: quantus_runtime :: transaction_extensions :: WormholeProofRecorderExtension ,) > > ; pub mod output { use super::runtime_types; pub type Output = (); @@ -216,8 +217,7 @@ pub mod api { } pub mod initialize_block { use super::runtime_types; - pub type Header = - runtime_types::sp_runtime::generic::header::Header<::core::primitive::u32>; + pub type Header = runtime_types::qp_header::Header<::core::primitive::u32>; pub mod output { use super::runtime_types; pub type Output = runtime_types::sp_runtime::ExtrinsicInclusionMode; @@ -412,9 +412,9 @@ pub mod api { "finalize_block", types::FinalizeBlock {}, [ - 244u8, 207u8, 24u8, 33u8, 13u8, 69u8, 9u8, 249u8, 145u8, 143u8, 122u8, - 96u8, 197u8, 55u8, 64u8, 111u8, 238u8, 224u8, 34u8, 201u8, 27u8, 146u8, - 232u8, 99u8, 191u8, 30u8, 114u8, 16u8, 32u8, 220u8, 58u8, 62u8, + 135u8, 81u8, 28u8, 123u8, 19u8, 171u8, 129u8, 82u8, 85u8, 96u8, 238u8, + 155u8, 211u8, 153u8, 243u8, 31u8, 189u8, 82u8, 91u8, 225u8, 78u8, 48u8, + 241u8, 236u8, 143u8, 65u8, 91u8, 167u8, 114u8, 146u8, 31u8, 197u8, ], ) } @@ -452,10 +452,10 @@ pub mod api { "check_inherents", types::CheckInherents { block, data }, [ - 153u8, 134u8, 1u8, 215u8, 139u8, 11u8, 53u8, 51u8, 210u8, 175u8, 197u8, - 28u8, 38u8, 209u8, 175u8, 247u8, 142u8, 157u8, 50u8, 151u8, 164u8, - 191u8, 181u8, 118u8, 80u8, 97u8, 160u8, 248u8, 110u8, 217u8, 181u8, - 234u8, + 44u8, 230u8, 134u8, 154u8, 73u8, 173u8, 160u8, 231u8, 223u8, 148u8, + 247u8, 104u8, 214u8, 168u8, 43u8, 202u8, 204u8, 14u8, 148u8, 154u8, + 9u8, 103u8, 239u8, 45u8, 186u8, 21u8, 97u8, 136u8, 200u8, 108u8, 205u8, + 167u8, ], ) } @@ -464,7 +464,7 @@ pub mod api { use super::runtime_types; pub mod apply_extrinsic { use super::runtime_types; - pub type Extrinsic = :: subxt :: ext :: subxt_core :: utils :: UncheckedExtrinsic < :: subxt :: ext :: subxt_core :: utils :: MultiAddress < :: subxt :: ext :: subxt_core :: utils :: AccountId32 , () > , runtime_types :: quantus_runtime :: RuntimeCall , runtime_types :: qp_dilithium_crypto :: types :: DilithiumSignatureScheme , (runtime_types :: frame_system :: extensions :: check_non_zero_sender :: CheckNonZeroSender , runtime_types :: frame_system :: extensions :: check_spec_version :: CheckSpecVersion , runtime_types :: frame_system :: extensions :: check_tx_version :: CheckTxVersion , runtime_types :: frame_system :: extensions :: check_genesis :: CheckGenesis , runtime_types :: frame_system :: extensions :: check_mortality :: CheckMortality , runtime_types :: frame_system :: extensions :: check_nonce :: CheckNonce , runtime_types :: frame_system :: extensions :: check_weight :: CheckWeight , runtime_types :: pallet_transaction_payment :: ChargeTransactionPayment , runtime_types :: frame_metadata_hash_extension :: CheckMetadataHash , runtime_types :: quantus_runtime :: transaction_extensions :: ReversibleTransactionExtension ,) > ; + pub type Extrinsic = :: subxt :: ext :: subxt_core :: utils :: UncheckedExtrinsic < :: subxt :: ext :: subxt_core :: utils :: MultiAddress < :: subxt :: ext :: subxt_core :: utils :: AccountId32 , () > , runtime_types :: quantus_runtime :: RuntimeCall , runtime_types :: qp_dilithium_crypto :: types :: DilithiumSignatureScheme , (runtime_types :: frame_system :: extensions :: check_non_zero_sender :: CheckNonZeroSender , runtime_types :: frame_system :: extensions :: check_spec_version :: CheckSpecVersion , runtime_types :: frame_system :: extensions :: check_tx_version :: CheckTxVersion , runtime_types :: frame_system :: extensions :: check_genesis :: CheckGenesis , runtime_types :: frame_system :: extensions :: check_mortality :: CheckMortality , runtime_types :: frame_system :: extensions :: check_nonce :: CheckNonce , runtime_types :: frame_system :: extensions :: check_weight :: CheckWeight , runtime_types :: pallet_transaction_payment :: ChargeTransactionPayment , runtime_types :: frame_metadata_hash_extension :: CheckMetadataHash , runtime_types :: quantus_runtime :: transaction_extensions :: ReversibleTransactionExtension , runtime_types :: quantus_runtime :: transaction_extensions :: WormholeProofRecorderExtension ,) > ; pub mod output { use super::runtime_types; pub type Output = :: core :: result :: Result < :: core :: result :: Result < () , runtime_types :: sp_runtime :: DispatchError > , runtime_types :: sp_runtime :: transaction_validity :: TransactionValidityError > ; @@ -488,9 +488,7 @@ pub mod api { use super::runtime_types; pub mod output { use super::runtime_types; - pub type Output = runtime_types::sp_runtime::generic::header::Header< - ::core::primitive::u32, - >; + pub type Output = runtime_types::qp_header::Header<::core::primitive::u32>; } } #[derive( @@ -510,7 +508,7 @@ pub mod api { pub type Inherent = runtime_types::sp_inherents::InherentData; pub mod output { use super::runtime_types; - pub type Output = :: subxt :: ext :: subxt_core :: alloc :: vec :: Vec < :: subxt :: ext :: subxt_core :: utils :: UncheckedExtrinsic < :: subxt :: ext :: subxt_core :: utils :: MultiAddress < :: subxt :: ext :: subxt_core :: utils :: AccountId32 , () > , runtime_types :: quantus_runtime :: RuntimeCall , runtime_types :: qp_dilithium_crypto :: types :: DilithiumSignatureScheme , (runtime_types :: frame_system :: extensions :: check_non_zero_sender :: CheckNonZeroSender , runtime_types :: frame_system :: extensions :: check_spec_version :: CheckSpecVersion , runtime_types :: frame_system :: extensions :: check_tx_version :: CheckTxVersion , runtime_types :: frame_system :: extensions :: check_genesis :: CheckGenesis , runtime_types :: frame_system :: extensions :: check_mortality :: CheckMortality , runtime_types :: frame_system :: extensions :: check_nonce :: CheckNonce , runtime_types :: frame_system :: extensions :: check_weight :: CheckWeight , runtime_types :: pallet_transaction_payment :: ChargeTransactionPayment , runtime_types :: frame_metadata_hash_extension :: CheckMetadataHash , runtime_types :: quantus_runtime :: transaction_extensions :: ReversibleTransactionExtension ,) > > ; + pub type Output = :: subxt :: ext :: subxt_core :: alloc :: vec :: Vec < :: subxt :: ext :: subxt_core :: utils :: UncheckedExtrinsic < :: subxt :: ext :: subxt_core :: utils :: MultiAddress < :: subxt :: ext :: subxt_core :: utils :: AccountId32 , () > , runtime_types :: quantus_runtime :: RuntimeCall , runtime_types :: qp_dilithium_crypto :: types :: DilithiumSignatureScheme , (runtime_types :: frame_system :: extensions :: check_non_zero_sender :: CheckNonZeroSender , runtime_types :: frame_system :: extensions :: check_spec_version :: CheckSpecVersion , runtime_types :: frame_system :: extensions :: check_tx_version :: CheckTxVersion , runtime_types :: frame_system :: extensions :: check_genesis :: CheckGenesis , runtime_types :: frame_system :: extensions :: check_mortality :: CheckMortality , runtime_types :: frame_system :: extensions :: check_nonce :: CheckNonce , runtime_types :: frame_system :: extensions :: check_weight :: CheckWeight , runtime_types :: pallet_transaction_payment :: ChargeTransactionPayment , runtime_types :: frame_metadata_hash_extension :: CheckMetadataHash , runtime_types :: quantus_runtime :: transaction_extensions :: ReversibleTransactionExtension , runtime_types :: quantus_runtime :: transaction_extensions :: WormholeProofRecorderExtension ,) > > ; } } #[derive( @@ -529,7 +527,7 @@ pub mod api { } pub mod check_inherents { use super::runtime_types; - pub type Block = runtime_types :: sp_runtime :: generic :: block :: Block < runtime_types :: sp_runtime :: generic :: header :: Header < :: core :: primitive :: u32 > , :: subxt :: ext :: subxt_core :: utils :: UncheckedExtrinsic < :: subxt :: ext :: subxt_core :: utils :: MultiAddress < :: subxt :: ext :: subxt_core :: utils :: AccountId32 , () > , runtime_types :: quantus_runtime :: RuntimeCall , runtime_types :: qp_dilithium_crypto :: types :: DilithiumSignatureScheme , (runtime_types :: frame_system :: extensions :: check_non_zero_sender :: CheckNonZeroSender , runtime_types :: frame_system :: extensions :: check_spec_version :: CheckSpecVersion , runtime_types :: frame_system :: extensions :: check_tx_version :: CheckTxVersion , runtime_types :: frame_system :: extensions :: check_genesis :: CheckGenesis , runtime_types :: frame_system :: extensions :: check_mortality :: CheckMortality , runtime_types :: frame_system :: extensions :: check_nonce :: CheckNonce , runtime_types :: frame_system :: extensions :: check_weight :: CheckWeight , runtime_types :: pallet_transaction_payment :: ChargeTransactionPayment , runtime_types :: frame_metadata_hash_extension :: CheckMetadataHash , runtime_types :: quantus_runtime :: transaction_extensions :: ReversibleTransactionExtension ,) > > ; + pub type Block = runtime_types :: sp_runtime :: generic :: block :: Block < runtime_types :: qp_header :: Header < :: core :: primitive :: u32 > , :: subxt :: ext :: subxt_core :: utils :: UncheckedExtrinsic < :: subxt :: ext :: subxt_core :: utils :: MultiAddress < :: subxt :: ext :: subxt_core :: utils :: AccountId32 , () > , runtime_types :: quantus_runtime :: RuntimeCall , runtime_types :: qp_dilithium_crypto :: types :: DilithiumSignatureScheme , (runtime_types :: frame_system :: extensions :: check_non_zero_sender :: CheckNonZeroSender , runtime_types :: frame_system :: extensions :: check_spec_version :: CheckSpecVersion , runtime_types :: frame_system :: extensions :: check_tx_version :: CheckTxVersion , runtime_types :: frame_system :: extensions :: check_genesis :: CheckGenesis , runtime_types :: frame_system :: extensions :: check_mortality :: CheckMortality , runtime_types :: frame_system :: extensions :: check_nonce :: CheckNonce , runtime_types :: frame_system :: extensions :: check_weight :: CheckWeight , runtime_types :: pallet_transaction_payment :: ChargeTransactionPayment , runtime_types :: frame_metadata_hash_extension :: CheckMetadataHash , runtime_types :: quantus_runtime :: transaction_extensions :: ReversibleTransactionExtension , runtime_types :: quantus_runtime :: transaction_extensions :: WormholeProofRecorderExtension ,) > > ; pub type Data = runtime_types::sp_inherents::InherentData; pub mod output { use super::runtime_types; @@ -595,7 +593,7 @@ pub mod api { use super::runtime_types; pub type Source = runtime_types::sp_runtime::transaction_validity::TransactionSource; - pub type Tx = :: subxt :: ext :: subxt_core :: utils :: UncheckedExtrinsic < :: subxt :: ext :: subxt_core :: utils :: MultiAddress < :: subxt :: ext :: subxt_core :: utils :: AccountId32 , () > , runtime_types :: quantus_runtime :: RuntimeCall , runtime_types :: qp_dilithium_crypto :: types :: DilithiumSignatureScheme , (runtime_types :: frame_system :: extensions :: check_non_zero_sender :: CheckNonZeroSender , runtime_types :: frame_system :: extensions :: check_spec_version :: CheckSpecVersion , runtime_types :: frame_system :: extensions :: check_tx_version :: CheckTxVersion , runtime_types :: frame_system :: extensions :: check_genesis :: CheckGenesis , runtime_types :: frame_system :: extensions :: check_mortality :: CheckMortality , runtime_types :: frame_system :: extensions :: check_nonce :: CheckNonce , runtime_types :: frame_system :: extensions :: check_weight :: CheckWeight , runtime_types :: pallet_transaction_payment :: ChargeTransactionPayment , runtime_types :: frame_metadata_hash_extension :: CheckMetadataHash , runtime_types :: quantus_runtime :: transaction_extensions :: ReversibleTransactionExtension ,) > ; + pub type Tx = :: subxt :: ext :: subxt_core :: utils :: UncheckedExtrinsic < :: subxt :: ext :: subxt_core :: utils :: MultiAddress < :: subxt :: ext :: subxt_core :: utils :: AccountId32 , () > , runtime_types :: quantus_runtime :: RuntimeCall , runtime_types :: qp_dilithium_crypto :: types :: DilithiumSignatureScheme , (runtime_types :: frame_system :: extensions :: check_non_zero_sender :: CheckNonZeroSender , runtime_types :: frame_system :: extensions :: check_spec_version :: CheckSpecVersion , runtime_types :: frame_system :: extensions :: check_tx_version :: CheckTxVersion , runtime_types :: frame_system :: extensions :: check_genesis :: CheckGenesis , runtime_types :: frame_system :: extensions :: check_mortality :: CheckMortality , runtime_types :: frame_system :: extensions :: check_nonce :: CheckNonce , runtime_types :: frame_system :: extensions :: check_weight :: CheckWeight , runtime_types :: pallet_transaction_payment :: ChargeTransactionPayment , runtime_types :: frame_metadata_hash_extension :: CheckMetadataHash , runtime_types :: quantus_runtime :: transaction_extensions :: ReversibleTransactionExtension , runtime_types :: quantus_runtime :: transaction_extensions :: WormholeProofRecorderExtension ,) > ; pub type BlockHash = ::subxt::ext::subxt_core::utils::H256; pub mod output { use super::runtime_types; @@ -638,9 +636,10 @@ pub mod api { "offchain_worker", types::OffchainWorker { header }, [ - 10u8, 135u8, 19u8, 153u8, 33u8, 216u8, 18u8, 242u8, 33u8, 140u8, 4u8, - 223u8, 200u8, 130u8, 103u8, 118u8, 137u8, 24u8, 19u8, 127u8, 161u8, - 29u8, 184u8, 111u8, 222u8, 111u8, 253u8, 73u8, 45u8, 31u8, 79u8, 60u8, + 131u8, 199u8, 206u8, 86u8, 209u8, 109u8, 229u8, 152u8, 235u8, 155u8, + 35u8, 252u8, 70u8, 180u8, 47u8, 173u8, 84u8, 182u8, 176u8, 164u8, + 107u8, 88u8, 249u8, 181u8, 85u8, 174u8, 240u8, 226u8, 254u8, 189u8, + 167u8, 155u8, ], ) } @@ -649,8 +648,7 @@ pub mod api { use super::runtime_types; pub mod offchain_worker { use super::runtime_types; - pub type Header = - runtime_types::sp_runtime::generic::header::Header<::core::primitive::u32>; + pub type Header = runtime_types::qp_header::Header<::core::primitive::u32>; pub mod output { use super::runtime_types; pub type Output = (); @@ -1356,7 +1354,7 @@ pub mod api { use super::runtime_types; pub mod query_info { use super::runtime_types; - pub type Uxt = :: subxt :: ext :: subxt_core :: utils :: UncheckedExtrinsic < :: subxt :: ext :: subxt_core :: utils :: MultiAddress < :: subxt :: ext :: subxt_core :: utils :: AccountId32 , () > , runtime_types :: quantus_runtime :: RuntimeCall , runtime_types :: qp_dilithium_crypto :: types :: DilithiumSignatureScheme , (runtime_types :: frame_system :: extensions :: check_non_zero_sender :: CheckNonZeroSender , runtime_types :: frame_system :: extensions :: check_spec_version :: CheckSpecVersion , runtime_types :: frame_system :: extensions :: check_tx_version :: CheckTxVersion , runtime_types :: frame_system :: extensions :: check_genesis :: CheckGenesis , runtime_types :: frame_system :: extensions :: check_mortality :: CheckMortality , runtime_types :: frame_system :: extensions :: check_nonce :: CheckNonce , runtime_types :: frame_system :: extensions :: check_weight :: CheckWeight , runtime_types :: pallet_transaction_payment :: ChargeTransactionPayment , runtime_types :: frame_metadata_hash_extension :: CheckMetadataHash , runtime_types :: quantus_runtime :: transaction_extensions :: ReversibleTransactionExtension ,) > ; + pub type Uxt = :: subxt :: ext :: subxt_core :: utils :: UncheckedExtrinsic < :: subxt :: ext :: subxt_core :: utils :: MultiAddress < :: subxt :: ext :: subxt_core :: utils :: AccountId32 , () > , runtime_types :: quantus_runtime :: RuntimeCall , runtime_types :: qp_dilithium_crypto :: types :: DilithiumSignatureScheme , (runtime_types :: frame_system :: extensions :: check_non_zero_sender :: CheckNonZeroSender , runtime_types :: frame_system :: extensions :: check_spec_version :: CheckSpecVersion , runtime_types :: frame_system :: extensions :: check_tx_version :: CheckTxVersion , runtime_types :: frame_system :: extensions :: check_genesis :: CheckGenesis , runtime_types :: frame_system :: extensions :: check_mortality :: CheckMortality , runtime_types :: frame_system :: extensions :: check_nonce :: CheckNonce , runtime_types :: frame_system :: extensions :: check_weight :: CheckWeight , runtime_types :: pallet_transaction_payment :: ChargeTransactionPayment , runtime_types :: frame_metadata_hash_extension :: CheckMetadataHash , runtime_types :: quantus_runtime :: transaction_extensions :: ReversibleTransactionExtension , runtime_types :: quantus_runtime :: transaction_extensions :: WormholeProofRecorderExtension ,) > ; pub type Len = ::core::primitive::u32; pub mod output { use super::runtime_types; @@ -1384,7 +1382,7 @@ pub mod api { } pub mod query_fee_details { use super::runtime_types; - pub type Uxt = :: subxt :: ext :: subxt_core :: utils :: UncheckedExtrinsic < :: subxt :: ext :: subxt_core :: utils :: MultiAddress < :: subxt :: ext :: subxt_core :: utils :: AccountId32 , () > , runtime_types :: quantus_runtime :: RuntimeCall , runtime_types :: qp_dilithium_crypto :: types :: DilithiumSignatureScheme , (runtime_types :: frame_system :: extensions :: check_non_zero_sender :: CheckNonZeroSender , runtime_types :: frame_system :: extensions :: check_spec_version :: CheckSpecVersion , runtime_types :: frame_system :: extensions :: check_tx_version :: CheckTxVersion , runtime_types :: frame_system :: extensions :: check_genesis :: CheckGenesis , runtime_types :: frame_system :: extensions :: check_mortality :: CheckMortality , runtime_types :: frame_system :: extensions :: check_nonce :: CheckNonce , runtime_types :: frame_system :: extensions :: check_weight :: CheckWeight , runtime_types :: pallet_transaction_payment :: ChargeTransactionPayment , runtime_types :: frame_metadata_hash_extension :: CheckMetadataHash , runtime_types :: quantus_runtime :: transaction_extensions :: ReversibleTransactionExtension ,) > ; + pub type Uxt = :: subxt :: ext :: subxt_core :: utils :: UncheckedExtrinsic < :: subxt :: ext :: subxt_core :: utils :: MultiAddress < :: subxt :: ext :: subxt_core :: utils :: AccountId32 , () > , runtime_types :: quantus_runtime :: RuntimeCall , runtime_types :: qp_dilithium_crypto :: types :: DilithiumSignatureScheme , (runtime_types :: frame_system :: extensions :: check_non_zero_sender :: CheckNonZeroSender , runtime_types :: frame_system :: extensions :: check_spec_version :: CheckSpecVersion , runtime_types :: frame_system :: extensions :: check_tx_version :: CheckTxVersion , runtime_types :: frame_system :: extensions :: check_genesis :: CheckGenesis , runtime_types :: frame_system :: extensions :: check_mortality :: CheckMortality , runtime_types :: frame_system :: extensions :: check_nonce :: CheckNonce , runtime_types :: frame_system :: extensions :: check_weight :: CheckWeight , runtime_types :: pallet_transaction_payment :: ChargeTransactionPayment , runtime_types :: frame_metadata_hash_extension :: CheckMetadataHash , runtime_types :: quantus_runtime :: transaction_extensions :: ReversibleTransactionExtension , runtime_types :: quantus_runtime :: transaction_extensions :: WormholeProofRecorderExtension ,) > ; pub type Len = ::core::primitive::u32; pub mod output { use super::runtime_types; @@ -1473,9 +1471,9 @@ pub mod api { "query_call_info", types::QueryCallInfo { call, len }, [ - 124u8, 24u8, 108u8, 27u8, 208u8, 239u8, 216u8, 228u8, 57u8, 228u8, - 174u8, 239u8, 59u8, 192u8, 215u8, 42u8, 41u8, 201u8, 169u8, 7u8, 33u8, - 161u8, 23u8, 79u8, 0u8, 57u8, 32u8, 8u8, 13u8, 5u8, 138u8, 98u8, + 86u8, 229u8, 66u8, 90u8, 9u8, 192u8, 94u8, 166u8, 53u8, 95u8, 117u8, + 12u8, 3u8, 4u8, 189u8, 7u8, 73u8, 230u8, 139u8, 35u8, 5u8, 109u8, + 158u8, 162u8, 231u8, 1u8, 128u8, 220u8, 143u8, 156u8, 31u8, 122u8, ], ) } @@ -1493,10 +1491,9 @@ pub mod api { "query_call_fee_details", types::QueryCallFeeDetails { call, len }, [ - 250u8, 80u8, 231u8, 164u8, 228u8, 157u8, 118u8, 66u8, 94u8, 60u8, - 100u8, 68u8, 96u8, 22u8, 100u8, 185u8, 1u8, 160u8, 77u8, 30u8, 126u8, - 180u8, 230u8, 117u8, 99u8, 101u8, 101u8, 49u8, 237u8, 192u8, 219u8, - 41u8, + 181u8, 7u8, 183u8, 151u8, 247u8, 92u8, 240u8, 27u8, 40u8, 192u8, 150u8, + 16u8, 176u8, 113u8, 208u8, 17u8, 253u8, 72u8, 92u8, 180u8, 153u8, + 179u8, 32u8, 229u8, 61u8, 136u8, 33u8, 123u8, 48u8, 172u8, 216u8, 8u8, ], ) } @@ -2007,9 +2004,9 @@ pub mod api { .hash(); runtime_metadata_hash == [ - 0u8, 63u8, 162u8, 224u8, 195u8, 69u8, 233u8, 104u8, 127u8, 217u8, 171u8, 115u8, - 255u8, 248u8, 177u8, 84u8, 158u8, 190u8, 76u8, 185u8, 144u8, 155u8, 69u8, 210u8, - 153u8, 253u8, 206u8, 43u8, 20u8, 28u8, 169u8, 236u8, + 92u8, 199u8, 247u8, 245u8, 15u8, 124u8, 69u8, 52u8, 138u8, 213u8, 161u8, 230u8, + 234u8, 254u8, 189u8, 183u8, 200u8, 237u8, 73u8, 35u8, 183u8, 80u8, 71u8, 120u8, + 128u8, 234u8, 140u8, 160u8, 131u8, 172u8, 255u8, 32u8, ] } pub mod system { @@ -3108,9 +3105,10 @@ pub mod api { "Events", (), [ - 19u8, 73u8, 6u8, 2u8, 209u8, 127u8, 197u8, 110u8, 228u8, 146u8, 149u8, - 129u8, 191u8, 123u8, 182u8, 64u8, 160u8, 106u8, 123u8, 149u8, 123u8, - 193u8, 14u8, 100u8, 42u8, 223u8, 34u8, 212u8, 161u8, 98u8, 44u8, 49u8, + 233u8, 203u8, 207u8, 158u8, 57u8, 161u8, 88u8, 160u8, 148u8, 0u8, + 176u8, 254u8, 251u8, 206u8, 46u8, 94u8, 178u8, 136u8, 154u8, 109u8, + 197u8, 147u8, 125u8, 17u8, 120u8, 246u8, 69u8, 50u8, 48u8, 172u8, 81u8, + 34u8, ], ) } @@ -4625,31 +4623,6 @@ pub mod api { const PALLET: &'static str = "Balances"; const EVENT: &'static str = "TotalIssuanceForced"; } - #[derive( - :: subxt :: ext :: subxt_core :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: subxt_core :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] - #[doc = "Transfer proof was stored."] - pub struct TransferProofStored { - pub transfer_count: transfer_proof_stored::TransferCount, - pub source: transfer_proof_stored::Source, - pub dest: transfer_proof_stored::Dest, - pub funding_amount: transfer_proof_stored::FundingAmount, - } - pub mod transfer_proof_stored { - use super::runtime_types; - pub type TransferCount = ::core::primitive::u64; - pub type Source = ::subxt::ext::subxt_core::utils::AccountId32; - pub type Dest = ::subxt::ext::subxt_core::utils::AccountId32; - pub type FundingAmount = ::core::primitive::u128; - } - impl ::subxt::ext::subxt_core::events::StaticEvent for TransferProofStored { - const PALLET: &'static str = "Balances"; - const EVENT: &'static str = "TransferProofStored"; - } } pub mod storage { use super::runtime_types; @@ -4709,20 +4682,6 @@ pub mod api { >; pub type Param0 = ::subxt::ext::subxt_core::utils::AccountId32; } - pub mod transfer_proof { - use super::runtime_types; - pub type TransferProof = (); - pub type Param0 = ( - ::core::primitive::u64, - ::subxt::ext::subxt_core::utils::AccountId32, - ::subxt::ext::subxt_core::utils::AccountId32, - ::core::primitive::u128, - ); - } - pub mod transfer_count { - use super::runtime_types; - pub type TransferCount = ::core::primitive::u64; - } } pub struct StorageApi; impl StorageApi { @@ -5050,74 +5009,6 @@ pub mod api { ], ) } - #[doc = " Transfer proofs for a wormhole transfers"] - pub fn transfer_proof_iter( - &self, - ) -> ::subxt::ext::subxt_core::storage::address::StaticAddress< - (), - types::transfer_proof::TransferProof, - (), - (), - ::subxt::ext::subxt_core::utils::Yes, - > { - ::subxt::ext::subxt_core::storage::address::StaticAddress::new_static( - "Balances", - "TransferProof", - (), - [ - 210u8, 54u8, 36u8, 79u8, 12u8, 123u8, 227u8, 172u8, 23u8, 232u8, 200u8, - 138u8, 130u8, 99u8, 12u8, 186u8, 77u8, 74u8, 208u8, 111u8, 137u8, - 159u8, 169u8, 112u8, 227u8, 111u8, 65u8, 127u8, 232u8, 57u8, 166u8, - 14u8, - ], - ) - } - #[doc = " Transfer proofs for a wormhole transfers"] - pub fn transfer_proof( - &self, - _0: types::transfer_proof::Param0, - ) -> ::subxt::ext::subxt_core::storage::address::StaticAddress< - ::subxt::ext::subxt_core::storage::address::StaticStorageKey< - types::transfer_proof::Param0, - >, - types::transfer_proof::TransferProof, - ::subxt::ext::subxt_core::utils::Yes, - (), - (), - > { - ::subxt::ext::subxt_core::storage::address::StaticAddress::new_static( - "Balances", - "TransferProof", - ::subxt::ext::subxt_core::storage::address::StaticStorageKey::new(_0), - [ - 210u8, 54u8, 36u8, 79u8, 12u8, 123u8, 227u8, 172u8, 23u8, 232u8, 200u8, - 138u8, 130u8, 99u8, 12u8, 186u8, 77u8, 74u8, 208u8, 111u8, 137u8, - 159u8, 169u8, 112u8, 227u8, 111u8, 65u8, 127u8, 232u8, 57u8, 166u8, - 14u8, - ], - ) - } - pub fn transfer_count( - &self, - ) -> ::subxt::ext::subxt_core::storage::address::StaticAddress< - (), - types::transfer_count::TransferCount, - ::subxt::ext::subxt_core::utils::Yes, - ::subxt::ext::subxt_core::utils::Yes, - (), - > { - ::subxt::ext::subxt_core::storage::address::StaticAddress::new_static( - "Balances", - "TransferCount", - (), - [ - 105u8, 10u8, 160u8, 118u8, 193u8, 131u8, 207u8, 188u8, 78u8, 238u8, - 252u8, 99u8, 31u8, 72u8, 159u8, 128u8, 159u8, 215u8, 110u8, 101u8, - 27u8, 132u8, 12u8, 59u8, 182u8, 107u8, 98u8, 77u8, 189u8, 100u8, 51u8, - 209u8, - ], - ) - } } } pub mod constants { @@ -5497,9 +5388,10 @@ pub mod api { call: ::subxt::ext::subxt_core::alloc::boxed::Box::new(call), }, [ - 86u8, 27u8, 250u8, 23u8, 151u8, 9u8, 221u8, 180u8, 232u8, 7u8, 44u8, - 235u8, 50u8, 104u8, 247u8, 184u8, 102u8, 4u8, 48u8, 196u8, 84u8, 123u8, - 30u8, 123u8, 85u8, 124u8, 151u8, 25u8, 83u8, 221u8, 50u8, 226u8, + 203u8, 72u8, 88u8, 39u8, 226u8, 214u8, 8u8, 216u8, 109u8, 243u8, 223u8, + 189u8, 193u8, 191u8, 45u8, 189u8, 20u8, 195u8, 62u8, 97u8, 210u8, + 214u8, 151u8, 193u8, 31u8, 108u8, 69u8, 46u8, 140u8, 222u8, 228u8, + 169u8, ], ) } @@ -5522,9 +5414,9 @@ pub mod api { weight, }, [ - 182u8, 73u8, 169u8, 247u8, 46u8, 137u8, 24u8, 91u8, 219u8, 22u8, 25u8, - 193u8, 10u8, 234u8, 25u8, 205u8, 215u8, 83u8, 83u8, 26u8, 250u8, 195u8, - 164u8, 108u8, 247u8, 77u8, 86u8, 233u8, 185u8, 14u8, 233u8, 6u8, + 64u8, 94u8, 77u8, 108u8, 78u8, 248u8, 236u8, 53u8, 252u8, 34u8, 135u8, + 22u8, 131u8, 225u8, 167u8, 100u8, 56u8, 83u8, 244u8, 9u8, 173u8, 199u8, + 88u8, 108u8, 230u8, 56u8, 106u8, 54u8, 86u8, 235u8, 180u8, 228u8, ], ) } @@ -5562,10 +5454,10 @@ pub mod api { call: ::subxt::ext::subxt_core::alloc::boxed::Box::new(call), }, [ - 154u8, 244u8, 161u8, 46u8, 224u8, 242u8, 181u8, 54u8, 246u8, 56u8, - 180u8, 221u8, 178u8, 69u8, 160u8, 158u8, 238u8, 224u8, 137u8, 224u8, - 115u8, 26u8, 218u8, 51u8, 144u8, 218u8, 78u8, 236u8, 165u8, 238u8, 5u8, - 33u8, + 8u8, 102u8, 80u8, 179u8, 244u8, 71u8, 31u8, 51u8, 95u8, 97u8, 65u8, + 110u8, 217u8, 40u8, 207u8, 195u8, 130u8, 247u8, 148u8, 175u8, 138u8, + 222u8, 176u8, 210u8, 200u8, 53u8, 95u8, 253u8, 149u8, 73u8, 173u8, + 153u8, ], ) } @@ -7643,9 +7535,10 @@ pub mod api { call: ::subxt::ext::subxt_core::alloc::boxed::Box::new(call), }, [ - 125u8, 78u8, 236u8, 0u8, 94u8, 174u8, 252u8, 109u8, 210u8, 132u8, 29u8, - 112u8, 44u8, 65u8, 73u8, 253u8, 86u8, 230u8, 65u8, 52u8, 161u8, 234u8, - 74u8, 178u8, 132u8, 229u8, 110u8, 243u8, 240u8, 3u8, 34u8, 245u8, + 90u8, 168u8, 100u8, 250u8, 215u8, 75u8, 141u8, 146u8, 204u8, 225u8, + 150u8, 231u8, 151u8, 205u8, 65u8, 240u8, 45u8, 2u8, 98u8, 5u8, 141u8, + 255u8, 9u8, 53u8, 135u8, 131u8, 137u8, 181u8, 188u8, 200u8, 250u8, + 108u8, ], ) } @@ -7687,10 +7580,10 @@ pub mod api { call: ::subxt::ext::subxt_core::alloc::boxed::Box::new(call), }, [ - 239u8, 122u8, 34u8, 125u8, 56u8, 62u8, 199u8, 184u8, 247u8, 111u8, - 102u8, 80u8, 111u8, 14u8, 86u8, 113u8, 222u8, 120u8, 142u8, 223u8, - 41u8, 160u8, 217u8, 210u8, 238u8, 4u8, 112u8, 244u8, 52u8, 101u8, 50u8, - 196u8, + 254u8, 116u8, 223u8, 77u8, 222u8, 118u8, 131u8, 7u8, 35u8, 246u8, + 214u8, 44u8, 105u8, 203u8, 31u8, 211u8, 208u8, 85u8, 63u8, 237u8, 34u8, + 103u8, 3u8, 229u8, 78u8, 119u8, 199u8, 193u8, 131u8, 128u8, 154u8, + 27u8, ], ) } @@ -7729,10 +7622,9 @@ pub mod api { call: ::subxt::ext::subxt_core::alloc::boxed::Box::new(call), }, [ - 254u8, 153u8, 225u8, 60u8, 41u8, 44u8, 134u8, 216u8, 75u8, 142u8, 22u8, - 162u8, 207u8, 33u8, 163u8, 39u8, 155u8, 217u8, 10u8, 86u8, 105u8, - 174u8, 110u8, 14u8, 15u8, 116u8, 55u8, 252u8, 144u8, 174u8, 122u8, - 49u8, + 67u8, 98u8, 234u8, 203u8, 198u8, 87u8, 76u8, 191u8, 8u8, 128u8, 225u8, + 169u8, 148u8, 200u8, 47u8, 118u8, 216u8, 229u8, 197u8, 38u8, 8u8, 28u8, + 164u8, 63u8, 208u8, 100u8, 156u8, 29u8, 99u8, 179u8, 75u8, 209u8, ], ) } @@ -7757,9 +7649,10 @@ pub mod api { call: ::subxt::ext::subxt_core::alloc::boxed::Box::new(call), }, [ - 220u8, 105u8, 133u8, 190u8, 222u8, 170u8, 54u8, 24u8, 52u8, 74u8, 38u8, - 40u8, 49u8, 202u8, 246u8, 238u8, 114u8, 242u8, 189u8, 247u8, 45u8, - 184u8, 23u8, 60u8, 64u8, 26u8, 173u8, 94u8, 8u8, 121u8, 4u8, 55u8, + 147u8, 123u8, 83u8, 248u8, 110u8, 162u8, 244u8, 115u8, 186u8, 216u8, + 98u8, 153u8, 83u8, 198u8, 255u8, 53u8, 20u8, 221u8, 154u8, 224u8, 11u8, + 226u8, 188u8, 40u8, 247u8, 251u8, 57u8, 137u8, 101u8, 147u8, 35u8, + 137u8, ], ) } @@ -8787,9 +8680,9 @@ pub mod api { "batch", types::Batch { calls }, [ - 8u8, 14u8, 63u8, 36u8, 47u8, 180u8, 133u8, 150u8, 98u8, 46u8, 251u8, - 65u8, 127u8, 92u8, 106u8, 133u8, 181u8, 255u8, 175u8, 67u8, 153u8, - 238u8, 69u8, 73u8, 66u8, 99u8, 96u8, 13u8, 147u8, 128u8, 96u8, 201u8, + 247u8, 255u8, 73u8, 140u8, 94u8, 73u8, 225u8, 12u8, 45u8, 234u8, 39u8, + 94u8, 64u8, 54u8, 195u8, 173u8, 213u8, 184u8, 159u8, 251u8, 73u8, 9u8, + 74u8, 229u8, 19u8, 77u8, 36u8, 70u8, 173u8, 166u8, 126u8, 156u8, ], ) } @@ -8819,9 +8712,9 @@ pub mod api { call: ::subxt::ext::subxt_core::alloc::boxed::Box::new(call), }, [ - 240u8, 79u8, 20u8, 90u8, 191u8, 182u8, 34u8, 19u8, 193u8, 234u8, 213u8, - 178u8, 65u8, 218u8, 186u8, 74u8, 118u8, 209u8, 240u8, 129u8, 238u8, - 239u8, 91u8, 252u8, 78u8, 134u8, 163u8, 216u8, 147u8, 98u8, 30u8, 94u8, + 141u8, 234u8, 46u8, 19u8, 175u8, 133u8, 239u8, 49u8, 92u8, 144u8, 18u8, + 166u8, 50u8, 108u8, 96u8, 72u8, 121u8, 82u8, 37u8, 35u8, 128u8, 50u8, + 159u8, 197u8, 203u8, 245u8, 252u8, 230u8, 206u8, 120u8, 145u8, 228u8, ], ) } @@ -8847,9 +8740,10 @@ pub mod api { "batch_all", types::BatchAll { calls }, [ - 222u8, 8u8, 55u8, 135u8, 112u8, 82u8, 66u8, 76u8, 1u8, 9u8, 107u8, - 125u8, 153u8, 254u8, 59u8, 239u8, 61u8, 136u8, 189u8, 46u8, 91u8, 38u8, - 252u8, 97u8, 39u8, 215u8, 145u8, 174u8, 171u8, 47u8, 213u8, 6u8, + 197u8, 249u8, 16u8, 146u8, 49u8, 44u8, 209u8, 110u8, 241u8, 172u8, + 211u8, 117u8, 251u8, 137u8, 219u8, 157u8, 77u8, 198u8, 95u8, 118u8, + 219u8, 117u8, 174u8, 119u8, 1u8, 103u8, 213u8, 59u8, 201u8, 35u8, 47u8, + 246u8, ], ) } @@ -8872,9 +8766,10 @@ pub mod api { call: ::subxt::ext::subxt_core::alloc::boxed::Box::new(call), }, [ - 220u8, 56u8, 148u8, 222u8, 163u8, 153u8, 156u8, 238u8, 167u8, 7u8, - 58u8, 11u8, 0u8, 102u8, 165u8, 102u8, 104u8, 60u8, 212u8, 73u8, 160u8, - 29u8, 225u8, 115u8, 0u8, 55u8, 189u8, 160u8, 95u8, 119u8, 16u8, 17u8, + 126u8, 91u8, 53u8, 68u8, 190u8, 43u8, 235u8, 28u8, 47u8, 103u8, 238u8, + 171u8, 70u8, 123u8, 143u8, 153u8, 155u8, 125u8, 45u8, 164u8, 41u8, + 200u8, 56u8, 163u8, 249u8, 150u8, 158u8, 87u8, 125u8, 137u8, 88u8, + 81u8, ], ) } @@ -8900,9 +8795,9 @@ pub mod api { "force_batch", types::ForceBatch { calls }, [ - 42u8, 74u8, 40u8, 136u8, 212u8, 238u8, 120u8, 35u8, 155u8, 233u8, 90u8, - 11u8, 103u8, 251u8, 234u8, 130u8, 172u8, 5u8, 219u8, 41u8, 231u8, 20u8, - 162u8, 99u8, 204u8, 189u8, 79u8, 21u8, 203u8, 90u8, 170u8, 161u8, + 113u8, 196u8, 193u8, 13u8, 222u8, 221u8, 108u8, 232u8, 210u8, 14u8, + 195u8, 2u8, 179u8, 155u8, 190u8, 186u8, 109u8, 98u8, 99u8, 58u8, 59u8, + 133u8, 145u8, 32u8, 186u8, 12u8, 198u8, 85u8, 230u8, 85u8, 247u8, 52u8, ], ) } @@ -8925,10 +8820,9 @@ pub mod api { weight, }, [ - 203u8, 125u8, 63u8, 180u8, 29u8, 135u8, 10u8, 130u8, 245u8, 74u8, 95u8, - 40u8, 166u8, 188u8, 185u8, 246u8, 14u8, 191u8, 130u8, 108u8, 188u8, - 93u8, 163u8, 151u8, 253u8, 22u8, 181u8, 237u8, 241u8, 17u8, 245u8, - 61u8, + 78u8, 208u8, 22u8, 102u8, 235u8, 74u8, 42u8, 190u8, 137u8, 216u8, 66u8, + 115u8, 20u8, 245u8, 101u8, 199u8, 156u8, 250u8, 122u8, 200u8, 65u8, + 43u8, 78u8, 60u8, 46u8, 65u8, 119u8, 31u8, 33u8, 170u8, 27u8, 229u8, ], ) } @@ -8968,10 +8862,10 @@ pub mod api { fallback: ::subxt::ext::subxt_core::alloc::boxed::Box::new(fallback), }, [ - 127u8, 165u8, 98u8, 125u8, 184u8, 176u8, 6u8, 2u8, 146u8, 14u8, 154u8, - 49u8, 52u8, 253u8, 35u8, 127u8, 216u8, 178u8, 115u8, 253u8, 150u8, - 191u8, 55u8, 119u8, 165u8, 206u8, 24u8, 23u8, 106u8, 204u8, 188u8, - 151u8, + 223u8, 119u8, 179u8, 217u8, 241u8, 14u8, 29u8, 115u8, 177u8, 237u8, + 205u8, 6u8, 227u8, 113u8, 89u8, 101u8, 97u8, 82u8, 22u8, 191u8, 14u8, + 205u8, 13u8, 198u8, 165u8, 175u8, 152u8, 231u8, 190u8, 54u8, 15u8, + 124u8, ], ) } @@ -8994,10 +8888,9 @@ pub mod api { call: ::subxt::ext::subxt_core::alloc::boxed::Box::new(call), }, [ - 199u8, 2u8, 66u8, 203u8, 254u8, 202u8, 231u8, 19u8, 158u8, 151u8, - 157u8, 241u8, 252u8, 194u8, 188u8, 185u8, 59u8, 176u8, 72u8, 20u8, - 34u8, 248u8, 151u8, 147u8, 80u8, 251u8, 225u8, 219u8, 240u8, 79u8, - 139u8, 10u8, + 135u8, 83u8, 250u8, 68u8, 40u8, 246u8, 6u8, 82u8, 241u8, 47u8, 39u8, + 197u8, 248u8, 48u8, 173u8, 141u8, 28u8, 152u8, 58u8, 51u8, 84u8, 207u8, + 164u8, 66u8, 250u8, 88u8, 12u8, 170u8, 18u8, 81u8, 181u8, 70u8, ], ) } @@ -16603,9 +16496,9 @@ pub mod api { call: ::subxt::ext::subxt_core::alloc::boxed::Box::new(call), }, [ - 3u8, 200u8, 160u8, 7u8, 52u8, 80u8, 43u8, 2u8, 39u8, 251u8, 144u8, - 99u8, 69u8, 29u8, 179u8, 239u8, 176u8, 48u8, 100u8, 91u8, 44u8, 249u8, - 176u8, 179u8, 28u8, 21u8, 93u8, 92u8, 26u8, 220u8, 149u8, 183u8, + 136u8, 165u8, 225u8, 86u8, 177u8, 169u8, 20u8, 142u8, 186u8, 42u8, + 170u8, 86u8, 16u8, 67u8, 250u8, 64u8, 121u8, 164u8, 33u8, 84u8, 193u8, + 32u8, 144u8, 184u8, 87u8, 18u8, 71u8, 81u8, 107u8, 193u8, 232u8, 170u8, ], ) } @@ -21165,39 +21058,130 @@ pub mod api { )] pub struct VerifyWormholeProof { pub proof_bytes: verify_wormhole_proof::ProofBytes, - pub block_number: verify_wormhole_proof::BlockNumber, - pub header: verify_wormhole_proof::Header, } pub mod verify_wormhole_proof { use super::runtime_types; pub type ProofBytes = ::subxt::ext::subxt_core::alloc::vec::Vec<::core::primitive::u8>; - pub type BlockNumber = ::core::primitive::u32; - pub type Header = - runtime_types::sp_runtime::generic::header::Header<::core::primitive::u32>; } impl ::subxt::ext::subxt_core::blocks::StaticExtrinsic for VerifyWormholeProof { const PALLET: &'static str = "Wormhole"; const CALL: &'static str = "verify_wormhole_proof"; } + #[derive( + :: subxt :: ext :: subxt_core :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: subxt_core :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + #[decode_as_type( + crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" + )] + #[encode_as_type( + crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode" + )] + #[doc = "Transfer native tokens and store proof for wormhole"] + pub struct TransferNative { + pub dest: transfer_native::Dest, + #[codec(compact)] + pub amount: transfer_native::Amount, + } + pub mod transfer_native { + use super::runtime_types; + pub type Dest = ::subxt::ext::subxt_core::utils::MultiAddress< + ::subxt::ext::subxt_core::utils::AccountId32, + (), + >; + pub type Amount = ::core::primitive::u128; + } + impl ::subxt::ext::subxt_core::blocks::StaticExtrinsic for TransferNative { + const PALLET: &'static str = "Wormhole"; + const CALL: &'static str = "transfer_native"; + } + #[derive( + :: subxt :: ext :: subxt_core :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: subxt_core :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + #[decode_as_type( + crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" + )] + #[encode_as_type( + crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode" + )] + #[doc = "Transfer asset tokens and store proof for wormhole"] + pub struct TransferAsset { + pub asset_id: transfer_asset::AssetId, + pub dest: transfer_asset::Dest, + #[codec(compact)] + pub amount: transfer_asset::Amount, + } + pub mod transfer_asset { + use super::runtime_types; + pub type AssetId = ::core::primitive::u32; + pub type Dest = ::subxt::ext::subxt_core::utils::MultiAddress< + ::subxt::ext::subxt_core::utils::AccountId32, + (), + >; + pub type Amount = ::core::primitive::u128; + } + impl ::subxt::ext::subxt_core::blocks::StaticExtrinsic for TransferAsset { + const PALLET: &'static str = "Wormhole"; + const CALL: &'static str = "transfer_asset"; + } } pub struct TransactionApi; impl TransactionApi { pub fn verify_wormhole_proof( &self, proof_bytes: types::verify_wormhole_proof::ProofBytes, - block_number: types::verify_wormhole_proof::BlockNumber, - header: types::verify_wormhole_proof::Header, ) -> ::subxt::ext::subxt_core::tx::payload::StaticPayload { ::subxt::ext::subxt_core::tx::payload::StaticPayload::new_static( "Wormhole", "verify_wormhole_proof", - types::VerifyWormholeProof { proof_bytes, block_number, header }, + types::VerifyWormholeProof { proof_bytes }, [ - 162u8, 205u8, 5u8, 181u8, 62u8, 111u8, 128u8, 61u8, 0u8, 236u8, 196u8, - 137u8, 88u8, 33u8, 13u8, 36u8, 251u8, 55u8, 206u8, 185u8, 61u8, 58u8, - 132u8, 180u8, 106u8, 253u8, 232u8, 24u8, 224u8, 220u8, 216u8, 237u8, + 242u8, 232u8, 238u8, 253u8, 96u8, 217u8, 86u8, 251u8, 216u8, 200u8, + 103u8, 7u8, 182u8, 218u8, 118u8, 149u8, 120u8, 244u8, 124u8, 33u8, + 133u8, 50u8, 150u8, 163u8, 187u8, 19u8, 37u8, 76u8, 73u8, 48u8, 213u8, + 193u8, + ], + ) + } + #[doc = "Transfer native tokens and store proof for wormhole"] + pub fn transfer_native( + &self, + dest: types::transfer_native::Dest, + amount: types::transfer_native::Amount, + ) -> ::subxt::ext::subxt_core::tx::payload::StaticPayload + { + ::subxt::ext::subxt_core::tx::payload::StaticPayload::new_static( + "Wormhole", + "transfer_native", + types::TransferNative { dest, amount }, + [ + 108u8, 65u8, 158u8, 226u8, 204u8, 38u8, 41u8, 193u8, 72u8, 15u8, 175u8, + 111u8, 213u8, 47u8, 70u8, 113u8, 235u8, 77u8, 160u8, 118u8, 210u8, + 134u8, 44u8, 76u8, 24u8, 231u8, 234u8, 50u8, 44u8, 75u8, 99u8, 215u8, + ], + ) + } + #[doc = "Transfer asset tokens and store proof for wormhole"] + pub fn transfer_asset( + &self, + asset_id: types::transfer_asset::AssetId, + dest: types::transfer_asset::Dest, + amount: types::transfer_asset::Amount, + ) -> ::subxt::ext::subxt_core::tx::payload::StaticPayload + { + ::subxt::ext::subxt_core::tx::payload::StaticPayload::new_static( + "Wormhole", + "transfer_asset", + types::TransferAsset { asset_id, dest, amount }, + [ + 49u8, 152u8, 37u8, 165u8, 177u8, 50u8, 177u8, 190u8, 98u8, 23u8, 130u8, + 61u8, 91u8, 175u8, 20u8, 208u8, 21u8, 95u8, 21u8, 10u8, 229u8, 132u8, + 118u8, 155u8, 74u8, 212u8, 103u8, 247u8, 138u8, 49u8, 157u8, 214u8, ], ) } @@ -21225,6 +21209,56 @@ pub mod api { const PALLET: &'static str = "Wormhole"; const EVENT: &'static str = "ProofVerified"; } + #[derive( + :: subxt :: ext :: subxt_core :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: subxt_core :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] + #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] + pub struct NativeTransferred { + pub from: native_transferred::From, + pub to: native_transferred::To, + pub amount: native_transferred::Amount, + pub transfer_count: native_transferred::TransferCount, + } + pub mod native_transferred { + use super::runtime_types; + pub type From = ::subxt::ext::subxt_core::utils::AccountId32; + pub type To = ::subxt::ext::subxt_core::utils::AccountId32; + pub type Amount = ::core::primitive::u128; + pub type TransferCount = ::core::primitive::u64; + } + impl ::subxt::ext::subxt_core::events::StaticEvent for NativeTransferred { + const PALLET: &'static str = "Wormhole"; + const EVENT: &'static str = "NativeTransferred"; + } + #[derive( + :: subxt :: ext :: subxt_core :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: subxt_core :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] + #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] + pub struct AssetTransferred { + pub asset_id: asset_transferred::AssetId, + pub from: asset_transferred::From, + pub to: asset_transferred::To, + pub amount: asset_transferred::Amount, + pub transfer_count: asset_transferred::TransferCount, + } + pub mod asset_transferred { + use super::runtime_types; + pub type AssetId = ::core::primitive::u32; + pub type From = ::subxt::ext::subxt_core::utils::AccountId32; + pub type To = ::subxt::ext::subxt_core::utils::AccountId32; + pub type Amount = ::core::primitive::u128; + pub type TransferCount = ::core::primitive::u64; + } + impl ::subxt::ext::subxt_core::events::StaticEvent for AssetTransferred { + const PALLET: &'static str = "Wormhole"; + const EVENT: &'static str = "AssetTransferred"; + } } pub mod storage { use super::runtime_types; @@ -21235,6 +21269,21 @@ pub mod api { pub type UsedNullifiers = ::core::primitive::bool; pub type Param0 = [::core::primitive::u8; 32usize]; } + pub mod transfer_proof { + use super::runtime_types; + pub type TransferProof = (); + pub type Param0 = ( + ::core::primitive::u32, + ::core::primitive::u64, + ::subxt::ext::subxt_core::utils::AccountId32, + ::subxt::ext::subxt_core::utils::AccountId32, + ::core::primitive::u128, + ); + } + pub mod transfer_count { + use super::runtime_types; + pub type TransferCount = ::core::primitive::u64; + } } pub struct StorageApi; impl StorageApi { @@ -21283,6 +21332,73 @@ pub mod api { ], ) } + #[doc = " Transfer proofs for wormhole transfers (both native and assets)"] + pub fn transfer_proof_iter( + &self, + ) -> ::subxt::ext::subxt_core::storage::address::StaticAddress< + (), + types::transfer_proof::TransferProof, + (), + (), + ::subxt::ext::subxt_core::utils::Yes, + > { + ::subxt::ext::subxt_core::storage::address::StaticAddress::new_static( + "Wormhole", + "TransferProof", + (), + [ + 162u8, 38u8, 220u8, 3u8, 188u8, 47u8, 138u8, 210u8, 217u8, 129u8, 26u8, + 172u8, 96u8, 61u8, 145u8, 79u8, 185u8, 128u8, 39u8, 11u8, 94u8, 231u8, + 163u8, 227u8, 139u8, 18u8, 42u8, 47u8, 138u8, 192u8, 119u8, 84u8, + ], + ) + } + #[doc = " Transfer proofs for wormhole transfers (both native and assets)"] + pub fn transfer_proof( + &self, + _0: types::transfer_proof::Param0, + ) -> ::subxt::ext::subxt_core::storage::address::StaticAddress< + ::subxt::ext::subxt_core::storage::address::StaticStorageKey< + types::transfer_proof::Param0, + >, + types::transfer_proof::TransferProof, + ::subxt::ext::subxt_core::utils::Yes, + (), + (), + > { + ::subxt::ext::subxt_core::storage::address::StaticAddress::new_static( + "Wormhole", + "TransferProof", + ::subxt::ext::subxt_core::storage::address::StaticStorageKey::new(_0), + [ + 162u8, 38u8, 220u8, 3u8, 188u8, 47u8, 138u8, 210u8, 217u8, 129u8, 26u8, + 172u8, 96u8, 61u8, 145u8, 79u8, 185u8, 128u8, 39u8, 11u8, 94u8, 231u8, + 163u8, 227u8, 139u8, 18u8, 42u8, 47u8, 138u8, 192u8, 119u8, 84u8, + ], + ) + } + #[doc = " Transfer count for all wormhole transfers"] + pub fn transfer_count( + &self, + ) -> ::subxt::ext::subxt_core::storage::address::StaticAddress< + (), + types::transfer_count::TransferCount, + ::subxt::ext::subxt_core::utils::Yes, + ::subxt::ext::subxt_core::utils::Yes, + (), + > { + ::subxt::ext::subxt_core::storage::address::StaticAddress::new_static( + "Wormhole", + "TransferCount", + (), + [ + 105u8, 10u8, 160u8, 118u8, 193u8, 131u8, 207u8, 188u8, 78u8, 238u8, + 252u8, 99u8, 31u8, 72u8, 159u8, 128u8, 159u8, 215u8, 110u8, 101u8, + 27u8, 132u8, 12u8, 59u8, 182u8, 107u8, 98u8, 77u8, 189u8, 100u8, 51u8, + 209u8, + ], + ) + } } } pub mod constants { @@ -23587,14 +23703,6 @@ pub mod api { old: ::core::primitive::u128, new: ::core::primitive::u128, }, - #[codec(index = 22)] - #[doc = "Transfer proof was stored."] - TransferProofStored { - transfer_count: ::core::primitive::u64, - source: ::subxt::ext::subxt_core::utils::AccountId32, - dest: ::subxt::ext::subxt_core::utils::AccountId32, - funding_amount: ::core::primitive::u128, - }, } } pub mod types { @@ -27467,10 +27575,27 @@ pub mod api { verify_wormhole_proof { proof_bytes: ::subxt::ext::subxt_core::alloc::vec::Vec<::core::primitive::u8>, - block_number: ::core::primitive::u32, - header: runtime_types::sp_runtime::generic::header::Header< - ::core::primitive::u32, + }, + #[codec(index = 1)] + #[doc = "Transfer native tokens and store proof for wormhole"] + transfer_native { + dest: ::subxt::ext::subxt_core::utils::MultiAddress< + ::subxt::ext::subxt_core::utils::AccountId32, + (), >, + #[codec(compact)] + amount: ::core::primitive::u128, + }, + #[codec(index = 2)] + #[doc = "Transfer asset tokens and store proof for wormhole"] + transfer_asset { + asset_id: ::core::primitive::u32, + dest: ::subxt::ext::subxt_core::utils::MultiAddress< + ::subxt::ext::subxt_core::utils::AccountId32, + (), + >, + #[codec(compact)] + amount: ::core::primitive::u128, }, } #[derive( @@ -27506,6 +27631,10 @@ pub mod api { BlockNotFound, #[codec(index = 9)] InvalidBlockNumber, + #[codec(index = 10)] + AssetNotFound, + #[codec(index = 11)] + SelfTransfer, } #[derive( :: subxt :: ext :: subxt_core :: ext :: scale_decode :: DecodeAsType, @@ -27522,6 +27651,21 @@ pub mod api { pub enum Event { #[codec(index = 0)] ProofVerified { exit_amount: ::core::primitive::u128 }, + #[codec(index = 1)] + NativeTransferred { + from: ::subxt::ext::subxt_core::utils::AccountId32, + to: ::subxt::ext::subxt_core::utils::AccountId32, + amount: ::core::primitive::u128, + transfer_count: ::core::primitive::u64, + }, + #[codec(index = 2)] + AssetTransferred { + asset_id: ::core::primitive::u32, + from: ::subxt::ext::subxt_core::utils::AccountId32, + to: ::subxt::ext::subxt_core::utils::AccountId32, + amount: ::core::primitive::u128, + transfer_count: ::core::primitive::u64, + }, } } } @@ -27573,6 +27717,23 @@ pub mod api { } } } + pub mod qp_header { + use super::runtime_types; + #[derive( + :: subxt :: ext :: subxt_core :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: subxt_core :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + #[decode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode")] + #[encode_as_type(crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode")] + pub struct Header<_0> { + pub parent_hash: ::subxt::ext::subxt_core::utils::H256, + pub number: _0, + pub state_root: ::subxt::ext::subxt_core::utils::H256, + pub extrinsics_root: ::subxt::ext::subxt_core::utils::H256, + pub digest: runtime_types::sp_runtime::generic::digest::Digest, + } + } pub mod qp_poseidon { use super::runtime_types; #[derive( @@ -27676,6 +27837,18 @@ pub mod api { crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode" )] pub struct ReversibleTransactionExtension; + #[derive( + :: subxt :: ext :: subxt_core :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: subxt_core :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + #[decode_as_type( + crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" + )] + #[encode_as_type( + crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode" + )] + pub struct WormholeProofRecorderExtension; } #[derive( :: subxt :: ext :: subxt_core :: ext :: scale_decode :: DecodeAsType, @@ -28586,28 +28759,6 @@ pub mod api { Mortal255(::core::primitive::u8), } } - pub mod header { - use super::runtime_types; - #[derive( - :: subxt :: ext :: subxt_core :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: subxt_core :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - #[decode_as_type( - crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_decode" - )] - #[encode_as_type( - crate_path = ":: subxt :: ext :: subxt_core :: ext :: scale_encode" - )] - pub struct Header<_0> { - pub parent_hash: ::subxt::ext::subxt_core::utils::H256, - #[codec(compact)] - pub number: _0, - pub state_root: ::subxt::ext::subxt_core::utils::H256, - pub extrinsics_root: ::subxt::ext::subxt_core::utils::H256, - pub digest: runtime_types::sp_runtime::generic::digest::Digest, - } - } } pub mod proving_trie { use super::runtime_types; diff --git a/src/cli/wormhole.rs b/src/cli/wormhole.rs index 11d5dcb..f4f4278 100644 --- a/src/cli/wormhole.rs +++ b/src/cli/wormhole.rs @@ -2,13 +2,12 @@ use crate::{ chain::{ client::{ChainConfig, QuantusClient}, quantus_subxt as quantus_node, - quantus_subxt::api::balances, + quantus_subxt::api::wormhole, }, cli::common::submit_transaction, log_print, log_success, log_verbose, wallet::QuantumKeyPair, }; -use anyhow::anyhow; use clap::Subcommand; use plonky2::plonk::{circuit_data::CircuitConfig, proof::ProofWithPublicInputs}; use qp_poseidon::PoseidonHasher; @@ -17,13 +16,16 @@ use qp_wormhole_circuit::{ nullifier::Nullifier, }; use qp_wormhole_prover::WormholeProver; -use qp_zk_circuits_common::utils::{BytesDigest, Digest}; +use qp_zk_circuits_common::{ + storage_proof::prepare_proof_for_circuit, + utils::{BytesDigest, Digest}, +}; use sp_core::{ crypto::{AccountId32, Ss58Codec}, Hasher, }; use subxt::{ - backend::legacy::rpc_methods::{Bytes, ReadProof}, + backend::legacy::rpc_methods::ReadProof, blocks::Block, ext::{ codec::Encode, @@ -80,7 +82,7 @@ pub async fn handle_wormhole_command( password, password_file, output, - } => + } => { generate_proof( secret, amount, @@ -91,7 +93,8 @@ pub async fn handle_wormhole_command( output, node_url, ) - .await, + .await + }, } } @@ -188,7 +191,7 @@ async fn generate_proof( let storage_api = client.storage().at(block_hash_pre); let transfer_count_previous = storage_api - .fetch(&quantus_node::api::storage().balances().transfer_count()) + .fetch(&quantus_node::api::storage().wormhole().transfer_count()) .await .map_err(|e| crate::error::QuantusError::Generic(e.to_string()))? .unwrap_or_default(); @@ -216,7 +219,7 @@ async fn generate_proof( .map_err(|e| crate::error::QuantusError::Generic(e.to_string()))?; let event = events_api - .find::() + .find::() .next() .ok_or_else(|| { crate::error::QuantusError::Generic("No TransferProofStored event found".to_string()) @@ -225,7 +228,7 @@ async fn generate_proof( let storage_api = client.storage().at(block_hash); let transfer_count = storage_api - .fetch(&quantus_node::api::storage().balances().transfer_count()) + .fetch(&quantus_node::api::storage().wormhole().transfer_count()) .await .map_err(|e| crate::error::QuantusError::Generic(e.to_string()))? .unwrap_or_default(); @@ -238,14 +241,14 @@ async fn generate_proof( // Get storage proof let leaf_hash = qp_poseidon::PoseidonHasher::hash_storage::( - &(event.transfer_count, event.source.clone(), event.dest.clone(), event.funding_amount) - .encode(), + &(event.transfer_count, event.from.clone(), event.to.clone(), event.amount).encode(), ); - let proof_address = quantus_node::api::storage().balances().transfer_proof(( + let proof_address = quantus_node::api::storage().wormhole().transfer_proof(( + 0, event.transfer_count, - event.source.clone(), - event.dest.clone(), - event.funding_amount, + event.from.clone(), + event.to.clone(), + event.amount, )); let mut final_key = proof_address.to_root_bytes(); final_key.extend_from_slice(&leaf_hash); @@ -280,9 +283,12 @@ async fn generate_proof( let block_number = header.number; // Prepare storage proof - let processed_storage_proof = - prepare_proof_for_circuit(read_proof.proof, hex::encode(header.state_root.0), leaf_hash) - .map_err(|e| crate::error::QuantusError::Generic(e.to_string()))?; + let processed_storage_proof = prepare_proof_for_circuit( + read_proof.proof.iter().map(|proof| proof.0.clone()).collect(), + hex::encode(header.state_root.0), + leaf_hash, + ) + .map_err(|e| crate::error::QuantusError::Generic(e.to_string()))?; let inputs = CircuitInputs { private: PrivateCircuitInputs { @@ -305,6 +311,7 @@ async fn generate_proof( .map_err(|e| crate::error::QuantusError::Generic(e.to_string()))?, parent_hash, block_number, + asset_id: 0, }, }; @@ -340,108 +347,3 @@ async fn at_best_block( let block = quantus_client.client().blocks().at(best_block).await?; Ok(block) } - -// Utility functions from proof-utils.rs -fn hash_node_with_poseidon_padded(node_bytes: &[u8]) -> [u8; 32] { - use qp_poseidon_core::{hash_padded_bytes, FIELD_ELEMENT_PREIMAGE_PADDING_LEN}; - hash_padded_bytes::(node_bytes) -} - -fn prepare_proof_for_circuit( - proof: Vec, - state_root: String, - leaf_hash: [u8; 32], -) -> anyhow::Result { - let mut node_map: std::collections::HashMap, String)> = - std::collections::HashMap::new(); - for (idx, node) in proof.iter().enumerate() { - let hash = hash_node_with_poseidon_padded(&node.0); - let hash_hex = hex::encode(hash); - let node_hex = hex::encode(&node.0); - node_map.insert(hash_hex.clone(), (idx, node.0.clone(), node_hex)); - } - - let state_root_hex = state_root.trim_start_matches("0x").to_string(); - - let root_hash = if node_map.contains_key(&state_root_hex) { - state_root_hex.clone() - } else { - anyhow::bail!("No node hashes to state root!"); - }; - - let root_entry = node_map - .get(&root_hash) - .ok_or_else(|| anyhow!("Failed to get root entry from map"))?; - - let mut ordered_nodes = vec![root_entry.1.clone()]; - let mut current_node_hex = root_entry.2.clone(); - - const HASH_LENGTH_PREFIX: &str = "2000000000000000"; - - loop { - let mut found_child = None; - for (child_hash, (_, child_bytes, _)) in &node_map { - let hash_with_prefix = format!("{}{}", HASH_LENGTH_PREFIX, child_hash); - if current_node_hex.contains(&hash_with_prefix) { - if !ordered_nodes.iter().any(|n| n == child_bytes) { - found_child = Some((child_hash.clone(), child_bytes.clone())); - break; - } - } - } - - if let Some((_, child_bytes)) = found_child { - ordered_nodes.push(child_bytes.clone()); - current_node_hex = hex::encode(ordered_nodes.last().unwrap()); - } else { - break; - } - } - - let mut indices = Vec::::new(); - - for i in 0..ordered_nodes.len() - 1 { - let current_hex = hex::encode(&ordered_nodes[i]); - let next_node = &ordered_nodes[i + 1]; - let next_hash = hex::encode(hash_node_with_poseidon_padded(next_node)); - - if let Some(hex_idx) = current_hex.find(&next_hash) { - indices.push(hex_idx); - } else { - anyhow::bail!("Could not find child hash in ordered node {}", i); - } - } - - let (found, last_idx) = check_leaf(&leaf_hash, ordered_nodes.last().unwrap().clone()); - if !found { - anyhow::bail!("Leaf hash suffix not found in leaf node!"); - } - - indices.push(last_idx); - - if indices.len() != ordered_nodes.len() { - log_verbose!( - "Warning: indices.len() = {}, ordered_nodes.len() = {}", - indices.len(), - ordered_nodes.len() - ); - } - - qp_wormhole_circuit::storage_proof::ProcessedStorageProof::new(ordered_nodes, indices) -} - -fn check_leaf(leaf_hash: &[u8; 32], leaf_node: Vec) -> (bool, usize) { - let hash_suffix = &leaf_hash[8..32]; - let mut last_idx = 0usize; - let mut found = false; - - for i in 0..=leaf_node.len().saturating_sub(hash_suffix.len()) { - if &leaf_node[i..i + hash_suffix.len()] == hash_suffix { - last_idx = i; - found = true; - break; - } - } - - (found, (last_idx * 2).saturating_sub(16)) -} diff --git a/src/quantus_metadata.scale b/src/quantus_metadata.scale index f17e3cba4c7431e58fa78ad61f5c5d1daeb21422..b0c4f05f1457a99ebd9620348d85a34a0c73b4d8 100644 GIT binary patch delta 3519 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 Xwqd2)IMhy$ndG^;lk#92QN(`%aV8*t delta 3133 zcmZuz3vg7`89v{?C&?0{-H6qHIrW%LPNz-_XV{|gQ<1j70Mtrp@b;?v*8Fj?AR?+@>HbpdzX%{Nyx zCf2H(1Z+)uD161Nr#a$p^7%J4Xl*8l11{cGskLf;hL|K<%#(A>qn%sKvz^j*P8TT6mZ{`pi&D$#J2V?p(s>g7jofH!<|@6%c1_$iPh*<&0Z8z z57e2L;Z~#PF_DF}J(aKi?u8e9>P!b_80(f{FVJtCS&j%WpjOr*ihlJ$E%v(yARR08 zP^2|%m30_|tilLjwR$&8F$lq5R#h-4#R${<52|0(p&Uc%&O^vmAJ-w9Y1Cr|M%2uD zluqV7Rupdugu)Fze{*0EuvK#(%bJzP_QaAIzpBR?qEV>bZ=fjlk2zV!^{dc^$zy

I6mR(Wn%Yi->TH-=X8rIc+g3eh5UW;Zn#A~B@!ynAqBN0z3GM-Xo z{GuXF%0ObARAhooDiWtu$tLW>E5`9n_!r?7)qfZMhSSEO&5-GM%Xn}rer>@!>V^o~ zxjPoYbo^Dl6v0aFuG@xbbQbEB^Kcj&wqbu3K2&FaiWZzxpX^1cx_d7|N%|4)I``o| z?y@^D7oV!d9k@w;4m_N2HTClj*yvNl0!0q>dX4@%J&2t7g(R}z@UvxWt%U?rkU4=Z zdQc1d0{)9r#ci6uNn_{Qk>F7e9AeP>WbSnw|`Qa+aCMuY+Sb51RswlRn(ryeKL6-&9%Gm|Gs_lfmGK%7= z_HfYW5BVB78nCTja$HB!aRprZw=AJ3!Lw3tEWfyEq2Y~U117sP(#c0{w3T+yJ+y~9 z=qL$IWyg?boOuY3|heUq@)NLO~;SFAfH(>I6aw@1G6-nXX zYg&Cx6>9V2D9Ic&F$PEsr7%WP7$+{n7*U-AD4TK)-^Dn`v4!Kg>iY~iSBVoQ)Ch^u z6x3J>>f~imV@as^72?F{5)_HJ`gj1dCZ04A$4H#wUfSG3I1J|#SR+wk>^hE(Ssd-( zeF`jUud(4B+{{s5^}LH}qu^P9u43mXhRv_F>Dh*B47;XquwnMu#!GMG0YW^rCvNW9 zm6?{37Gz9&5BsL7<6of&F7@hHcu&20fy2dW_4x(dj`iw?U!!EDCZ!|k2c|c!m$2II z2>5k2I9qL?O_yT5OvG57`7VXzPL9Yv=1oN8PG(L8WM7imr=I;9x1mj0zu^P7s@dPL zEj;rziqxiW@IFuQ^7QUj@*>jxG|j+{?)Pa{*$ye4m32W~uhF(x<&RN8awR-$Sobh$ zqMz{2B;3{h7Cp!TX|Wd8ggBVMSI>iPbRQijcT`?3c+|ulFL^Y% zbt%zt&SPH^&A6p!+za(y`9i(POPd|_u^S`=^z=*7uhv>^yH|eLSOA7g@vrcId%5iJXZ|fW9x8++%T->$D ztid4MPV;RNpV41L-DPS2!O9GpsB)XQGAsD=7s1v&e89ND31mDB18+E(o-MOo9>9Tw)&cV zdN2e?l1|o-z)=X!zvsjB;M96^Vlrn1nRfoonLy*yVUCudNF&BZ4pZdMS@6Z#zv=*S6CfXvWfZ8V2;A?WC^E zC}fLsiO=r~#XiyPYIrA2vqWT6y|$A!XI7JqbE_7S9jba4eUf`nTEp!% Date: Wed, 17 Dec 2025 18:20:02 +0600 Subject: [PATCH 08/14] Fix submit transaction --- src/cli/wormhole.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/cli/wormhole.rs b/src/cli/wormhole.rs index f4f4278..3bb6e30 100644 --- a/src/cli/wormhole.rs +++ b/src/cli/wormhole.rs @@ -82,7 +82,7 @@ pub async fn handle_wormhole_command( password, password_file, output, - } => { + } => generate_proof( secret, amount, @@ -93,8 +93,7 @@ pub async fn handle_wormhole_command( output, node_url, ) - .await - }, + .await, } } @@ -201,7 +200,7 @@ async fn generate_proof( private_key: keypair.private_key.clone(), }; - submit_transaction(&quantus_client, &quantum_keypair, transfer_tx, None) + submit_transaction(&quantus_client, &quantum_keypair, transfer_tx, None, false) .await .map_err(|e| crate::error::QuantusError::Generic(e.to_string()))?; From 08fdc0cedd9f48660420fafeecaed4bd29691a7a Mon Sep 17 00:00:00 2001 From: Dastan <88332432+dastansam@users.noreply.github.com> Date: Wed, 17 Dec 2025 18:22:21 +0600 Subject: [PATCH 09/14] taplo fmt --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 2d83d3f..7ce8f2b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -54,6 +54,7 @@ qp-rusty-crystals-hdwallet = { version = "1.0.0" } qp-poseidon = { version = "1.0.1", features = [ "serde", ] } +qp-poseidon-core = { version = "1.0.4", default-features = false, features = ["p2", "p3"] } qp-dilithium-crypto = { version = "0.2.0", features = ["serde"] } # Blockchain and RPC client @@ -75,7 +76,6 @@ qp-wormhole-circuit = { git = "https://github.com/Quantus-Network/zk-circuits", qp-wormhole-prover = { git = "https://github.com/Quantus-Network/zk-circuits", branch = "feat/asset-id-wormhole", default-features = false } qp-zk-circuits-common = { git = "https://github.com/Quantus-Network/zk-circuits", branch = "feat/asset-id-wormhole", default-features = false } qp-plonky2 = { version = "1.1.3", default-features = false, features = ["no_random"] } -qp-poseidon-core = { git = "https://github.com/Quantus-Network/qp-poseidon", branch = "feat/transfer-proof-asset-id", default-features = false, features = ["p2", "p3"] } [dev-dependencies] tempfile = "3.8" From 6c849c1cbc50c1576bd3a19ea4fd85728f27455f Mon Sep 17 00:00:00 2001 From: Dastan <88332432+dastansam@users.noreply.github.com> Date: Wed, 17 Dec 2025 18:22:39 +0600 Subject: [PATCH 10/14] Version bumps --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 7ce8f2b..a984ad3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -51,7 +51,7 @@ aes-gcm = "0.10" # AES-256-GCM (quantum-safe with 256-bit keys) # Quantus crypto dependencies qp-rusty-crystals-dilithium = { version = "2.0.0" } qp-rusty-crystals-hdwallet = { version = "1.0.0" } -qp-poseidon = { version = "1.0.1", features = [ +qp-poseidon = { version = "1.0.4", features = [ "serde", ] } qp-poseidon-core = { version = "1.0.4", default-features = false, features = ["p2", "p3"] } From b5a03977223392718ff5bca04aacb90a8ac9ae7c Mon Sep 17 00:00:00 2001 From: Dastan <88332432+dastansam@users.noreply.github.com> Date: Thu, 18 Dec 2025 12:05:47 +0600 Subject: [PATCH 11/14] Update Cargo.lock --- Cargo.lock | 48 +++++++++++------------------------------------- 1 file changed, 11 insertions(+), 37 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 55835b9..1c54eb5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3754,7 +3754,7 @@ dependencies = [ "plonky2_maybe_rayon", "plonky2_util", "qp-plonky2-field", - "qp-poseidon-constants 1.0.1", + "qp-poseidon-constants", "rand 0.8.5", "serde", "static_assertions", @@ -3779,15 +3779,15 @@ dependencies = [ [[package]] name = "qp-poseidon" -version = "1.0.1" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0353086f7af1df7d45a1ecb995cf84b583c8211d7122f542044b37388b5effcd" +checksum = "f124a93e98e6f1b42b18728c80d529e353b4ed09665477693026fdbb7bc8b523" dependencies = [ "log", "p3-field", "p3-goldilocks", "parity-scale-codec", - "qp-poseidon-core 1.0.3", + "qp-poseidon-core", "scale-info", "serde", "sp-core", @@ -3809,44 +3809,18 @@ dependencies = [ "rand_chacha 0.9.0", ] -[[package]] -name = "qp-poseidon-constants" -version = "1.0.2" -source = "git+https://github.com/Quantus-Network/qp-poseidon?branch=feat%2Ftransfer-proof-asset-id#9ae96dea18464d6ea43de5c78a066f9d1f17b801" -dependencies = [ - "p3-field", - "p3-goldilocks", - "p3-poseidon2", - "rand 0.9.2", - "rand_chacha 0.9.0", -] - [[package]] name = "qp-poseidon-core" -version = "1.0.2" -source = "git+https://github.com/Quantus-Network/qp-poseidon?branch=feat%2Ftransfer-proof-asset-id#9ae96dea18464d6ea43de5c78a066f9d1f17b801" -dependencies = [ - "p3-field", - "p3-goldilocks", - "p3-poseidon2", - "p3-symmetric", - "qp-plonky2", - "qp-poseidon-constants 1.0.2", - "rand_chacha 0.9.0", -] - -[[package]] -name = "qp-poseidon-core" -version = "1.0.3" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f52c70df221c356b3ce63afabfae623aae632c27d3e078cd20eec4348096c2d7" +checksum = "9e513413affb8c745e368503b50b629e4b2f764e15b1622b8980eec20fbfccfd" dependencies = [ "p3-field", "p3-goldilocks", "p3-poseidon2", "p3-symmetric", "qp-plonky2", - "qp-poseidon-constants 1.0.1", + "qp-poseidon-constants", "rand_chacha 0.9.0", ] @@ -3872,7 +3846,7 @@ dependencies = [ "hex", "hex-literal", "nam-tiny-hderive", - "qp-poseidon-core 1.0.3", + "qp-poseidon-core", "qp-rusty-crystals-dilithium", "rand_chacha 0.9.0", "rand_core 0.9.3", @@ -3889,7 +3863,7 @@ dependencies = [ "anyhow", "hex", "qp-plonky2", - "qp-poseidon-core 1.0.3", + "qp-poseidon-core", "qp-zk-circuits-common", ] @@ -3912,7 +3886,7 @@ dependencies = [ "anyhow", "hex", "qp-plonky2", - "qp-poseidon-core 1.0.3", + "qp-poseidon-core", "serde", ] @@ -3935,7 +3909,7 @@ dependencies = [ "qp-dilithium-crypto", "qp-plonky2", "qp-poseidon", - "qp-poseidon-core 1.0.2", + "qp-poseidon-core", "qp-rusty-crystals-dilithium", "qp-rusty-crystals-hdwallet", "qp-wormhole-circuit", From 66ba31de67b6585028720da90145398510d4f79e Mon Sep 17 00:00:00 2001 From: Dastan <88332432+dastansam@users.noreply.github.com> Date: Thu, 18 Dec 2025 16:53:41 +0600 Subject: [PATCH 12/14] clippy --- src/cli/wormhole.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/cli/wormhole.rs b/src/cli/wormhole.rs index 3bb6e30..8029188 100644 --- a/src/cli/wormhole.rs +++ b/src/cli/wormhole.rs @@ -82,7 +82,7 @@ pub async fn handle_wormhole_command( password, password_file, output, - } => + } => { generate_proof( secret, amount, @@ -93,7 +93,8 @@ pub async fn handle_wormhole_command( output, node_url, ) - .await, + .await + }, } } @@ -125,8 +126,8 @@ async fn generate_proof( })?; // Parse exit account - let exit_account_id = if exit_account_str.starts_with("0x") { - let exit_account_bytes = hex::decode(&exit_account_str[2..]).map_err(|e| { + let exit_account_id = if let Some(exit_account) = exit_account_str.strip_prefix("0x") { + let exit_account_bytes = hex::decode(exit_account).map_err(|e| { crate::error::QuantusError::Generic(format!("Invalid exit account hex: {}", e)) })?; if exit_account_bytes.len() != 32 { From 056b448d2c2f3f463c4cce0a71a5c12da0fa2f26 Mon Sep 17 00:00:00 2001 From: Dastan <88332432+dastansam@users.noreply.github.com> Date: Thu, 18 Dec 2025 16:57:11 +0600 Subject: [PATCH 13/14] Bump versions, fix lock file --- Cargo.lock | 8 ++++---- Cargo.toml | 4 ++-- src/cli/wormhole.rs | 5 ++--- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 1c54eb5..584ab37 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3779,9 +3779,9 @@ dependencies = [ [[package]] name = "qp-poseidon" -version = "1.0.4" +version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f124a93e98e6f1b42b18728c80d529e353b4ed09665477693026fdbb7bc8b523" +checksum = "5029d1c8223c0312a0247ebc745c5b09622dcbebe104f0fdb9de358b87ef032a" dependencies = [ "log", "p3-field", @@ -3811,9 +3811,9 @@ dependencies = [ [[package]] name = "qp-poseidon-core" -version = "1.0.4" +version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e513413affb8c745e368503b50b629e4b2f764e15b1622b8980eec20fbfccfd" +checksum = "71dd1bf5d2997abf70247fcd23c8f04d7093b1faf33b775a42fb00c07e0a0e05" dependencies = [ "p3-field", "p3-goldilocks", diff --git a/Cargo.toml b/Cargo.toml index a984ad3..83313a2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -51,10 +51,10 @@ aes-gcm = "0.10" # AES-256-GCM (quantum-safe with 256-bit keys) # Quantus crypto dependencies qp-rusty-crystals-dilithium = { version = "2.0.0" } qp-rusty-crystals-hdwallet = { version = "1.0.0" } -qp-poseidon = { version = "1.0.4", features = [ +qp-poseidon = { version = "1.0.5", features = [ "serde", ] } -qp-poseidon-core = { version = "1.0.4", default-features = false, features = ["p2", "p3"] } +qp-poseidon-core = { version = "1.0.5", default-features = false, features = ["p2", "p3"] } qp-dilithium-crypto = { version = "0.2.0", features = ["serde"] } # Blockchain and RPC client diff --git a/src/cli/wormhole.rs b/src/cli/wormhole.rs index 8029188..2386964 100644 --- a/src/cli/wormhole.rs +++ b/src/cli/wormhole.rs @@ -82,7 +82,7 @@ pub async fn handle_wormhole_command( password, password_file, output, - } => { + } => generate_proof( secret, amount, @@ -93,8 +93,7 @@ pub async fn handle_wormhole_command( output, node_url, ) - .await - }, + .await, } } From b7d6b1ea197dc5ba6ea6c8f8bdf056aafe47d421 Mon Sep 17 00:00:00 2001 From: Dastan <88332432+dastansam@users.noreply.github.com> Date: Sat, 10 Jan 2026 21:58:26 +0600 Subject: [PATCH 14/14] Bump versions for crates --- Cargo.lock | 15 +++++++++------ Cargo.toml | 6 +++--- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 584ab37..9104ee9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3857,8 +3857,9 @@ dependencies = [ [[package]] name = "qp-wormhole-circuit" -version = "0.1.4" -source = "git+https://github.com/Quantus-Network/zk-circuits?branch=feat%2Fasset-id-wormhole#b97f33e7db8d4f07d6817883e434c86565959046" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bcbccee20e314a1c52f36d8e78b1fa8205da46050c18da60d4964f41875bd4f6" dependencies = [ "anyhow", "hex", @@ -3869,8 +3870,9 @@ dependencies = [ [[package]] name = "qp-wormhole-prover" -version = "0.1.4" -source = "git+https://github.com/Quantus-Network/zk-circuits?branch=feat%2Fasset-id-wormhole#b97f33e7db8d4f07d6817883e434c86565959046" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9fd377a2fa936e6edb069ffecbf41afe10803b342e5cda8ff3aab199f77fde5d" dependencies = [ "anyhow", "qp-plonky2", @@ -3880,8 +3882,9 @@ dependencies = [ [[package]] name = "qp-zk-circuits-common" -version = "0.1.4" -source = "git+https://github.com/Quantus-Network/zk-circuits?branch=feat%2Fasset-id-wormhole#b97f33e7db8d4f07d6817883e434c86565959046" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "445cc21c39959d1b553c4d8ea94d058ceab84cd70e5d47ec82b11535494cec46" dependencies = [ "anyhow", "hex", diff --git a/Cargo.toml b/Cargo.toml index 83313a2..230b43b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -72,9 +72,9 @@ subxt-metadata = "0.43.0" # ZK proof generation anyhow = "1.0" -qp-wormhole-circuit = { git = "https://github.com/Quantus-Network/zk-circuits", branch = "feat/asset-id-wormhole", default-features = false } -qp-wormhole-prover = { git = "https://github.com/Quantus-Network/zk-circuits", branch = "feat/asset-id-wormhole", default-features = false } -qp-zk-circuits-common = { git = "https://github.com/Quantus-Network/zk-circuits", branch = "feat/asset-id-wormhole", default-features = false } +qp-wormhole-circuit = { version = "0.1.7", default-features = false } +qp-wormhole-prover = { version = "0.1.7", default-features = false } +qp-zk-circuits-common = { version = "0.1.7", default-features = false } qp-plonky2 = { version = "1.1.3", default-features = false, features = ["no_random"] } [dev-dependencies]