Skip to content

spec: Clearly document the ordering within VoteInfo and ExtendedVoteInfo #779

Closed

Description

@adizere

Feature Request

Summary

It would be useful if the spec for ABCI 2.0 documented the expected ordering of elements within fields VoteInfo and ExtendedVoteInfo in all the methods where these fields appear. Application developers might expects that these elements are ordered deterministically by validator power; if so, the docs should capture it, and if not, we should also state it.

Problem Definition

Developers who are integrating v0.38 can be confused about the guarantees on the ordering of elements within VoteInfo and ExtendedVoteInfo. There are three ABCI methods concerned here:

Proposal

The method ValidatorSet.Validators already handles ordering:

// ValidatorSet represent a set of *Validator at a given height.
//
// The validators can be fetched by address or index.
// The index is in order of .VotingPower, so the indices are fixed for all
// rounds of a given blockchain height - ie. the validators are sorted by their
// voting power (descending). Secondary index - .Address (ascending).
//
// On the other hand, the .ProposerPriority of each validator and the
// designated .GetProposer() of a set changes every round, upon calling
// .IncrementProposerPriority().
//
// NOTE: Not goroutine-safe.
// NOTE: All get/set to validators should copy the value for safety.
type ValidatorSet struct {
// NOTE: persisted via reflect, must be exported.
Validators []*Validator `json:"validators"`

This method is used by buildExtendedCommitInfo and buildLastCommitInfo, used in the three ABCI methods described above.

Acceptance criteria:

  • double-check that the above is accurate
  • extend the specification for the three ABCI methods concerned to document the ordering guarantees

H/t Marko B. for noticing this underspecified part of the spec!

Activity

  1. added
    good first issue
    abci
    spec
    on May 1, 2023
  2. self-assigned this
    on Apr 1, 2024
  3. moved this from Todo to In Progress in CometBFTon Apr 1, 2024
  4. added this to the 2024-Q2 milestone on Apr 1, 2024
  5. moved this from In Progress to Ready for Review in CometBFTon Apr 3, 2024
  6. added a commit that references this issue on Apr 4, 2024
    0349b99
  7. moved this from Ready for Review to Done in CometBFTon Apr 4, 2024
  8. added a commit that references this issue on Apr 4, 2024
    dc99059
  9. added a commit that references this issue on Apr 4, 2024
    4d4ac34
  10. added a commit that references this issue on Apr 5, 2024
    e34e967
  11. added a commit that references this issue on Apr 5, 2024
    fd5b3f3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

abcigood first issuespec

Type

No type

Projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions