Skip to content

Fix ContractInstance storage in ScVal::validate - #600

Merged
leighmcculloch merged 2 commits into
mainfrom
validate-contract-instance-storage
Oct 8, 2026
Merged

leighmcculloch merged 2 commits into
mainfrom
validate-contract-instance-storage

Conversation

@leighmcculloch

@leighmcculloch leighmcculloch commented Sep 29, 2026 •

Copy link
Copy Markdown
Member

What

Make ScVal::validate check a contract instance's storage map with the same rules as any other map.

Why

validate() returned Ok for a ScVal::ContractInstance whose storage was unsorted, had duplicate keys, or held invalid values, even though the Soroban host rejects such storage when it loads the instance.

Close #599

Known limitations

validate() still accepts values the host can't put in a map, such as LedgerKeyNonce or claimable balance addresses.

Copilot AI lite review requested due to automatic review settings September 29, 2026 14:56
@leighmcculloch leighmcculloch changed the title Check ContractInstance storage in ScVal::validate Fix ContractInstance storage in ScVal::validate Sep 29, 2026
@leighmcculloch
leighmcculloch requested a review from a team September 29, 2026 14:57

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🟢 Approval recommended

No unresolved blocking issues were identified.

Review effort: Lite
Findings: None

What changed in this PR

Updates ScVal::validate to validate ContractInstance storage maps recursively.

Changes:

  • Applies standard map validation to contract storage.
  • Adds tests for ordering, duplicates, invalid values, and nested storage.
File Summary
src/​scval_validations.rs Adds contract storage validation and test coverage.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@anupsdf
anupsdf requested a review from sisuresh September 29, 2026 18:25
@leighmcculloch
leighmcculloch requested a review from a team October 5, 2026 22:13
Copilot AI lite review requested due to automatic review settings October 5, 2026 22:13

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🟢 Approval recommended

No unresolved blocking issues were identified.

Review effort: Lite
Findings: None

@leighmcculloch
leighmcculloch added this pull request to the merge queue Oct 8, 2026
Merged via the queue into main with commit 541ca7e Oct 8, 2026
407 checks passed
@leighmcculloch
leighmcculloch deleted the validate-contract-instance-storage branch October 8, 2026 01:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ScVal::validate does not check ContractInstance storage

3 participants