-
Notifications
You must be signed in to change notification settings - Fork 36
Ensure slot number is strictly increasing #41
Ensure slot number is strictly increasing #41
Conversation
asynchronous backing will remove this guarantee such that there may be multiple parachain blocks for a single relay chain parent block |
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.
We can change >
to >=
when asynchronous backing is included
Thanks @JoshOrndorff ! |
let author = <Author<T>>::get() | ||
.expect("Block invalid, no authorship information supplied in preruntime digest."); | ||
|
||
assert!( | ||
T::CanAuthor::can_author(&author, &T::SlotBeacon::slot()), |
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.
T::CanAuthor::can_author(&author, &T::SlotBeacon::slot()), | |
T::CanAuthor::can_author(&author, &slot), |
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.
just missed this, not sure how much better it is
We should bump the weight returned by |
Rob gives some options for how to address asynchronous backing in paritytech/polkadot#3779 (comment) I had also considered a notion of slot that is derived from both the relay block number and parachain block number, maybe Maybe that's similar to his idea # 3 |
This PR adds a simple storage item and validation check that ensures the slot number associated with each block is always strictly greater than the previous highest slot number in this chain.
Nimbus has always assumed this invariant to be true, but has not enforced it. In the parachain context, we are guaranteed increasing slot numbers because we use the relay chain parent number which is always strictly increasing. But in other contexts, nimbus will need to ensure this manually. (Plus nimbus should ensure it manually anyways in case the design of cumulus ever changes without warning.)
This works toward #1 and #3