flow-go
flow-go copied to clipboard
Support Epoch Extensions in HotStuff Committee
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 handleEpochExtended
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.