flow-go icon indicating copy to clipboard operation
flow-go copied to clipboard

Support Epoch Extensions in HotStuff Committee

Open jordanschalm opened this issue 1 year ago • 1 comments

This PR updates the Consensus Committee to support epoch extensions. Addresses #5730.

Changes

  • Modifies protocol.Epoch FinalView method to account for any extensions.
  • Modifies committees.Consensus to handle EpochExtended protocol event. When we observe an epoch extension, we simply re-compute the leader selection for the entire epoch, including the new view range added by the extension. This is slightly wasteful, incurring a cost of around 20-30ms per extension on Mainnet, but simplifies the business logic and state quite a bit compared to tracking each extension independently.
  • Moves internal event processing to a shared channel Now that we can move into and out of EFM several times over the lifecycle of the component, it is easier to reason about correctness if we use a shared channel for events to enforce in-order processing. The event consumer function prepares a (potentially blocking) event handler function to be executed and passes the closure into the channel. The worker goroutine pulls event handler closures off the channel and executes them in order.

jordanschalm avatar Jun 25 '24 22:06 jordanschalm

Codecov Report

Attention: Patch coverage is 61.15702% with 47 lines in your changes missing coverage. Please review.

Project coverage is 41.70%. Comparing base (9c3ed48) to head (43754d1).

Files Patch % Lines
...nsensus/hotstuff/committees/consensus_committee.go 74.39% 16 Missing and 5 partials :warning:
consensus/hotstuff/committees/leader/consensus.go 0.00% 13 Missing :warning:
state/protocol/inmem/epoch.go 31.25% 10 Missing and 1 partial :warning:
state/protocol/badger/snapshot.go 77.77% 2 Missing :warning:
Additional details and impacted files
@@                   Coverage Diff                    @@
##           feature/efm-recovery    #6154      +/-   ##
========================================================
+ Coverage                 41.68%   41.70%   +0.01%     
========================================================
  Files                      1975     1975              
  Lines                    139306   139258      -48     
========================================================
- Hits                      58072    58071       -1     
+ Misses                    75182    75139      -43     
+ Partials                   6052     6048       -4     
Flag Coverage Δ
unittests 41.70% <61.15%> (+0.01%) :arrow_up:

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

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov-commenter avatar Jun 25 '24 23:06 codecov-commenter