Block Sync

Channel

Block sync has one channel.

NameNumber
BlockchainChannel64

Message Types

There are multiple message types for Block Sync

BlockRequest

BlockRequest asks a peer for a block at the height specified.

NameTypeDescriptionField Number
Heightint64Height of requested block1

NoBlockResponse

NoBlockResponse notifies the peer requesting a block that the node does not contain it.

NameTypeDescriptionField Number
Heightint64Height of requested block1

BlockResponse

BlockResponse contains the block requested and its commit.

NameTypeDescriptionField Number
BlockbytesRequested Block, serialized as it was committed: the bytes of its parts, in order. On the wire this is the same as an embedded Block.1
CommitCommitCommit for the requested block2

The receiver cuts Block into parts of 64kB, the last one shorter, and checks the part set header it computes against the one in the commit's block ID. Block is served as stored, because decoding and re-encoding the block can change its bytes.

Block sync rebuilds only this standard cut, which honest proposers use. Consensus does not require it yet: it accepts parts of other sizes, and proofs of a tree larger than the header counts. A block committed that way fails the commit check (wrong block ID) whichever peer serves it, and block sync does not get past its height.

StatusRequest

StatusRequest is an empty message that notifies the peer to respond with the highest and lowest blocks it has stored.

Empty message.

StatusResponse

StatusResponse responds to a peer with the highest and lowest block stored.

NameTypeDescriptionField Number
Heightint64Current Height of a node1
baseint64First known block, if pruning is enabled it will be higher than 11

Message

Message is a oneof protobuf type. The oneof consists of five messages.

NameTypeDescriptionField Number
block_requestBlockRequestRequest a block from a peer1
no_block_responseNoBlockResponseResponse saying it doe snot have the requested block2
block_responseBlockResponseResponse with requested block3
status_requestStatusRequestRequest the highest and lowest block numbers from a peer4
status_responseStatusResponseResponse with the highest and lowest block numbers the store5