2

I want to change inflation rate of a substrate based chain, the method for inflation is written in frame/staking/reward-curve and it being initialised in bin/node/runtime/lib.rs

pallet_staking_reward_curve::build! {
    const REWARD_CURVE: PiecewiseLinear<'static> = curve!(
        min_inflation: 0_025_000,
        max_inflation: 0_100_000,
        ideal_stake: 0_500_000,
        falloff: 0_050_000,
        max_piece_count: 40,
        test_precision: 0_005_000,
    );
}

So i changed the min_inflation and max_inflation in runtime/lib.rs but the inflation rate does change. What I want to ask is am I doing something wrong or is it not the right way to change the inflation rate.

1
  • good question bro Aug 9, 2022 at 7:21

1 Answer 1

1

Yes, that's the right way. That's what the pallet wants you to do.

parameter_types! {
    pub const RewardCurve: &'static PiecewiseLinear<'static> = &REWARD_CURVE;
}


impl pallet_staking::Config for Runtime {
    ...
    type EraPayout = pallet_staking::ConvertCurve<RewardCurve>;
}

As you can see, the trait name is Config. So this is a configuration for you.

You may write your pallet in the future. And if you want other people to use the pallet more flexibly. You would also provide some configurations.

5
  • Thats what i thought but when i changed and built it, there was no change at all in inflation. Jul 29, 2022 at 4:53
  • Did you clean the DB or make a runtime upgrade? What chain are you using? Or you should re build-sepc.
    – AurevoirXavier
    Jul 29, 2022 at 7:04
  • 1
    Just build a new substrate chain and run it in development mode with inflation changes but it is not reflecting. Jul 29, 2022 at 7:39
  • May I have your code?
    – AurevoirXavier
    Jul 29, 2022 at 8:05
  • It is a substrate clone just changed the value of min_inflation and max_inflation Jul 29, 2022 at 9:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.