Skip to content

Commit 6e3757b

Browse files
committed
Changes
1 parent 56b1184 commit 6e3757b

File tree

2 files changed

+19
-10
lines changed

2 files changed

+19
-10
lines changed

pallets/inflation/src/lib.rs

+7-5
Original file line numberDiff line numberDiff line change
@@ -636,17 +636,17 @@ pub trait PayoutPerBlock<Imbalance> {
636636
/// `OnRuntimeUpgrade` logic for integrating this pallet into the live network.
637637
#[cfg(feature = "try-runtime")]
638638
use sp_std::vec::Vec;
639-
pub struct PalletInflationInitConfig<T, P>(PhantomData<(T, P)>);
640-
impl<T: Config, P: Get<(InflationParameters, EraNumber)>> OnRuntimeUpgrade
641-
for PalletInflationInitConfig<T, P>
639+
pub struct PalletInflationInitConfig<T, P>(PhantomData<(T, P, W)>);
640+
impl<T: Config, P: Get<(InflationParameters, EraNumber, Weight)>> OnRuntimeUpgrade
641+
for PalletInflationInitConfig<T, P, W>
642642
{
643643
fn on_runtime_upgrade() -> Weight {
644644
if Pallet::<T>::on_chain_storage_version() >= STORAGE_VERSION {
645645
return T::DbWeight::get().reads(1);
646646
}
647647

648648
// 1. Get & set inflation parameters
649-
let (inflation_params, next_era) = P::get();
649+
let (inflation_params, next_era, extra_weight) = P::get();
650650
InflationParams::<T>::put(inflation_params.clone());
651651

652652
// 2. Calculation inflation config, set it & deposit event
@@ -660,7 +660,9 @@ impl<T: Config, P: Get<(InflationParameters, EraNumber)>> OnRuntimeUpgrade
660660

661661
log::info!("Inflation pallet storage initialized.");
662662

663-
T::WeightInfo::recalculation().saturating_add(T::DbWeight::get().reads_writes(1, 2))
663+
T::WeightInfo::recalculation()
664+
.saturating_add(T::DbWeight::get().reads_writes(1, 2))
665+
.saturating_add(extra_weight)
664666
}
665667

666668
#[cfg(feature = "try-runtime")]

runtime/shiden/src/lib.rs

+12-5
Original file line numberDiff line numberDiff line change
@@ -644,7 +644,6 @@ impl pallet_vesting::Config for Runtime {
644644
const MAX_VESTING_SCHEDULES: u32 = 28;
645645
}
646646

647-
// TODO: changing depost per item and per byte to `deposit` function will require storage migration it seems
648647
parameter_types! {
649648
pub const DepositPerItem: Balance = contracts_deposit(1, 0);
650649
pub const DepositPerByte: Balance = contracts_deposit(0, 1);
@@ -1122,7 +1121,7 @@ parameter_types! {
11221121
///
11231122
/// Once done, migrations should be removed from the tuple.
11241123
pub type Migrations = (
1125-
pallet_inflation::PalletInflationInitConfig<Runtime, InitInflationParams>,
1124+
pallet_inflation::PalletInflationInitConfig<Runtime, InitInflationParamsHelper>,
11261125
pallet_dapp_staking_v3::migrations::DAppStakingV3InitConfig<Runtime, InitDappStakingV3Params>,
11271126
frame_support::migrations::RemovePallet<
11281127
BlockRewardName,
@@ -1131,13 +1130,20 @@ pub type Migrations = (
11311130
// This will handle new pallet storage version setting & it will put the new pallet into maintenance mode.
11321131
// But it's most important for testing with try-runtime.
11331132
pallet_dapp_staking_migration::DappStakingMigrationHandler<Runtime>,
1133+
pallet_static_price_provider::InitActivePrice<Runtime, InitActivePriceGet>,
11341134
);
11351135

1136-
// TODO: add static price provider migration too
1136+
pub struct InitActivePriceGet;
1137+
impl Get<FixedU64> for InitActivePriceGet {
1138+
fn get() -> FixedU64 {
1139+
// TODO: set this to the correct value
1140+
FixedU64::from_rational(1, 10)
1141+
}
1142+
}
11371143

11381144
/// Used to initialize inflation parameters for the runtime.
1139-
pub struct InitInflationParams;
1140-
impl Get<(pallet_inflation::InflationParameters, EraNumber)> for InitInflationParams {
1145+
pub struct InitInflationParamsHelper;
1146+
impl Get<(pallet_inflation::InflationParameters, EraNumber)> for InitInflationParamsHelper {
11411147
fn get() -> (pallet_inflation::InflationParameters, EraNumber) {
11421148
(
11431149
pallet_inflation::InflationParameters {
@@ -1152,6 +1158,7 @@ impl Get<(pallet_inflation::InflationParameters, EraNumber)> for InitInflationPa
11521158
ideal_staking_rate: Perquintill::from_percent(50),
11531159
},
11541160
pallet_dapps_staking::CurrentEra::<Runtime>::get().saturating_add(1),
1161+
T::DbWeight::get().reads(1),
11551162
)
11561163
}
11571164
}

0 commit comments

Comments
 (0)