Conversation
There was a problem hiding this comment.
Stale comment
This PR adds
BiPoolManagerFeeSetterimplementation addresses plus a governance proposal/script to upgradeBiPoolManagerso spread fees can be changed without recreating pools.
mgps/mgp17.md
- Important:
L3-L4says this proposal starts by reducing selected USDm pairs from 5 bps to 2 bps, butL40-L46andscript/migration/MGP17.solonly perform an implementation upgrade. There are nosetSpreadcalls in the payload, so the prose overstates what governance is actually approving.
script/migration/MGP17.sol
- Important:
L56-L60only verify proxy-admin ownership. This upgrade adds a new owner-gated capability, but the script never asserts thatIOwnable(biPoolManagerProxy).owner()is the intended fee-setting authority.checkSetSpreadPermission()then pranks whatever addressowner()returns, so the proposal can pass while silently granting spread control to an unexpected account.- Important:
L82-L85andL88-L101provesetSpreadon one arbitrary exchange (exchangeIds[0]) instead of the USDm collateral pools the proposal is meant to unblock. If the regression is specific toUSDm/USDC,USDm/axlUSDC, orUSDm/USDT, this post-check still passes.Final verdict: 🚫 Needs changes
Sent by Cursor Automation: PR Review
| @@ -0,0 +1,51 @@ | |||
| ## TL;DR | |||
|
|
|||
| We propose upgrading the BiPoolManager implementation to a new version that adds a `setSpread` function. The currently deployed implementation requires destroying and recreating a pool to change its fee, making fee adjustments operationally expensive. This upgrade enables the contract owner to adjust spread fees directly, starting with a reduction from 5bps to 2bps on select USDm pairs. | |||
There was a problem hiding this comment.
L3-L4 says this proposal starts by reducing spreads from 5 bps to 2 bps on selected USDm pairs, but the executable payload below only upgrades the implementation. There are no setSpread calls anywhere in script/migration/MGP17.sol, so this TL;DR is describing an effect governance is not actually approving in this proposal.
|
|
||
| function preChecks() internal view { | ||
| console.log("== Pre-checks =="); | ||
| console.log(unicode" > 👀 checking BiPoolManager proxy admin is governance timelock"); |
There was a problem hiding this comment.
This pre-check is missing the more important invariant for this upgrade: who currently owns BiPoolManager. setSpread is owner-gated, and checkSetSpreadPermission() later pranks whatever owner() returns, so the script will still pass even if spread-setting authority is already held by the wrong account. For a proposal that introduces new privileged behavior, you should assert the expected owner() here before upgrading.
|
|
||
| address owner = IOwnable(biPoolManagerProxy).owner(); | ||
| bytes32[] memory exchangeIds = IBiPoolManager(biPoolManagerProxy).getExchangeIds(); | ||
| require(exchangeIds.length > 0, "no exchanges found on BiPoolManager"); |
There was a problem hiding this comment.
This only exercises setSpread on exchangeIds[0], which is too weak for the stated goal of enabling fee changes on the USDm collateral pools. If the upgraded implementation regresses only on USDm/USDC, USDm/axlUSDC, or USDm/USDT, this check still passes. Target the intended pools explicitly or iterate all exchanges instead of relying on the first entry.
There was a problem hiding this comment.
Stale comment
Adds MGP-17 governance artifacts to upgrade
BiPoolManagerto asetSpread-capable implementation and records the new implementation address for mainnet and Sepolia.
- Important
:3, :15-20The proposal text says this change starts reducing spreads from 5bps to 2bps, butscript/migration/MGP17.solonly upgrades the implementation. There is nosetSpreadcall in the proposal. Reword the TL;DR/overview so voters are not told this proposal changes live pool fees when it only enables a later owner action.
- Important
:83-101checkSetSpreadPermission()usessender("migrationOwner").accountas the source of truth for ownership. That makes the post-check depend on local Treb sender config instead of the upgraded contract state, and it never explicitly validatesowner()after the upgrade. ReadIOwnable(biPoolManagerProxy).owner()from chain state and prank that address for the capability check; if you also want config validation, assert the on-chain owner matches the expected sender separately.Final verdict: 🚫 Needs changes
Sent by Cursor Automation: PR Review
| @@ -0,0 +1,51 @@ | |||
| ## TL;DR | |||
|
|
|||
| We propose upgrading the BiPoolManager implementation to a new version that adds a `setSpread` function. The currently deployed implementation requires destroying and recreating a pool to change its fee, making fee adjustments operationally expensive. This upgrade enables the contract owner to adjust spread fees directly, starting with a reduction from 5bps to 2bps on select USDm pairs. | |||
There was a problem hiding this comment.
This reads as if MGP-17 itself reduces live spreads to 2bps, but script/migration/MGP17.sol only upgrades the implementation. Because governance voters rely on this markdown to understand what will execute, please reword the TL;DR/overview to make it clear that this proposal only enables a later fee change.
| address owner = sender("migrationOwner").account; | ||
| bytes32[] memory exchangeIds = IBiPoolManager(biPoolManagerProxy).getExchangeIds(); | ||
| require(exchangeIds.length > 0, "no exchanges found on BiPoolManager"); | ||
|
|
||
| bytes32 exchangeId = exchangeIds[0]; | ||
| IBiPoolManager.PoolExchange memory exchange = IBiPoolManager(biPoolManagerProxy).getPoolExchange(exchangeId); | ||
| uint256 originalSpread = exchange.config.spread.value; | ||
|
|
||
| // Set a test spread value | ||
| uint256 testSpread = originalSpread == 0 ? 1 : originalSpread - 1; | ||
| vm.prank(owner); | ||
| IBiPoolManager(biPoolManagerProxy).setSpread(exchangeId, testSpread); |
There was a problem hiding this comment.
This post-check is proving that the locally configured migrationOwner sender can call setSpread, not that the upgraded contract preserved the correct owner. That makes the result namespace-config dependent and misses an explicit owner() assertion after the upgrade. Please read IOwnable(biPoolManagerProxy).owner() from chain state, prank that address for the capability check, and only compare it to migrationOwner as a separate config sanity check if needed.
There was a problem hiding this comment.
Stale comment
This PR adds the
MGP-17proposal artifacts and the migration script to upgradeBiPoolManagerto an implementation that exposessetSpread. I reviewed all six changed files; only the files below have findings.
mgps/mgp17.md
- 🔴 Critical:
50-51say the proposal upgrades proxy0x22d9db95E6Ae61c104A7B6F6C78D7993B94ec901to implementation0xC016174B60519Bdc24433d4ed2cFf6c1efaC7881, but the only committed broadcast payload in this PR upgrades0xeCB3C656C131fCd9bB8D1d80898716bD684feb78to0x15b38D560928029a74d1D0a56eE232fb5Ff3A4B1(broadcast/MGP17.sol/11142220/run-1776254228027.json:10-13,broadcast/MGP17.sol/11142220/run-latest.json:10-13). The human-readable proposal text and the executable proposal artifacts describe different actions, so reviewers cannot tell which contracts this PR is actually proposing to upgrade.
broadcast/MGP17.sol/11142220/run-1776254228027.json
- 🔴 Critical:
10-13encode a proposal that targets the Sepolia proxy/implementation, while the embedded markdown still names the mainnet proxy/implementation. If this file is meant to be the auditable rehearsal artifact, it is currently misleading.
broadcast/MGP17.sol/11142220/run-latest.json
- 🔴 Critical: same issue at
10-13; the committedrun-latestartifact disagrees with the proposal text about the target proxy and implementation.
.treb/deployments.json
- 🟡 Important:
25786-25789update the proxy's current implementation to0x15b38D560928029a74d1D0a56eE232fb5Ff3A4B1but still record the upgrade history astestnet-v2-rc5/11142220/BiPoolManager:v2.6.5, whose deployment entry resolves to0x641A91B3c70D0E4A9A8bf5B3a2047ed9762F600c(22089-22095) rather than0x15b38.... Any tooling that followsimplementationIdwill now point at the wrong artifact/address for this upgrade.Final verdict: 🚫 Needs changes
Sent by Cursor Automation: PR Review
|
|
||
| | Contract | Address | | ||
| | ------------- | ------------------------------------------ | | ||
| | BiPoolManager (proxy) | 0x22d9db95E6Ae61c104A7B6F6C78D7993B94ec901 | |
There was a problem hiding this comment.
These addresses do not match the committed proposal payload. The checked-in broadcasts target 0xeCB3C656C131fCd9bB8D1d80898716bD684feb78 and 0x15b38D560928029a74d1D0a56eE232fb5Ff3A4B1, so either this markdown or the broadcast artifacts are wrong. As written, reviewers are being shown different contracts than the ones the proposal actually encodes.
| "[0xeCB3C656C131fCd9bB8D1d80898716bD684feb78]", | ||
| "[0]", | ||
| "[0xbb913f4100000000000000000000000015b38d560928029a74d1d0a56ee232fb5ff3a4b1]", | ||
| "{\\\"description\\\":\\\"## TL;DR\\\\n\\\\nWe propose upgrading the BiPoolManager implementation to a new version that adds a `setSpread` function. The currently deployed implementation requires destroying and recreating a pool to change its fee, making fee adjustments operationally expensive. This upgrade enables the contract owner to adjust spread fees directly, starting with a reduction from 5bps to 2bps on select USDm pairs.\\\\n\\\\n---\\\\n\\\\n## Overview\\\\n\\\\nThe currently deployed BiPoolManager implementation does not have a `setSpread` function, meaning every fee change requires destroying and recreating the pool with the new fee parameters. This proposal upgrades the BiPoolManager proxy to a new implementation that adds a `setSpread` function, allowing the contract owner to adjust spread fees directly without the overhead of pool destruction and recreation.\\\\n\\\\nThe motivation behind this change is to enable fee structure experimentation on Mento collateral pools. The previous 5bps spread fee, introduced via MGP-13, was set to protect reserves from arbitrage losses and generate protocol revenue. However, Mento Labs aims to optimize the fee structure by balancing reserve protection and protocol revenue with keeping Mento competitive in on-chain stablecoin swaps.\\\\n\\\\n### Initial Fee Adjustment\\\\n\\\\nFollowing this upgrade, Mento Labs plans to reduce spread fees from 5bps to 2bps on:\\\\n\\\\n- USDm to USDC\\\\n- USDm to axlUSDC\\\\n- USDm to USDT\\\\n\\\\nOngoing monitoring of swap volume, reserve impact, and protocol revenue will inform further adjustments, communicated via the forum.\\\\n\\\\nFor full details, see the forum discussion: [Fee Structure Experimentation on Mento Collateral Pools](https://forum.mento.org/t/fee-structure-experimentation-on-mento-collateral-pools/115)\\\\n\\\\n---\\\\n\\\\n### Security Considerations\\\\n\\\\n**Risk Assessment**\\\\n\\\\n- The upgrade only changes the BiPoolManager implementation; no ownership transfers are involved.\\\\n- The governance timelock retains proxy admin ownership of the BiPoolManager.\\\\n\\\\n**Safety Measures**\\\\n\\\\nThe new implementation is the same one that was used in [MGP-13: Increase Circuit Breaker to 15bps and Enable 5bps Spread Fee](https://governance.mento.org/proposals/33774473826582746102247872468112299588808192529529153992548885265611575112929), which has already been reviewed and executed successfully. The proxy upgrade mechanism is the same Celo legacy proxy pattern used across all existing Mento V2 contracts.\\\\n\\\\n### Transaction Details\\\\n\\\\nThis proposal consists of **1 transaction**.\\\\n\\\\n**Step 1: Upgrade BiPoolManager Implementation (1 transaction)**\\\\n\\\\nUpgrade the BiPoolManager proxy to the new implementation that adds the `setSpread` function.\\\\n\\\\n- Call `_setImplementation(address)` on the BiPoolManager proxy\\\\n\\\\n| Contract | Address |\\\\n| ------------- | ------------------------------------------ |\\\\n| BiPoolManager (proxy) | 0x22d9db95E6Ae61c104A7B6F6C78D7993B94ec901 |\\\\n| New Implementation | 0xC016174B60519Bdc24433d4ed2cFf6c1efaC7881 |\\\\n\\\",\\\"title\\\":\\\"MGP-17: Upgrade BiPoolManager with FeeSetter\\\"}" |
There was a problem hiding this comment.
This JSON encodes a proposal targeting the Sepolia proxy/implementation from lines 10-12, but the embedded markdown string still says the upgrade is for 0x22d9... -> 0xC016.... That makes the committed rehearsal artifact internally inconsistent and misleading to review.
There was a problem hiding this comment.
This PR adds the MGP-17 proposal artifacts and migration script to upgrade BiPoolManager to an implementation that exposes setSpread. I reviewed all 7 changed files; only the files below have findings.
mgps/mgp17.md
- 🟡 Important:
3,15-19say this proposal starts by reducing selected USDm collateral-pool spreads from5bpsto2bps, but42-46describe only a single_setImplementation(address)call. The executable payload never callssetSpread, so the human-readable proposal text overstates what governance is actually approving.
script/migration/MGP17.sol
- 🟡 Important:
83-94proves the new permission againstsender("migrationOwner").account, not against the upgraded contract's actual on-chainowner(). That makes the post-check depend on local Treb sender configuration instead of the state the proposal leaves behind; if those ever diverge, this check can pass or fail for the wrong reason. ReadIOwnable(biPoolManagerProxy).owner()from chain state and, if desired, assert separately that it matches the expected sender alias.
broadcast/MGP17.sol/42220/run-1776267061591.json
- 🟡 Important:
13embeds the same misleading proposal text asmgps/mgp17.md: it says the proposal starts lowering live spreads, but the encoded calldata only submits the_setImplementation(address)action.
broadcast/MGP17.sol/42220/run-latest.json
- 🟡 Important:
13has the same issue as the timestamped mainnet artifact: the embedded description promises a fee reduction that the calldata does not perform.
broadcast/MGP17.sol/11142220/run-1776254228027.json
- 🟡 Important:
13is self-contradictory. The actual Sepolia proposal targets proxy0xeCB3C656C131fCd9bB8D1d80898716bD684feb78at10and implementation0x15b38D560928029a74d1D0a56eE232fb5Ff3A4B1at12, but the embedded markdown still says the proposal upgrades mainnet proxy0x22d9db95E6Ae61c104A7B6F6C78D7993B94ec901to implementation0xC016174B60519Bdc24433d4ed2cFf6c1efaC7881. That makes the rehearsal artifact misleading.
broadcast/MGP17.sol/11142220/run-latest.json
- 🟡 Important: same issue at
10-13; the committedrun-latestSepolia artifact disagrees with itself about which proxy and implementation are being proposed.
Final verdict: 🚫 Needs changes
Sent by Cursor Automation: PR Review


No description provided.