Skip to content

fix(escrow,milestones): reject contribute at or after deadline (#568) - #763

Open
huangji6693-max wants to merge 1 commit into
MergeFi:mainfrom
huangji6693-max:fix/reject-contributions-after-grace-period-568
Open

huangji6693-max wants to merge 1 commit into
MergeFi:mainfrom
huangji6693-max:fix/reject-contributions-after-grace-period-568

Conversation

@huangji6693-max

Copy link
Copy Markdown

Closes #568

Problem

Neither escrow::contribute nor milestones::contribute checked the stored deadline. Once now >= deadline + GRACE_PERIOD, escrow::refund and milestones::cancel_milestone_after_deadline become permissionless, yet both contracts continued accepting new contributions that could be immediately refunded or cancelled by any third party in the next transaction.

Solution

  • Reject escrow::contribute with Error::InvalidDeadline once env.ledger().timestamp() >= escrow.deadline.
  • Reject milestones::contribute with Error::DeadlinePassed once env.ledger().timestamp() >= milestone.deadline (matching milestones::allocate).
  • Add regression unit tests (test_contribute_rejects_at_or_after_deadline) in both mergefi-escrow and mergefi-milestones verifying now == deadline - 1 (succeeds), now == deadline (rejected), and now == deadline + GRACE_PERIOD (rejected).

Verification

  • CARGO_BUILD_JOBS=2 cargo test -p mergefi-escrow (99/99 passed)
  • CARGO_BUILD_JOBS=2 cargo test -p mergefi-milestones -- test_contribute_rejects_at_or_after_deadline (passed)
  • CARGO_BUILD_JOBS=2 cargo clippy --workspace --lib --locked -- -D warnings (0 warnings)

@vercel

vercel Bot commented Oct 26, 2026

Copy link
Copy Markdown

@huangji6693-max is attempting to deploy a commit to the chonilius' projects Team on Vercel.

A member of the Team first needs to authorize it.

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

escrow::contribute and milestones::contribute accept new funds after deadline + GRACE_PERIOD, when anyone can already refund or cancel

1 participant