Skip to content

Add EventOwedTotal and the over-allocation guard #109

Description

@0xdevcollins

The bug this prevents ships green and surfaces as an unpayable winner.

remaining_escrow decrements at claim time, not award time. Under percentages that was safe by construction. With explicit amounts it is not:

$1,000 pool. Award position 1 for $600, unclaimed. A second call awards position 2 for $600. The check sees remaining_escrow still at $1,000 and passes. Winner 1 claims, leaving $400. Winner 2 can never claim.

EventUnclaimedPrizes holds a count, not an amount, so it cannot be reused.

Done when

  • DataKey::EventOwedTotal(u64) -> i128 appended (append only, do not reorder variants)
  • select_winners enforces sum(new amounts) + owed <= remaining_escrow, reusing InsufficientEscrow
  • Test: award, partially claim, award again, verify the second claim still succeeds
  • Test: an over-allocating second call is rejected

See plan 3.5.1. Pair-review this one.


Plan: boundless-bounty-programs-implementation-plan.md

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions