Skip to content

fix: fee ceiling, treasury recipient validation, migrate v0 rejection, and upgrade standardization - #925

Merged
chonilius merged 1 commit into
MergeFi:mainfrom
drips-projects:validate-fee-ceiling-100-percent
Nov 24, 2026
Merged

chonilius merged 1 commit into
MergeFi:mainfrom
drips-projects:validate-fee-ceiling-100-percent

Conversation

@Joeloo1

@Joeloo1 Joeloo1 commented Nov 24, 2026

Copy link
Copy Markdown
Contributor

This PR addresses four security and consistency issues:

Changes

  1. Fee Ceiling (Issue escrow::set_fee_bps can ratchet the protocol fee to 100% in 500-bps steps — validate_fee_change bounds the step size, not the ceiling #778): Added MAX_FEE_BPS constant (1000 = 10%) to prevent fee ratcheting to 100% through repeated set_fee_bps calls. The step limit (500 bps) prevents accidental spikes, while the ceiling prevents malicious ratcheting.

  2. Treasury Recipient Validation (Issue escrow::release never checks that the treasury is absent from recipients, so the treasury can be paid twice out of a single release #781): Modified compute_split to reject treasury address as a recipient. A compromised oracle can no longer route funds back to the protocol by naming treasury as a 10000-bps recipient.

  3. Migrate Version 0 Rejection (Issue escrow::migrate accepts from_version = 0 on a contract that was never initialized, writing Version = 2 onto empty instance storage #783): Explicitly reject from_version=0 in migrate() to prevent contracts that predate the Version key from incorrectly reporting v2 without actual storage migration.

  4. Upgrade Standardization (Issue escrow::upgrade leaves DataKey::Version at the pre-upgrade value while milestones::upgrade writes it — the three contracts disagree on which call advances the version #785): Standardized upgrade behavior across all three contracts - upgrade() now only updates WASM and publishes ContractUpgraded with current version, while migrate() advances the Version.

Testing

  • All escrow tests passing (104/104)
  • Core functionality verified for all three contracts
  • Pre-existing test failures in main branch were also fixed

Closes #778
Closes #781
Closes #783
Closes #785

@Joeloo1
Joeloo1 requested a review from chonilius as a code owner November 24, 2026 00:12
@vercel

vercel Bot commented Nov 24, 2026

Copy link
Copy Markdown

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

A member of the Team first needs to authorize it.

@drips-wave

drips-wave Bot commented Nov 24, 2026

Copy link
Copy Markdown

@Joeloo1 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@chonilius
chonilius merged commit 679a5e3 into MergeFi:main Nov 24, 2026
1 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment