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

Justified revision #802

Merged
merged 16 commits into from
Sep 4, 2024
Merged

Justified revision #802

merged 16 commits into from
Sep 4, 2024

Conversation

paologalligit
Copy link
Member

Description

This PR refers to this ticket. It introduces a new revision named justified. The meaning of this revision is the same Ethereum is using (see here, in geth the justified revision is referred to as safe). The chain is composed of epochs (each epoch is composed of 180 blocks) whose starting point is called checkpoint. When an epoch ends, if its checkpoint has garnered a ⅔ supermajority, the checkpoint gets justified; this happens every 30 minutes.

Example:

-- current best block
|
|
-- checkpoint
|
|
|
|
|
-- justified checkpoint
|
|
|
|
|
-- finalized checkpoint

Type of change

  • New feature (non-breaking change which adds functionality)
  • This change requires a documentation update

How Has This Been Tested?

  • running thor unit tests

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • New and existing E2E tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules
  • I have not added any vulnerable dependencies to my code

@paologalligit paologalligit requested a review from a team as a code owner July 26, 2024 07:54
@codecov-commenter
Copy link

codecov-commenter commented Jul 26, 2024

Codecov Report

Attention: Patch coverage is 75.00000% with 14 lines in your changes missing coverage. Please review.

Project coverage is 62.36%. Comparing base (029ac6b) to head (737aa92).

Files with missing lines Patch % Lines
bft/engine.go 76.47% 4 Missing and 4 partials ⚠️
cmd/thor/solo/types.go 0.00% 3 Missing ⚠️
api/utils/revisions.go 75.00% 1 Missing and 1 partial ⚠️
cmd/thor/node/packer_loop.go 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #802      +/-   ##
==========================================
+ Coverage   62.33%   62.36%   +0.03%     
==========================================
  Files         206      208       +2     
  Lines       18859    18904      +45     
==========================================
+ Hits        11756    11790      +34     
- Misses       6002     6009       +7     
- Partials     1101     1105       +4     

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

@leszek-vechain
Copy link
Contributor

can we add test for justified in e2e ? (we can open PR for now and just merge it when needed, before we forget about it)

@paologalligit
Copy link
Member Author

can we add test for justified in e2e ? (we can open PR for now and just merge it when needed, before we forget about it)

Tests added in this PR.

@libotony
Copy link
Member

libotony commented Aug 6, 2024

@paologalligit I had a non-persist way, if you have a bit, please take a look #808

darrenvechain
darrenvechain previously approved these changes Aug 9, 2024
libotony
libotony previously approved these changes Aug 9, 2024
Copy link
Member

@otherview otherview left a comment

Choose a reason for hiding this comment

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

Did a partial review looks good, still want to digg one more time into the engine.go

api/utils/revisions.go Show resolved Hide resolved
api/blocks/blocks_test.go Outdated Show resolved Hide resolved
api/blocks/blocks_test.go Show resolved Hide resolved
cmd/thor/node/packer_loop.go Show resolved Hide resolved
test/datagen/addess.go Outdated Show resolved Hide resolved
@libotony libotony marked this pull request as draft August 16, 2024 02:22
@libotony libotony marked this pull request as ready for review August 19, 2024 09:37
otherview
otherview previously approved these changes Aug 21, 2024
darrenvechain
darrenvechain previously approved these changes Aug 21, 2024
@darrenvechain darrenvechain dismissed stale reviews from otherview and themself via bde41c3 August 26, 2024 10:52
@paologalligit paologalligit merged commit 062c0d9 into master Sep 4, 2024
12 checks passed
@paologalligit paologalligit deleted the feat/paolo/justified branch September 4, 2024 09:43
libotony added a commit that referenced this pull request Sep 6, 2024
* feature: add justified revision for block

* fix: missing err declaration

* docs: add justified revision to thor.yaml

* feat: storing justified blockId in engine.data

* a non-persist way to implement jutified

* use store point to restore quality

* refactor: rename CommitLevel interface

* refactor: change approach to non-persist the justified block

* bft: add justified tests

* fix: rename file name and simplified error check in test

* improve bft package

* add comments

---------

Co-authored-by: tony <[email protected]>
Co-authored-by: otherview <[email protected]>
Co-authored-by: Darren Kelly <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants