Skip to content

fix(contract): add auth fixture helpers and tombstone read tests (#641 #624) - #769

Merged
manoahLinks merged 1 commit into
mind-vault-1:mainfrom
Prozaks:fix/624-641-contract-auth-tombstone-tests
Aug 31, 2026
Merged

fix(contract): add auth fixture helpers and tombstone read tests (#641 #624)#769
manoahLinks merged 1 commit into
mind-vault-1:mainfrom
Prozaks:fix/624-641-contract-auth-tombstone-tests

Conversation

@Prozaks

@Prozaks Prozaks commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Summary

Closes #641 — Add Soroban auth fixture helpers
Closes #624 — Add tombstone read behavior documentation tests

Changes

auth_fixtures.rs (issue #641)

Added contract/contracts/vault-registry/src/test/auth_fixtures.rs — a module of reusable MockAuth/MockAuthInvoke fixture helpers for contract tests.

  • Per-method invoke builders for all creator-gated methods: set_price, update_metadata, set_tags, set_listed, delist, transfer_ownership, freeze_metadata
  • Invoke builder for verifier-gated method: set_verification_status
  • Invoke builder for admin-gated method: tombstone_resource
  • setup_with_verifier convenience helper (env + creator + admin + verifier + client)
  • Acceptance tests for every helper: correct signer succeeds, wrong signer panics (strict auth enforcement)

tombstone_read.rs (issue #624)

Added contract/contracts/vault-registry/src/test/tombstone_read.rs — documentation tests for the exact read behaviour after tombstoning.

Covers 10 sections:

  1. get(id) — tombstoned resource still readable with preserved fields
  2. exists(id) / exists_many — still return true
  3. get_owner — last owner still readable
  4. count() — monotonic, does not decrement
  5. list / list_page — tombstoned entries remain in canonical catalog
  6. list_by_tag — tombstoned resource removed from tag index
  7. list_by_creator / creator_resource_count — excluded and decremented
  8. list_listed / listed_count — excluded and decremented
  9. Mutation guards — all creator mutations blocked with ResourceNotMutable
  10. get_many — batch read includes tombstoned entries

Test Results

  • 429 tests pass (up from 388 on upstream main)
  • 13 failing tests are pre-existing on main and unrelated to these changes

Notes

Rebased cleanly on current main (b49c495a).

…one read tests (mind-vault-1#624)

- Add auth_fixtures.rs: reusable MockAuth/MockAuthInvoke builders for every
  creator-gated, verifier-gated, and admin-gated contract method, with
  acceptance tests confirming correct signer succeeds and wrong signer panics.

- Add tombstone_read.rs: documentation tests for all tombstone read semantics:
  get/exists/get_owner remain readable, count stays monotonic, list/list_page
  include tombstoned entries, tag/creator/listed indexes exclude them, and all
  creator mutations return ResourceNotMutable.

Supporting compilation fixes:
- Remove duplicate TTL_DAY_IN_LEDGERS const in lib.rs
- Remove unimplemented list_payments from METHOD_SCHEMA
- Fix DataKey::PaymentReceipt pattern match (1-arg not 2-arg)
- Update storage_key_migration_covers_every_variant count (18→23) and add
  missing variants (PaymentIndex, Paused, Settler, ListedCount, AttestationHash)
- Fix receipt_keys test to use PaymentIndex instead of 2-arg PaymentReceipt
- Fix listed_count tests to use String::from_str instead of bare &str literals
- Add &None as 4th arg to set_verification_status calls in lifecycle_roles.rs,
  moderation_pause.rs, properties_events.rs, schema_registry.rs
- Fix set_verification_status event decoder to read 3-tuple (adds attestation_hash)
- Replace env_without_snapshots() with Env::default() in hardening_preflight.rs,
  properties_events.rs, metadata_updates.rs
- Update vault-registry README: schema version 5→6, add v6 history row,
  add get_attestation_hash and listed_count to Methods table,
  add Contract version compatibility section to contract/README.md

All 401 tests pass.

Closes mind-vault-1#624
Closes mind-vault-1#641
@manoahLinks
manoahLinks merged commit 01c3f91 into mind-vault-1:main Aug 31, 2026
6 of 9 checks passed
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] Add Soroban auth fixture helpers [Contract] Add tombstone read behavior documentation tests

2 participants