Skip to content

[PVM] Fix Psi_M to panic when the program fails to load - #374

Merged
0xjunha merged 1 commit into
mainfrom
psi-m-load-panic
Nov 17, 2026
Merged

0xjunha merged 1 commit into
mainfrom
psi-m-load-panic

Conversation

@0xjunha

@0xjunha 0xjunha commented Nov 17, 2026

Copy link
Copy Markdown
Member

Summary

Fixes Ψ_M so that a program which fails standard program initialization (Y) or deblob ends the invocation with the PVM exit reason panic and gas used 0. Before, the failure became an error that rejected the whole block. The rule is the same in GP v0.7.2 and v0.8.0, so this is not a deviation.

What was wrong

  • invoke_with_args returned Err(PVMError) for from_standard_program, is_program_size_valid check and ProgramLoader::load_program. In accumulation this became a TransitionError and rejected the block.

Changes

  • get_or_load_program reads the global program cache and loads the program on a miss. It returns None when Y or deblob fails, and such a program is not cached.
  • invoke_with_args returns PVMInvocationResult::panic(0) on None, as it already did when PVM::new_with_formatted_program fails.
  • Internal errors (e.g. hashing) still propagate.
  • This covers every Ψ_M caller (accumulate, refine, is-authorized).

- follows `Ψ_M` of the Graypaper, which yields the PVM exit reason `panic` with no gas used when `Y` or `deblob` fails, where FastRoll returned an error and rejected the block
- adds `get_or_load_program`, which returns `None` for such a program and does not cache it
- returns `PVMInvocationResult::panic(0)` from `invoke_with_args` on `None`
- tests the load failures and a `Ψ_M` panic on a program failing `deblob`
@0xjunha
0xjunha merged commit d19450f into main Nov 17, 2026
1 check passed
@0xjunha
0xjunha deleted the psi-m-load-panic branch November 17, 2026 12:31
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