Skip to content

Commit 7364a43

Browse files
committed
add docs, link to issue
1 parent ac73708 commit 7364a43

File tree

4 files changed

+13
-1
lines changed

4 files changed

+13
-1
lines changed

consensus/hotstuff/committee.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,8 @@ type Replicas interface {
7373
// The list of all legitimate HotStuff participants for the given epoch can be obtained by using `filter.Any`
7474
//
7575
// CAUTION: DO NOT use this method for validating block proposals.
76+
// CAUTION: This method considers epochs outside of Previous, Current, Next, w.r.t. the
77+
// finalized block, to be unknown. https://github.com/onflow/flow-go/issues/4085
7678
//
7779
// Returns the following expected errors for invalid inputs:
7880
// * model.ErrViewForUnknownEpoch if no epoch containing the given view is known
@@ -82,6 +84,9 @@ type Replicas interface {
8284

8385
// IdentityByEpoch returns the full Identity for specified HotStuff participant.
8486
// The node must be a legitimate HotStuff participant with NON-ZERO WEIGHT at the specified block.
87+
// CAUTION: This method considers epochs outside of Previous, Current, Next, w.r.t. the
88+
// finalized block, to be unknown. https://github.com/onflow/flow-go/issues/4085
89+
//
8590
// ERROR conditions:
8691
// * model.InvalidSignerError if participantID does NOT correspond to an authorized HotStuff participant at the specified block.
8792
//

consensus/hotstuff/committees/consensus_committee.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,13 +187,14 @@ func NewConsensusCommittee(state protocol.State, me flow.Identifier) (*Consensus
187187
return com, nil
188188
}
189189

190-
// Identities returns the identities of all authorized consensus participants at the given block.
190+
// IdentitiesByBlock returns the identities of all authorized consensus participants at the given block.
191191
// The order of the identities is the canonical order.
192192
func (c *Consensus) IdentitiesByBlock(blockID flow.Identifier) (flow.IdentityList, error) {
193193
il, err := c.state.AtBlockID(blockID).Identities(filter.IsVotingConsensusCommitteeMember)
194194
return il, err
195195
}
196196

197+
// IdentityByBlock returns the identity of the node with the given node ID at the given block.
197198
func (c *Consensus) IdentityByBlock(blockID flow.Identifier, nodeID flow.Identifier) (*flow.Identity, error) {
198199
identity, err := c.state.AtBlockID(blockID).Identity(nodeID)
199200
if err != nil {
@@ -210,6 +211,8 @@ func (c *Consensus) IdentityByBlock(blockID flow.Identifier, nodeID flow.Identif
210211

211212
// IdentitiesByEpoch returns the committee identities in the epoch which contains
212213
// the given view.
214+
// CAUTION: This method considers epochs outside of Previous, Current, Next, w.r.t. the
215+
// finalized block, to be unknown. https://github.com/onflow/flow-go/issues/4085
213216
//
214217
// Error returns:
215218
// - model.ErrViewForUnknownEpoch if no committed epoch containing the given view is known.
@@ -225,6 +228,8 @@ func (c *Consensus) IdentitiesByEpoch(view uint64) (flow.IdentityList, error) {
225228

226229
// IdentityByEpoch returns the identity for the given node ID, in the epoch which
227230
// contains the given view.
231+
// CAUTION: This method considers epochs outside of Previous, Current, Next, w.r.t. the
232+
// finalized block, to be unknown. https://github.com/onflow/flow-go/issues/4085
228233
//
229234
// Error returns:
230235
// - model.ErrViewForUnknownEpoch if no committed epoch containing the given view is known.

module/epochs.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ type QCContractClient interface {
4646
}
4747

4848
// EpochLookup enables looking up epochs by view.
49+
// CAUTION: EpochLookup should only be used for querying the previous, current, or next epoch.
4950
type EpochLookup interface {
5051

5152
// EpochForViewWithFallback returns the counter of the epoch that the input view belongs to.

module/epochs/epoch_lookup.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ func (cache *epochRangeCache) add(epoch epochRange) error {
100100
}
101101

102102
// EpochLookup implements the EpochLookup interface using protocol state to match views to epochs.
103+
// CAUTION: EpochLookup should only be used for querying the previous, current, or next epoch.
103104
type EpochLookup struct {
104105
state protocol.State
105106
mu sync.RWMutex

0 commit comments

Comments
 (0)