Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.

Conversation

@Demi-Marie
Copy link
Contributor

@Demi-Marie Demi-Marie commented Jun 7, 2019

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).

@Demi-Marie Demi-Marie added the A3-in_progress Pull request is in progress. No review needed at this stage. label Jun 7, 2019
@Demi-Marie Demi-Marie added this to the 2.0-alpha milestone Jun 7, 2019
@marcio-diaz
Copy link
Contributor

marcio-diaz commented Jun 7, 2019

I'm interested, could you please add a description or link an issue? @demimarie-parity

`Aura` → `Babe`

Co-Authored-By: Pierre Krieger <[email protected]>
@Demi-Marie
Copy link
Contributor Author

@marcio-diaz I just included a description of this feature, along with the addition of import queues.

@Demi-Marie Demi-Marie added A0-please_review Pull request needs code review. and removed A3-in_progress Pull request is in progress. No review needed at this stage. A4-gotissues labels Jun 12, 2019
@Demi-Marie Demi-Marie requested review from bkchr and marcio-diaz June 13, 2019 18:50
Copy link
Contributor

@andresilva andresilva left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor grumble, overall lgtm.

auxiliary: Vec::new(),
fork_choice: ForkChoiceStrategy::LongestChain,
};
const NANOS_PER_SEC: u32 = 1_000_000_000;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we move this block of code to some aux function?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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!!!!).

Copy link
Member

@bkchr bkchr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good so far, just some minor issues.

@Demi-Marie
Copy link
Contributor Author

@bkchr can you do another review?

Copy link
Member

@bkchr bkchr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall looking good, some last nitpicks.

@Demi-Marie Demi-Marie merged commit 2d7b4fe into master Jun 22, 2019
@Demi-Marie Demi-Marie deleted the demi-relative-slots branch June 22, 2019 16:21
MTDK1 pushed a commit to bdevux/substrate that referenced this pull request Jul 10, 2019
* Initial work on relative slots for BABE

* More work

* Update core/consensus/babe/src/lib.rs

`Aura` → `Babe`

Co-Authored-By: Pierre Krieger <[email protected]>

* 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 <[email protected]>

* 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 <[email protected]>

* 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
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

A0-please_review Pull request needs code review.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants