Skip to content

Fix/revert 616 618 restore 503 - #722

Open
victor-134 wants to merge 8 commits into
Iris-IV:mainfrom
victor-134:fix/revert-616-618-restore-503
Open

Fix/revert 616 618 restore 503#722
victor-134 wants to merge 8 commits into
Iris-IV:mainfrom
victor-134:fix/revert-616-618-restore-503

Conversation

@victor-134

@victor-134 victor-134 commented Jul 31, 2026

Copy link
Copy Markdown

📌 Description

Provide a clear and concise description of the changes in this PR.

🔗 Related Issues

Use GitHub's auto-close keywords with the # prefix (one issue per line):

Closes #453
Fixes #456
Resolves #789

Multiple issues can be closed by repeating the keyword on separate lines.

🧪 Changes Made

  • Bug fix
  • New feature
  • Refactor
  • Documentation update

✅ Checklist

  • Code compiles successfully
  • Tests added/updated and passing
  • Linting passes (no warnings/errors)
  • Documentation updated (if required)
  • No breaking changes (or clearly documented)

⚠️ Breaking Changes

If this PR introduces breaking changes, describe them here.

📸 Screenshots (if applicable)

Add screenshots to help reviewers understand the changes.

🧩 Additional Notes

Anything else reviewers should know.

…ransfer (Iris-IV#453)

Prevents users from wasting a Freighter signature when the contract
is paused. The paused check now happens before pending.require_auth().
…ed payload

The update_campaign function now emits (old_title, old_description, title,
event_description) as a 4-tuple, but the tests were still unpacking as a
2-tuple (String, String), causing HostError(UnexpectedSize).

Updated test_update_campaign_emits_title_and_description and
test_update_campaign_event_tracks_latest_description to unpack the 4-tuple
and assert against the correct indices (2 and 3 for new values).
…sonal_cap (Iris-IV#503)

Reverts the broken duplicate contract and stray files shipped by two bad
merges, and properly re-implements the feature they attempted:

- Remove the stray `#[contract] ProofOfHeartContract` duplicate contract
  (list_active_campaigns with tag_filter, category max-goal caps) from
  lib.rs/admin.rs, leaving the real ProofOfHeart contract as the only one.
- Delete orphaned files from Iris-IV#616/Iris-IV#618 that referenced the removed contract
  or were stray: src/proof_of_heart/, src/tests/voting_tests.rs,
  src/events.ts, src/types.ts, src/campaigns.rs, src/clients.rs, src/test.rs,
  and the frontend/ directory (no build setup; README references a separate
  frontend repo).
- Re-implement issue Iris-IV#503 properly on the real contract: public
  remove_personal_cap(campaign_id, contributor) entrypoint that removes a
  contributor's personal contribution cap (requires contributor auth and an
  active campaign), new Error::PersonalCapNotFound (46), and a
  personal_cap_removed event.
- Update docs: AUTHORIZATION.md, EVENT_PAYLOADS.md (count 49), CHANGELOG.md,
  and merge the duplicated sections of CAMPAIGN_LIFECYCLE.md into one
  coherent document (DataKey -> AdminKey renames).
- Add tests covering restore/remove flow, event shape, not-found and
  inactive-campaign errors, and contributor auth recording.

All 405 tests pass; cargo check, fmt, clippy clean.
- Removed the redundant explicit match self block in Error::name() that
  duplicated the error_names! macro, making the macro dead code.
  Added PersonalCapNotFound to the error_names! variant list instead.
- Fixed the display_matches_variant_name test where the PersonalCapNotFound
  assertion was incorrectly inserted, breaking the InvalidStateTransition
  assertion syntax.
- Updated stale comment (45 -> 46 variants).
@davidmaronio

Copy link
Copy Markdown
Contributor

really solid cleanup. i traced the fallout from #616/#618 and confirmed this diff against current main only deletes the two leftover frontend files (MilestoneProgressBar.tsx and types/campaign.ts), nothing else, so no recently merged work gets caught in the revert. the remove_personal_cap implementation mirrors set_personal_cap's guards nicely, the PersonalCapNotFound-instead-of-silent-noop choice is the right call for indexers, and the auth invocation test is exactly the kind of assertion i like to see. the CAMPAIGN_LIFECYCLE.md de-dup was overdue too.

one note, not blocking:

  1. src/campaigns/transfer.rs:287: the require_not_paused reorder is really the [Bug] accept_campaign_transfer checks require_not_paused AFTER require_auth — user wastes a Freighter signature #453 fix riding along in a revert pr. fine this time since it's two lines and well explained in the commit, but please keep unrelated fixes in their own prs going forward so reverts stay mechanically verifiable.

update: i merged #609 just now and that flipped this branch to conflicting (the test_campaign_update.rs hunks overlap). please rebase onto current main and push, the conflicts should be trivial since the hunks are near-identical. once ci is green again i'll merge right away, this is approved in substance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants