Skip to content

consensus: check proposal block size is valid on receiving it #5423

@cmwaters

Description

@cmwaters

Summary

Validators should ensure that block size should not exceed MaxBytes defined in the consensus params

Problem Definition

This check was originally in place but was unfortunately inadvertently removed when migrating to protobuf. There is logic on the proposer side to ensure that the block is of the correct size but if the proposer were to bypass it, it allows them to create blocks of any size where the other validators would approve of it. This only applies for 0.34.

As a side note we should also check to make sure that none of the other validation logic was affected by the protobuf migration.

Proposal

Reimplement the check here:

tendermint/consensus/state.go

Lines 1782 to 1792 in 99aea7b

if added && cs.ProposalBlockParts.IsComplete() {
bz, err := ioutil.ReadAll(cs.ProposalBlockParts.GetReader())
if err != nil {
return added, err
}
var pbb = new(tmproto.Block)
err = proto.Unmarshal(bz, pbb)
if err != nil {
return added, err
}
block, err := types.BlockFromProto(pbb)


For Admin Use

  • Not duplicate issue
  • Appropriate labels applied
  • Appropriate contributors tagged
  • Contributor assigned/self-assigned

Metadata

Metadata

Assignees

No one assigned

    Labels

    C:consensusComponent: ConsensusT:securityType: Security (specify priority)

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions