-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Generalize pallet-babe to be independent of BABE primitives #5655
Conversation
I finished the part that generalize |
… sp-babe-frame-generic
… sp-babe-frame-generic
… sp-babe-frame-generic
@sorpaas we'll need this bringing up to date... |
closing because of inactivity. |
|
||
if let PreDigest::Primary(primary) = digest { | ||
if let Some(randomness) = T::make_randomness(&digest) { | ||
// place the VRF output into the `Initialized` storage item | ||
// and it'll be put onto the under-construction randomness | ||
// later, once we've decided which epoch this block is in. |
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.
Can someone explain the issue with knowing in which epoch the block comes? It'd be easier on the storage if UnderConstruction = Hash(UnderConstruction, BlockVrfOutput)
but you cannot do that if you donnot what epoch a block lies in. We should always know what epoch sassafras blocks lie in though, yes?
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.
It's just that at this point we are still running the block initialization logic and haven't processed any epoch change. It might be the case that this block starts a new epoch, in which case the randomness should be pooled under the new epoch (i.e. empty pool) rather than adding it to the existing epoch's. This will all be done as part of block processing so once we exit from the runtime the randomness will be stored in its appropriate place (you're right that we can always tell what epoch a given block belongs to).
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.
In sassafras, we authorized block production by building this VRF output list for the whole epoch, so we'll need to know our epoch so that we can check the right list. I suspect this might just be a place where babe and sassafras diverge more than expected.
cc #7053 |
This is an attempt that aims at generalizing
pallet-babe
so that it does not depend on BABE primitives. The goal is to make the pallet also suitable to be used in Sassafras.Mostly we'd need to generalize the pre-digest and post-block-digest logics, which are the differences of BABE and Sassafras. The current generalization still depend on schnorrkel types. Given Sassafras needs to be moved to ring VRF, this also has to be generalized.