test(admin): add integration unit test preventing duplicate votes on multi-sig upgrade proposal - #845
Open
onajidavid87-web wants to merge 2 commits into
Open
Conversation
…multi-sig upgrade proposals This PR adds a unit/integration test (test_double_vote_reverts) to verify that the multi-sig governance module in bc-forge-admin prevents duplicate votes on upgrade proposals. When an authorized pool member attempts to approve a proposal they have already voted on, the contract must revert with AdminError::ProposalAlreadyApproved (Error code 10). Closes BCPathway#670
|
@onajidavid87-web 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! 🚀 |
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.
Closes #670
What does this PR do?
Adds a unit/integration test (test_double_vote_reverts) to verify that the multi-sig governance module in bc-forge-admin prevents duplicate votes on upgrade proposals.
When an authorized pool member attempts to approve a proposal they have already voted on, the contract must revert with AdminError::ProposalAlreadyApproved (Error code 10).
Added is_proposal_ready to AdminContract in
contracts/admin/tests/upgrade_e2e.rs
to allow proposal status checking during end-to-end integration testing.
Added test_double_vote_reverts:
Initialized an AdminContract instance with a multi-sig pool of 2 admins and a threshold of 2.
Admin 1 created a WASM upgrade proposal (automatically recorded as the first approval).
Step 1 (First Vote): Admin 2 approves the proposal (client.approve_proposal(&member, &proposal_id)). Asserted that is_proposal_ready returns true.
Step 2 (Second Vote Attempt): Admin 2 attempts to approve the proposal a second time via client.try_approve_proposal(&member, &proposal_id).
Step 3 (Revert Assertion): Asserted that the second attempt returns Err(Ok(soroban_sdk::Error::from_contract_error(AdminError::ProposalAlreadyApproved))).
🔍 Files Changed
contracts/admin/tests/upgrade_e2e.rs
: Added is_proposal_ready helper and test_double_vote_reverts test case.
Type of change
Checklist
pre-commit run --all-fileslocally and it passedBreaking changes?
No
Related issues
Closes #670