-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Return babe configuration information in the babe api epoch functions #8072
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 we need to have 3 storage entries:
EpochConfig: BabeEpochConfiguration
- We need to make the module's genesis config (add_extra_genesis
) take this as a parameter.NextEpochConfig: Option<BabeEpochConfiguration>
- This represents the config for epochN+1
which is already set in stone (i.e. it was already previously announced). When implementingfn next_config()
we read from here, if it'sNone
then we return the value fromEpochConfig
since the config for the next epoch is the same as the current one.PendingEpochConfigChange: Option<NextConfigDescriptor>
- This is the currentNextEpochConfig
entry, it should be renamed to this. It represents a pending epoch config change forN+2
, which will be announced once we finish the current epoch (N
) and start the epochN+1
by announcing the config forN+2
.
b2f4332
to
120fc30
Compare
We could also remove |
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.
.
Co-authored-by: André Silva <123550+andresilva@users.noreply.github.com>
frame/babe/src/lib.rs
Outdated
|
||
struct __OldNextEpochConfig; | ||
impl frame_support::traits::StorageInstance for __OldNextEpochConfig { | ||
fn pallet_prefix() -> &'static str { "BabeApi" } |
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.
This is wrong.
Currently this is Babe
and not BabeApi
.
Also this should probably be configurable.
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've made it configurable, but I think it still is BabeApi
. See paritytech/polkadot#2467 (comment).
bot merge |
The PR is currently unmergeable. |
bot merge |
Trying merge. |
…paritytech#8072) * Make changes * Add serialize/deserialize, copy babe epoch config defaults from node runtime * Fix line widths and turn default features off for serde * Remove ser/deser from Epoch, fix node-cli * Apply suggestions * Add comment to BABE_GENESIS_EPOCH_CONFIG in bin * Apply suggestions * Add a sketchy migration function * Add a migration test * Check for PendingEpochConfigChange as well * Make epoch_config in node-cli * Move updating EpochConfig out of the if * Fix executor tests * Calculate weight for add_epoch_configurations * Fix babe test * Apply suggestions from code review Co-authored-by: André Silva <123550+andresilva@users.noreply.github.com> * Add more asserts to tests, remove unused changes to primitives/slots * Allow setting the migration pallet prefix * Rename to BabePalletPrefix Co-authored-by: André Silva <123550+andresilva@users.noreply.github.com>
* Remove VestingAccount * Fix chain specs * Update rust-toolchain * Update make test and benchmark * Update CI * Run `make format` and `make clippy` * Update CI * Quick fix * Support try-runtime * Remove pallet-randomness-collective-flip * Migrate elections-phragmen (paritytech/substrate#7040) * Migrate PalletVersion to StorageVersion (paritytech/substrate#9165) * Migrate pallet-babe epoch config (paritytech/substrate#8072) * Migrate frame-system AccountInfo to AccountInfoWithTripleRefCount (paritytech/substrate#8221) * Migrate prefix `GrandpaFinality` -> `Grandpa` * Migrate prefix `Instance1Collective` -> `Council` * Migrate prefix `Instance2Collective` -> `TechnicalCommittee` * Migrate prefix `Instance1Membership` -> `TechnicalMembership` * Migrate pallet-tips prefix from `Treasury` -> `Tips` * Migrate pallet-bounties prefix from `Treasury` -> `Bounties` * Migrate prefix from `PhragmenElection` -> `Elections` * Revert `dev` spec_name * Confirm migrations order * Use ChainX substrate patch for system migration * Run `make format` * Reset spec_name `dev` -> `chainx` * Add migrations.rs for mainnet and testnet * Bump ChainX version to `4.0.0` * Bump ChainX version to `4.0.0` * Update governance parameters for dev and malan * Update malan chainspec * Quick fix * Quick fix * Update generate_keys.sh * Adjust malan parameters * Update malan chainspec * Update malan chainspec * Update malan chainspec * Rename malan testnet name * Add bootnodes url * Run `make format` * Regenerate weights * Disable pre_release.yml CI * Regenerate benchmark weights * Run `make clippy` * Run `make format` Co-authored-by: icodezjb <icodezjb@users.noreply.github.com>
* Remove VestingAccount * Fix chain specs * Update rust-toolchain * Update make test and benchmark * Update CI * Run `make format` and `make clippy` * Update CI * Quick fix * Support try-runtime * Remove pallet-randomness-collective-flip * Migrate elections-phragmen (paritytech/substrate#7040) * Migrate PalletVersion to StorageVersion (paritytech/substrate#9165) * Migrate pallet-babe epoch config (paritytech/substrate#8072) * Migrate frame-system AccountInfo to AccountInfoWithTripleRefCount (paritytech/substrate#8221) * Migrate prefix `GrandpaFinality` -> `Grandpa` * Migrate prefix `Instance1Collective` -> `Council` * Migrate prefix `Instance2Collective` -> `TechnicalCommittee` * Migrate prefix `Instance1Membership` -> `TechnicalMembership` * Migrate pallet-tips prefix from `Treasury` -> `Tips` * Migrate pallet-bounties prefix from `Treasury` -> `Bounties` * Migrate prefix from `PhragmenElection` -> `Elections` * Revert `dev` spec_name * Confirm migrations order * Use ChainX substrate patch for system migration * Run `make format` * Reset spec_name `dev` -> `chainx` * Add migrations.rs for mainnet and testnet * Bump ChainX version to `4.0.0` * Bump ChainX version to `4.0.0` * Update governance parameters for dev and malan * Update malan chainspec * Quick fix * Quick fix * Update generate_keys.sh * Adjust malan parameters * Update malan chainspec * Update malan chainspec * Update malan chainspec * Rename malan testnet name * Add bootnodes url * Run `make format` * Regenerate weights * Disable pre_release.yml CI * Regenerate benchmark weights * Run `make clippy` * Run `make format` Co-authored-by: icodezjb <icodezjb@users.noreply.github.com>
polkadot companion: paritytech/polkadot#2467
This PR is an attempt to solve #8060. I'm not very familiar with
decl_storage!
, so I need to figure a few things out before I can continue.