0

Context

I have achieved PoA by setting StakingConfig::force_era to Forcing::ForceNone. This will prevent eras and election to be triggered, so that the validator set will be effectively constant. Polkadot did the same at mainnet launch : https://github.com/paritytech/polkadot/blob/00fed3bc47dcb9cb591bdec1b2b2e703051241ae/node/service/src/chain_spec.rs

In order to switch to NPoS I will issue a pallet_staking::force_new_era(sudo_origin) so that election cycles and era can occur again. The authorities however will continue to accrue era points during the length of the whole era and they would be able to claim them before HISTORY_DEPTH eras have passed.

Question

Did polkadot allowed for PoA authorities to claim their era payouts? If not how did it make sure that authorities could not collect era reward?

thanks in advance

1 Answer 1

1

I believe the PoA period had staking rewards normally. Nonetheless, because no one was nominating, it basically only went into the initial authorities.

If you want to control this, you can easily do it at the top level runtime, by overwriting the RewardCurve type in pallet_staking::Config. For example, the default implementation in substrate's kitchensink-runtime is using pallet_staking::ConvertCurve. This merely takes a pre-generated reward curve and translates it to the appropriate inflation rate.

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

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

You can provide your own implementation that slightly adjusts this for the PoA mode. Recall that at the end of the day, type EraPayout in pallet_staking::Config must be anything that implements trait EraPayout.

pub struct NoInflationIfNoEras;
impl EraPayout<Balance> for NoInflationIfNoEras {
  fn era_payout(
    total_staked: Balance,
    total_issuance: Balance,
    era_duration_millis: u64,
  ) -> (Balance, Balance) {
    if pallet_staking::Forcing::<Runtime>::get() == Forcing::None {
      // PoA mode: no inflation.
      (0, 0)
    } else {
      // proxy to whatever else is the default: 
      <pallet_staking::ConvertCurve as EraPayout<Balance>>::era_payout(
         total_staked,
         total_issuance,
         era_duration_millis,
      )
    }
  }
}

Your Answer

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

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