Skip to content

feat: Move VaultDelete invariants from ValidVault to VaultDelete#7436

Draft
Tapanito wants to merge 1 commit into
tapanito/vault-create-invariantsfrom
tapanito/vault-delete-invariants
Draft

feat: Move VaultDelete invariants from ValidVault to VaultDelete#7436
Tapanito wants to merge 1 commit into
tapanito/vault-create-invariantsfrom
tapanito/vault-delete-invariants

Conversation

@Tapanito

@Tapanito Tapanito commented Jun 9, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Moves the ttVAULT_DELETE-specific invariant checks from ValidVault::finalize into VaultDelete::visitInvariantEntry / VaultDelete::finalizeInvariants, following the same pattern established for VaultCreate in the parent branch.
  • Extends VaultInvariantData with a beforeMPTs_ vector and a findDeletedShares(mptID) accessor so VaultDelete can locate the deleted MPTokenIssuance without depending on ValidVault's internals.
  • The "vault deleted by a wrong transaction type" sentinel in ValidVault is kept — it guards against any non-ttVAULT_DELETE transaction that inadvertently deletes a vault entry. The "vault deletion succeeded without deleting a vault" sentinel (triggered when ttVAULT_DELETE runs but the vault still exists) is now owned by VaultDelete::finalizeInvariants. The delete-specific emptiness checks (no shares, no assets total, no assets available) are also moved to VaultDelete.

Checks moved from ValidVault → VaultDelete

  1. afterVaults().empty() — vault was actually deleted (sentinel)
  2. findDeletedShares(shareMPTID) found — shares issuance was also deleted
  3. sharesTotal == 0 — no outstanding shares at deletion time
  4. beforeVault.assetsTotal == 0 — no assets outstanding
  5. beforeVault.assetsAvailable == 0 — no assets available

Test plan

  • ./xrpld -u Vault,Invariants passes with 437 cases, 0 failures

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.

1 participant