Skip to content

Commit

Permalink
Corrections
Browse files Browse the repository at this point in the history
  • Loading branch information
olegnn committed Jan 22, 2024
1 parent ad1f933 commit 50a39d1
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 22 deletions.
17 changes: 5 additions & 12 deletions pallets/core/src/modules/accumulator/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ use crate::{
pub use actions::*;
use codec::{Decode, Encode, MaxEncodedLen};
use frame_support::{
traits::Get,
dispatch::{DispatchResult, Weight},
ensure, storage_alias,
traits::Get,
};
use sp_std::{fmt::Debug, prelude::*};
use utils::CheckedDivCeil;
Expand Down Expand Up @@ -275,13 +275,8 @@ mod migration {
use frame_support::pallet_prelude::*;

#[storage_alias]
pub type AccumulatorOwnerCounters<T: Config> = StorageMap<
Pallet<T>,
Blake2_128Concat,
Did,
StoredAccumulatorOwnerCounters,
ValueQuery,
>;
pub type AccumulatorOwnerCounters<T: Config> =
StorageMap<Pallet<T>, Blake2_128Concat, Did, StoredAccumulatorOwnerCounters, ValueQuery>;

#[storage_alias]
pub type AccumulatorParams<T: Config> = StorageDoubleMap<
Expand Down Expand Up @@ -320,9 +315,7 @@ mod migration {

let params: Vec<_> = {
AccumulatorParams::<T>::drain()
.map(|(did, id, params): (Did, _, _)| {
(AccumulatorOwner(did.into()), id, params)
})
.map(|(did, id, params): (Did, _, _)| (AccumulatorOwner(did.into()), id, params))
.collect()
};

Expand All @@ -345,7 +338,7 @@ mod migration {
}

T::DbWeight::get().reads_writes(reads_writes, reads_writes)
}
}
}

impl<T: Config> SubstrateWeight<T> {
Expand Down
2 changes: 1 addition & 1 deletion pallets/staking-rewards/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ 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> = Some(DurationInEras::new_non_zero(10));
pub PostUpgradeHighRateDuration: Option<DurationInEras> = None;
}

// For testing, setting `LowRateRewardDecayPct` this way so it can be changed during tests
Expand Down
10 changes: 1 addition & 9 deletions runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1650,20 +1650,12 @@ pallet_staking_reward_curve::build! {
);
}

/// Pay high-rate rewards for 3 months (in eras) after the upgrade.
const POST_UPGRADE_HIGH_RATE_DURATION: DurationInEras =
DurationInEras::new_non_zero((90 * DAY / EPOCH_DURATION_IN_BLOCKS / SESSIONS_PER_ERA) as u16);

#[cfg(not(feature = "small_durations"))]
// 1 era lasts for 12h.
const_assert_eq!(POST_UPGRADE_HIGH_RATE_DURATION.0.get(), 90 * 2);

parameter_types! {
pub const RewardCurve: &'static PiecewiseLinear<'static> = &REWARD_CURVE;
pub const HighRateRewardDecayPct: Percent = Percent::from_percent(50);
pub const LowRateRewardDecayPct: Percent = Percent::from_percent(25);
pub const TreasuryRewardsPct: Percent = Percent::from_percent(50);
pub const PostUpgradeHighRateDuration: Option<DurationInEras> = Some(POST_UPGRADE_HIGH_RATE_DURATION);
pub const PostUpgradeHighRateDuration: Option<DurationInEras> = None;
}

impl dock_staking_rewards::Config for Runtime {
Expand Down

0 comments on commit 50a39d1

Please sign in to comment.