Skip to content

Commit

Permalink
chore: remove fees from curators (#59)
Browse files Browse the repository at this point in the history
Removes fee payments from extrinsics dispatched by curators and sudo
keys.
  • Loading branch information
saiintbrisson authored Jan 8, 2025
1 parent 0a1cc74 commit fd89c88
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 10 deletions.
18 changes: 9 additions & 9 deletions pallets/governance/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ pub mod pallet {
#[pallet::call]
impl<T: Config> Pallet<T> {
#[pallet::call_index(0)]
#[pallet::weight((<T as Config>::WeightInfo::add_curator(), DispatchClass::Normal, Pays::Yes))]
#[pallet::weight((<T as Config>::WeightInfo::add_curator(), DispatchClass::Normal, Pays::No))]
pub fn add_curator(origin: OriginFor<T>, key: AccountIdOf<T>) -> DispatchResult {
if ensure_signed_or_root(origin.clone())?.is_some() {
roles::ensure_root_curator::<T>(origin)?;
Expand All @@ -172,7 +172,7 @@ pub mod pallet {
}

#[pallet::call_index(1)]
#[pallet::weight((<T as Config>::WeightInfo::remove_curator(), DispatchClass::Normal, Pays::Yes))]
#[pallet::weight((<T as Config>::WeightInfo::remove_curator(), DispatchClass::Normal, Pays::No))]
pub fn remove_curator(origin: OriginFor<T>, key: AccountIdOf<T>) -> DispatchResult {
if ensure_signed_or_root(origin.clone())?.is_some() {
roles::ensure_root_curator::<T>(origin)?;
Expand All @@ -182,7 +182,7 @@ pub mod pallet {
}

#[pallet::call_index(2)]
#[pallet::weight((<T as Config>::WeightInfo::add_allocator(), DispatchClass::Normal, Pays::Yes))]
#[pallet::weight((<T as Config>::WeightInfo::add_allocator(), DispatchClass::Normal, Pays::No))]
pub fn add_allocator(origin: OriginFor<T>, key: AccountIdOf<T>) -> DispatchResult {
if ensure_signed_or_root(origin.clone())?.is_some() {
roles::ensure_root_curator::<T>(origin)?;
Expand All @@ -192,7 +192,7 @@ pub mod pallet {
}

#[pallet::call_index(3)]
#[pallet::weight((<T as Config>::WeightInfo::remove_allocator(), DispatchClass::Normal, Pays::Yes))]
#[pallet::weight((<T as Config>::WeightInfo::remove_allocator(), DispatchClass::Normal, Pays::No))]
pub fn remove_allocator(origin: OriginFor<T>, key: AccountIdOf<T>) -> DispatchResult {
if ensure_signed_or_root(origin.clone())?.is_some() {
roles::ensure_root_curator::<T>(origin)?;
Expand All @@ -202,35 +202,35 @@ pub mod pallet {
}

#[pallet::call_index(4)]
#[pallet::weight((<T as Config>::WeightInfo::add_to_whitelist(), DispatchClass::Normal, Pays::Yes))]
#[pallet::weight((<T as Config>::WeightInfo::add_to_whitelist(), DispatchClass::Normal, Pays::No))]
pub fn add_to_whitelist(origin: OriginFor<T>, key: AccountIdOf<T>) -> DispatchResult {
roles::ensure_curator::<T>(origin)?;
whitelist::add_to_whitelist::<T>(key)
}

#[pallet::call_index(5)]
#[pallet::weight((<T as Config>::WeightInfo::remove_from_whitelist(), DispatchClass::Normal, Pays::Yes))]
#[pallet::weight((<T as Config>::WeightInfo::remove_from_whitelist(), DispatchClass::Normal, Pays::No))]
pub fn remove_from_whitelist(origin: OriginFor<T>, key: AccountIdOf<T>) -> DispatchResult {
roles::ensure_curator::<T>(origin)?;
whitelist::remove_from_whitelist::<T>(key)
}

#[pallet::call_index(6)]
#[pallet::weight((<T as Config>::WeightInfo::accept_application(), DispatchClass::Normal, Pays::Yes))]
#[pallet::weight((<T as Config>::WeightInfo::accept_application(), DispatchClass::Normal, Pays::No))]
pub fn accept_application(origin: OriginFor<T>, application_id: u32) -> DispatchResult {
roles::ensure_curator::<T>(origin)?;
application::accept_application::<T>(application_id)
}

#[pallet::call_index(7)]
#[pallet::weight((<T as Config>::WeightInfo::deny_application(), DispatchClass::Normal, Pays::Yes))]
#[pallet::weight((<T as Config>::WeightInfo::deny_application(), DispatchClass::Normal, Pays::No))]
pub fn deny_application(origin: OriginFor<T>, application_id: u32) -> DispatchResult {
roles::ensure_curator::<T>(origin)?;
application::deny_application::<T>(application_id)
}

#[pallet::call_index(8)]
#[pallet::weight((<T as Config>::WeightInfo::penalize_agent(), DispatchClass::Normal, Pays::Yes))]
#[pallet::weight((<T as Config>::WeightInfo::penalize_agent(), DispatchClass::Normal, Pays::No))]
pub fn penalize_agent(
origin: OriginFor<T>,
agent_key: AccountIdOf<T>,
Expand Down
4 changes: 4 additions & 0 deletions pallets/governance/tests/voting.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use pallet_emission0::EmissionRecyclingPercentage;
use pallet_governance::{
config::GovernanceConfiguration,
proposal::{GlobalParamsData, ProposalStatus},
Expand Down Expand Up @@ -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::<Test>::set(Percent::one());

let default_proposal_expiration: u64 =
<Test as pallet_governance::Config>::DefaultProposalExpiration::get();
Expand Down Expand Up @@ -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::<Test>::set(Percent::one());

let default_proposal_expiration: u64 =
<Test as pallet_governance::Config>::DefaultProposalExpiration::get();
Expand Down Expand Up @@ -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::<Test>::set(Percent::one());

let default_proposal_expiration: u64 =
<Test as pallet_governance::Config>::DefaultProposalExpiration::get();
Expand Down
2 changes: 1 addition & 1 deletion pallets/torus0/src/agent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ pub fn register<T: crate::Config>(
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: <polkadot_sdk::frame_system::Pallet<T>>::block_number(),
fees: Default::default(),
},
Expand Down

0 comments on commit fd89c88

Please sign in to comment.