Skip to content

Commit

Permalink
Tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
olegnn committed Jan 22, 2024
1 parent dd139b9 commit dfe8cab
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion pallets/staking-rewards/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ pub mod pallet {

#[pallet::call]
impl<T: Config> Pallet<T> {
/// Enable/disable emission rewards by calling this function with true or false respectively.
/// Enable/disable emission rewards by calling this function true or false respectively.
#[pallet::weight(T::DbWeight::get().writes(1))]
pub fn set_emission_status(
origin: OriginFor<T>,
Expand Down
4 changes: 2 additions & 2 deletions pallets/staking-rewards/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,10 @@ parameter_types! {
pub const SS58Prefix: u8 = 21;
pub const TreasuryRewardsPct: Percent = Percent::from_percent(60);
pub const RewardCurve: &'static PiecewiseLinear<'static> = &REWARD_CURVE;
pub PostUpgradeHighRateDuration: Option<DurationInEras> = None;
pub PostUpgradeHighRateDuration: Option<DurationInEras> = Some(DurationInEras::new_non_zero(10));
}

// For testing, setting `LowRateRewardDecayPct` this way so it can be changed during tests
// For testing, set `LowRateRewardDecayPct` this way so it can be changed during tests
thread_local! {
static LOW_RATE_REWARD_DECAY_PCT: RefCell<Percent> = RefCell::new(Percent::from_percent(10));
static HIGH_RATE_REWARD_DECAY_PCT: RefCell<Percent> = RefCell::new(Percent::from_percent(20));
Expand Down
6 changes: 4 additions & 2 deletions pallets/staking-rewards/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,15 +123,17 @@ impl HighRateRewardsState {
/// HighRateRewardsState::None.inc_duration_or_init(TWO_ERAS), /* => */ HighRateRewardsState::StartingInNextEra { duration: TWO_ERAS }
/// # );
/// ```
pub fn inc_duration_or_init(&mut self, inc_duration: DurationInEras) -> Self {
pub fn inc_duration_or_init(
&mut self,
inc_duration @ DurationInEras(increment): DurationInEras,
) -> Self {
match self {
HighRateRewardsState::StartingInNextEra {
duration: DurationInEras(duration),
}
| HighRateRewardsState::Active {
ends_after: DurationInEras(duration),
} => {
let DurationInEras(increment) = inc_duration;
*duration = duration.saturating_add(increment.get());
}
HighRateRewardsState::None => {
Expand Down

0 comments on commit dfe8cab

Please sign in to comment.