From 58f92f4900d6cc2bb456d2884f31ade099881f60 Mon Sep 17 00:00:00 2001 From: Amiya Behera Date: Tue, 7 May 2024 22:43:57 +0530 Subject: [PATCH] ValidationBlock rename --- .helix/config.toml.bak | 7 +++++++ pallets/department-funding/src/extras.rs | 2 +- pallets/department-funding/src/lib.rs | 6 +++--- pallets/profile-validation/src/extras.rs | 12 +++++------ pallets/profile-validation/src/lib.rs | 26 ++++++++++++------------ pallets/project-tips/src/extras.rs | 4 ++-- pallets/project-tips/src/lib.rs | 6 +++--- 7 files changed, 35 insertions(+), 28 deletions(-) create mode 100644 .helix/config.toml.bak diff --git a/.helix/config.toml.bak b/.helix/config.toml.bak new file mode 100644 index 0000000..053d9dc --- /dev/null +++ b/.helix/config.toml.bak @@ -0,0 +1,7 @@ +[editor.lsp] +display-inlay-hints = true + + + [keys.normal.space] + "H" = ":toggle lsp.display-inlay-hints" + diff --git a/pallets/department-funding/src/extras.rs b/pallets/department-funding/src/extras.rs index 77f3732..6c37eb8 100644 --- a/pallets/department-funding/src/extras.rs +++ b/pallets/department-funding/src/extras.rs @@ -119,7 +119,7 @@ impl Pallet { department_required_fund_id: DepartmentRequiredFundId, ) -> Result, DispatchError> { let block_number_option = - >::get(department_required_fund_id); + >::get(department_required_fund_id); let block_number = match block_number_option { Some(block_number) => block_number, None => Err(Error::::BlockDepartmentRequiredFundIdNotExists)?, diff --git a/pallets/department-funding/src/lib.rs b/pallets/department-funding/src/lib.rs index 07f0deb..5f6c65b 100644 --- a/pallets/department-funding/src/lib.rs +++ b/pallets/department-funding/src/lib.rs @@ -123,8 +123,8 @@ pub mod pallet { StorageMap<_, Twox64Concat, DepartmentRequiredFundId, bool, ValueQuery>; #[pallet::storage] - #[pallet::getter(fn validation_department_required_funds_block_number)] - pub type ValidationDepartmentRequiredFundsBlock = + #[pallet::getter(fn validation_block)] + pub type ValidationBlock = StorageMap<_, Blake2_128Concat, DepartmentRequiredFundId, BlockNumberOf>; #[pallet::storage] @@ -245,7 +245,7 @@ pub mod pallet { department_required_fund_id, block_number: now.clone(), }; - ValidationDepartmentRequiredFundsBlock::::insert( + ValidationBlock::::insert( department_required_fund_id, now.clone(), ); diff --git a/pallets/profile-validation/src/extras.rs b/pallets/profile-validation/src/extras.rs index 1f53ee8..f1be13b 100644 --- a/pallets/profile-validation/src/extras.rs +++ b/pallets/profile-validation/src/extras.rs @@ -108,7 +108,7 @@ impl Pallet { pub fn get_evidence_period_end_block(profile_user_account: T::AccountId) -> Option { let now = >::block_number(); - let block_number = >::get(&profile_user_account); + let block_number = >::get(&profile_user_account); let key = SumTreeName::ProfileValidation { citizen_address: profile_user_account.clone(), @@ -125,7 +125,7 @@ impl Pallet { pub fn get_staking_period_end_block(profile_user_account: T::AccountId) -> Option { let now = >::block_number(); - let block_number = >::get(&profile_user_account); + let block_number = >::get(&profile_user_account); let key = SumTreeName::ProfileValidation { citizen_address: profile_user_account.clone(), @@ -141,7 +141,7 @@ impl Pallet { } pub fn get_drawing_period_end(profile_user_account: T::AccountId) -> (u64, u64, bool) { - let block_number = >::get(&profile_user_account); + let block_number = >::get(&profile_user_account); let key = SumTreeName::ProfileValidation { citizen_address: profile_user_account.clone(), @@ -156,7 +156,7 @@ impl Pallet { pub fn get_commit_period_end_block(profile_user_account: T::AccountId) -> Option { let now = >::block_number(); - let block_number = >::get(&profile_user_account); + let block_number = >::get(&profile_user_account); let key = SumTreeName::ProfileValidation { citizen_address: profile_user_account.clone(), @@ -172,7 +172,7 @@ impl Pallet { pub fn get_vote_period_end_block(profile_user_account: T::AccountId) -> Option { let now = >::block_number(); - let block_number = >::get(&profile_user_account); + let block_number = >::get(&profile_user_account); let key = SumTreeName::ProfileValidation { citizen_address: profile_user_account.clone(), @@ -187,7 +187,7 @@ impl Pallet { } pub fn selected_as_juror(profile_user_account: T::AccountId, who: T::AccountId) -> bool { - let block_number = >::get(&profile_user_account); + let block_number = >::get(&profile_user_account); let key = SumTreeName::ProfileValidation { citizen_address: profile_user_account.clone(), diff --git a/pallets/profile-validation/src/lib.rs b/pallets/profile-validation/src/lib.rs index 3c7ef98..1758862 100644 --- a/pallets/profile-validation/src/lib.rs +++ b/pallets/profile-validation/src/lib.rs @@ -171,8 +171,8 @@ pub mod pallet { StorageMap<_, Blake2_128Concat, T::AccountId, BalanceOf, ValueQuery>; #[pallet::storage] - #[pallet::getter(fn profile_validation_blocknumber)] - pub type ProfileValidationBlock = + #[pallet::getter(fn validation_block)] + pub type ValidationBlock = StorageMap<_, Blake2_128Concat, T::AccountId, BlockNumberOf, ValueQuery>; #[pallet::storage] @@ -317,7 +317,7 @@ pub mod pallet { /// /// ## Storage /// - /// - `ProfileValidationBlock`: Stores the block number to be used for the profile's validation when `amount_to_fund` equals `required_fund`. + /// - `ValidationBlock`: Stores the block number to be used for the profile's validation when `amount_to_fund` equals `required_fund`. /// - `ProfileFundDetails`: Stores details of funds deposited by users for a specific profile. /// - `ProfileTotalFundCollected`: Keeps track of the total funds collected for each profile. /// - `RegistrationFee`: Retrieves the registration fee required for profile validation. @@ -371,7 +371,7 @@ pub mod pallet { citizen_address: profile_user_account.clone(), block_number: now.clone(), }; - >::insert(&profile_user_account, now); + >::insert(&profile_user_account, now); // Set a link to the evidence period in the Schelling Game. T::SchellingGameSharedSource::set_to_evidence_period_link(key, now)?; @@ -467,7 +467,7 @@ pub mod pallet { }, } - let block_number = >::get(&profile_user_account); + let block_number = >::get(&profile_user_account); let key = SumTreeName::ProfileValidation { citizen_address: profile_user_account.clone(), @@ -658,7 +658,7 @@ pub mod pallet { ) -> DispatchResult { let _who = ensure_signed(origin)?; - let block_number = >::get(&profile_user_account); + let block_number = >::get(&profile_user_account); let key = SumTreeName::ProfileValidation { citizen_address: profile_user_account.clone(), @@ -697,7 +697,7 @@ pub mod pallet { ) -> DispatchResult { let who = ensure_signed(origin)?; - let block_number = >::get(&profile_user_account); + let block_number = >::get(&profile_user_account); let key = SumTreeName::ProfileValidation { citizen_address: profile_user_account.clone(), @@ -726,7 +726,7 @@ pub mod pallet { iterations: u64, ) -> DispatchResult { let _who = ensure_signed(origin)?; - let block_number = >::get(&profile_user_account); + let block_number = >::get(&profile_user_account); let key = SumTreeName::ProfileValidation { citizen_address: profile_user_account.clone(), @@ -748,7 +748,7 @@ pub mod pallet { profile_user_account: T::AccountId, ) -> DispatchResult { let who = ensure_signed(origin)?; - let block_number = >::get(&profile_user_account); + let block_number = >::get(&profile_user_account); let key = SumTreeName::ProfileValidation { citizen_address: profile_user_account.clone(), @@ -766,7 +766,7 @@ pub mod pallet { vote_commit: [u8; 32], ) -> DispatchResult { let who = ensure_signed(origin)?; - let block_number = >::get(&profile_user_account); + let block_number = >::get(&profile_user_account); let key = SumTreeName::ProfileValidation { citizen_address: profile_user_account.clone(), @@ -785,7 +785,7 @@ pub mod pallet { salt: Vec, ) -> DispatchResult { let who = ensure_signed(origin)?; - let block_number = >::get(&profile_user_account); + let block_number = >::get(&profile_user_account); let key = SumTreeName::ProfileValidation { citizen_address: profile_user_account.clone(), @@ -806,7 +806,7 @@ pub mod pallet { profile_user_account: T::AccountId, ) -> DispatchResult { let who = ensure_signed(origin)?; - let block_number = >::get(&profile_user_account); + let block_number = >::get(&profile_user_account); let key = SumTreeName::ProfileValidation { citizen_address: profile_user_account.clone(), @@ -826,7 +826,7 @@ pub mod pallet { profile_user_account: T::AccountId, ) -> DispatchResult { let who = ensure_signed(origin)?; - let block_number = >::get(&profile_user_account); + let block_number = >::get(&profile_user_account); let key = SumTreeName::ProfileValidation { citizen_address: profile_user_account.clone(), block_number, diff --git a/pallets/project-tips/src/extras.rs b/pallets/project-tips/src/extras.rs index c719e39..bdd0fc9 100644 --- a/pallets/project-tips/src/extras.rs +++ b/pallets/project-tips/src/extras.rs @@ -43,7 +43,7 @@ impl Pallet { } pub fn ensure_staking_period_set_once_project_id(project_id: ProjectId) -> DispatchResult { - let block_number_option = >::get(project_id); + let block_number_option = >::get(project_id); match block_number_option { Some(_block) => Err(Error::::ProjectIdStakingPeriodAlreadySet)?, None => Ok(()), @@ -53,7 +53,7 @@ impl Pallet { pub fn get_block_number_of_schelling_game( project_id: ProjectId, ) -> Result, DispatchError> { - let block_number_option = >::get(project_id); + let block_number_option = >::get(project_id); let block_number = match block_number_option { Some(block_number) => block_number, None => Err(Error::::BlockNumberProjectIdNotExists)?, diff --git a/pallets/project-tips/src/lib.rs b/pallets/project-tips/src/lib.rs index ec1dab4..ad3bd08 100644 --- a/pallets/project-tips/src/lib.rs +++ b/pallets/project-tips/src/lib.rs @@ -116,8 +116,8 @@ pub mod pallet { // StorageMap<_, Twox64Concat, DepartmentId, BalanceOf, ValueQuery>; #[pallet::storage] - #[pallet::getter(fn validation_project_block_number)] - pub type ValidationProjectBlock = + #[pallet::getter(fn validation_block)] + pub type ValidationBlock = StorageMap<_, Blake2_128Concat, ProjectId, BlockNumberOf>; // Pallets use events to inform users when important changes are made. @@ -234,7 +234,7 @@ pub mod pallet { let key = SumTreeName::ProjectTips { project_id, block_number: now.clone() }; - >::insert(project_id, now.clone()); + >::insert(project_id, now.clone()); // check what if called again, its done with `ensure_staking_period_set_once_project_id` T::SchellingGameSharedSource::set_to_staking_period_pe_link(key.clone(), now.clone())?; T::SchellingGameSharedSource::create_tree_helper_link(key, 3)?;