fix: tolerate absent/non-bytearray context var in DeserializeContext substitution#879
Open
mwaddip wants to merge 2 commits into
Open
fix: tolerate absent/non-bytearray context var in DeserializeContext substitution#879mwaddip wants to merge 2 commits into
mwaddip wants to merge 2 commits into
Conversation
…ubstitution
substitute_deserialize rewrites the whole tree, so a DeserializeContext over a context-extension variable absent from the transaction errored (ExtensionKeyNotFound) even when the node sat on a branch the live reduction never takes. This diverges from the JVM: Interpreter.substDeserialize returns None for an absent var, leaving the node in place (everywherebu), and the sibling DeserializeRegister branch here already does the same.
Leave the node unchanged on an absent var, mirroring both. A leftover node on the live path still errors at eval ("DeserializeContext cannot be evaluated"), so this cannot make a live-path deserialize silently pass. Fixes a sync wedge on testnet block 111,927 (tx 2, input 0: empty proof, empty extension, DeserializeContext(0) on a dead `if` branch). The now-unreachable ExtensionKeyNotFound variant is removed.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…ntext substitution Completes parity with Interpreter.substDeserialize, whose inner match returns None not only for an absent var but also for a present var that is not an SByteArray (`case _ => None`), leaving the node in place. Mirror it: a DeserializeContext over a present-but-wrong-typed var on a dead branch no longer sinks reduction. A wrong-typed var on the live path still errors at eval (eval_context_extension_wrong_type), so this stays safe. 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.
substitute_deserializerewrites the whole tree, so aDeserializeContextover a context-extension variable that is absent (or present but notColl[Byte]) errored even when the node sat on a branch the live reduction never takes.The JVM
Interpreter.substDeserializereturnsNonein both cases, leaving the node; the siblingDeserializeRegisteralready does the same. This mirrors them. A leftover node on the live path still errors at eval (DeserializeContext cannot be evaluated), so a live-path deserialize cannot silently pass.Fixes a full-node sync wedge on testnet block 111,927 (tx 2 input 0: empty proof, empty extension,
DeserializeContext(0)on a deadifbranch).Two commits: absent var, then non-bytearray var (full
substDeserializeparity).