flow-go
flow-go copied to clipboard
[Protocol State] Differentiate between uncommitted and committed epochs in API
Problem Definition
The Epoch Preparation Protocol prepares for each subsequent epoch in two steps: EpochSetup
and EpochCommit
, each represented by a service event.
Most components should only access data (view ranges, etc.) for committed epochs (after EpochCommit
step is complete), because uncommitted are tentative and may change.
However, the components directly involved in epoch preparation (namely the DKG engine and QC Voting engine, in Consensus and Collection Nodes respectively, require access to the tentative data associated with uncommitted epochs.
The current epoch API:
- uses the same interface type to represent all epochs, whether committed or not
- exposes all epoch data as soon as it is available, even if the epoch is not committed
Proposed Solution
- Create two types to represent uncommitted and committed epochs distinctly (eg.
TentativeEpoch
andCommittedEpoch
)-
EpochQuery.Previous()
returnsCommittedEpoch, nil
ornil, NotFound
-
EpochQuery.Current()
returnsCommittedEpoch, nil
-
EpochQuery.Next()
may returnnil, NotFound
,TentativeEpoch, nil
, orCommittedEpoch, nil
(need a way for caller to check which of the two return types it is)
-
-
CommittedEpoch
is informationally equivalent to currentprotocol.Epoch
API -
TentativeEpoch
contains only the information from theEpochSetup
service event which is necessary to complete DKG and QC voting- (For example, I think we could omit the overall epoch view range)
Related Issues
- https://github.com/dapperlabs/flow-go/issues/6368
- https://github.com/onflow/flow-go/issues/5974