fix(contract): handle scSpecTypeVal in Spec.scValToNative - #1551
Merged
Conversation
…c-val # Conflicts: # CHANGELOG.md
quietbits
approved these changes
Jul 23, 2026
Shaptic
approved these changes
Jul 23, 2026
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.
What
Spec.scValToNativenow short-circuitsscSpecTypeValand delegates to the base untypedscValToNativehelper, mirroring the encoding-side fix from #1485. Values typed asValin a contract spec — whether a bare return value, aVec<Val>element, or a struct field — decode to their natural native representation (Address → string, u32 → number, Symbol → string, vecs/maps recurse).Includes unit tests covering all scalar types plus a regression test reproducing the exact
OutcomeContract { args: Vec<Val> }shape from the issue, decoded throughfuncResToNative. Also verified end-to-end against a live local network with a dummy contract exposing-> Val,-> Vec<Val>, and-> OutcomeContractmethods, called throughcontract.Client.Why
Decoding any contract response containing a
Val-typed string, symbol, vec, or map threw (e.g.ScSpecType scSpecTypeVal was not string or symbol), becausescValToNativevalidated the ScVal against the spec type but had no case for the typelessVal. #1485 fixed the encoding path; this fixes the decoding path so a singleVec<Val>field no longer breaks an entire client call.Closes #1498