-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Independence of Slot-based algorithms from system Timestamp #12224
Independence of Slot-based algorithms from system Timestamp #12224
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.
Some nitpicks, otherwise looking good! Ty
The dependency on timestamp was used to perform the check that the Does this keep that property? It'd be nice to have a test if so. |
@rphmeier the property is enforced by exactly the same means as before. In practice the check is performed in Babe here: substrate/client/consensus/babe/src/verification.rs Lines 84 to 87 in dd1f1b5
And in AURA here: substrate/client/consensus/aura/src/import_queue.rs Lines 77 to 80 in dd1f1b5
The check consists in ensuring that the slot used by the block author is less than I'll check it a test exists already. Otherwise I'm going to add one. |
Thanks for clarifying! |
We also have these checks inside the runtime: https://github.com/paritytech/substrate/blob/master/frame/babe/src/lib.rs#L866-L869 To ensure that timestamp and slot are matching. |
@andresilva your opinion on this? |
bot merge |
…ch#12224) * Remove timestamp from SlotInfo * Expose as millis instead of secs * Nits * Fix test after field removal * Yet another test fix * On the fly timestamp computation * Removed slot timestamp from logs * Removed reference to timestamp from slots subsystem * Slot based algorithm tests do not require timstamp inherent anymore * Remove junk files * Further tests cleanup * Trigger pipeline * Apply code suggestions * Trigger pipeline Co-authored-by: André Silva <andrerfosilva@gmail.com>
Removal from
SlotInfo
:slot_info.slot * slot_info.duration
.(Edited)
Slot based algorithms such as Babe, Aura and (in the future) Sassafras should not explicitly depend on Timestamp.
This PR relaxes this requirement by removing direct timestamp inclusion from Slots crate.
If the slot value is computed using the system timestamp then this should be a user choice part of the node construction (i.e. within the bin).
Note that this also simplifies the creation of slot values for future for other consensus algorithms using a different criteria.
For example I wish to at least try (or keep the door open) to implement 2 different slot providers for Sassafras:
polkadot companion: paritytech/polkadot#5997
cumulus companion: paritytech/cumulus#1617