From 0b78960c5040d2c41efb6668fc8756de2346cfa2 Mon Sep 17 00:00:00 2001 From: bgallois <benjamin@gallois.cc> Date: Fri, 21 Mar 2025 16:27:07 +0100 Subject: [PATCH] add reviews --- runtime/common/src/handlers.rs | 6 ++---- runtime/gdev/tests/integration_tests.rs | 12 +++++++++--- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/runtime/common/src/handlers.rs b/runtime/common/src/handlers.rs index 66ac960d..0029cb4e 100644 --- a/runtime/common/src/handlers.rs +++ b/runtime/common/src/handlers.rs @@ -173,8 +173,7 @@ where /// Runtime handler OwnerKeyChangePermission. pub struct KeyChangeHandler<Runtime, ReportLongevity>( - core::marker::PhantomData<Runtime>, - core::marker::PhantomData<ReportLongevity>, + core::marker::PhantomData<(Runtime, ReportLongevity)>, ); impl< Runtime: frame_system::Config<AccountId = AccountId> @@ -220,8 +219,7 @@ impl< /// Runtime handler for managing fee handling by transferring unbalanced amounts to a treasury account. pub struct HandleFees<TreasuryAccount, Balances>( - frame_support::pallet_prelude::PhantomData<TreasuryAccount>, - frame_support::pallet_prelude::PhantomData<Balances>, + frame_support::pallet_prelude::PhantomData<(TreasuryAccount, Balances)>, ); type CreditOf<Balances> = frame_support::traits::tokens::fungible::Credit<AccountId, Balances>; impl<TreasuryAccount, Balances> frame_support::traits::OnUnbalanced<CreditOf<Balances>> diff --git a/runtime/gdev/tests/integration_tests.rs b/runtime/gdev/tests/integration_tests.rs index bc3ccd87..4031f377 100644 --- a/runtime/gdev/tests/integration_tests.rs +++ b/runtime/gdev/tests/integration_tests.rs @@ -1603,6 +1603,7 @@ fn test_change_owner_key_offline() { } }); } + pallet_certification::CertsRemovableOn::<Runtime>::take(ValidityPeriod::get()); run_to_block(ReportLongevity::get() + 1); // Charlie can set its session_keys @@ -1689,6 +1690,7 @@ fn test_change_owner_key() { // We run after the bound period // Keeping members intact + let smith_expire_on = ReportLongevity::get() * 2; for i in 1..4 { let expiration = pallet_membership::Membership::<Runtime>::get(i) .unwrap() @@ -1696,10 +1698,14 @@ fn test_change_owner_key() { pallet_membership::MembershipsExpireOn::<Runtime>::take(expiration); pallet_smith_members::Smiths::<Runtime>::mutate(i, |data| { if let Some(ref mut data) = data { - data.expires_on = Some(ReportLongevity::get() * 2); + data.expires_on = Some(smith_expire_on); } }); } + pallet_certification::CertsRemovableOn::<Runtime>::take(ValidityPeriod::get()); + pallet_smith_members::ExpiresOn::<Runtime>::take(SmithInactivityMaxDuration::get() + 1); + run_to_block(SmithInactivityMaxDuration::get() * 25); + pallet_smith_members::ExpiresOn::<Runtime>::take(SmithInactivityMaxDuration::get() + 2); run_to_block(ReportLongevity::get() + 1); // Charlie can change his owner key to Ferdie's @@ -1718,7 +1724,7 @@ fn test_change_owner_key() { SmithMembers::smiths(3), Some(SmithMeta { status: SmithStatus::Smith, - expires_on: Some(ReportLongevity::get() * 2), + expires_on: Some(smith_expire_on), issued_certs: vec![1, 2], received_certs: vec![1, 2], last_online: Some(1), @@ -1740,7 +1746,7 @@ fn test_change_owner_key() { SmithMembers::smiths(3), Some(SmithMeta { status: SmithStatus::Smith, - expires_on: Some(ReportLongevity::get() * 2), + expires_on: Some(smith_expire_on), issued_certs: vec![1, 2], received_certs: vec![1, 2], last_online: Some(1), -- GitLab