fix: reject unsupported (arity != 2) tuple-typed values at eval (JVM checkType)#897
Open
mwaddip wants to merge 2 commits into
Open
fix: reject unsupported (arity != 2) tuple-typed values at eval (JVM checkType)#897mwaddip wants to merge 2 commits into
mwaddip wants to merge 2 commits into
Conversation
…checkType) The JVM checkTypes each Tuple item (values.scala:801/804) via SType.isValueOfType, which rejects a tuple type of arity != 2 (and a function type of arity != 1) with "Unsupported tuple type" (SType.scala:200-205). sigma-rust models flat N-ary tuples (TupleItems 2..=255), so an arity-3 tuple carried as a constant (the item of a valid pair) evaluated where the JVM rejects — a consensus accept/reject divergence. Add check_value_type mirroring isValueOfType's reachable rejections and call it at the Tuple-eval items. Placeholder constants are substituted into the body before eval on this branch, so the segregated case reduces to the same inline Tuple-item case; the eni cherry-pick additionally guards ConstantPlaceholder eval (where eni resolves placeholders lazily). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
kushti
requested changes
Jun 23, 2026
| // (arity != 2) is rejected ("Unsupported tuple type", SType.scala:200). | ||
| // Catches an arity-3 tuple constant carried as a pair item, which the | ||
| // JVM refuses but sigma-rust would otherwise evaluate. | ||
| crate::eval::check_value_type(&i.tpe())?; |
Member
There was a problem hiding this comment.
Better to check type before evaluation to abort earlier if type is not ok?
Mirror the JVM order: checkType before evaluating each item (values.scala:801/804). Aborts earlier if the type is unsupported rather than doing the eval work first. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
kushti
approved these changes
Jun 23, 2026
mwaddip
added a commit
to mwaddip/sigma-rust
that referenced
this pull request
Jun 23, 2026
Mirror the JVM order: checkType before evaluating each Tuple item (values.scala:801/804). Aborts earlier if the type is unsupported. Co-Authored-By: Claude Fable 5 <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 JVM checkTypes each Tuple item (values.scala:801/804) via SType.isValueOfType, which rejects a tuple type of arity != 2 with "Unsupported tuple type" (SType.scala:200-205). sigma-rust models flat N-ary tuples (2..=255), so an arity-3 tuple carried as a constant (the item of a valid pair) evaluated where the JVM rejects — a consensus accept/reject divergence on crafted trees.
Adds check_value_type (eval.rs) mirroring isValueOfType's reachable rejections, called on Tuple-eval items. Constants are substituted into the body before eval on develop, so the segregated-constant case reduces to the same inline Tuple-item case.
Regression tests drive the JVM-blessed vector bytes end-to-end (parse → eval → expect the eval error).