通道
共识有四个独立的通道。通道标识符如下。| 名称 | 编号 |
|---|---|
| StateChannel | 32 |
| DataChannel | 33 |
| VoteChannel | 34 |
| VoteSetBitsChannel | 35 |
消息类型
Proposal
当提出新区块时,会发送 Proposal。它表示对区块链下一个区块应为何值的建议。| 名称 | 类型 | 说明 | 字段编号 |
|---|---|---|---|
| proposal | Proposal | 用于达成共识的提议区块 | 1 |
Vote
Vote 用于对某个区块进行投票(或告知其他节点某个进程在当前轮次不投票)。Vote 包含验证者信息(验证者地址和索引)、发送该投票对应的高度与轮次、投票类型、如果进程对某个区块投票则包含 blockID(否则为nil),以及投票发送时的时间戳。该消息由验证者私钥签名。
| 名称 | 类型 | 说明 | 字段编号 |
|---|---|---|---|
| vote | Vote | 对提议区块的投票 | 1 |
BlockPart
BlockPart 在对提议区块的某个分片进行 gossip 时发送。它包含高度、轮次以及该区块分片。| 名称 | 类型 | 说明 | 字段编号 |
|---|---|---|---|
| height | int64 | 对应区块的高度。 | 1 |
| round | int32 | 用于最终确认区块的投票轮次。 | 2 |
| part | Part | 区块的一个分片。 | 3 |
NewRoundStep
核心共识算法执行期间的每一次步骤转换都会发送 NewRoundStep。它用于 CometBFT 共识协议的 gossip 部分,向对等节点告知某个进程当前所处的高度/轮次/步骤。| 名称 | 类型 | 说明 | 字段编号 |
|---|---|---|---|
| height | int64 | 对应区块的高度 | 1 |
| round | int32 | 用于最终确认区块的投票轮次。 | 2 |
| step | uint32 | 3 | |
| seconds_since_start_time | int64 | 4 | |
| last_commit_round | int32 | 5 |
NewValidBlock
当验证者在某个轮次 r 观察到一个有效区块 B 时,会发送 NewValidBlock,即该轮次 r 中存在针对区块 B 的 Proposal,且区块 B 获得了超过 2/3 的 prevote。它包含观察到有效区块时的高度和轮次、描述该有效区块并用于获取全部区块分片的区块分片头,以及一个表示进程当前已拥有区块分片的位数组,以便对等节点知道它缺少哪些分片并发送给它。如果该区块也已经提交,则 IsCommit 标志会被设置为 true。| 名称 | 类型 | 说明 | 字段编号 |
|---|---|---|---|
| height | int64 | 对应区块的高度 | 1 |
| round | int32 | 用于最终确认区块的投票轮次。 | 2 |
| block_part_set_header | PartSetHeader | 3 | |
| block_parts | int32 | 4 | |
| is_commit | bool | 5 |
ProposalPOL
当前一个区块被重新提议时,会发送 ProposalPOL。它用于告知对等节点,进程是在第几轮获知该区块的(ProposalPOLRound),以及进程持有哪些针对该重新提议区块的 prevote。| 名称 | 类型 | 说明 | 字段编号 |
|---|---|---|---|
| height | int64 | 对应区块的高度 | 1 |
| proposal_pol_round | int32 | 2 | |
| proposal_pol | bitarray | 3 |
ReceivedVote
ReceivedVote 用于表示某个特定投票已经被接收。它包含高度、轮次、投票类型,以及对应投票发起验证者的索引。| 名称 | 类型 | 说明 | 字段编号 |
|---|---|---|---|
| height | int64 | 对应区块的高度 | 1 |
| round | int32 | 用于最终确认区块的投票轮次。 | 2 |
| type | SignedMessageType | 3 | |
| index | int32 | 4 |
VoteSetMaj23
VoteSetMaj23 用于表示某个进程已经看到某个 BlockID 获得了超过 2/3 的投票。它包含高度、轮次、投票类型和 BlockID。| 名称 | 类型 | 说明 | 字段编号 |
|---|---|---|---|
| height | int64 | 对应区块的高度 | 1 |
| round | int32 | 用于最终确认区块的投票轮次。 | 2 |
| type | SignedMessageType | 3 |
VoteSetBits
VoteSetBits 用于传达某个进程针对给定 BlockID 已见到的投票位数组。它包含高度、轮次、投票类型、BlockID,以及一个表示进程当前拥有投票的位数组。| 名称 | 类型 | 说明 | 字段编号 |
|---|---|---|---|
| height | int64 | 对应区块的高度 | 1 |
| round | int32 | 用于最终确认区块的投票轮次。 | 2 |
| type | SignedMessageType | 3 | |
| block_id | BlockID | 4 | |
| votes | BitArray | 用于最终确认区块的投票轮次。 | 5 |
Message
Message 是一种oneof protobuf 类型。
| 名称 | 类型 | 说明 | 字段编号 |
|---|---|---|---|
| new_round_step | NewRoundStep | 对应区块的高度 | 1 |
| new_valid_block | NewValidBlock | 用于最终确认区块的投票轮次。 | 2 |
| proposal | Proposal | 3 | |
| proposal_pol | ProposalPOL | 4 | |
| block_part | BlockPart | 5 | |
| vote | Vote | 6 | |
| received_vote | ReceivedVote | 7 | |
| vote_set_maj23 | VoteSetMaj23 | 8 | |
| vote_set_bits | VoteSetBits | 9 |
Channel
Consensus has four separate channels. The channel identifiers are listed below.| Name | Number |
|---|---|
| StateChannel | 32 |
| DataChannel | 33 |
| VoteChannel | 34 |
| VoteSetBitsChannel | 35 |
Message Types
Proposal
Proposal is sent when a new block is proposed. It is a suggestion of what the next block in the blockchain should be.| Name | Type | Description | Field Number |
|---|---|---|---|
| proposal | Proposal | Proposed Block to come to consensus on | 1 |
Vote
Vote is sent to vote for some block (or to inform others that a process does not vote in the current round). Vote contains validator’s information (validator address and index), height and round for which the vote is sent, vote type, blockID if process vote for some block (nil otherwise)
and a timestamp when the vote is sent. The message is signed by the validator private key.
| Name | Type | Description | Field Number |
|---|---|---|---|
| vote | Vote | Vote for a proposed Block | 1 |
BlockPart
BlockPart is sent when gossiping a piece of the proposed block. It contains height, round and the block part.| Name | Type | Description | Field Number |
|---|---|---|---|
| height | int64 | Height of corresponding block. | 1 |
| round | int32 | Round of voting to finalize the block. | 2 |
| part | Part | A part of the block. | 3 |
NewRoundStep
NewRoundStep is sent for every step transition during the core consensus algorithm execution. It is used in the gossip part of the CometBFT consensus protocol to inform peers about a current height/round/step a process is in.| Name | Type | Description | Field Number |
|---|---|---|---|
| height | int64 | Height of corresponding block | 1 |
| round | int32 | Round of voting to finalize the block. | 2 |
| step | uint32 | 3 | |
| seconds_since_start_time | int64 | 4 | |
| last_commit_round | int32 | 5 |
NewValidBlock
NewValidBlock is sent when a validator observes a valid block B in some round r, i.e., there is a Proposal for block B and 2/3+ prevotes for the block B in the round r. It contains height and round in which valid block is observed, block parts header that describes the valid block and is used to obtain all block parts, and a bit array of the block parts a process currently has, so its peers can know what parts it is missing so they can send them. In case the block is also committed, then IsCommit flag is set to true.| Name | Type | Description | Field Number |
|---|---|---|---|
| height | int64 | Height of corresponding block | 1 |
| round | int32 | Round of voting to finalize the block. | 2 |
| block_part_set_header | PartSetHeader | 3 | |
| block_parts | int32 | 4 | |
| is_commit | bool | 5 |
ProposalPOL
ProposalPOL is sent when a previous block is re-proposed. It is used to inform peers in what round the process learned for this block (ProposalPOLRound), and what prevotes for the re-proposed block the process has.| Name | Type | Description | Field Number |
|---|---|---|---|
| height | int64 | Height of corresponding block | 1 |
| proposal_pol_round | int32 | 2 | |
| proposal_pol | bitarray | 3 |
ReceivedVote
ReceivedVote is sent to indicate that a particular vote has been received. It contains height, round, vote type and the index of the validator that is the originator of the corresponding vote.| Name | Type | Description | Field Number |
|---|---|---|---|
| height | int64 | Height of corresponding block | 1 |
| round | int32 | Round of voting to finalize the block. | 2 |
| type | SignedMessageType | 3 | |
| index | int32 | 4 |
VoteSetMaj23
VoteSetMaj23 is sent to indicate that a process has seen +2/3 votes for some BlockID. It contains height, round, vote type and the BlockID.| Name | Type | Description | Field Number |
|---|---|---|---|
| height | int64 | Height of corresponding block | 1 |
| round | int32 | Round of voting to finalize the block. | 2 |
| type | SignedMessageType | 3 |
VoteSetBits
VoteSetBits is sent to communicate the bit-array of votes a process has seen for a given BlockID. It contains height, round, vote type, BlockID and a bit array of the votes a process has.| Name | Type | Description | Field Number |
|---|---|---|---|
| height | int64 | Height of corresponding block | 1 |
| round | int32 | Round of voting to finalize the block. | 2 |
| type | SignedMessageType | 3 | |
| block_id | BlockID | 4 | |
| votes | BitArray | Round of voting to finalize the block. | 5 |
Message
Message is aoneof protobuf type.
| Name | Type | Description | Field Number |
|---|---|---|---|
| new_round_step | NewRoundStep | Height of corresponding block | 1 |
| new_valid_block | NewValidBlock | Round of voting to finalize the block. | 2 |
| proposal | Proposal | 3 | |
| proposal_pol | ProposalPOL | 4 | |
| block_part | BlockPart | 5 | |
| vote | Vote | 6 | |
| received_vote | ReceivedVote | 7 | |
| vote_set_maj23 | VoteSetMaj23 | 8 | |
| vote_set_bits | VoteSetBits | 9 |