Skip to content

feat(contract): add simulation entry point for proposed resource mutations - #1158

Closed
jeffrey-graham wants to merge 1 commit into
mind-vault-1:mainfrom
jeffrey-graham:feat/issue-1067-resource-mutation-simulation
Closed

jeffrey-graham wants to merge 1 commit into
mind-vault-1:mainfrom
jeffrey-graham:feat/issue-1067-resource-mutation-simulation

Conversation

@jeffrey-graham

@jeffrey-graham jeffrey-graham commented Nov 10, 2026 •

Copy link
Copy Markdown

Summary

Adds a read-only simulate_resource_mutation(caller, id, mutation) entry point and ProposedResourceMutation XDR enum (SetPrice(i128), UpdateMetadata(String), TransferOwnership(Address)) to vault-registry.

  • Evaluates the exact same contract pause, lifecycle (ensure_mutable), ownership (resource.owner == caller), and payload validation rules (validate_price_and_share, validate_metadata_len, validate_metadata_pointer, MetadataFrozen, AlreadyOwner) as the state-changing entry points without writing to storage, bumping revision, or emitting events.
  • Returns the previewed post-mutation Resource (with incremented revision) on success or the identical Error code on rejection.
  • Adds focused unit tests in contract/contracts/vault-registry/src/test.rs and updates contract/README.md and docs/mcp-onchain-preflight.md.

Verification

  • cargo test simulate_resource_mutation && cargo test readme_ && cargo test event_schema_ && cargo test storage_key_ (13/13 passed)

Closes #1067

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.

[Contract] [Feature] Add simulation entry point for proposed resource mutations

1 participant