fix: parse box value and token amount unbounded from the wire#885
Open
mwaddip wants to merge 1 commit into
Open
fix: parse box value and token amount unbounded from the wire#885mwaddip wants to merge 1 commit into
mwaddip wants to merge 1 commit into
Conversation
… wire The reference implementation reads both with getULong() and no range check (ErgoBoxCandidate.parseBodyWithIndexedDigests), storing them as signed Longs: values in [2^63, 2^64) hydrate and surface as their signed (negative) view at eval (SELF.value, R0, SELF.tokens(0)._2), and there is no minimum at parse either (the min-value-per-byte rule is a node transaction-validation rule, not a deserialization bound). sigma-rust rejected such boxes at sigma_parse via BoxValue/TokenAmount try_from bounds, so a context carrying one could not even be constructed from bytes where the JVM evaluates it. Parse now constructs the values directly; bounds stay enforced in the construction API (new/try_from, checked arithmetic) used for transaction building. The issue-ergoplatform#698 on-chain Coll[Box] register constant accordingly now parses (as on the JVM) instead of failing with ValueOutOfBounds; eval surfaces are pinned by JVM-blessed byte vectors (santa-eval Box.signed_view_u64). Co-Authored-By: Claude Opus 4.8 <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.
The reference impl parses box value and token amounts with
getULong()and no range check (ErgoBoxCandidate.parseBodyWithIndexedDigests), storing signed Longs: values in[2^63, 2^64)hydrate and surface as their signed view at eval (SELF.value,R0,tokens(0)._2), and there is no minimum at parse either (min-value-per-byte is a node tx-validation rule, not a deserialization bound).sigma-rust rejected such boxes at
sigma_parseviaBoxValue/TokenAmountbounds, so a context box the JVM evaluates could not even deserialize. Parse now constructs directly; bounds stay on the construction API (new/try_from, checked arithmetic) used for tx building.The issue-#698 on-chain
Coll[Box]register constant now parses, as on the JVM. Eval pinned by JVM-blessed byte vectors.