Skip to content
This repository has been archived by the owner on Jun 6, 2024. It is now read-only.

Demonstrate time-based slots #3

Open
JoshOrndorff opened this issue Nov 1, 2021 · 2 comments
Open

Demonstrate time-based slots #3

JoshOrndorff opened this issue Nov 1, 2021 · 2 comments

Comments

@JoshOrndorff
Copy link
Contributor

A non-parachain node may also like to use Nimbus using wall-clock time as the slot trigger. This can easily be added on the runtime side by implementing the SlotBeacon trait for the timestamp pallet. On the client side we will need some work. Probably the best path forward would be to implement Substrate's SlotWorker trait.

@JoshOrndorff
Copy link
Contributor Author

JoshOrndorff commented Nov 4, 2021

This will require a little more work on the client side. Currently we have no way of directly enforcing that there is only one block in each slot. If the slots are driven by a block height (either our native height or a backing relay chain's block height), we implicitly have this guarantee because there cannot be two blocks in the same chain at the same height. But if we expend to a non-block-height-based notion of slots, such as wall clock time, then we need to explicitly guarantee that no block is on a lower (or equal) slot than its parent.

@JoshOrndorff
Copy link
Contributor Author

JoshOrndorff commented Nov 4, 2021

Actually, ensuring that there are not two blocks in the same slot in the same chain in the runtime should be pretty easy. We can just store the slot number of the last block. Then when executing this block we calculate the current slot number from the slot beacon trait and make sure it is at least as large as the previously stored slot number.

Of course this does nothing about two blocks in the same slot in different chains. That falls under equivocation detection.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant