Repository navigation
Description
Surfaced by the multi-agent review of #1529 and deliberately left out of that PR: both fixes belong in GuardedBuybackBurner, which is a shipped contract, and both bounds are ADR 018 § Parameter Table decisions rather than deploy-script ones.
#1529 closed the deploy-time half of the second item at the BuybackVenueLib seam (GuardBandDead). Neither the runtime setter path nor the slippage issue is addressed.
1. slippageBps has no meaningful ceiling — the MEV defense fails open
contracts/src/GuardedBuybackBurner.sol:156 (constructor) and :237 (setSlippageTolerance) both reject only >= BPS_DENOMINATOR:
if (g.slippageBps_ >= BPS_DENOMINATOR) revert SlippageOutOfBounds(g.slippageBps_, BPS_DENOMINATOR);_twapFloor computes afterFee * (BPS_DENOMINATOR - slippageBps) / BPS_DENOMINATOR, so slippageBps = 9999 collapses the TWAP floor to 0.01% of fair value. The entire ADR 018 MEV stack is off with no revert, no event, and a green deploy. ADR 018's parameter table gives 200 bps; anything within an order of magnitude of 10000 is not a tolerance, it is a disabled guard.
Reachable two ways:
- deploy-time, via
vm.envOr("SLIPPAGE_BPS", 200)in bothDeployProtocol.s.solandActivateBuyback.s.sol - post-deploy, via
setSlippageToleranceunder the 48h timelock
The asymmetry is the tell: epochLiquidityCapFraction — the parameter directly beside it — carries CAP_FRACTION_FLOOR = 100 / CAP_FRACTION_CEILING = 3000 on both the constructor (:157) and the setter (:258). The precedent for a bounded band already exists in the same constructor; slippage just never got one. The file also reasons explicitly about this exact fail-open shape for the swap fee (:432-435, "would collapse the floor to 0 (fail-open), so reject it") and then does not apply it to the slippage input beside it.
Proposed: a SLIPPAGE_CEILING constant applied at both sites, mirroring the cap-fraction pattern. The value is the ADR decision — 1000–2000 bps would still be generous against a 200 bps default.
2. A zero buyback band is reachable through the runtime setters
contracts/src/GuardedBuybackBurner.sol:154 rejects an inverted band (min > max) but not a zero one, so min == max == 0 constructs cleanly. Then :196:
if (amountIn > maxBuybackAmount) revert AboveMaxBuyback(amountIn, maxBuybackAmount);fires on every non-zero call, forever — a burner receiving the buyback bucket's 30% of routed USDC that can never spend it. Same outcome MissingBuybackKeeper exists to prevent, reached through a different door.
#1529 blocked the deploy-time path (BuybackVenueLib.GuardBandDead, rejecting maxBuybackAmount_ == 0 at the seam both scripts share). The runtime path is still open: setMaxBuybackAmount(0) checks only newAmount < minBuybackAmount (:251), which passes when minBuybackAmount is also 0 — and setMinBuybackAmount(0) always passes (:244). So a governance proposal can walk the band to 0/0 in two calls with no revert.
Proposed: reject maxBuybackAmount == 0 in the constructor and in setMaxBuybackAmount. That subsumes the library-level guard #1529 added, which can then be removed or kept as a fail-fast.
Why not in #1529
That PR is scoped to deploy scripts (contracts/script/) and touches no contract in contracts/src/. Changing a shipped contract's validation:
- needs the ADR 018 parameter table to state the bounds, since a ceiling is a protocol parameter and not an implementation detail
- re-blesses the gas snapshot and, for the constructor change, every burner deployment path
- would mix an audited-surface change into a governance/deploy-script PR, making both harder to review and to revert
Neither is attacker-exploitable — both require a governance proposal or a mis-set deploy env var — which is why they are a follow-up rather than a blocker.
Acceptance
- ADR 018 § Parameter Table states a slippage ceiling and a non-zero
maxBuybackAmountrequirement -
GuardedBuybackBurnerenforces both, at the constructor and the corresponding setter - Tests cover each bound at both entry points
- Decide whether
BuybackVenueLib.GuardBandDeadstays as a pre-broadcast fail-fast or is removed as redundant
Metadata
Metadata
Assignees
Labels
Type
Fields
Priority
Activity
feat(contracts): bootstrap-multisig governance phase + buyback deploy…
fix: close two money-path guards that had no correct branch (#1532, #…
fix: address multi-agent review of #1532/#1495
fix: close two money-path guards that had no correct branch (#1532, #…