Skip to content

fix: Require prepare quorum on NEWVIEW M1 and reject incomplete CX proofs - #5138

Draft
GheisMohammadi wants to merge 2 commits into
devfrom
fix/coreissues
Draft

fix: Require prepare quorum on NEWVIEW M1 and reject incomplete CX proofs#5138
GheisMohammadi wants to merge 2 commits into
devfrom
fix/coreissues

Conversation

@GheisMohammadi

@GheisMohammadi GheisMohammadi commented Aug 27, 2026

Copy link
Copy Markdown
Collaborator

Two small validation fixes. Behavior for normal blocks and valid proofs is unchanged.

NEWVIEW M1 prepare check

During view change, a NEWVIEW message can carry an M1 payload: the prepared block hash, plus the prepare signature and bitmap.

ProcessViewChangeMsg already requires that prepare bitmap to reach quorum. onNewView now does the same:

  • payload must be at least ValidPayloadLength (32-byte hash plus signature bytes) before the hash is read
  • prepare mask must meet quorum
  • prepare signature must still verify against the hash

If those checks fail, the node stays in view change.

Incomplete CX receipts proofs

A cross-shard receipts proof is incomplete if required pointers are missing. Those fields are now treated as empty / invalid before they are used:

  • nil receipt in the Receipts list → GetToShardID returns an error
  • missing MerkleProof.BlockNum or header number → ContainsEmptyField is true
  • nil Amount on CXReceipt.Copy → copy keeps amount as nil (big.Int.Set needs a non-nil source)
  • No extra fork epoch is needed for rollout.

M1 is a prepare certificate: the payload must include the block hash, and the prepare mask must meet quorum.
Nil receipts, merkle block numbers, header numbers, and amounts cannot be read as values.
@GheisMohammadi GheisMohammadi self-assigned this Aug 27, 2026
@GheisMohammadi
GheisMohammadi marked this pull request as draft August 27, 2026 21:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant