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

[Epoch Sync] Verify merkle proofs for the first block in current epoch. #12330

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

robin-near
Copy link
Contributor

  • Verify the first block of the current epoch against the last final block of the current epoch, using the merkle proof.
  • Verify the last and second last headers before the first header.
  • Verify the partial merkle tree (note: this is NOT the merkle proof!) of the first block; add is_well_formed() to facilitate that validation.
  • Clearly document what every field of EpochSyncProof is validated against.

Copy link

codecov bot commented Oct 28, 2024

Codecov Report

Attention: Patch coverage is 74.50980% with 13 lines in your changes missing coverage. Please review.

Project coverage is 71.21%. Comparing base (244422d) to head (d1a8885).
Report is 19 commits behind head on master.

Files with missing lines Patch % Lines
chain/client/src/sync/epoch.rs 66.66% 12 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master   #12330      +/-   ##
==========================================
- Coverage   71.25%   71.21%   -0.05%     
==========================================
  Files         838      839       +1     
  Lines      169020   169777     +757     
  Branches   169020   169777     +757     
==========================================
+ Hits       120442   120908     +466     
- Misses      43338    43615     +277     
- Partials     5240     5254      +14     
Flag Coverage Δ
backward-compatibility 0.16% <0.00%> (-0.01%) ⬇️
db-migration 0.16% <0.00%> (-0.01%) ⬇️
genesis-check 1.22% <0.00%> (-0.01%) ⬇️
integration-tests 39.01% <56.86%> (-0.04%) ⬇️
linux 70.65% <74.50%> (-0.05%) ⬇️
linux-nightly 70.79% <74.50%> (-0.06%) ⬇️
macos 50.41% <23.52%> (+0.03%) ⬆️
pytests 1.53% <0.00%> (-0.01%) ⬇️
sanity-checks 1.34% <0.00%> (-0.01%) ⬇️
unittests 64.27% <23.52%> (+0.06%) ⬆️
upgradability 0.21% <0.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@staffik staffik left a comment

Choose a reason for hiding this comment

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

LGTM!
Could you remind what happens if last final block of current epoch has not been endorsed by next epoch's block producers?

@robin-near
Copy link
Contributor Author

@staffik it doesn't matter; as long as the current epoch's block producers endorsed it, it is valid.

@robin-near
Copy link
Contributor Author

@Longarithm @shreyan-gupta could I please get a review on this - thank you!!

Copy link
Contributor

@shreyan-gupta shreyan-gupta left a comment

Choose a reason for hiding this comment

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

Approving to unblock. Took a high level look and lgtm, however would be nice for someone to take a more detailed look.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants