Conversation
|
I'm interested, could you please add a description or link an issue? @demimarie-parity |
`Aura` → `Babe` Co-Authored-By: Pierre Krieger <pierre.krieger1708@gmail.com>
|
@marcio-diaz I just included a description of this feature, along with the addition of import queues. |
Somehow, those broke the build
It is more useful
Also: `1000_000_000` → `1_000_000_000` Suggested-by: Niklas Adolfsson <niklasadolfsson1@gmail.com>
andresilva
left a comment
There was a problem hiding this comment.
minor grumble, overall lgtm.
core/consensus/babe/src/lib.rs
Outdated
| auxiliary: Vec::new(), | ||
| fork_choice: ForkChoiceStrategy::LongestChain, | ||
| }; | ||
| const NANOS_PER_SEC: u32 = 1_000_000_000; |
There was a problem hiding this comment.
Can we move this block of code to some aux function?
There was a problem hiding this comment.
We should. We also need to get the information to the block-authoring logic somehow ― currently, it is never used by it. However, I could not think of a better way to do it than to stuff it in a global variable (yuck!!!!).
bkchr
left a comment
There was a problem hiding this comment.
Looks good so far, just some minor issues.
Otherwise it would panic.
Co-Authored-By: Bastian Köcher <bkchr@users.noreply.github.com>
… into demi-relative-slots
for signed `Duration` values. Suggested-by: Bastian Köcher
|
@bkchr can you do another review? |
bkchr
left a comment
There was a problem hiding this comment.
Overall looking good, some last nitpicks.
* Initial work on relative slots for BABE * More work * Update core/consensus/babe/src/lib.rs `Aura` → `Babe` Co-Authored-By: Pierre Krieger <pierre.krieger1708@gmail.com> * More work on relative slots * Add missing field in test-runtime * Bump `impl_version` and `authoring_version` * Fix compile errors and warnings * Upgrade dependencies * Update dependencies more * Revert some updates to dependencies Somehow, those broke the build * Fix compilation errors * `Duration` → `u128` in calculations * `slot_duration` is in milleseconds, not seconds * Median algorithm: ignore blocks with slot_num < sl * Fix silly compile error * Store a duration, rather than an instant It is more useful * Fix compilation errors * `INVERSE_NANO` → `NANOS_PER_SEC` Also: `1000_000_000` → `1_000_000_000` Suggested-by: Niklas Adolfsson <niklasadolfsson1@gmail.com> * Un-bump `authoring_version` * Disable median algorithm when `median_required_blocks` is 0 Otherwise it would panic. * Apply suggestions from code review Co-Authored-By: Bastian Köcher <bkchr@users.noreply.github.com> * Simplify panic * Fix build error * Create `SignedDuration` struct for signed `Duration` values. Suggested-by: Bastian Köcher * Refactor median algorithm into separate function * Add issues for FIXMEs and respond to code review * Fix minor warnings
BABE uses relative time to determine slots, which avoids AuRa’s requirement that each node have a synchronized clock. However, this has not been implemented until now. Future plans, which will follow this PR, include an on-chain, VRF-based randomness beacon, as well as general improvements to the consensus infrastructure.
This also implements BABE import queues, which are required to use BABE for anything other than its own test suite. This makes using BABE in an actual blockchain possible, although it would be insecure, as equivocation reporting is not yet implemented. That said, I do not believe equivocation reporting has been implemented for AuRa or GRANDPA either (but it will be before 2.0).