From 9f4c9b4d192e47b00a1040db841459d26230d48c Mon Sep 17 00:00:00 2001 From: Kurdistan Tech Ministry Date: Sun, 22 Mar 2026 20:17:58 +0300 Subject: [PATCH] style: fix formatting, regenerate umbrella, taplo format --- .../pezpallets/identity-kyc/src/lib.rs | 3 +- .../pezpallets/perwerde/src/tests.rs | 7 +--- .../pezpallets/pez-rewards/src/lib.rs | 3 +- .../pezpallets/pez-treasury/src/lib.rs | 4 +-- .../pezpallets/ping/src/benchmarking.rs | 6 +++- .../teyrchains/pezpallets/ping/src/tests.rs | 34 ++++--------------- .../teyrchains/pezpallets/presale/src/lib.rs | 30 +++++++--------- .../pezpallets/teyrchain-info/Cargo.toml | 5 ++- .../pezpallets/teyrchain-info/src/tests.rs | 2 +- .../teyrchains/pezpallets/tiki/src/lib.rs | 5 ++- .../teyrchains/pezpallets/trust/src/lib.rs | 2 +- .../teyrchains/pezpallets/welati/src/lib.rs | 24 ++++--------- pezkuwi/pezpallets/validator-pool/src/lib.rs | 4 +-- umbrella/Cargo.toml | 1 - 14 files changed, 47 insertions(+), 83 deletions(-) diff --git a/pezcumulus/teyrchains/pezpallets/identity-kyc/src/lib.rs b/pezcumulus/teyrchains/pezpallets/identity-kyc/src/lib.rs index 155292b2..3864d42b 100644 --- a/pezcumulus/teyrchains/pezpallets/identity-kyc/src/lib.rs +++ b/pezcumulus/teyrchains/pezpallets/identity-kyc/src/lib.rs @@ -185,8 +185,7 @@ pub mod pezpallet { /// Ensures no two accounts can register with the same identity hash #[pezpallet::storage] #[pezpallet::getter(fn identity_hash_owner)] - pub type IdentityHashToAccount = - StorageMap<_, Blake2_128Concat, H256, T::AccountId>; + pub type IdentityHashToAccount = StorageMap<_, Blake2_128Concat, H256, T::AccountId>; /// Referrer of approved citizens (for direct responsibility tracking) /// Kept permanently for penalty system even after application is removed diff --git a/pezcumulus/teyrchains/pezpallets/perwerde/src/tests.rs b/pezcumulus/teyrchains/pezpallets/perwerde/src/tests.rs index 0fe7cca3..19fb2550 100644 --- a/pezcumulus/teyrchains/pezpallets/perwerde/src/tests.rs +++ b/pezcumulus/teyrchains/pezpallets/perwerde/src/tests.rs @@ -377,12 +377,7 @@ fn complete_course_with_max_allowed_points() { assert_ok!(PerwerdePallet::enroll(RuntimeOrigin::signed(student), 0)); // Complete with maximum allowed points (MaxPointsPerCourse = 1000) - assert_ok!(PerwerdePallet::complete_course( - RuntimeOrigin::signed(admin), - student, - 0, - 1000 - )); + assert_ok!(PerwerdePallet::complete_course(RuntimeOrigin::signed(admin), student, 0, 1000)); let enrollment = crate::Enrollments::::get((student, 0)).unwrap(); assert_eq!(enrollment.points_earned, 1000); diff --git a/pezcumulus/teyrchains/pezpallets/pez-rewards/src/lib.rs b/pezcumulus/teyrchains/pezpallets/pez-rewards/src/lib.rs index 5f74bc52..5388b412 100644 --- a/pezcumulus/teyrchains/pezpallets/pez-rewards/src/lib.rs +++ b/pezcumulus/teyrchains/pezpallets/pez-rewards/src/lib.rs @@ -612,8 +612,7 @@ pub mod pezpallet { // Calculate unclaimed amount: total allocated - total claimed let total_claimed = EpochTotalClaimed::::get(epoch_index); - let unclaimed_amount = - reward_pool.total_reward_pool.saturating_sub(total_claimed); + let unclaimed_amount = reward_pool.total_reward_pool.saturating_sub(total_claimed); let incentive_pot = Self::incentive_pot_account_id(); let clawback_recipient = ::ClawbackRecipient::get(); diff --git a/pezcumulus/teyrchains/pezpallets/pez-treasury/src/lib.rs b/pezcumulus/teyrchains/pezpallets/pez-treasury/src/lib.rs index 217c45ed..3a040551 100644 --- a/pezcumulus/teyrchains/pezpallets/pez-treasury/src/lib.rs +++ b/pezcumulus/teyrchains/pezpallets/pez-treasury/src/lib.rs @@ -360,8 +360,8 @@ pub mod pezpallet { } pub fn do_monthly_release() -> DispatchResult { - let start_block = TreasuryStartBlock::::get() - .ok_or(Error::::TreasuryNotInitialized)?; + let start_block = + TreasuryStartBlock::::get().ok_or(Error::::TreasuryNotInitialized)?; let current_block = pezframe_system::Pezpallet::::block_number(); let next_month = NextReleaseMonth::::get(); diff --git a/pezcumulus/teyrchains/pezpallets/ping/src/benchmarking.rs b/pezcumulus/teyrchains/pezpallets/ping/src/benchmarking.rs index 718edd23..cf62119c 100644 --- a/pezcumulus/teyrchains/pezpallets/ping/src/benchmarking.rs +++ b/pezcumulus/teyrchains/pezpallets/ping/src/benchmarking.rs @@ -99,5 +99,9 @@ mod benchmarks { // The weight functions `ping(s)` and `pong(s)` in weights.rs account for the // payload size variable and provide conservative estimates. - impl_benchmark_test_suite!(Pezpallet, super::super::mock::new_bench_ext(), super::super::mock::Test); + impl_benchmark_test_suite!( + Pezpallet, + super::super::mock::new_bench_ext(), + super::super::mock::Test + ); } diff --git a/pezcumulus/teyrchains/pezpallets/ping/src/tests.rs b/pezcumulus/teyrchains/pezpallets/ping/src/tests.rs index eb71f543..a402d816 100644 --- a/pezcumulus/teyrchains/pezpallets/ping/src/tests.rs +++ b/pezcumulus/teyrchains/pezpallets/ping/src/tests.rs @@ -83,11 +83,7 @@ fn start_rejects_too_many_targets() { new_test_ext().execute_with(|| { // MaxTeyrchains is 100. for i in 0..100u32 { - assert_ok!(Ping::start( - RuntimeOrigin::root(), - ParaId::from(2000 + i), - vec![0u8; 4], - )); + assert_ok!(Ping::start(RuntimeOrigin::root(), ParaId::from(2000 + i), vec![0u8; 4],)); } // 101st should fail. @@ -144,12 +140,7 @@ fn start_many_respects_max_targets() { fn start_many_rejects_payload_too_large() { new_test_ext().execute_with(|| { assert_noop!( - Ping::start_many( - RuntimeOrigin::root(), - ParaId::from(2000u32), - 1, - vec![0u8; 1025], - ), + Ping::start_many(RuntimeOrigin::root(), ParaId::from(2000u32), 1, vec![0u8; 1025],), Error::::PayloadTooLarge ); }); @@ -256,9 +247,7 @@ fn ping_from_sibling_para_works() { assert_ok!(Ping::ping(origin, 1, vec![42u8; 8])); // Should have deposited a Pinged event. - System::assert_has_event( - Event::::Pinged(para_id, 1, vec![42u8; 8]).into(), - ); + System::assert_has_event(Event::::Pinged(para_id, 1, vec![42u8; 8]).into()); }); } @@ -295,9 +284,7 @@ fn pong_processes_known_ping() { assert!(Pings::::get(42u32).is_none()); // Should emit Ponged event with the round-trip time. - System::assert_has_event( - Event::::Ponged(para_id, 42, vec![0u8; 4], 0u64).into(), - ); + System::assert_has_event(Event::::Ponged(para_id, 42, vec![0u8; 4], 0u64).into()); }); } @@ -310,9 +297,7 @@ fn pong_handles_unknown_pong() { // No ping entry for seq 99. assert_ok!(Ping::pong(origin, 99, vec![0u8; 4])); - System::assert_has_event( - Event::::UnknownPong(para_id, 99, vec![0u8; 4]).into(), - ); + System::assert_has_event(Event::::UnknownPong(para_id, 99, vec![0u8; 4]).into()); }); } @@ -347,14 +332,7 @@ fn on_finalize_sends_pings_to_targets() { // Should have emitted PingSent event (MockXcmSender always succeeds). System::assert_has_event( - Event::::PingSent( - para, - 1, - vec![7u8; 4], - [0u8; 32], - Assets::new(), - ) - .into(), + Event::::PingSent(para, 1, vec![7u8; 4], [0u8; 32], Assets::new()).into(), ); }); } diff --git a/pezcumulus/teyrchains/pezpallets/presale/src/lib.rs b/pezcumulus/teyrchains/pezpallets/presale/src/lib.rs index 1e873ab4..2f7fc362 100644 --- a/pezcumulus/teyrchains/pezpallets/presale/src/lib.rs +++ b/pezcumulus/teyrchains/pezpallets/presale/src/lib.rs @@ -931,7 +931,13 @@ pub mod pezpallet { // Cannot cancel presales that are already finalized, failed, or cancelled ensure!( - matches!(presale.status, PresaleStatus::Active | PresaleStatus::Pending | PresaleStatus::Paused | PresaleStatus::Successful), + matches!( + presale.status, + PresaleStatus::Active + | PresaleStatus::Pending + | PresaleStatus::Paused + | PresaleStatus::Successful + ), Error::::AlreadyFinalized, ); @@ -968,8 +974,7 @@ pub mod pezpallet { let treasury = Self::presale_account_id(presale_id); let contributors = Contributors::::get(presale_id); - let end_index = - start_index.saturating_add(batch_size).min(contributors.len() as u32); + let end_index = start_index.saturating_add(batch_size).min(contributors.len() as u32); let mut refunded_count = 0u32; let mut total_refunded = 0u128; @@ -1008,8 +1013,7 @@ pub mod pezpallet { })?; refunded_count += 1; - total_refunded = - total_refunded.saturating_add(contribution_info.amount); + total_refunded = total_refunded.saturating_add(contribution_info.amount); Self::deposit_event(Event::Refunded { presale_id, @@ -1129,22 +1133,17 @@ pub mod pezpallet { ) -> DispatchResult { ensure_signed(origin)?; // Anyone can trigger - let mut presale = - Presales::::get(presale_id).ok_or(Error::::PresaleNotFound)?; + let mut presale = Presales::::get(presale_id).ok_or(Error::::PresaleNotFound)?; // Only works on SUCCESSFUL presales (soft cap reached, not yet finalized) - ensure!( - presale.status == PresaleStatus::Successful, - Error::::PresaleNotSuccessful, - ); + ensure!(presale.status == PresaleStatus::Successful, Error::::PresaleNotSuccessful,); let total_raised = TotalRaised::::get(presale_id); let treasury = Self::presale_account_id(presale_id); let contributors = Contributors::::get(presale_id); // Calculate end index (don't exceed array length) - let end_index = - start_index.saturating_add(batch_size).min(contributors.len() as u32); + let end_index = start_index.saturating_add(batch_size).min(contributors.len() as u32); let mut distributed_count = 0u32; let mut total_distributed = 0u128; @@ -1229,10 +1228,7 @@ pub mod pezpallet { presale.status = PresaleStatus::Finalized; Presales::::insert(presale_id, &presale); - Self::deposit_event(Event::PresaleFinalized { - presale_id, - total_raised, - }); + Self::deposit_event(Event::PresaleFinalized { presale_id, total_raised }); } Self::deposit_event(Event::BatchDistributionCompleted { diff --git a/pezcumulus/teyrchains/pezpallets/teyrchain-info/Cargo.toml b/pezcumulus/teyrchains/pezpallets/teyrchain-info/Cargo.toml index f1818853..c65590aa 100644 --- a/pezcumulus/teyrchains/pezpallets/teyrchain-info/Cargo.toml +++ b/pezcumulus/teyrchains/pezpallets/teyrchain-info/Cargo.toml @@ -24,8 +24,8 @@ pezsp-runtime = { workspace = true } pezcumulus-primitives-core = { workspace = true } [dev-dependencies] -pezsp-io = { workspace = true } pezsp-core = { workspace = true } +pezsp-io = { workspace = true } [features] default = ["std"] @@ -34,6 +34,8 @@ std = [ "pezcumulus-primitives-core/std", "pezframe-support/std", "pezframe-system/std", + "pezsp-core/std", + "pezsp-io/std", "pezsp-runtime/std", "scale-info/std", ] @@ -47,6 +49,7 @@ runtime-benchmarks = [ "pezcumulus-primitives-core/runtime-benchmarks", "pezframe-support/runtime-benchmarks", "pezframe-system/runtime-benchmarks", + "pezsp-io/runtime-benchmarks", "pezsp-runtime/runtime-benchmarks", ] serde = [] diff --git a/pezcumulus/teyrchains/pezpallets/teyrchain-info/src/tests.rs b/pezcumulus/teyrchains/pezpallets/teyrchain-info/src/tests.rs index 80e76861..5754a599 100644 --- a/pezcumulus/teyrchains/pezpallets/teyrchain-info/src/tests.rs +++ b/pezcumulus/teyrchains/pezpallets/teyrchain-info/src/tests.rs @@ -18,8 +18,8 @@ use crate::mock::*; use crate::pezpallet::Pezpallet; -use pezframe_support::traits::Get; use pezcumulus_primitives_core::ParaId; +use pezframe_support::traits::Get; #[test] fn genesis_default_teyrchain_id_is_100() { diff --git a/pezcumulus/teyrchains/pezpallets/tiki/src/lib.rs b/pezcumulus/teyrchains/pezpallets/tiki/src/lib.rs index 80df3e3a..c72921e5 100644 --- a/pezcumulus/teyrchains/pezpallets/tiki/src/lib.rs +++ b/pezcumulus/teyrchains/pezpallets/tiki/src/lib.rs @@ -780,7 +780,10 @@ pub trait TikiProvider { impl TikiScoreProvider for Pezpallet { fn get_tiki_score(who: &T::AccountId) -> u32 { let tikis = Self::user_tikis(who); - tikis.iter().map(Self::get_bonus_for_tiki).fold(0u32, |acc, x| acc.saturating_add(x)) + tikis + .iter() + .map(Self::get_bonus_for_tiki) + .fold(0u32, |acc, x| acc.saturating_add(x)) } } diff --git a/pezcumulus/teyrchains/pezpallets/trust/src/lib.rs b/pezcumulus/teyrchains/pezpallets/trust/src/lib.rs index 684d00f5..68ae13eb 100644 --- a/pezcumulus/teyrchains/pezpallets/trust/src/lib.rs +++ b/pezcumulus/teyrchains/pezpallets/trust/src/lib.rs @@ -401,7 +401,7 @@ pub mod pezpallet { .saturating_add(tiki_u128.saturating_mul(300)); // Safe: both operands are derived from u32 scores, product fits in u128 - let final_score_u128 = staking_u128 + let final_score_u128 = staking_u128 .saturating_mul(weighted_sum) .checked_div(base) .ok_or(Error::::CalculationOverflow)?; diff --git a/pezcumulus/teyrchains/pezpallets/welati/src/lib.rs b/pezcumulus/teyrchains/pezpallets/welati/src/lib.rs index 973c70a1..43bca319 100644 --- a/pezcumulus/teyrchains/pezpallets/welati/src/lib.rs +++ b/pezcumulus/teyrchains/pezpallets/welati/src/lib.rs @@ -653,10 +653,7 @@ pub mod pezpallet { // H7 fix: Validate endorsers count early, before any storage reads, // to prevent large Vecs from consuming excessive weight. - ensure!( - endorsers.len() as u32 <= T::MaxEndorsers::get(), - Error::::TooManyEndorsers - ); + ensure!(endorsers.len() as u32 <= T::MaxEndorsers::get(), Error::::TooManyEndorsers); let mut election = ActiveElections::::get(election_id).ok_or(Error::::ElectionNotFound)?; @@ -860,8 +857,8 @@ pub mod pezpallet { let total_citizen_count = Self::get_total_citizen_count(); let turnout_percentage = if total_citizen_count > 0 { - ((election.total_votes as u64).saturating_mul(100) / total_citizen_count as u64) - as u8 + ((election.total_votes as u64).saturating_mul(100) + / total_citizen_count as u64) as u8 } else { 0 }; @@ -1140,18 +1137,12 @@ pub mod pezpallet { CollectiveDecisionType::ConstitutionalReview | CollectiveDecisionType::ConstitutionalUnanimous => { // Diwan members only - ensure!( - Self::is_diwan_member(&voter), - Error::::NotAuthorizedToVote, - ); + ensure!(Self::is_diwan_member(&voter), Error::::NotAuthorizedToVote,); }, CollectiveDecisionType::ExecutiveDecision => { // Serok (President) only let serok = CurrentOfficials::::get(GovernmentPosition::Serok); - ensure!( - serok.as_ref() == Some(&voter), - Error::::NotAuthorizedToVote, - ); + ensure!(serok.as_ref() == Some(&voter), Error::::NotAuthorizedToVote,); }, CollectiveDecisionType::HybridDecision => { // Parliament members OR Serok @@ -1159,10 +1150,7 @@ pub mod pezpallet { let is_parliament = members.iter().any(|m| m.account == voter); let serok = CurrentOfficials::::get(GovernmentPosition::Serok); let is_serok = serok.as_ref() == Some(&voter); - ensure!( - is_parliament || is_serok, - Error::::NotAuthorizedToVote, - ); + ensure!(is_parliament || is_serok, Error::::NotAuthorizedToVote,); }, } diff --git a/pezkuwi/pezpallets/validator-pool/src/lib.rs b/pezkuwi/pezpallets/validator-pool/src/lib.rs index 12634a5b..5088b0e6 100644 --- a/pezkuwi/pezpallets/validator-pool/src/lib.rs +++ b/pezkuwi/pezpallets/validator-pool/src/lib.rs @@ -370,10 +370,10 @@ pub mod pezpallet { // - SelectionHistory::mutate per selected validator let pool_size = Self::pool_size(); weight = weight.saturating_add( - T::DbWeight::get().reads(pool_size as u64 * 2) // iter + history per member + T::DbWeight::get().reads(pool_size as u64 * 2), // iter + history per member ); weight = weight.saturating_add( - T::DbWeight::get().writes(3 + pool_size as u64) // era state + history updates + T::DbWeight::get().writes(3 + pool_size as u64), // era state + history updates ); // Trigger new era if enough time has passed diff --git a/umbrella/Cargo.toml b/umbrella/Cargo.toml index 0514ff1b..91d3acde 100644 --- a/umbrella/Cargo.toml +++ b/umbrella/Cargo.toml @@ -1,6 +1,5 @@ [package] name = "pezkuwi-sdk" -version = "0.0.0" description = "Pezkuwi SDK umbrella crate." license = "Apache-2.0"