Skip to content

Commit

Permalink
reject proof at infinity when validating blobs
Browse files Browse the repository at this point in the history
Currently, passing `0xc00000...` proof seems to pass `verifyProofs`.
Unsure why such a check is not necessary in spec, and also unsure
whether it is correct to reject proof at infinity, or if it could
occur, e.g., for a blob containing all 0 bytes. Weird overall...
  • Loading branch information
etan-status committed Sep 19, 2023
1 parent 6344076 commit 905ad2e
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions beacon_chain/spec/state_transition_block.nim
Original file line number Diff line number Diff line change
Expand Up @@ -791,6 +791,13 @@ proc validate_blobs*(expected_kzg_commitments: seq[KzgCommitment],
if proofs.len != blobs.len:
return err("validate_blobs: different proof and blob lengths")

const infinityProof = KzgProof([
0xc0.byte, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])
if infinityProof in proofs:
return err("validate_blobs: proof at infinity is not allowed")

if verifyProofs(blobs, expected_kzg_commitments, proofs).isErr():
return err("validate_blobs: proof verification failed")

Expand Down

0 comments on commit 905ad2e

Please sign in to comment.