diff --git a/node/src/chain_spec/crab.rs b/node/src/chain_spec/crab.rs index 05b98d28a..c720844bc 100644 --- a/node/src/chain_spec/crab.rs +++ b/node/src/chain_spec/crab.rs @@ -200,7 +200,7 @@ pub fn genesis_config() -> ChainSpec { darwinia_staking: DarwiniaStakingConfig { now: SystemTime::now().duration_since(UNIX_EPOCH).unwrap().as_millis(), elapsed_time: 0, - max_unstake_ring: 10_000_000 * UNIT, + rate_limit: 20_000_000 * UNIT, collator_count: 6, collators: collators .iter() @@ -304,7 +304,7 @@ fn testnet_genesis( darwinia_staking: DarwiniaStakingConfig { now: SystemTime::now().duration_since(UNIX_EPOCH).unwrap().as_millis(), elapsed_time: 0, - max_unstake_ring: 10_000_000 * UNIT, + rate_limit: 20_000_000 * UNIT, collator_count: collators.len() as _, collators: collators.iter().map(|(a, _)| (a.to_owned(), UNIT)).collect(), }, diff --git a/node/src/chain_spec/darwinia.rs b/node/src/chain_spec/darwinia.rs index 247871b15..b86debe47 100644 --- a/node/src/chain_spec/darwinia.rs +++ b/node/src/chain_spec/darwinia.rs @@ -196,7 +196,7 @@ pub fn genesis_config() -> ChainSpec { darwinia_staking: DarwiniaStakingConfig { now: SystemTime::now().duration_since(UNIX_EPOCH).unwrap().as_millis(), elapsed_time: 0, - max_unstake_ring: 10_000_000 * UNIT, + rate_limit: 20_000_000 * UNIT, collator_count: 5, collators: collators .iter() @@ -302,7 +302,7 @@ fn testnet_genesis( darwinia_staking: DarwiniaStakingConfig { now: SystemTime::now().duration_since(UNIX_EPOCH).unwrap().as_millis(), elapsed_time: 0, - max_unstake_ring: 10_000_000 * UNIT, + rate_limit: 20_000_000 * UNIT, collator_count: collators.len() as _, collators: collators.iter().map(|(a, _)| (a.to_owned(), UNIT)).collect(), }, diff --git a/node/src/chain_spec/pangolin.rs b/node/src/chain_spec/pangolin.rs index 85e151dfb..361b466d5 100644 --- a/node/src/chain_spec/pangolin.rs +++ b/node/src/chain_spec/pangolin.rs @@ -174,7 +174,7 @@ pub fn genesis_config() -> ChainSpec { darwinia_staking: DarwiniaStakingConfig { now: SystemTime::now().duration_since(UNIX_EPOCH).unwrap().as_millis(), elapsed_time: 0, - max_unstake_ring: 10_000_000 * UNIT, + rate_limit: 20_000_000 * UNIT, collator_count: 3, collators: vec![ (array_bytes::hex_n_into_unchecked::<_, _, 20>(C1), UNIT), @@ -292,7 +292,7 @@ fn testnet_genesis( darwinia_staking: DarwiniaStakingConfig { now: SystemTime::now().duration_since(UNIX_EPOCH).unwrap().as_millis(), elapsed_time: 0, - max_unstake_ring: 10_000_000 * UNIT, + rate_limit: 20_000_000 * UNIT, collator_count: collators.len() as _, collators: collators.iter().map(|(a, _)| (a.to_owned(), UNIT)).collect(), }, diff --git a/pallet/staking/src/benchmarking.rs b/pallet/staking/src/benchmarking.rs index 71b7d971d..90d2e1f98 100644 --- a/pallet/staking/src/benchmarking.rs +++ b/pallet/staking/src/benchmarking.rs @@ -159,7 +159,7 @@ mod benchmarks { } #[benchmark] - fn set_max_unstake_ring() { + fn set_rate_limit() { // Worst-case scenario: // // Set max unstake ring successfully. diff --git a/pallet/staking/src/lib.rs b/pallet/staking/src/lib.rs index 90eaf03ad..8c3a872a3 100644 --- a/pallet/staking/src/lib.rs +++ b/pallet/staking/src/lib.rs @@ -166,8 +166,8 @@ pub mod pallet { pub enum Error { /// Exceed maximum deposit count. ExceedMaxDeposits, - /// Exceed maximum unstake amount. - ExceedMaxUnstakeAmount, + /// Exceed rate limit. + ExceedRateLimit, /// Deposit not found. DepositNotFound, /// You are not a staker. @@ -282,19 +282,19 @@ pub mod pallet { #[pallet::getter(fn elapsed_time)] pub type ElapsedTime = StorageValue<_, Moment, ValueQuery>; - /// Max unstake RING limit. + /// Rate limit. /// - /// The maximum RING amount that can be unstaked in a session. + /// The maximum amount of RING that can be staked or unstaked in one session. #[pallet::storage] - #[pallet::getter(fn max_unstake_ring)] - pub type MaxUnstakeRing = StorageValue<_, Balance, ValueQuery>; + #[pallet::getter(fn rate_limit)] + pub type RateLimit = StorageValue<_, Balance, ValueQuery>; - /// Unstake accumulator. + /// Rate limit state. /// - /// Tracks the total RING amount being unstaked in a session. + /// Tracks the rate limit state in a session. #[pallet::storage] - #[pallet::getter(fn accumulate_unstake)] - pub type AccumulateUnstake = StorageValue<_, Balance, ValueQuery>; + #[pallet::getter(fn rate_limit_state)] + pub type RateLimitState = StorageValue<_, RateLimiter, ValueQuery>; #[derive(DefaultNoBound)] #[pallet::genesis_config] @@ -303,8 +303,8 @@ pub mod pallet { pub now: Moment, /// The running time of Darwinia1. pub elapsed_time: Moment, - /// Max unstake RING limit. - pub max_unstake_ring: Balance, + /// Rate limit. + pub rate_limit: Balance, /// Genesis collator count. pub collator_count: u32, /// Genesis collator preferences. @@ -320,7 +320,7 @@ pub mod pallet { >::put(self.now); >::put(self.elapsed_time); - >::put(self.max_unstake_ring); + >::put(self.rate_limit); >::put(self.collator_count); self.collators.iter().for_each(|(who, ring_amount)| { @@ -376,7 +376,7 @@ pub mod pallet { return Ok(()); } - >::try_mutate(&who, |l| { + let flow_in_amount = >::try_mutate(&who, |l| { let l = if let Some(l) = l { l } else { @@ -386,18 +386,29 @@ pub mod pallet { l.as_mut().expect("[pallet::staking] `l` must be some; qed") }; + let mut v = ring_amount; if ring_amount != 0 { Self::stake_ring(&who, &mut l.ring, ring_amount)?; } for d in deposits.clone() { + v = v.saturating_add(T::Deposit::amount(&who, d).unwrap_or_default()); + Self::stake_deposit(&who, l, d)?; } - DispatchResult::Ok(()) + >::Ok(v) })?; + if let Some(r) = + >::get().flow_in(flow_in_amount, >::get()) + { + >::put(r); + } else { + Err(>::ExceedRateLimit)?; + } + Self::deposit_event(Event::Staked { who, ring_amount, deposits }); Ok(()) @@ -417,10 +428,9 @@ pub mod pallet { return Ok(()); } - let mut acc = >::get().saturating_add(ring_amount); - - >::try_mutate(&who, |l| { + let flow_out_amount = >::try_mutate(&who, |l| { let l = l.as_mut().ok_or(>::NotStaker)?; + let mut v = ring_amount; if ring_amount != 0 { l.ring = l @@ -432,7 +442,7 @@ pub mod pallet { } for d in deposits { - acc = acc.saturating_add(T::Deposit::amount(&who, d).unwrap_or_default()); + v = v.saturating_add(T::Deposit::amount(&who, d).unwrap_or_default()); l.deposits.remove( l.deposits @@ -444,13 +454,15 @@ pub mod pallet { T::Deposit::unstake(&who, d)?; } - DispatchResult::Ok(()) + >::Ok(v) })?; - if acc <= >::get() { - >::put(acc); + if let Some(r) = + >::get().flow_out(flow_out_amount, >::get()) + { + >::put(r); } else { - Err(>::ExceedMaxUnstakeAmount)?; + Err(>::ExceedRateLimit)?; } Self::try_clean_ledger_of(&who); @@ -522,11 +534,11 @@ pub mod pallet { /// Set max unstake RING limit. #[pallet::call_index(9)] - #[pallet::weight(::WeightInfo::set_max_unstake_ring())] - pub fn set_max_unstake_ring(origin: OriginFor, amount: Balance) -> DispatchResult { + #[pallet::weight(::WeightInfo::set_rate_limit())] + pub fn set_rate_limit(origin: OriginFor, amount: Balance) -> DispatchResult { ensure_root(origin)?; - >::put(amount); + >::put(amount); Ok(()) } @@ -676,6 +688,7 @@ pub mod pallet { /// Prepare the session state. pub fn prepare_new_session(index: u32) -> Option> { + >::kill(); >::shift_exposure_cache_states(); #[allow(deprecated)] @@ -810,6 +823,57 @@ where } } +/// Staking rate limiter. +#[derive(Clone, Debug, PartialEq, Encode, Decode, MaxEncodedLen, TypeInfo)] +pub enum RateLimiter { + /// Positive balance. + Pos(Balance), + /// Negative balance. + Neg(Balance), +} +impl RateLimiter { + fn flow_in(self, amount: Balance, limit: Balance) -> Option { + match self { + Self::Pos(v) => v.checked_add(amount).filter(|&v| v <= limit).map(Self::Pos), + Self::Neg(v) => + if v >= amount { + Some(Self::Neg(v - amount)) + } else { + let v = amount - v; + + if v <= limit { + Some(Self::Pos(v)) + } else { + None + } + }, + } + } + + fn flow_out(self, amount: Balance, limit: Balance) -> Option { + match self { + Self::Pos(v) => + if v >= amount { + Some(Self::Pos(v - amount)) + } else { + let v = amount - v; + + if v <= limit { + Some(Self::Neg(v)) + } else { + None + } + }, + Self::Neg(v) => v.checked_add(amount).filter(|&new_v| new_v <= limit).map(Self::Neg), + } + } +} +impl Default for RateLimiter { + fn default() -> Self { + Self::Pos(0) + } +} + /// Exposure cache's state. #[allow(missing_docs)] #[cfg_attr(any(test, feature = "runtime-benchmarks", feature = "try-runtime"), derive(PartialEq))] diff --git a/pallet/staking/src/migration/v2.rs b/pallet/staking/src/migration/v2.rs index 863a377e2..bf2e34201 100644 --- a/pallet/staking/src/migration/v2.rs +++ b/pallet/staking/src/migration/v2.rs @@ -83,7 +83,7 @@ where >::kill(); >::kill(); >::kill(); - >::put(10_000_000 * UNIT); + >::put(10_000_000 * UNIT); >::translate::, _>(|a, o| { w += 6; diff --git a/pallet/staking/src/mock.rs b/pallet/staking/src/mock.rs index 2ab28137f..2891070f8 100644 --- a/pallet/staking/src/mock.rs +++ b/pallet/staking/src/mock.rs @@ -368,7 +368,7 @@ impl ExtBuilder { .assimilate_storage(&mut storage) .unwrap(); darwinia_staking::GenesisConfig:: { - max_unstake_ring: 100 * UNIT, + rate_limit: 100 * UNIT, collator_count: self.collator_count, collators: if self.genesis_collator { (1..=self.collator_count).map(|i| (i, UNIT)).collect() diff --git a/pallet/staking/src/tests.rs b/pallet/staking/src/tests.rs index 6769fd3ab..d6a4f6f7b 100644 --- a/pallet/staking/src/tests.rs +++ b/pallet/staking/src/tests.rs @@ -20,7 +20,7 @@ use core::time::Duration; // darwinia use crate::{mock::*, *}; -use darwinia_deposit::{Deposit as DepositS, Error as DepositError}; +use darwinia_deposit::Error as DepositError; use dc_types::UNIT; // substrate use frame_support::{assert_noop, assert_ok, BoundedVec}; @@ -118,6 +118,7 @@ fn stake_should_work() { assert_eq!(System::account(1).consumers, 0); assert!(Staking::ledger_of(1).is_none()); assert_eq!(Balances::free_balance(1), 1_000 * UNIT); + assert_eq!(Staking::rate_limit_state(), RateLimiter::Pos(0)); // Stake 1 RING. assert_ok!(Staking::stake(RuntimeOrigin::signed(1), UNIT, Vec::new())); @@ -127,6 +128,7 @@ fn stake_should_work() { Ledger { ring: UNIT, deposits: Default::default() } ); assert_eq!(Balances::free_balance(1), 999 * UNIT); + assert_eq!(Staking::rate_limit_state(), RateLimiter::Pos(UNIT)); // Stake invalid deposit. assert_noop!( @@ -142,17 +144,19 @@ fn stake_should_work() { Staking::ledger_of(1).unwrap(), Ledger { ring: UNIT, deposits: BoundedVec::truncate_from(vec![0]) } ); + assert_eq!(Staking::rate_limit_state(), RateLimiter::Pos(2 * UNIT)); - // Stake 500 RING and 2 deposits. + // Stake 2 RING and 2 deposits. assert_eq!(System::account(1).consumers, 2); - assert_ok!(Deposit::lock(RuntimeOrigin::signed(1), 200 * UNIT, 1)); - assert_ok!(Deposit::lock(RuntimeOrigin::signed(1), 200 * UNIT, 1)); - assert_ok!(Staking::stake(RuntimeOrigin::signed(1), 500 * UNIT, vec![1, 2])); - assert_eq!(Balances::free_balance(1), 98 * UNIT); + assert_ok!(Deposit::lock(RuntimeOrigin::signed(1), UNIT, 1)); + assert_ok!(Deposit::lock(RuntimeOrigin::signed(1), UNIT, 1)); + assert_ok!(Staking::stake(RuntimeOrigin::signed(1), 2 * UNIT, vec![1, 2])); + assert_eq!(Balances::free_balance(1), 994 * UNIT); assert_eq!( Staking::ledger_of(1).unwrap(), - Ledger { ring: 501 * UNIT, deposits: BoundedVec::truncate_from(vec![0, 1, 2]) } + Ledger { ring: 3 * UNIT, deposits: BoundedVec::truncate_from(vec![0, 1, 2]) } ); + assert_eq!(Staking::rate_limit_state(), RateLimiter::Pos(6 * UNIT)); }); } @@ -164,42 +168,19 @@ fn unstake_should_work() { assert_ok!(Deposit::lock(RuntimeOrigin::signed(1), UNIT, 1)); assert_ok!(Staking::stake(RuntimeOrigin::signed(1), 3 * UNIT, vec![0, 1, 2])); assert_eq!(Balances::free_balance(1), 994 * UNIT); + assert_eq!(Staking::rate_limit_state(), RateLimiter::Pos(6 * UNIT)); assert_eq!( Staking::ledger_of(1).unwrap(), Ledger { ring: 3 * UNIT, deposits: BoundedVec::truncate_from(vec![0, 1, 2]) } ); assert_eq!( - Deposit::deposit_of(1).unwrap(), - ::MaxDeposits>>::truncate_from( - vec![ - DepositS { - id: 0, - value: UNIT, - start_time: 3, - expired_time: 2635200003, - in_use: true - }, - DepositS { - id: 1, - value: UNIT, - start_time: 3, - expired_time: 2635200003, - in_use: true - }, - DepositS { - id: 2, - value: UNIT, - start_time: 3, - expired_time: 2635200003, - in_use: true - } - ] - ) + Deposit::deposit_of(1).unwrap().into_iter().map(|d| d.in_use).collect::>(), + [true, true, true] ); // Unstake 1 RING. assert_ok!(Staking::unstake(RuntimeOrigin::signed(1), UNIT, Vec::new())); - assert_eq!(Staking::accumulate_unstake(), UNIT); + assert_eq!(Staking::rate_limit_state(), RateLimiter::Pos(5 * UNIT)); assert_eq!(Balances::free_balance(1), 995 * UNIT); assert_eq!( Staking::ledger_of(1).unwrap(), @@ -215,94 +196,49 @@ fn unstake_should_work() { // Unstake 1 deposit. Efflux::block(1); assert_ok!(Staking::unstake(RuntimeOrigin::signed(1), 0, vec![1])); - assert_eq!(Staking::accumulate_unstake(), 2 * UNIT); + assert_eq!(Staking::rate_limit_state(), RateLimiter::Pos(4 * UNIT)); assert_eq!( Staking::ledger_of(1).unwrap(), Ledger { ring: 2 * UNIT, deposits: BoundedVec::truncate_from(vec![0, 2]) } ); assert_eq!( - Deposit::deposit_of(1).unwrap(), - ::MaxDeposits>>::truncate_from( - vec![ - DepositS { - id: 0, - value: UNIT, - start_time: 3, - expired_time: 2635200003, - in_use: true - }, - DepositS { - id: 1, - value: UNIT, - start_time: 3, - expired_time: 2635200003, - in_use: false - }, - DepositS { - id: 2, - value: UNIT, - start_time: 3, - expired_time: 2635200003, - in_use: true - } - ] - ) + Deposit::deposit_of(1).unwrap().into_iter().map(|d| d.in_use).collect::>(), + [true, false, true] ); // Unstake 2 RING and 2 deposits. Efflux::block(1); assert_ok!(Staking::unstake(RuntimeOrigin::signed(1), 2 * UNIT, vec![0, 2])); - assert_eq!(Staking::accumulate_unstake(), 6 * UNIT); + assert_eq!(Staking::rate_limit_state(), RateLimiter::Pos(0)); assert!(Staking::ledger_of(1).is_none()); assert_eq!( - Deposit::deposit_of(1).unwrap(), - ::MaxDeposits>>::truncate_from( - vec![ - DepositS { - id: 0, - value: UNIT, - start_time: 3, - expired_time: 2635200003, - in_use: false - }, - DepositS { - id: 1, - value: UNIT, - start_time: 3, - expired_time: 2635200003, - in_use: false - }, - DepositS { - id: 2, - value: UNIT, - start_time: 3, - expired_time: 2635200003, - in_use: false - } - ] - ) + Deposit::deposit_of(1).unwrap().into_iter().map(|d| d.in_use).collect::>(), + [false, false, false] ); // Prepare rate limit test data. - assert_ok!(Deposit::lock(RuntimeOrigin::signed(1), 94 * UNIT + 1, 1)); - assert_ok!(Staking::stake(RuntimeOrigin::signed(1), 94 * UNIT + 1, vec![3])); + assert_ok!(Deposit::lock(RuntimeOrigin::signed(1), 100 * UNIT + 1, 1)); + >::put(200 * UNIT + 2); + assert_ok!(Staking::stake(RuntimeOrigin::signed(1), 100 * UNIT + 1, vec![3])); + >::put(100 * UNIT); + >::kill(); - // Unstake 94 UNIT + 1. + // Unstake 100 UNIT + 1. assert_noop!( - Staking::unstake(RuntimeOrigin::signed(1), 94 * UNIT + 1, Vec::new()), - >::ExceedMaxUnstakeAmount + Staking::unstake(RuntimeOrigin::signed(1), 100 * UNIT + 1, Vec::new()), + >::ExceedRateLimit ); - // Unstake 94 UNIT + 1. + // Unstake 100 UNIT + 1. assert_noop!( Staking::unstake(RuntimeOrigin::signed(1), 0, vec![3]), - >::ExceedMaxUnstakeAmount + >::ExceedRateLimit ); - // Unstake RING(94 UNIT + 1) and deposit(94 UNIT + 1). + // Unstake RING(100 UNIT + 1) and deposit(100 UNIT + 1). assert_noop!( - Staking::unstake(RuntimeOrigin::signed(1), 94 * UNIT + 1, vec![3]), - >::ExceedMaxUnstakeAmount + Staking::unstake(RuntimeOrigin::signed(1), 100 * UNIT + 1, vec![3]), + >::ExceedRateLimit ); }); } @@ -699,3 +635,45 @@ fn on_new_session_should_work() { ); }); } + +#[test] +fn rate_limiter_should_work() { + let r = RateLimiter::default(); + let r = r.flow_in(UNIT, 3 * UNIT).unwrap(); + + assert_eq!(r, RateLimiter::Pos(UNIT)); + + let r = r.flow_in(2 * UNIT, 3 * UNIT).unwrap(); + + assert_eq!(r, RateLimiter::Pos(3 * UNIT)); + assert!(r.clone().flow_in(1, 3 * UNIT).is_none()); + + let r = r.flow_out(UNIT, 3 * UNIT).unwrap(); + + assert_eq!(r, RateLimiter::Pos(2 * UNIT)); + + let r = r.flow_out(2 * UNIT, 3 * UNIT).unwrap(); + + assert_eq!(r, RateLimiter::Pos(0)); + + let r = r.flow_out(UNIT, 3 * UNIT).unwrap(); + + assert_eq!(r, RateLimiter::Neg(UNIT)); + + let r = r.flow_out(2 * UNIT, 3 * UNIT).unwrap(); + + assert_eq!(r, RateLimiter::Neg(3 * UNIT)); + assert!(r.clone().flow_out(1, 3 * UNIT).is_none()); + + let r = r.flow_in(UNIT, 3 * UNIT).unwrap(); + + assert_eq!(r, RateLimiter::Neg(2 * UNIT)); + + let r = r.flow_in(2 * UNIT, 3 * UNIT).unwrap(); + + assert_eq!(r, RateLimiter::Neg(0)); + + let r = r.flow_in(UNIT, 3 * UNIT).unwrap(); + + assert_eq!(r, RateLimiter::Pos(UNIT)); +} diff --git a/pallet/staking/src/weights.rs b/pallet/staking/src/weights.rs index 51dc53194..da3e8102b 100644 --- a/pallet/staking/src/weights.rs +++ b/pallet/staking/src/weights.rs @@ -58,7 +58,7 @@ pub trait WeightInfo { fn nominate() -> Weight; fn chill() -> Weight; fn payout() -> Weight; - fn set_max_unstake_ring() -> Weight; + fn set_rate_limit() -> Weight; fn set_collator_count() -> Weight; } @@ -172,7 +172,7 @@ impl WeightInfo for SubstrateWeight { .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } - fn set_max_unstake_ring() -> Weight { + fn set_rate_limit() -> Weight { Default::default() } /// Storage: `DarwiniaStaking::CollatorCount` (r:0 w:1) @@ -297,7 +297,7 @@ impl WeightInfo for () { .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } - fn set_max_unstake_ring() -> Weight { + fn set_rate_limit() -> Weight { Default::default() } /// Storage: `DarwiniaStaking::CollatorCount` (r:0 w:1) diff --git a/precompile/staking/src/mock.rs b/precompile/staking/src/mock.rs index 0b492f7b7..e9855f3e0 100644 --- a/precompile/staking/src/mock.rs +++ b/precompile/staking/src/mock.rs @@ -275,7 +275,7 @@ impl ExtBuilder { .assimilate_storage(&mut storage) .unwrap(); darwinia_staking::GenesisConfig:: { - max_unstake_ring: 500, + rate_limit: 500, collator_count: 1, ..Default::default() } diff --git a/runtime/crab/src/weights/darwinia_staking.rs b/runtime/crab/src/weights/darwinia_staking.rs index cfd61b156..a5a4babcd 100644 --- a/runtime/crab/src/weights/darwinia_staking.rs +++ b/runtime/crab/src/weights/darwinia_staking.rs @@ -168,7 +168,7 @@ impl darwinia_staking::WeightInfo for WeightInfo { .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(2)) } - fn set_max_unstake_ring() -> Weight { + fn set_rate_limit() -> Weight { Default::default() } /// Storage: `DarwiniaStaking::CollatorCount` (r:0 w:1) diff --git a/runtime/darwinia/src/weights/darwinia_staking.rs b/runtime/darwinia/src/weights/darwinia_staking.rs index 412514971..f1b33afb0 100644 --- a/runtime/darwinia/src/weights/darwinia_staking.rs +++ b/runtime/darwinia/src/weights/darwinia_staking.rs @@ -168,7 +168,7 @@ impl darwinia_staking::WeightInfo for WeightInfo { .saturating_add(T::DbWeight::get().reads(35)) .saturating_add(T::DbWeight::get().writes(2)) } - fn set_max_unstake_ring() -> Weight { + fn set_rate_limit() -> Weight { Default::default() } /// Storage: `DarwiniaStaking::CollatorCount` (r:0 w:1) diff --git a/runtime/pangolin/src/weights/darwinia_staking.rs b/runtime/pangolin/src/weights/darwinia_staking.rs index cf8708ca7..4098e3c0c 100644 --- a/runtime/pangolin/src/weights/darwinia_staking.rs +++ b/runtime/pangolin/src/weights/darwinia_staking.rs @@ -168,7 +168,7 @@ impl darwinia_staking::WeightInfo for WeightInfo { .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(2)) } - fn set_max_unstake_ring() -> Weight { + fn set_rate_limit() -> Weight { Default::default() } /// Storage: `DarwiniaStaking::CollatorCount` (r:0 w:1)