10

I believe the default era period in substrate-node-template is 24 hours. Is there a way for me to change that period?

1 Answer 1

10

Eras are measured in sessions. The duration of sessions are dependent on the consensus mechanism.

To reduce the number of sessions per era, simply adjust the SessionsPerEra value in the implementation of pallet_staking::Config.

In BABE, the EpochDuration config member is used to set the number of slots (and therefore the amount of time) in a session. This can only be set in the genesis. The actual parameters given to BABE which determine the block time are in the epoch_config field of pallet_babe's GenesisConfig.

To sum up: you have a few variables to play with - the time between blocks, the amount of blocks in a session, and the amount of sessions in an era. By adjusting these, you can adjust the overall time in a staking era.

3
  • 1
    Very insightful. Thank you!
    – Kanishka
    Mar 23, 2022 at 5:10
  • Is it possible to change it by a runtime upgrade?
    – h4x3rotab
    Mar 23, 2022 at 6:28
  • 1
    It's possible to change the sessions per era in a runtime upgrade, but not possible (with BABE) to update the block time or number of slots in a session with a runtime upgrade.
    – rob
    Mar 24, 2022 at 2:19

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.