Fix #360 #361 #377 #391: voting auth, cast_vote event, pending-transfer query, admin resume tests#394
Merged
Uchechukwu-Ekezie merged 1 commit intoMay 28, 2026
Conversation
|
@JamesVictor-O 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! 🚀 |
Contributor
|
Auto-review failed (API error). Leaving PR for human review. |
…g-transfer query, and admin-path tests Issue #377: Remove unused `_admin` parameter from `voting::set_params` — auth is enforced exclusively by `lib.rs::assert_admin`, which already calls `require_auth()`. Keeping the dead parameter created a false sense of defense-in-depth while passing a value that was never used. Issue #391: Enrich the `campaign_vote_cast` event payload to include the voter's token balance and computed vote weight as `(approve, balance, vote_weight)`. Off-chain indexers can now independently verify the tally without querying historical RPC balances. Issue #361: Add `has_pending_campaign_transfer(env, campaign_id) -> bool` view function so off-chain tooling and the pending creator can discover pending transfers on-chain without iterating all campaigns or relying on external communication. Issue #360: Add three missing test cases for `resume_campaign`: - `test_resume_by_admin` — admin (not creator) can lift the auto-pause - `test_resume_unauthorized_fails` — random address is correctly rejected - `test_resume_after_campaign_transfer_uses_new_creator` — after ownership transfer the NEW creator holds the resume right, not the original creator Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
c72987c to
d85a150
Compare
Contributor
|
Auto-review failed (API error). Leaving PR for human review. |
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
Resolves four open issues assigned to me in a single combined changeset. All 338 tests pass.
Issue #377 —
voting::set_paramsremoves dead_adminparameter_admin: Addresswas passed tovoting::set_paramsbut never used — norequire_auth()was called, creating a misleading signature.lib.rs::assert_admin, which callsadmin.require_auth()before delegating tovoting::set_params. Keeping a dead parameter was not defense-in-depth; it was dead code.Issue #391 —
cast_voteevent now includes voter balance and vote weightcampaign_vote_castevent only emitted(campaign_id, voter, approve). Off-chain indexers could not independently verify the weighted tally without fetching historical RPC balances.(approve, balance, vote_weight)— providing the voter's token balance and the resulting weight in-event, making the tally fully reproducible from logs alone.Issue #361 — Add
has_pending_campaign_transferview functionpub fn has_pending_campaign_transfer(env: Env, campaign_id: u32) -> bool— returnstrueifpending_creator != None,falsefor unknown IDs. Enables off-chain tooling to index pending transfers without iterating all campaigns.Issue #360 — Missing admin-path tests for
resume_campaignissues_test.rs:test_resume_by_admin— admin (not the creator) can lift an auto-pausetest_resume_unauthorized_fails— random address is correctly rejected withNotAuthorizedtest_resume_after_campaign_transfer_uses_new_creator— after ownership transfer, the NEW creator holds the resume right; original creator is rejectedTest plan
cargo test— all 338 tests passtest_resume_by_adminpasses (admin can resume)test_resume_unauthorized_failspasses (stranger rejected)test_resume_after_campaign_transfer_uses_new_creatorpasses (new creator resumes, old creator fails)test_set_voting_params_emits_eventstill passes (no double-auth regression)test_vote_on_campaign_basic_flowevent payload includes(approve, balance, vote_weight)Closes #360
Closes #361
Closes #377
Closes #391
🤖 Generated with Claude Code