Skip to content

Remove POLInfo and simplify Proposal message #2646

@milosevic

Description

@milosevic

According to the spec, Proposal message has the following format:
⟨PROPOSAL, height , round , proposal, validRound⟩ where proposal corresponds to the id of the block proposal (BlockID). Currently, Proposal message has the following format:

type Proposal struct {
Height int64 `json:"height"`
Round int `json:"round"`
Timestamp time.Time `json:"timestamp"`
BlockPartsHeader PartSetHeader `json:"block_parts_header"`
POLRound int `json:"pol_round"` // -1 if null.
POLBlockID BlockID `json:"pol_block_id"` // zero if null.
Signature []byte `json:"signature"`
}

We could simplify Proposal message as done in spec by removing BlockPartsHeader and only having a single field that is BlockID of the proposed block. Furthermore, we currently rely on function POLInfo to decide what is POLRound and POLBlockID that goes into Proposal message. See

func (hvs *HeightVoteSet) POLInfo() (polRound int, polBlockID types.BlockID) {
hvs.mtx.Lock()
defer hvs.mtx.Unlock()
for r := hvs.round; r >= 0; r-- {
rvs := hvs.getVoteSet(r, types.PrevoteType)
polBlockID, ok := rvs.TwoThirdsMajority()
if ok {
return r, polBlockID
}
}
return -1, types.BlockID{}
}

This is not needed as ValidRound, ValidBlock and ValidBlockParts keep equivalent of those information. Therefore, we could completely remove POLInfo function.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C:consensusComponent: ConsensusT:bugType Bug (Confirmed)

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions