Skip to content

Allow cancellation of approved withdrawal requests#446

Merged
Bridgerz merged 1 commit intomainfrom
allow-cancel-approved-withdrawal
Apr 13, 2026
Merged

Allow cancellation of approved withdrawal requests#446
Bridgerz merged 1 commit intomainfrom
allow-cancel-approved-withdrawal

Conversation

@Bridgerz
Copy link
Copy Markdown
Contributor

Summary

  • Removes the ECannotCancelAfterApproval guard from cancel_withdrawal()
  • Withdrawal requests can now be cancelled while in Requested or Approved state
  • Once the committee commits the request to a WithdrawalTransaction (status moves to Processing, BTC is burned, request moves to processed bag), cancellation is no longer possible — borrow_request() will abort since the request is no longer in the requests bag

Why

Previously, approval was treated as the point of no return. But between Approved and Processing there's a window where the request is still in the active requests bag with its full BTC balance intact. The actual irreversible step is commit_requests(), which drains the BTC and moves the request to the processed bag. Allowing cancellation in the Approved state gives users more flexibility without any safety risk.

Test plan

  • test_approve_then_cancel — now verifies successful cancellation returns full BTC
  • sui move test -p packages/hashi — 71/71 pass
  • prettier-move -c — formatting clean

🤖 Generated with Claude Code

@Bridgerz Bridgerz requested a review from bmwill as a code owner April 13, 2026 21:06
#[expected_failure(abort_code = hashi::withdraw::ECannotCancelAfterApproval)]
/// Cancelling an approved (but not yet processing) request should succeed
/// and return the full BTC balance to the requester.
fun test_approve_then_cancel() {
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.

can we add a test for trying to cancel a request that was entered into the processed state?

Withdrawal requests can now be cancelled while in the Approved state,
not just Requested. The BTC balance is still intact until the committee
commits the request to a WithdrawalTransaction (Processing), so
cancellation is safe in both states.
@Bridgerz Bridgerz force-pushed the allow-cancel-approved-withdrawal branch from 6344be2 to 9514d84 Compare April 13, 2026 21:45
@Bridgerz
Copy link
Copy Markdown
Contributor Author

@bmwill ready for another round

@Bridgerz Bridgerz merged commit 7d651ea into main Apr 13, 2026
5 checks passed
@Bridgerz Bridgerz deleted the allow-cancel-approved-withdrawal branch April 13, 2026 22:08
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.

2 participants