From 829652c2a57e2749331b0a0acbac327c06cf622c Mon Sep 17 00:00:00 2001 From: Hugo Trentesaux <hugo@trentesaux.fr> Date: Tue, 16 Jan 2024 19:38:20 +0100 Subject: [PATCH] comments --- live-tests/tests/sanity_gdev.rs | 2 -- pallets/distance/src/lib.rs | 5 ++--- pallets/duniter-wot/src/lib.rs | 2 +- pallets/membership/src/lib.rs | 2 +- pallets/universal-dividend/src/lib.rs | 5 ++--- runtime/gdev/tests/integration_tests.rs | 3 +-- 6 files changed, 7 insertions(+), 12 deletions(-) diff --git a/live-tests/tests/sanity_gdev.rs b/live-tests/tests/sanity_gdev.rs index d0ae6434c..e326b7191 100644 --- a/live-tests/tests/sanity_gdev.rs +++ b/live-tests/tests/sanity_gdev.rs @@ -156,8 +156,6 @@ mod verifier { Self { errors: Vec::new() } } - // FIXME why async functions when called with await? - /// method to run all storage tests pub(super) async fn verify_storage(&mut self, storage: &Storage) -> anyhow::Result<()> { self.verify_accounts(&storage.accounts).await; diff --git a/pallets/distance/src/lib.rs b/pallets/distance/src/lib.rs index a776c8182..cbfa3e9ef 100644 --- a/pallets/distance/src/lib.rs +++ b/pallets/distance/src/lib.rs @@ -439,10 +439,9 @@ pub mod pallet { idty_index: <T as pallet_identity::Config>::IdtyIndex, ) -> Result<(), DispatchError> { Pallet::<T>::mutate_current_pool( - pallet_session::CurrentIndex::<T>::get(), // TODO look + pallet_session::CurrentIndex::<T>::get(), |current_pool| { - // TODO not needed if called in extrinsics only - // since extrinsics are transactional by default + // extrinsics are transactional by default, this check might not be needed ensure!( current_pool.evaluations.len() < (MAX_EVALUATIONS_PER_SESSION as usize), Error::<T>::QueueFull diff --git a/pallets/duniter-wot/src/lib.rs b/pallets/duniter-wot/src/lib.rs index f7c009034..67961a5a1 100644 --- a/pallets/duniter-wot/src/lib.rs +++ b/pallets/duniter-wot/src/lib.rs @@ -230,7 +230,7 @@ impl<T: Config> pallet_identity::traits::OnIdtyChange<T> for Pallet<T> { } } } - // TODO split in removed / revoked in two events: + // we could split this event in removed / revoked: // if identity is revoked keep it // if identity is removed also remove certs IdtyEvent::Removed { status } => { diff --git a/pallets/membership/src/lib.rs b/pallets/membership/src/lib.rs index f699a24c0..36884fba8 100644 --- a/pallets/membership/src/lib.rs +++ b/pallets/membership/src/lib.rs @@ -93,7 +93,7 @@ pub mod pallet { type AccountIdOf: Convert<Self::IdtyId, Option<Self::AccountId>>; #[pallet::constant] /// Maximum life span of a single membership (in number of blocks) - // TODO this could be renamed "validity" or "duration" + // (this could be renamed "validity" or "duration") type MembershipPeriod: Get<Self::BlockNumber>; /// Minimum delay to wait before renewing membership // i.e. asking for distance evaluation diff --git a/pallets/universal-dividend/src/lib.rs b/pallets/universal-dividend/src/lib.rs index be744570e..92ae7c7df 100644 --- a/pallets/universal-dividend/src/lib.rs +++ b/pallets/universal-dividend/src/lib.rs @@ -97,14 +97,14 @@ pub mod pallet { #[pallet::getter(fn current_ud)] pub type CurrentUd<T: Config> = StorageValue<_, BalanceOf<T>, ValueQuery>; + // default value for number of the next UD #[pallet::type_value] pub fn DefaultForCurrentUdIndex() -> UdIndex { - // FIXME seems off by 1 - // or rename to "next" ud index instead of "current" ud index 1 } /// Current UD index + // (more like the index of the ongoing UD = the next one) #[pallet::storage] #[pallet::getter(fn ud_index)] pub type CurrentUdIndex<T: Config> = @@ -268,7 +268,6 @@ pub mod pallet { // Increment ud index let ud_index = CurrentUdIndex::<T>::mutate(|next_ud_index| { - // FIXME seems off by 1 due to default to 1 core::mem::replace(next_ud_index, next_ud_index.saturating_add(1)) }); diff --git a/runtime/gdev/tests/integration_tests.rs b/runtime/gdev/tests/integration_tests.rs index 6f1dbc89d..55eba276c 100644 --- a/runtime/gdev/tests/integration_tests.rs +++ b/runtime/gdev/tests/integration_tests.rs @@ -481,8 +481,8 @@ fn test_identity_creation_workflow() { Identity::identity(5), Some(pallet_identity::IdtyValue { data: IdtyData { - // ud creation period is 60_000 ms ~ 10 blocks // block time is 6_000 ms + // ud creation period is 60_000 ms ~ 10 blocks // first ud is at 24_000 ms ~ 4 blocks // at block 75 this should be the UD number 7, so next is 8 not 9 // FIXME wrong UD count @@ -583,7 +583,6 @@ fn test_membership_renewal() { run_to_block(76); // not possible to renew manually // can not ask renewal when period is not respected - // TODO check that it is possible again within the right delay assert_noop!( Distance::request_distance_evaluation( frame_system::RawOrigin::Signed(AccountKeyring::Alice.to_account_id()).into(), -- GitLab