Repository navigation
fix(contracts): restrict cancel_vault to Draft vaults and use Symbol event topics - #1752
Merged
1nonlypiece merged 2 commits intoOct 24, 2026
Conversation
…event topics - Restrict cancel_vault to Draft status; return Error::NotDraft for non-Draft vaults (Active, Completed, Failed, Cancelled, Disputed) without mutating status or moving token balances. - Ensure cancel_vault cannot be used to dodge slash_on_miss on overdue vaults. - Standardize emitted event topics to Symbol for vault_cancelled, vault_disputed, and vault_dispute_resolved (replacing String topics). - Introduce Destinations struct for create_vault to group success and failure destinations within Soroban SDK's 10-parameter limit. - Update AccountabilityVault spec and contracts/README.md documentation. - Add unit tests for non-draft cancel rejection, slash unblocking, and Symbol event topics. Fixes Disciplr-Org#1706
|
@Stephan-Thomas Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves #1706
Summary
Restrict
cancel_vaulttoDraftvaults so funded stakes cannot be locked forever, and standardize event topics across cancellation and administrative disputes to useSymbolrather thanString.Why
Previously,
cancel_vaultaccepted a vault in any status. For non-Draftvaults it set status toCancelledwithout transferring the stake back to the creator, permanently locking funded stakes because settlement pathways (claim,slash_on_miss) requireActivestatus. This also allowed creators of overdue vaults to callcancel_vaultand evadeslash_on_misspenalties. In addition,cancel_vault,admin_dispute, andadmin_resolveemitted inconsistent event topics (Stringinstead ofSymbol).Scope & Changes
cancel_vault, returnErr(Error::NotDraft)ifvault.status != VaultStatus::Draft. Removed the fall-through branch.Symbol:vault_cancelled->Symbol::new(&env, "vault_cancelled")vault_disputed->Symbol::new(&env, "vault_disputed")vault_dispute_resolved->Symbol::new(&env, "vault_dispute_resolved")Destinationsstruct (success: Address,failure: Address) to maintaincreate_vaultparameter count within Soroban SDK's 10-parameter limit.contracts/accountability_vault/spec/AccountabilityVault.spec.jsonforcreate_vaultargument grouping.contracts/README.mdevents list and migration section documentingcancel_vaultvswithdrawandSymboltopics.test_cancel_rejected_for_each_non_draft_status: table-driven test verifyingcancel_vaultonActive,Completed,Failed,Cancelled, andDisputedreturnsError::NotDraftwithout modifying state or balances.test_cancel_cannot_block_slash: verifies that an overdue vault cannot evade slashing viacancel_vault; after failed cancellation,slash_on_missproceeds and transfers stake tofailure_destination.test_cancel_draft_event_topic_is_symbol: assertsvault_cancelledtopic isSymboland notString.test_dispute_events_use_symbol_topics: assertsvault_disputedandvault_dispute_resolvedtopics areSymboland notString.Testing
cargo test: All 41 unit tests incontracts/accountability_vaultpassed (finished in 2.31s).cargo clippy --all-targets -- -D warnings: Passed cleanly with zero warnings.