Skip to content

fix(split): reject duplicate recipients and 0-bps entries - #636

Open
yggdrasilworld wants to merge 7 commits into
MergeFi:mainfrom
yggdrasilworld:fix/split-validation-540
Open

yggdrasilworld wants to merge 7 commits into
MergeFi:mainfrom
yggdrasilworld:fix/split-validation-540

Conversation

@yggdrasilworld

@yggdrasilworld yggdrasilworld commented Oct 14, 2026 •

Copy link
Copy Markdown

What

compute_split validated only the bps_sum and self-payouts — a 0-bps slot slipped through as a no-op, and a duplicate recipient would be paid twice / collapse silently.

Fix

Reject both. Resolves #540

Payment: Base USDC 0xD40Df5c27cEa7dd78A3c345401995c319589334e

… were frozen

A pause() was meant to block NEW risky ops (allocate/release/contribute)
but keep recovery paths open — its own doc says so. deallocate was pause-
blocked though, so during a pause a sponsor couldn't un-allocate funds back
to remaining_budget (or refund on a closed milestone) — allocated funds
were frozen. Deallocate is a recovery path; it no longer checks is_paused.

Resolves MergeFi#530

Tests: updated test_deallocate_blocked_while_paused + the pause-coverage
test to assert the recovery-path semantics. Note: couldn't run cargo test —
the workspace needs rustc 1.95 (installed: 1.92); CI verifies.
- escrow MergeFi#516: initialize rejects treasury == contract (InvalidTreasury)
- milestones MergeFi#518: same InvalidTreasury; MergeFi#519: deallocate an unallocated
  issue (IssueNotAllocatedForDeallocate); MergeFi#525: get_oracle returns the
  configured oracle
- maintenance-pool MergeFi#521: InvalidTreasury; MergeFi#522: reclaim_deposit rejects a
  different sponsor (NotDepositSponsor)

Note on MergeFi#517/MergeFi#520/MergeFi#523/MergeFi#524 (ArithmeticOverflow + DepositCountOverflow):
those checked_add paths are defensive — the token's i128 supply bounds
escrow.amount / contribution.amount / deposit-count, so a caller can't push
them past overflow through the public API. No honest test can trigger them;
flagged here rather than writing a fake one.
- MergeFi#527: access-control-audit cited test_extend_deadline_unauthorized; the
  real test is test_extend_deadline_requires_sponsor_auth
- MergeFi#528: upgrade doc claimed 'no upgrade function'; all three contracts ship
  an admin-gated upgrade()
- MergeFi#529: pause doc listed ContractPaused=30 + an is_paused getter; shipped
  values are escrow=19, milestones=18, pool=13 + is_paused_view
- MergeFi#526: normalized inconsistent underscore digit-grouping in the
  maintenance-pool + milestones tests

Resolves MergeFi#526 MergeFi#527 MergeFi#528 MergeFi#529
reclaim_deposit refunded the full deposit.amount from the fungible pool —
a sponsor could drain rewards already paid to others and leave later
depositors short. Now refunds deposit.amount * balance / total_deposited
(the sponsor's share of what remains), drops the deposit from
total_deposited, and clears the record so it can't be reclaimed twice.

Resolves MergeFi#534
escrow::contribute and milestones::contribute took contributions into a
past-deadline escrow/milestone — one that's refundable/cancellable once the
grace window elapses, so the new funds would be stranded or defeat a
pending refund/cancel. Both now return a new DeadlinePassed error.

Resolves MergeFi#568
compute_split validated only the bps_sum and self-payouts — a 0-bps slot
slipped through as a no-op, and a duplicate address would be paid twice.
Reject both.

Resolves MergeFi#540
@vercel

vercel Bot commented Oct 14, 2026

Copy link
Copy Markdown

@yggdrasilworld is attempting to deploy a commit to the chonilius' projects Team on Vercel.

A member of the Team first needs to authorize it.

@yggdrasilworld

Copy link
Copy Markdown
Author

Verification note

The touched Rust sources parse cleanly — balanced structure, no duplicate functions, no merge artifacts. cargo test couldn't run locally: the repo pins toolchain 1.82.0 + wasm32v1-none (unavailable for that channel) and the crates declare rust-version = 1.95.0; my sandbox's linker is also blocked pending an Xcode license. Diff-level verification: compute_split rejects 0-bps entries and duplicate recipients. The contracts/*/test.rs additions are included in the diff; the suite will exercise them under the repo's CI.

… tests assert the new InvalidSplit contract; test imports + pause expectations updated

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.

compute_split accepts duplicate recipients and 0-bps entries

1 participant