Open
Conversation
Two test scenarios: 1. test_cancel_withdrawal_before_approval: Shuts down 2 of 4 nodes to prevent quorum, creates a withdrawal request that stays in Requested state, cancels it, and verifies hBTC balance is restored. 2. test_cancel_approved_withdrawal: Uses a 1-hour batching delay so approved requests are not committed to a WithdrawalTransaction. Creates a request, waits for committee approval, cancels the approved request, and verifies hBTC balance is restored.
Adds a hidden `--disable-withdrawal-processing` flag to `hashi-localnet start` that gates the leader's approval and commit phases, so withdrawal requests stay in Requested/Approved state for manual cancellation testing. The flag is hidden from --help so validators don't enable it curiously; it's test/debug only. Also adds two e2e tests covering the cancel-vs-commit race boundary: - test_cancel_race_cancel_wins: cancel lands before commit; commit tx must fail and hBTC must be restored. - test_cancel_race_commit_wins: commit lands before cancel; cancel must abort with ECannotCancelProcessingWithdrawal and hBTC stays burned. The tests reuse the existing 1-hour `withdrawal_batching_delay_ms` trick to freeze the leader's Phase 2 and drive the commit PTB directly via a new `Hashi::build_and_sign_withdrawal_commitment` helper that factors out the quorum fan-out shared with the leader loop.
Contributor
|
How necessary is this full e2e test over writing a move unit test for these semantics? |
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.
Summary
Adds e2e coverage for the withdrawal cancellation flow, including the race boundary between cancel and the leader's commit phase.
Commits
Add e2e tests for withdrawal cancellation. Two scenarios:
test_cancel_withdrawal_before_approval: shuts down 2 of 4 nodes to starve quorum, so the request stays inRequested. Cancels and verifies hBTC is restored.test_cancel_approved_withdrawal: uses a 1-hour batching delay to keep the approved request from being committed to aWithdrawalTransaction. Cancels from the approved state and verifies hBTC is restored.Add localnet withdrawal-processing flag and cancel-race e2e tests. Adds a hidden
--disable-withdrawal-processingflag onhashi-localnet startthat gates the leader's approval/commit phases. Plus two tests covering the cancel-vs-commit race:test_cancel_race_cancel_wins: cancel lands first; the leader's commit tx must fail and hBTC must be restored.test_cancel_race_commit_wins: commit lands first; cancel must abort withECannotCancelProcessingWithdrawaland hBTC stays burned.These reuse the 1-hour
withdrawal_batching_delay_mstrick to freeze Phase 2, then drive the commit PTB directly via a newHashi::build_and_sign_withdrawal_commitmenthelper that factors out the quorum fan-out shared with the leader loop.Test plan
cargo test -p e2e-tests -- test_cancel_withdrawal_before_approval --ignoredcargo test -p e2e-tests -- test_cancel_approved_withdrawal --ignoredcargo test -p e2e-tests -- test_cancel_race_cancel_wins --ignoredcargo test -p e2e-tests -- test_cancel_race_commit_wins --ignored