From fd89c8827f16d751c3451fc33ac9e7c243a50076 Mon Sep 17 00:00:00 2001 From: Luiz Carvalho Date: Tue, 7 Jan 2025 21:11:51 -0300 Subject: [PATCH] chore: remove fees from curators (#59) Removes fee payments from extrinsics dispatched by curators and sudo keys. --- pallets/governance/src/lib.rs | 18 +++++++++--------- pallets/governance/tests/voting.rs | 4 ++++ pallets/torus0/src/agent.rs | 2 +- 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/pallets/governance/src/lib.rs b/pallets/governance/src/lib.rs index 13bb029..d9808e5 100644 --- a/pallets/governance/src/lib.rs +++ b/pallets/governance/src/lib.rs @@ -162,7 +162,7 @@ pub mod pallet { #[pallet::call] impl Pallet { #[pallet::call_index(0)] - #[pallet::weight((::WeightInfo::add_curator(), DispatchClass::Normal, Pays::Yes))] + #[pallet::weight((::WeightInfo::add_curator(), DispatchClass::Normal, Pays::No))] pub fn add_curator(origin: OriginFor, key: AccountIdOf) -> DispatchResult { if ensure_signed_or_root(origin.clone())?.is_some() { roles::ensure_root_curator::(origin)?; @@ -172,7 +172,7 @@ pub mod pallet { } #[pallet::call_index(1)] - #[pallet::weight((::WeightInfo::remove_curator(), DispatchClass::Normal, Pays::Yes))] + #[pallet::weight((::WeightInfo::remove_curator(), DispatchClass::Normal, Pays::No))] pub fn remove_curator(origin: OriginFor, key: AccountIdOf) -> DispatchResult { if ensure_signed_or_root(origin.clone())?.is_some() { roles::ensure_root_curator::(origin)?; @@ -182,7 +182,7 @@ pub mod pallet { } #[pallet::call_index(2)] - #[pallet::weight((::WeightInfo::add_allocator(), DispatchClass::Normal, Pays::Yes))] + #[pallet::weight((::WeightInfo::add_allocator(), DispatchClass::Normal, Pays::No))] pub fn add_allocator(origin: OriginFor, key: AccountIdOf) -> DispatchResult { if ensure_signed_or_root(origin.clone())?.is_some() { roles::ensure_root_curator::(origin)?; @@ -192,7 +192,7 @@ pub mod pallet { } #[pallet::call_index(3)] - #[pallet::weight((::WeightInfo::remove_allocator(), DispatchClass::Normal, Pays::Yes))] + #[pallet::weight((::WeightInfo::remove_allocator(), DispatchClass::Normal, Pays::No))] pub fn remove_allocator(origin: OriginFor, key: AccountIdOf) -> DispatchResult { if ensure_signed_or_root(origin.clone())?.is_some() { roles::ensure_root_curator::(origin)?; @@ -202,35 +202,35 @@ pub mod pallet { } #[pallet::call_index(4)] - #[pallet::weight((::WeightInfo::add_to_whitelist(), DispatchClass::Normal, Pays::Yes))] + #[pallet::weight((::WeightInfo::add_to_whitelist(), DispatchClass::Normal, Pays::No))] pub fn add_to_whitelist(origin: OriginFor, key: AccountIdOf) -> DispatchResult { roles::ensure_curator::(origin)?; whitelist::add_to_whitelist::(key) } #[pallet::call_index(5)] - #[pallet::weight((::WeightInfo::remove_from_whitelist(), DispatchClass::Normal, Pays::Yes))] + #[pallet::weight((::WeightInfo::remove_from_whitelist(), DispatchClass::Normal, Pays::No))] pub fn remove_from_whitelist(origin: OriginFor, key: AccountIdOf) -> DispatchResult { roles::ensure_curator::(origin)?; whitelist::remove_from_whitelist::(key) } #[pallet::call_index(6)] - #[pallet::weight((::WeightInfo::accept_application(), DispatchClass::Normal, Pays::Yes))] + #[pallet::weight((::WeightInfo::accept_application(), DispatchClass::Normal, Pays::No))] pub fn accept_application(origin: OriginFor, application_id: u32) -> DispatchResult { roles::ensure_curator::(origin)?; application::accept_application::(application_id) } #[pallet::call_index(7)] - #[pallet::weight((::WeightInfo::deny_application(), DispatchClass::Normal, Pays::Yes))] + #[pallet::weight((::WeightInfo::deny_application(), DispatchClass::Normal, Pays::No))] pub fn deny_application(origin: OriginFor, application_id: u32) -> DispatchResult { roles::ensure_curator::(origin)?; application::deny_application::(application_id) } #[pallet::call_index(8)] - #[pallet::weight((::WeightInfo::penalize_agent(), DispatchClass::Normal, Pays::Yes))] + #[pallet::weight((::WeightInfo::penalize_agent(), DispatchClass::Normal, Pays::No))] pub fn penalize_agent( origin: OriginFor, agent_key: AccountIdOf, diff --git a/pallets/governance/tests/voting.rs b/pallets/governance/tests/voting.rs index 171846d..9bfbd93 100644 --- a/pallets/governance/tests/voting.rs +++ b/pallets/governance/tests/voting.rs @@ -1,3 +1,4 @@ +use pallet_emission0::EmissionRecyclingPercentage; use pallet_governance::{ config::GovernanceConfiguration, proposal::{GlobalParamsData, ProposalStatus}, @@ -354,6 +355,7 @@ fn creates_treasury_transfer_proposal_and_transfers() { fn creates_emission_proposal_and_it_runs_after_2_days() { new_test_ext().execute_with(|| { zero_min_burn(); + EmissionRecyclingPercentage::::set(Percent::one()); let default_proposal_expiration: u64 = ::DefaultProposalExpiration::get(); @@ -391,6 +393,7 @@ fn creates_emission_proposal_and_it_runs_after_2_days() { fn creates_emission_proposal_and_it_runs_before_expiration() { new_test_ext().execute_with(|| { zero_min_burn(); + EmissionRecyclingPercentage::::set(Percent::one()); let default_proposal_expiration: u64 = ::DefaultProposalExpiration::get(); @@ -448,6 +451,7 @@ fn creates_emission_proposal_and_it_runs_before_expiration() { fn creates_emission_proposal_and_it_expires() { new_test_ext().execute_with(|| { zero_min_burn(); + EmissionRecyclingPercentage::::set(Percent::one()); let default_proposal_expiration: u64 = ::DefaultProposalExpiration::get(); diff --git a/pallets/torus0/src/agent.rs b/pallets/torus0/src/agent.rs index 26a3a90..d2cd1b2 100644 --- a/pallets/torus0/src/agent.rs +++ b/pallets/torus0/src/agent.rs @@ -107,7 +107,7 @@ pub fn register( name: BoundedVec::truncate_from(name), url: BoundedVec::truncate_from(url), metadata: BoundedVec::truncate_from(metadata), - weight_penalty_factor: Percent::from_percent(100), + weight_penalty_factor: Percent::zero(), registration_block: >::block_number(), fees: Default::default(), },