-
Notifications
You must be signed in to change notification settings - Fork 2.6k
babe: support online configuration upgrades #5514
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is a great idea and I like the approach taken here. Some questions though:
- I think currently it is not safe to change epoch length. The runtime module only emits
NextEpochDescriptor
digests which don't contain any epoch length, and from the client-side we always calculate end slot based on duration from current epoch (so basically genesis epoch duration). - I think it should be possible to change epoch length dynamically but it will need some support from runtime module (we also need to think about implications for light client).
epoch_configuration
is added as a runtime API method so should we add some support for this in the runtime module? Currently the runtime doesn't know aboutc
so this could be handled just by reading from chainspec (a hardfork basically).
It will need light client support because any changes in configuration is technically a hard-fork and requires finality to process. As Andre says it's probably not safe to change epoch length or slot time dynamically at the moment. |
Discussed with Rob. I'm going to add the config struct also to
|
Changed this a little bit, and I think I've got a design that I'm satisfied with a) maintains backward compatibility, b) support light clients, and c) extensible:
|
…rate into sp-epoch-config
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changes lgtm but there's a test failure on aux_schema. did you have a chance to test this on kusama? or maybe we can test after merging this and before #5501.
In a follow-up PR we should add a method to the babe pallet, callable by root, that allows signaling a config change. This should queue the change so that the event is sent together with the next epoch descriptor. |
Co-Authored-By: André Silva <123550+andresilva@users.noreply.github.com>
Finished test syncing Kusama in #5501. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm!
This is an attempt to support online configuration upgrades for BABE engine. Still needs to write the migration scripts, but would love to get some reviews.
Currently, BABE's configuration is only read at genesis block. It's then fixed, and cannot be changed. As a result, it's not possible to perform online upgrades, for example, from primary-slots only to primary-and-secondary-slots. This PR tries to fix that, by doing the following:
c
, and whether the engine supports secondary-slots. The encoding of epoch configuration can also be flexibly extended in the future.epoch_configuration
is read, and used as the epoch configuration for the epoch described by the next epoch descriptor. This config is then used by authorship and verification rules.