Skip to content

[PVM] Limit instruction data size and jump table entries in deblob - #377

Merged
0xjunha merged 1 commit into
mainfrom
limit-blob-size
Nov 20, 2026
Merged

0xjunha merged 1 commit into
mainfrom
limit-blob-size

Conversation

@0xjunha

@0xjunha 0xjunha commented Nov 20, 2026

Copy link
Copy Markdown
Member

Summary

Implements Gray Paper #559, applying code blob size limit in blob function.

cmov gas rule of the same PR comes with the new PVM gas model (GP #508).

Deviation from GP v0.8.0

  • GP v0.8.0 deblob has no size limits.
  • The 0.8.0 conformance material already applies this change.

Changes

  • deblob_program_code checks |j|, z and |c| right after decoding each one. It then checks that the rest of the blob is exactly j, c and k before reading any data. This replaces the trailing-octet check, and a short blob can no longer reserve the sizes its header claims.
  • New constants MAX_INSTRUCTION_DATA_SIZE (Z_C), MAX_JUMP_TABLE_ENTRY_COUNT (Z_J) and MAX_JUMP_TABLE_ENTRY_SIZE, with an error per limit.
  • A failure is handled like any other deblob failure. machine returns HUH, and Ψ_M panics once [PVM] Fix Ψ_M to panic when the program fails to load lands.
  • Z_C is reachable only through machine, since other invocations bound their code by W_A or W_C first.

- implements the size limits of Graypaper #559
- fails `deblob_program_code` when `|j|` exceeds `Z_J`, `z` exceeds 4 octets or `|c|` exceeds `Z_C`, and checks that the rest of the blob is exactly `j`, `c` and `k` before reading any data
- adds `MAX_INSTRUCTION_DATA_SIZE`, `MAX_JUMP_TABLE_ENTRY_COUNT` and `MAX_JUMP_TABLE_ENTRY_SIZE` with an error per limit
- tests each limit at the bound and one above it with valid `trap` programs, and a rest that does not match the sizes
@0xjunha
0xjunha merged commit f28b3c2 into main Nov 20, 2026
1 check passed
@0xjunha
0xjunha deleted the limit-blob-size branch November 20, 2026 04:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant