Skip to content

bug: expire_campaign reuses the CampaignCancelled event instead of a distinct CampaignExpired event #64

Description

@JamesVictor-O

Problem

expire_campaign publishes the exact same event as cancel_campaign — there's no way to tell the two outcomes apart on-chain (lib.rs:632-636 vs 584-588):

// cancel_campaign
events::CampaignCancelled { campaign_id, refunded_amount: refund }.publish(&env);

// expire_campaign — identical event, different function
events::CampaignCancelled { campaign_id, refunded_amount: refund }.publish(&env);

contracts/campaign-escrow/src/events.rs defines only CampaignCancelled (lines 78-90) — there's no CampaignExpired.

Concrete failure scenario

An indexer or frontend building a campaign timeline/audit trail (or simply wanting to show "Cancelled by business" vs. "Expired past deadline — no submissions") cannot distinguish the two from the event stream alone. It would have to separately fetch completion_deadline and compare it against the event's ledger timestamp to infer which happened — defeating the purpose of having a distinct, typed event per state transition, which is exactly how every other transition in this contract is modeled.

Expected behaviour

Add a CampaignExpired { campaign_id: CampaignId, refunded_amount: i128 } event and publish it from expire_campaign instead of reusing CampaignCancelled.

Files

  • contracts/campaign-escrow/src/events.rs — add CampaignExpired
  • contracts/campaign-escrow/src/lib.rs — publish it from expire_campaign

Acceptance criteria

  • CampaignExpired event added to events.rs, mirroring CampaignCancelled's shape
  • expire_campaign publishes CampaignExpired instead of CampaignCancelled
  • cancel_campaign's event is unchanged
  • A test asserts expire_campaign emits CampaignExpired, not CampaignCancelled

Metadata

Metadata

Labels

GrantFox OSSIssue tracked in GrantFox OSSMaybe RewardedIssue may be eligible for a GrantFox rewardOfficial Campaign | FWC26Campaign: Official Campaign | FWC26Third CampaignCampaign: Third CampaignbugSomething isn't workinggood first issueGood for newcomers

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions