Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

pallet-aura: Allow multiple blocks per slot #14024

Merged

Conversation

rphmeier
Copy link
Contributor

@rphmeier rphmeier commented Apr 26, 2023

This amends pallet-aura to optionally allow sequential blocks to be authored within the same slot. This is being done for paritytech/cumulus#2476 , as we often need to create a 'backlog' of blocks to post to the relay chain, and therefore can temporarily require block production to speed up.

This will also be useful for further roadmap items like elastic scaling and parallel block production, where chains need to make multiple blocks per slot for longer periods of time as well.

Update Guide

Set the new AllowMultipleBlocksPerSlot to false to maintain current behavior. Setting this value to true will be necessary for parachains looking to enable asynchronous backing later on, but this will require other changes alongside.

Example:

impl pallet_aura::Config for Runtime {
  // .. snip
  type AllowMultipleBlocksPerSlot = ConstBool<false>;
}

cumulus companion: paritytech/cumulus#2707

@rphmeier rphmeier added A0-please_review Pull request needs code review. C1-low PR touches the given topic and has a low impact on builders. D5-nicetohaveaudit ⚠️ PR contains trivial changes to logic that should be properly reviewed. B1-note_worthy Changes should be noted in the release notes labels Apr 26, 2023
@rphmeier rphmeier added the T1-runtime This PR/Issue is related to the topic “runtime”. label Apr 26, 2023
@xlc
Copy link
Contributor

xlc commented Apr 26, 2023

Config associated types require a full runtime upgrade

But a full runtime upgrade is required anyway?

The main point between storage vs config is that if we have the needs to toggle this value by governance without runtime upgrade. I can't think much use cases for now.

@bkchr
Copy link
Member

bkchr commented Apr 26, 2023

The main point between storage vs config is that if we have the needs to toggle this value by governance without runtime upgrade.

Another point is also that a config type is that we don't need to read the storage for checking the value and reading the storage is "expensive". Especially for something probably never changes that often. So, please make this a config type.

@rphmeier
Copy link
Contributor Author

rphmeier commented Apr 27, 2023

But a full runtime upgrade is required anyway?

The main point between storage vs config is that if we have the needs to toggle this value by governance without runtime upgrade. I can't think much use cases for now.

What I mean is that we can ship this in Substrate master now without worrying about breaking downstream users' runtimes or behaviors, and then those parachains' governance systems can change the storage item when enabling asynchronous backing.

One of the concerns I hear the most is about breaking changes where alterations to Substrate master cause compiler errors in users' runtimes they have to fix. I am trying to avoid that but getting mixed signals now.

Three options:

  • introduce breaking changes now and also later, when Cumulus' parachain-system pallet gets upgraded for asynchronous backing (latter seems unavoidable)
  • avoid breaking changes now but have them later, when ...
  • introduce a breaking change in this PR but don't merge that into Substrate master yet and do all the breaking changes at once.

@bkchr
Copy link
Member

bkchr commented Apr 27, 2023

One of the concerns I hear the most is about breaking changes where alterations to Substrate master cause compiler errors in users' runtimes they have to fix. I am trying to avoid that but getting mixed signals now.

I mean that is a fine consideration, but we are doing much more crazy breaking changes. If you write a proper explanation in your pr description on what people should do, it will be a no brainer for them to upgrade. The explanation is also rather trivial.

@bkchr
Copy link
Member

bkchr commented Apr 27, 2023

You can also do a feature branch, if you feel better with this. I don't care, but the current storage value is a no go.

Copy link
Member

@davxy davxy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Codewise obviously LGTM.

About the Config vs Storage. Frankly I would go with the Config as well and introduce the breaking change

frame/aura/src/lib.rs Outdated Show resolved Hide resolved
@rphmeier
Copy link
Contributor Author

Comments have been heard re the Config member. I will return to this PR soon and implement that - I have been preparing Cumulus for this change in the meantime

@rphmeier
Copy link
Contributor Author

rphmeier commented Jun 8, 2023

I'm not sure if we have Cumulus companions yet, but I opened paritytech/cumulus#2707 to merge as soon as this goes in.

@rphmeier
Copy link
Contributor Author

rphmeier commented Jun 8, 2023

bot merge

@paritytech-processbot
Copy link

Error: "Check reviews" status is not passing for paritytech/cumulus#2707

@rphmeier
Copy link
Contributor Author

rphmeier commented Jun 9, 2023

bot merge

@paritytech-processbot
Copy link

Error: "Check reviews" status is not passing for paritytech/cumulus#2707

@rphmeier
Copy link
Contributor Author

rphmeier commented Jun 9, 2023

bot merge

@paritytech-processbot paritytech-processbot bot merged commit e5763b8 into master Jun 9, 2023
@paritytech-processbot paritytech-processbot bot deleted the rh-aura-allow-multiple-blocks-per-slot branch June 9, 2023 21:04
nathanwhit pushed a commit to nathanwhit/substrate that referenced this pull request Jul 19, 2023
* pallet-aura: Allow multiple blocks per slot

* run fmt

* rework as associated type

* fix fallout

* fmt

* use constbool

* fmt
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A0-please_review Pull request needs code review. B1-note_worthy Changes should be noted in the release notes C1-low PR touches the given topic and has a low impact on builders. D5-nicetohaveaudit ⚠️ PR contains trivial changes to logic that should be properly reviewed. T1-runtime This PR/Issue is related to the topic “runtime”.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants