diff --git a/Cargo.lock b/Cargo.lock index 89351fa9..f12b7b84 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3040,7 +3040,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" dependencies = [ "libc", - "windows-sys 0.61.0", + "windows-sys 0.52.0", ] [[package]] @@ -3656,9 +3656,9 @@ dependencies = [ [[package]] name = "frame-system" -version = "41.0.0" +version = "41.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ce7df989cefbaab681101774748a1bbbcd23d0cc66e392f8f22d3d3159914db" +checksum = "4189198074d7964bd6cb9d1cf69d77d5d224026bce95bb0ca7efc7768bb8e29c" dependencies = [ "cfg-if", "docify", @@ -4512,7 +4512,7 @@ dependencies = [ "hyper 1.7.0", "libc", "pin-project-lite 0.2.16", - "socket2 0.6.0", + "socket2 0.5.10", "tokio 1.47.1", "tower-service", "tracing", @@ -4894,7 +4894,7 @@ checksum = "e04d7f318608d35d4b61ddd75cbdaee86b023ebe2bd5a66ee0915f0bf93095a9" dependencies = [ "hermit-abi 0.5.2", "libc", - "windows-sys 0.59.0", + "windows-sys 0.52.0", ] [[package]] @@ -7265,9 +7265,9 @@ dependencies = [ [[package]] name = "pallet-revive" -version = "0.7.0" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "474840408264f98eea7f187839ff2157f83a92bec6f3f3503dbf855c38f4de6b" +checksum = "1459d118aeccd7fef1dfb7e3ea002a376c8f07c61053eb2875acc38b1ceee4d9" dependencies = [ "alloy-core", "derive_more 0.99.20", @@ -8758,7 +8758,7 @@ version = "0.13.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "be769465445e8c1474e9c5dac2018218498557af32d9ed057325ec9a41ae81bf" dependencies = [ - "heck 0.5.0", + "heck 0.4.1", "itertools 0.14.0", "log", "multimap", @@ -9362,7 +9362,7 @@ dependencies = [ "quinn-udp 0.5.14", "rustc-hash 2.1.1", "rustls 0.23.32", - "socket2 0.6.0", + "socket2 0.5.10", "thiserror 2.0.18", "tokio 1.47.1", "tracing", @@ -9430,9 +9430,9 @@ dependencies = [ "cfg_aliases 0.2.1", "libc", "once_cell", - "socket2 0.6.0", + "socket2 0.5.10", "tracing", - "windows-sys 0.60.2", + "windows-sys 0.52.0", ] [[package]] @@ -9947,7 +9947,7 @@ dependencies = [ "errno", "libc", "linux-raw-sys 0.11.0", - "windows-sys 0.61.0", + "windows-sys 0.52.0", ] [[package]] @@ -10037,7 +10037,7 @@ dependencies = [ "security-framework 3.5.0", "security-framework-sys", "webpki-root-certs 0.26.11", - "windows-sys 0.59.0", + "windows-sys 0.52.0", ] [[package]] @@ -13421,7 +13421,7 @@ dependencies = [ "getrandom 0.3.3", "once_cell", "rustix 1.1.2", - "windows-sys 0.61.0", + "windows-sys 0.52.0", ] [[package]] @@ -14858,7 +14858,7 @@ version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22" dependencies = [ - "windows-sys 0.61.0", + "windows-sys 0.52.0", ] [[package]] diff --git a/pallets/mining-rewards/src/mock.rs b/pallets/mining-rewards/src/mock.rs index 88ad0b03..e8106731 100644 --- a/pallets/mining-rewards/src/mock.rs +++ b/pallets/mining-rewards/src/mock.rs @@ -4,7 +4,6 @@ use frame_support::{ parameter_types, traits::{ConstU32, Everything, Hooks}, }; -use pallet_treasury; use qp_poseidon::PoseidonHasher; use sp_consensus_pow::POW_ENGINE_ID; use sp_runtime::{ diff --git a/pallets/multisig/Cargo.toml b/pallets/multisig/Cargo.toml index 0fd05da0..295d45df 100644 --- a/pallets/multisig/Cargo.toml +++ b/pallets/multisig/Cargo.toml @@ -74,8 +74,3 @@ std = [ "sp-io/std", "sp-runtime/std", ] -try-runtime = [ - "frame-support/try-runtime", - "frame-system/try-runtime", - "sp-runtime/try-runtime", -] diff --git a/pallets/multisig/src/benchmarking.rs b/pallets/multisig/src/benchmarking.rs index 59f45386..70facc39 100644 --- a/pallets/multisig/src/benchmarking.rs +++ b/pallets/multisig/src/benchmarking.rs @@ -11,6 +11,24 @@ use frame_support::{traits::fungible::Mutate, BoundedBTreeMap}; const SEED: u32 = 0; +/// Multisig address used by the `propose_high_security` benchmark (signer1+signer2+caller). +/// Exposed so the mock `HighSecurity` can treat it as HS in unit tests. +#[cfg(any(test, feature = "runtime-benchmarks"))] +#[allow(dead_code)] +pub fn propose_high_security_benchmark_multisig_address() -> T::AccountId +where + T: Config + pallet_balances::Config, + BalanceOf2: From, +{ + use frame_benchmarking::v2::{account, whitelisted_caller}; + let caller: T::AccountId = whitelisted_caller(); + let signer1: T::AccountId = account("signer1", 0, SEED); + let signer2: T::AccountId = account("signer2", 1, SEED); + let mut signers = vec![caller, signer1, signer2]; + signers.sort(); + Multisig::::derive_multisig_address(&signers, 2, 0) +} + // Helper to fund an account type BalanceOf2 = ::Balance; @@ -113,6 +131,7 @@ mod benchmarks { } /// Insert a single proposal into storage. `approvals` = list of account ids that have approved. + #[allow(clippy::too_many_arguments)] fn insert_proposal( multisig_address: &T::AccountId, proposal_id: u32, @@ -202,11 +221,13 @@ mod benchmarks { /// Benchmark `propose` for high-security multisigs. /// Uses signer1/signer2 so multisig address matches genesis (ReversibleTransfers:: - /// initial_high_security_accounts). HighSecurityAccounts::contains_key reads from trie. + /// initial_high_security_accounts) or mock's HighSecurity (unit tests). + /// Uses whitelisted call (remark "safe") so HS path accepts it. #[benchmark] fn propose_high_security( c: Linear<0, { T::MaxCallSize::get().saturating_sub(100) }>, ) -> Result<(), BenchmarkError> { + let _ = c; let (caller, signers) = setup_funded_signer_set_hs::(); let threshold = 2u32; let multisig_address = insert_multisig::(&caller, &signers, threshold, 0, 0, 0); @@ -216,7 +237,7 @@ mod benchmarks { ); set_block::(100); - let new_call = frame_system::Call::::remark { remark: vec![99u8; c as usize] }; + let new_call = frame_system::Call::::remark { remark: b"safe".to_vec() }; let encoded_call = ::RuntimeCall::from(new_call).encode(); let expiry = frame_system::Pallet::::block_number() + 1000u32.into(); diff --git a/pallets/multisig/src/migration.rs b/pallets/multisig/src/migration.rs deleted file mode 100644 index e69de29b..00000000 diff --git a/pallets/multisig/src/tests.rs b/pallets/multisig/src/tests.rs index 444661eb..443e9d48 100644 --- a/pallets/multisig/src/tests.rs +++ b/pallets/multisig/src/tests.rs @@ -12,7 +12,15 @@ pub struct MockHighSecurity; impl HighSecurityInspector for MockHighSecurity { fn is_high_security(who: &AccountId32) -> bool { // For testing, account 100 is high security - who == &account_id(100) + if who == &account_id(100) { + return true; + } + // So that bench_propose_high_security passes (mock has no ReversibleTransfers genesis) + #[cfg(feature = "runtime-benchmarks")] + if who == &crate::benchmarking::propose_high_security_benchmark_multisig_address::() { + return true; + } + false } fn is_whitelisted(call: &RuntimeCall) -> bool { // For testing, only remarks with "safe" are whitelisted diff --git a/pallets/treasury/src/tests.rs b/pallets/treasury/src/tests.rs index 14bf2f12..3b9821cc 100644 --- a/pallets/treasury/src/tests.rs +++ b/pallets/treasury/src/tests.rs @@ -1,58 +1,55 @@ -#[cfg(test)] -mod tests { - use crate::{ - mock::{account_id, new_test_ext, Test, Treasury}, - Error, - }; - use frame_support::{assert_err, assert_ok}; +use crate::{ + mock::{account_id, new_test_ext, Test, Treasury}, + Error, +}; +use frame_support::{assert_err, assert_ok}; - #[test] - fn genesis_sets_treasury_config() { - new_test_ext().execute_with(|| { - assert_eq!(Treasury::account_id(), account_id(1)); - assert_eq!(Treasury::portion(), 50); - }); - } +#[test] +fn genesis_sets_treasury_config() { + new_test_ext().execute_with(|| { + assert_eq!(Treasury::account_id(), account_id(1)); + assert_eq!(Treasury::portion(), 50); + }); +} - #[test] - fn set_treasury_account_works() { - new_test_ext().execute_with(|| { - assert_ok!(Treasury::set_treasury_account( - frame_system::RawOrigin::Root.into(), - account_id(99) - )); - assert_eq!(Treasury::account_id(), account_id(99)); - }); - } +#[test] +fn set_treasury_account_works() { + new_test_ext().execute_with(|| { + assert_ok!(Treasury::set_treasury_account( + frame_system::RawOrigin::Root.into(), + account_id(99) + )); + assert_eq!(Treasury::account_id(), account_id(99)); + }); +} - #[test] - fn set_treasury_account_requires_root() { - new_test_ext().execute_with(|| { - assert_err!( - Treasury::set_treasury_account( - frame_system::RawOrigin::Signed(account_id(1)).into(), - account_id(99) - ), - sp_runtime::DispatchError::BadOrigin - ); - }); - } +#[test] +fn set_treasury_account_requires_root() { + new_test_ext().execute_with(|| { + assert_err!( + Treasury::set_treasury_account( + frame_system::RawOrigin::Signed(account_id(1)).into(), + account_id(99) + ), + sp_runtime::DispatchError::BadOrigin + ); + }); +} - #[test] - fn set_treasury_portion_works() { - new_test_ext().execute_with(|| { - assert_ok!(Treasury::set_treasury_portion(frame_system::RawOrigin::Root.into(), 30)); - assert_eq!(Treasury::portion(), 30); - }); - } +#[test] +fn set_treasury_portion_works() { + new_test_ext().execute_with(|| { + assert_ok!(Treasury::set_treasury_portion(frame_system::RawOrigin::Root.into(), 30)); + assert_eq!(Treasury::portion(), 30); + }); +} - #[test] - fn set_treasury_portion_rejects_invalid() { - new_test_ext().execute_with(|| { - assert_err!( - Treasury::set_treasury_portion(frame_system::RawOrigin::Root.into(), 101), - Error::::InvalidPortion - ); - }); - } +#[test] +fn set_treasury_portion_rejects_invalid() { + new_test_ext().execute_with(|| { + assert_err!( + Treasury::set_treasury_portion(frame_system::RawOrigin::Root.into(), 101), + Error::::InvalidPortion + ); + }); } diff --git a/pallets/wormhole/Cargo.toml b/pallets/wormhole/Cargo.toml index baeaada7..ffa42da9 100644 --- a/pallets/wormhole/Cargo.toml +++ b/pallets/wormhole/Cargo.toml @@ -69,4 +69,3 @@ std = [ "sp-io/std", "sp-runtime/std", ] -try-runtime = ["frame-support/try-runtime", "frame-system/try-runtime"] diff --git a/pallets/wormhole/src/benchmarking.rs b/pallets/wormhole/src/benchmarking.rs index 27ea4823..47d00851 100644 --- a/pallets/wormhole/src/benchmarking.rs +++ b/pallets/wormhole/src/benchmarking.rs @@ -39,9 +39,7 @@ mod benchmarks { // Extract values from aggregated public inputs let block_number_u32 = aggregated_inputs.block_data.block_number; - let block_hash_bytes: [u8; 32] = (*aggregated_inputs.block_data.block_hash) - .try_into() - .map_err(|_| BenchmarkError::Stop("Invalid block hash length"))?; + let block_hash_bytes = *aggregated_inputs.block_data.block_hash; // Ensure nullifiers haven't been used for nullifier in &aggregated_inputs.nullifiers { diff --git a/runtime/Cargo.toml b/runtime/Cargo.toml index aa9007f1..0ac0f17e 100644 --- a/runtime/Cargo.toml +++ b/runtime/Cargo.toml @@ -180,7 +180,6 @@ try-runtime = [ "pallet-sudo/try-runtime", "pallet-timestamp/try-runtime", "pallet-transaction-payment/try-runtime", - "pallet-wormhole/try-runtime", "sp-runtime/try-runtime", ] diff --git a/runtime/tests/governance/tech_collective.rs b/runtime/tests/governance/tech_collective.rs index 608fe9b3..cc232eb0 100644 --- a/runtime/tests/governance/tech_collective.rs +++ b/runtime/tests/governance/tech_collective.rs @@ -8,14 +8,11 @@ mod tests { use quantus_runtime::configs::TechReferendaInstance; use quantus_runtime::{ - Balances, OriginCaller, Preimage, Runtime, RuntimeCall, RuntimeOrigin, System, - TechCollective, TechReferenda, UNIT, + Balances, OriginCaller, Preimage, Runtime, RuntimeCall, RuntimeOrigin, TechCollective, + TechReferenda, UNIT, }; - use sp_runtime::{ - traits::{AccountIdConversion, Hash, StaticLookup}, - MultiAddress, - }; + use sp_runtime::{traits::Hash, MultiAddress}; const TRACK_ID: u16 = 0;