fix: add tests for issues #283, #294, #298 and enforce CHANGELOG updates in CI - #330
Merged
icentedward76-sketch merged 2 commits intoAug 30, 2026
Conversation
…d enforce CHANGELOG updates in CI Issue SoroWill#283 - close_will double-close rejection: - Add test_close_will_rejects_already_settled that asserts a second close_will call on an already-Settled will returns WillError::WillNotReleased. Issue SoroWill#294 - batch_check_in atomicity: - Add test_batch_check_in_atomicity_on_invalid_id that mixes valid and invalid will ids in a single batch_check_in call, asserts the entire transaction aborts, and verifies none of the valid wills were checked in. Issue SoroWill#298 - guardian_trigger keeper bounty behavior: - Document in guardian_trigger's rustdoc that keeper bounties are never paid on guardian-triggered releases because distribute is called with keeper = None. - Add test_guardian_trigger_does_not_pay_keeper_bounty that creates a will with a nonzero keeper_bounty_bps, releases it via guardian quorum, and asserts the beneficiary receives the full balance (no bounty deducted). Issue SoroWill#288 - CHANGELOG CI enforcement: - Add .github/scripts/check-changelog.sh that fails a PR when contracts/will/src/lib.rs changes CONTRACT_VERSION without also updating CHANGELOG.md. - Wire the script into .github/workflows/test.yml so it runs on every pull_request. Additionally fixes pre-existing compilation errors that prevented CI from passing: - Add missing GuardianConsent enum to types.rs and export it from lib.rs. - Update merge_wills call sites in merge_*_test.rs to match the current (owner, will_id_a, will_id_b) signature. - Update get_wills_by_beneficiary call sites in fuzz_harness.rs and profile.rs to pass the required cursor and limit arguments. - Fix comparison in merge_beneficiaries where addr types mismatched. - Fix move semantics in merge_beneficiaries match by cloning allocation and binding the Percentage arm to a named pattern. - Fix unused variable warnings and dead code in merge_active_count_test.rs. - Fix FixedAmount-only test data in merge_fixed_amount_test.rs so fixed amounts sum exactly to the will balance. - Add missing accept_guardian_role calls in profile::profile_public_entry_points. All cargo test --workspace and cargo clippy --all-targets -- -D warnings pass after these changes.
|
@adeniran19-maker 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 #283
Closes #294
Closes #298
Closes #288
Summary
This PR adds missing test coverage and a CI guard to ensure behavior changes are properly documented in
CHANGELOG.md.Issue #283 —
close_willmust reject already-settled willsNo test previously verified that calling
close_willtwice on the same will panics withWillError::WillNotReleasedon the second call.Fix: Added
test_close_will_rejects_already_settledinissue_298_283_294_test.rs. The test creates a will, triggers it, releases it, closes it once, and then asserts that a secondclose_willreturnsWillError::WillNotReleased.Issue #294 —
batch_check_inmust be atomic on invalid IDsbatch_check_inloops over will IDs and panics on the first invalid one, but no test explicitly verified that valid wills in the same batch were not checked in when an invalid ID appeared in the middle.Fix: Added
test_batch_check_in_atomicity_on_invalid_idinissue_298_283_294_test.rs. The test passes a batch containing two valid will IDs and one invalid ID, asserts the call panics/returns an error, and then confirms both valid wills'last_checkintimestamps are unchanged.Issue #298 —
guardian_triggerkeeper bounty behaviordistribute()excludes the owner from receiving a keeper bounty (k != &will.owner), butguardian_triggercallsdistribute(&env, &mut will, &None), meaning keeper bounties are never paid on guardian-triggered releases regardless ofkeeper_bounty_bps.Fix:
guardian_trigger's rustdoc to explicitly state that keeper bounties are never paid on guardian-triggered releases.test_guardian_trigger_does_not_pay_keeper_bountyinissue_298_283_294_test.rsthat creates a will withkeeper_bounty_bps = 50, releases it via guardian quorum, and asserts the beneficiary receives the full balance (no bounty deducted).Issue #288 — Enforce
CHANGELOG.mdupdates in CICHANGELOG.mdexists but nothing in CI checks that a PR modifyingcontracts/will/src/lib.rsin a way that changesCONTRACT_VERSIONalso updatesCHANGELOG.md.Fix:
.github/scripts/check-changelog.shwhich compares the PR's changed files againstorigin/mainand fails ifcontracts/will/src/lib.rswas modified with aCONTRACT_VERSIONchange butCHANGELOG.mdwas not..github/workflows/test.ymlso it runs on everypull_requesttomain.Additional fixes (pre-existing CI breakers)
While implementing the above, several pre-existing compilation errors that prevented
cargo test --workspaceandcargo clippy -- -D warningsfrom passing were also fixed:GuardianConsenttype: Added theGuardianConsentenum totypes.rsand exported it fromlib.rs.merge_willscall sites: Updatedmerge_active_count_test.rs,merge_fixed_amount_test.rs, andmerge_rounding_test.rsto use the current(owner, will_id_a, will_id_b)signature.get_wills_by_beneficiarycall sites: Updatedfuzz_harness.rsandprofile.rsto pass the requiredcursorandlimitarguments.merge_beneficiaries: Fixeda == addrwhereawas&AddressandaddrwasAddressby dereferencinga.merge_beneficiaries: Clonedbeneficiary.allocationbefore the inner loop and bound thePercentagematch arm to a named pattern to avoid borrow-checker errors.total_fixedwith_, removed unusedDAY/advanceinmerge_active_count_test.rs, and removed unusedtokensinevent_snapshot_test.rs.merge_preserves_all_fixed_amountstest: Fixed test data so fixed amounts sum exactly to the will balance (required byassert_valid_allocations).profile_public_entry_pointstest: Added missingaccept_guardian_rolecalls beforeguardian_trigger.Verification
cargo test --workspace— 60 passed, 0 failedcargo clippy --all-targets -- -D warnings— passedFiles changed
.github/scripts/check-changelog.sh(new).github/workflows/test.ymlcontracts/will/src/issue_298_283_294_test.rs(new)contracts/will/src/lib.rscontracts/will/src/types.rscontracts/will/src/event_snapshot_test.rscontracts/will/src/fuzz_harness.rscontracts/will/src/merge_active_count_test.rscontracts/will/src/merge_fixed_amount_test.rscontracts/will/src/merge_rounding_test.rscontracts/will/src/profile.rs