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

[BFT] model.Proposal refactoring #6526

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

Conversation

durkmurder
Copy link
Member

#6517

Context

This PR implements refactoring of model.Proposal, all details are in attached issue. This PR very closes follows proposed solution.

@codecov-commenter
Copy link

codecov-commenter commented Oct 3, 2024

Codecov Report

Attention: Patch coverage is 76.10619% with 27 lines in your changes missing coverage. Please review.

Project coverage is 41.15%. Comparing base (3beefb8) to head (3965e87).
Report is 172 commits behind head on master.

Files with missing lines Patch % Lines
consensus/recovery/recover.go 20.00% 4 Missing ⚠️
consensus/hotstuff/mocks/vote_aggregator.go 0.00% 3 Missing ⚠️
consensus/hotstuff/mocks/validator.go 0.00% 2 Missing ⚠️
consensus/hotstuff/mocks/vote_processor_factory.go 50.00% 0 Missing and 2 partials ⚠️
consensus/hotstuff/mocks/event_handler.go 50.00% 0 Missing and 1 partial ⚠️
consensus/hotstuff/mocks/event_loop.go 0.00% 1 Missing ⚠️
consensus/hotstuff/mocks/participant_consumer.go 0.00% 1 Missing ⚠️
consensus/hotstuff/mocks/safety_rules.go 75.00% 0 Missing and 1 partial ⚠️
...sensus/hotstuff/mocks/vote_aggregation_consumer.go 0.00% 1 Missing ⚠️
...stuff/mocks/vote_aggregation_violation_consumer.go 0.00% 1 Missing ⚠️
... and 10 more
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #6526      +/-   ##
==========================================
- Coverage   41.27%   41.15%   -0.13%     
==========================================
  Files        2030     2031       +1     
  Lines      145822   179602   +33780     
==========================================
+ Hits        60186    73912   +13726     
- Misses      79419    99491   +20072     
+ Partials     6217     6199      -18     
Flag Coverage Δ
unittests 41.15% <76.10%> (-0.13%) ⬇️

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.

consensus/hotstuff/forks/forks.go Outdated Show resolved Hide resolved
consensus/hotstuff/model/errors.go Outdated Show resolved Hide resolved
consensus/hotstuff/pacemaker/pacemaker.go Outdated Show resolved Hide resolved
consensus/hotstuff/pacemaker/view_tracker.go Outdated Show resolved Hide resolved
durkmurder and others added 2 commits October 7, 2024 14:25
Copy link
Member

@AlexHentschel AlexHentschel left a comment

Choose a reason for hiding this comment

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

very cool. Thanks for the cleanup. Mostly minor comments regarding documentation.

// This codifies the important aspect that a proposer's signature for their own block
// is conceptually also just a vote (we explicitly use that for aggregating votes, including the
// proposer's own vote to a QC). In order to express this conceptual equivalence in code, the
// voting logic in Safety Rules must also operate on an unsigned Proposal.
type Proposal struct {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
type Proposal struct {
//
// NOTE: LastViewTC is auxiliary data that must accompany a pending proposal until it is
// certified. Atm, we include LastViewTC in the `flow.Header` but that is not strictly needed.
// Conceptually, LastViewTC is only needed to prove that the proposer entered the block's view
// according to protocol rules. Thereby we protect the consensus process from malicious leaders
// attempting to skip views that haven't concluded yet (a form of front-running attack).
// However, the LastViewTC is only relevant until a proposed block has been certified.
// Thereafter, the QC attests that honest consensus participants have inspected the LastViewTC
// and found it to be valid. At that point, the LastViewTC is no longer needed. Therefore,
// the LastViewTC is auxiliary data that must accompany a pending proposal until it is
// certified but LastViewTC does not need to be part of the block itself.
//
// TODO: atm, the flow.Header embeds the LastViewTC and also includes it when computing the
// block's ID. This is simpler from an implementation perspective, but the LastViewTC wastes
// some communication bandwidth when relaying certified blocks to the consensus followers.
type Proposal struct {

consensus/hotstuff/model/proposal.go Show resolved Hide resolved
consensus/hotstuff/model/proposal.go Outdated Show resolved Hide resolved
consensus/hotstuff/eventhandler/event_handler_test.go Outdated Show resolved Hide resolved
consensus/hotstuff/verification/combined_signer_v2_test.go Outdated Show resolved Hide resolved
consensus/hotstuff/verification/combined_signer_v3_test.go Outdated Show resolved Hide resolved
consensus/hotstuff/votecollector/statemachine_test.go Outdated Show resolved Hide resolved
durkmurder and others added 7 commits October 22, 2024 19:05
Co-authored-by: Alexander Hentschel <alex.hentschel@flowfoundation.org>
Co-authored-by: Alexander Hentschel <alex.hentschel@flowfoundation.org>
…st.go

Co-authored-by: Alexander Hentschel <alex.hentschel@flowfoundation.org>
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.

4 participants