Skip to content

fix(contract): handle scSpecTypeVal in Spec.scValToNative - #1551

Merged
Ryang-21 merged 4 commits into
mainfrom
fix-scvaltonative-spec-val
Jul 23, 2026
Merged

fix(contract): handle scSpecTypeVal in Spec.scValToNative#1551
Ryang-21 merged 4 commits into
mainfrom
fix-scvaltonative-spec-val

Conversation

@Ryang-21

Copy link
Copy Markdown
Contributor

What

Spec.scValToNative now short-circuits scSpecTypeVal and delegates to the base untyped scValToNative helper, mirroring the encoding-side fix from #1485. Values typed as Val in a contract spec — whether a bare return value, a Vec<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 through funcResToNative. Also verified end-to-end against a live local network with a dummy contract exposing -> Val, -> Vec<Val>, and -> OutcomeContract methods, called through contract.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), because scValToNative validated the ScVal against the spec type but had no case for the typeless Val. #1485 fixed the encoding path; this fixes the decoding path so a single Vec<Val> field no longer breaks an entire client call.

Closes #1498

Copilot AI review requested due to automatic review settings July 16, 2026 23:31
@github-project-automation github-project-automation Bot moved this to Backlog (Not Ready) in DevX Jul 16, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.

@Ryang-21
Ryang-21 merged commit 600d619 into main Jul 23, 2026
12 of 13 checks passed
@github-project-automation github-project-automation Bot moved this from Backlog (Not Ready) to Done in DevX Jul 23, 2026
@Ryang-21
Ryang-21 deleted the fix-scvaltonative-spec-val branch July 23, 2026 22:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

get_dao response fails to decode when a returned struct contains Vec<Val> (scSpecTypeVal)

4 participants