fix(ergotree-ir): Global.powHit returns UnsignedBigInt, not Boolean#877
Open
mwaddip wants to merge 1 commit into
Open
fix(ergotree-ir): Global.powHit returns UnsignedBigInt, not Boolean#877mwaddip wants to merge 1 commit into
mwaddip wants to merge 1 commit into
Conversation
powHit computes the Autolykos-2 PoW hit value (a big integer), so its
result type is UnsignedBigInt — matching Scala SGlobalMethods.powHit and
the interpreter's POW_HIT_EVAL_FN, which already yields
Value::UnsignedBigInt. The descriptor mis-declared SBoolean, so
coll.map(x => Global.powHit(..)).exists((u: UnsignedBigInt) => ..) failed
parse-time type-checking ("Invalid condition tpe"), wedging a full node
off testnet at canonical block 28,474.
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.
Global.powHit(the Autolykos-2 hit value) was typedSBooleanin its method descriptor, but it returns a big integer — ScalaSGlobalMethods.powHitreturnsSUnsignedBigInt, and the interpreter'sPOW_HIT_EVAL_FNalready yieldsValue::UnsignedBigInt.The mistype broke parse-time type-checking of
coll.map(x => Global.powHit(..)).exists((u: UnsignedBigInt) => ..): the mapped collection resolved toColl[Boolean], soExists::newrejected theUnsignedBigInt => Booleanpredicate ("Invalid condition tpe"). A full node wedges off testnet at canonical block 28,474 (accepted by JVM 6.0.3).One-line type fix + regression tests (the descriptor, and the real block-28,474 tree parsing end-to-end). Serialization is unaffected — the return type is derived, never on the wire.