fix(generate-pie): strip VM tracebacks for "callee not deployed" reverts in receipt hashing#518
Closed
Mohiiit wants to merge 1 commit into
Closed
fix(generate-pie): strip VM tracebacks for "callee not deployed" reverts in receipt hashing#518Mohiiit wants to merge 1 commit into
Mohiiit wants to merge 1 commit into
Conversation
…rts in receipt hashing
The block-hash receipt commitment is hashed over the revert-reason string. For a
contract call whose callee is not deployed, blockifier renders the caller's VM
traceback ("Error at pc=...\nCairo traceback ..."), but the canonical chain
receipt omits it. `should_strip_vm_tracebacks` was gated on a constructor frame
only, so SNOS hashed the un-stripped string, computed a different
receipt_commitment, and therefore a different block hash -- failing the OS
`block_hash.cairo` consistency assertion.
Extend the gate to also fire for the "...is not deployed." shape so the receipt
commitment is computed over the same (stripped) string the chain stored. The
constructor-chain path is unchanged.
Validated against Paradex mocknet block 138087 (tx
0x37e4ace7cf678da99e30d39c32677dd197a7babbd51b4d05e4faccf921cfa8d): the receipt
revert reason goes 822 -> 701 chars, receipt_commitment becomes 0x286ef0...aaf2b5,
block hash becomes 0x43fabc...857f50, and SNOS PIE generation completes (previously
failed at block_hash.cairo:79). Adds a starknet_keccak regression pinning the exact
receipt bytes plus strip/no-strip coverage.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
SNOS fails the OS block-hash consistency assertion (
block_hash.cairo:79) on blocks containing a transaction that reverts because a called contract is not deployed.Observed on Paradex mocknet block 138087 (SnosRun batch covering 138086–138090):
This wedges the orchestrator (the failed SNOS job halts new job creation).
Root cause
The OS does not compute the block-hash commitments itself — the
get_block_hasheshint feeds them in fromos_input.block_hash_commitments, which SNOS builds ingenerate-pie. Of the four commitments, onlyreceipt_commitmentdiverged from the canonical chain value:0x13aa89…0x13aa89…0x5a0a24…0x5a0a24…0x247f69…0x286ef0…0x55da92…0x55da92…The receipt commitment is hashed over the transaction's revert-reason string. For the failing tx (
0x37e4ace…), the callee (class hash0x0) is not deployed, so blockifier renders the caller's VM traceback:The canonical chain receipt omits that traceback block (822 → 701 chars). But
should_strip_vm_tracebacksonly stripped tracebacks for the constructor-chain shape (has_constructor_frame && "Execution failed. Failure reason:"). This stack has noConstructorframe, so SNOS hashed the un-stripped 822-char string → wrongreceipt_commitment→ wrong block hash → assertion failure.Fix
Extend
should_strip_vm_tracebacksto also fire for the "callee not deployed" shape (aStringFramecontaining"is not deployed."), so the receipt commitment is hashed over the same stripped string the chain stored. The existing constructor-chain path is unchanged (refactored into a namedis_nested_constructor_failurehelper for clarity).Validation
Re-ran
generate-pieagainst the live mocknet RPC for block 138087 (SNOS v0.14.2-rc.2 / sequencerAPOLLO-0.14.2-RC.7):strip_applied=true, 822 → 701 charsreceipt_commitment=0x286ef0…aaf2b5(matches chain)0x43fabc…857f50PIE generation completed successfully— noblock_hash.cairoassertionTests
cargo test -p generate-pie revert_reason— 11 passed, 0 failed. New:undeployed_contract_revert_strips_vm_tracebacks_for_block_hashtransaction_output_uses_stripped_undeployed_revert_reasonundeployed_contract_revert_reason_hash_regression— pins the exact 701-char receipt bytes viastarknet_keccak(0xc31ec2f2…), the value behind the on-chainreceipt_commitment.Pre-existing revert-reason tests (incl. the non-constructor "keeps tracebacks" case) remain green, so the change is non-regressive.
🤖 Generated with Claude Code