github.com/aakash4dev/cometbft@v0.38.2/spec/p2p/legacy-docs/messages/consensus.md (about) 1 --- 2 order: 7 3 --- 4 5 # Consensus 6 7 ## Channel 8 9 Consensus has four separate channels. The channel identifiers are listed below. 10 11 | Name | Number | 12 |--------------------|--------| 13 | StateChannel | 32 | 14 | DataChannel | 33 | 15 | VoteChannel | 34 | 16 | VoteSetBitsChannel | 35 | 17 18 ## Message Types 19 20 ### Proposal 21 22 Proposal is sent when a new block is proposed. It is a suggestion of what the 23 next block in the blockchain should be. 24 25 | Name | Type | Description | Field Number | 26 |----------|----------------------------------------------------|----------------------------------------|--------------| 27 | proposal | [Proposal](../../../core/data_structures.md#proposal) | Proposed Block to come to consensus on | 1 | 28 29 ### Vote 30 31 Vote is sent to vote for some block (or to inform others that a process does not vote in the 32 current round). Vote is defined in the 33 [Blockchain](https://github.com/aakash4dev/cometbft/blob/main/spec/core/data_structures.md#blockidd) 34 section and contains validator's 35 information (validator address and index), height and round for which the vote is sent, vote type, 36 blockID if process vote for some block (`nil` otherwise) and a timestamp when the vote is sent. The 37 message is signed by the validator private key. 38 39 | Name | Type | Description | Field Number | 40 |------|--------------------------------------------|---------------------------|--------------| 41 | vote | [Vote](../../../core/data_structures.md#vote) | Vote for a proposed Block | 1 | 42 43 ### BlockPart 44 45 BlockPart is sent when gossiping a piece of the proposed block. It contains height, round 46 and the block part. 47 48 | Name | Type | Description | Field Number | 49 |--------|--------------------------------------------|----------------------------------------|--------------| 50 | height | int64 | Height of corresponding block. | 1 | 51 | round | int32 | Round of voting to finalize the block. | 2 | 52 | part | [Part](../../../core/data_structures.md#part) | A part of the block. | 3 | 53 54 ### NewRoundStep 55 56 NewRoundStep is sent for every step transition during the core consensus algorithm execution. 57 It is used in the gossip part of the CometBFT consensus protocol to inform peers about a current 58 height/round/step a process is in. 59 60 | Name | Type | Description | Field Number | 61 |--------------------------|--------|----------------------------------------|--------------| 62 | height | int64 | Height of corresponding block | 1 | 63 | round | int32 | Round of voting to finalize the block. | 2 | 64 | step | uint32 | | 3 | 65 | seconds_since_start_time | int64 | | 4 | 66 | last_commit_round | int32 | | 5 | 67 68 ### NewValidBlock 69 70 NewValidBlock is sent when a validator observes a valid block B in some round r, 71 i.e., there is a Proposal for block B and 2/3+ prevotes for the block B in the round r. 72 It contains height and round in which valid block is observed, block parts header that describes 73 the valid block and is used to obtain all 74 block parts, and a bit array of the block parts a process currently has, so its peers can know what 75 parts it is missing so they can send them. 76 In case the block is also committed, then IsCommit flag is set to true. 77 78 | Name | Type | Description | Field Number | 79 |-----------------------|--------------------------------------------------------------|----------------------------------------|--------------| 80 | height | int64 | Height of corresponding block | 1 | 81 | round | int32 | Round of voting to finalize the block. | 2 | 82 | block_part_set_header | [PartSetHeader](../../../core/data_structures.md#partsetheader) | | 3 | 83 | block_parts | int32 | | 4 | 84 | is_commit | bool | | 5 | 85 86 ### ProposalPOL 87 88 ProposalPOL is sent when a previous block is re-proposed. 89 It is used to inform peers in what round the process learned for this block (ProposalPOLRound), 90 and what prevotes for the re-proposed block the process has. 91 92 | Name | Type | Description | Field Number | 93 |--------------------|----------|-------------------------------|--------------| 94 | height | int64 | Height of corresponding block | 1 | 95 | proposal_pol_round | int32 | | 2 | 96 | proposal_pol | bitarray | | 3 | 97 98 ### ReceivedVote 99 100 ReceivedVote is sent to indicate that a particular vote has been received. It contains height, 101 round, vote type and the index of the validator that is the originator of the corresponding vote. 102 103 | Name | Type | Description | Field Number | 104 |--------|------------------------------------------------------------------|----------------------------------------|--------------| 105 | height | int64 | Height of corresponding block | 1 | 106 | round | int32 | Round of voting to finalize the block. | 2 | 107 | type | [SignedMessageType](../../../core/data_structures.md#signedmsgtype) | | 3 | 108 | index | int32 | | 4 | 109 110 ### VoteSetMaj23 111 112 VoteSetMaj23 is sent to indicate that a process has seen +2/3 votes for some BlockID. 113 It contains height, round, vote type and the BlockID. 114 115 | Name | Type | Description | Field Number | 116 |--------|------------------------------------------------------------------|----------------------------------------|--------------| 117 | height | int64 | Height of corresponding block | 1 | 118 | round | int32 | Round of voting to finalize the block. | 2 | 119 | type | [SignedMessageType](../../../core/data_structures.md#signedmsgtype) | | 3 | 120 121 ### VoteSetBits 122 123 VoteSetBits is sent to communicate the bit-array of votes a process has seen for a given 124 BlockID. It contains height, round, vote type, BlockID and a bit array of 125 the votes a process has. 126 127 | Name | Type | Description | Field Number | 128 |----------|------------------------------------------------------------------|----------------------------------------|--------------| 129 | height | int64 | Height of corresponding block | 1 | 130 | round | int32 | Round of voting to finalize the block. | 2 | 131 | type | [SignedMessageType](../../../core/data_structures.md#signedmsgtype) | | 3 | 132 | block_id | [BlockID](../../../core/data_structures.md#blockid) | | 4 | 133 | votes | BitArray | Round of voting to finalize the block. | 5 | 134 135 ### Message 136 137 Message is a [`oneof` protobuf type](https://developers.google.com/protocol-buffers/docs/proto#oneof). 138 139 | Name | Type | Description | Field Number | 140 |-----------------|---------------------------------|----------------------------------------|--------------| 141 | new_round_step | [NewRoundStep](#newroundstep) | Height of corresponding block | 1 | 142 | new_valid_block | [NewValidBlock](#newvalidblock) | Round of voting to finalize the block. | 2 | 143 | proposal | [Proposal](#proposal) | | 3 | 144 | proposal_pol | [ProposalPOL](#proposalpol) | | 4 | 145 | block_part | [BlockPart](#blockpart) | | 5 | 146 | vote | [Vote](#vote) | | 6 | 147 | received_vote | [ReceivedVote](#receivedvote) | | 7 | 148 | vote_set_maj23 | [VoteSetMaj23](#votesetmaj23) | | 8 | 149 | vote_set_bits | [VoteSetBits](#votesetbits) | | 9 |