Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add, use and test VerifyWeakSubjectivityRoot #7344

Merged
merged 16 commits into from
Sep 26, 2020
Merged

Conversation

terencechain
Copy link
Member

What type of PR is this?

Feature

What does this PR do? Why is it needed?

This PR adds in the weak subjectivity check as outlined in:
https://github.com/ethereum/eth2.0-specs/blob/master/specs/phase0/weak-subjectivity.md#weak-subjectivity-sync-procedure

This weak subjectivity check is currently opt-out. It'll switch to opt-in with the closure of issue #7342

Other notes for review
Tested run time under various conditions

1.) ws block not in db:
Screen Shot 2020-09-24 at 2 21 34 PM

2.) ws block in db but incorrect epoch:
Screen Shot 2020-09-24 at 2 22 03 PM

3.) ws check working during initial syncing
Screen Shot 2020-09-24 at 2 22 48 PM

4.) ws check working for an almost caught up node
Screen Shot 2020-09-24 at 2 24 02 PM

@terencechain terencechain added the Ready For Review A pull request ready for code review label Sep 24, 2020
@terencechain terencechain requested a review from a team as a code owner September 24, 2020 21:24
@terencechain terencechain self-assigned this Sep 24, 2020
beacon-chain/blockchain/service.go Outdated Show resolved Hide resolved
// Reference design: https://github.com/ethereum/eth2.0-specs/blob/master/specs/phase0/weak-subjectivity.md#weak-subjectivity-sync-procedure
func (s *Service) VerifyWeakSubjectivityRoot(ctx context.Context) error {
// TODO(7342): Remove the following to fully use weak subjectivity in production.
if len(s.wsRoot) == 0 && s.wsEpoch == 0 {
Copy link
Contributor

Choose a reason for hiding this comment

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

should this be an || ?

Copy link
Member Author

Choose a reason for hiding this comment

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

Either way is fine. This is not going to be production code. I changed it to | |

beacon-chain/blockchain/weak_subjectivity_checks.go Outdated Show resolved Hide resolved
@codecov
Copy link

codecov bot commented Sep 25, 2020

Codecov Report

Merging #7344 into master will decrease coverage by 0.33%.
The diff coverage is 66.66%.

@@            Coverage Diff             @@
##           master    #7344      +/-   ##
==========================================
- Coverage   60.42%   60.09%   -0.34%     
==========================================
  Files         418      417       -1     
  Lines       30316    29961     -355     
==========================================
- Hits        18319    18004     -315     
+ Misses       9029     9016      -13     
+ Partials     2968     2941      -27     

Copy link
Contributor

@farazdagi farazdagi left a comment

Choose a reason for hiding this comment

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

looks great!

@prylabs-bulldozer prylabs-bulldozer bot merged commit 68d0c09 into master Sep 26, 2020
@delete-merged-branch delete-merged-branch bot deleted the verify-ws branch September 26, 2020 08:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Ready For Review A pull request ready for code review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants