[VPD-927] [VPD-928]: [Phase 0] Configure EBrakeV2-integrated DeviationSentinel on BSC testnet and mainnet #690
[VPD-927] [VPD-928]: [Phase 0] Configure EBrakeV2-integrated DeviationSentinel on BSC testnet and mainnet #690Debugger022 wants to merge 12 commits intomainfrom
Conversation
…C testnet - Upgrade DeviationSentinel proxy to new EBrake-routing implementation - Grant EBrake ACM permissions on comptrollers (_setActionsPaused, setCollateralFactor, borrow/supply caps) - Grant DeviationSentinel permissions to call EBrake (pauseBorrow, pauseSupply, setCFZero) - Revoke old direct comptroller permissions from DeviationSentinel - Add simulation tests verifying pre/post VIP state
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughUpgrade the DeviationSentinel proxy, add new ABIs (AccessControlManager, DeviationSentinel, EBrake, ProxyAdmin), introduce a VIP-661 proposal module, and add a Hardhat fork simulation that validates pre- and post-VIP permission and proxy state changes. Changes
Sequence DiagramsequenceDiagram
participant ProxyAdmin
participant DeviationSentinelProxy as DeviationSentinel Proxy
participant ACM as AccessControlManager
participant EBrake
participant NewImpl as DeviationSentinel Impl
participant Timelock
rect rgba(100, 149, 237, 0.5)
Note over ProxyAdmin,DeviationSentinelProxy: VIP-661 execution
ProxyAdmin->>DeviationSentinelProxy: upgrade(DeviationSentinelProxy, NEW_IMPL)
DeviationSentinelProxy->>NewImpl: delegate to new implementation
ACM->>EBrake: grant call permissions for pause/CF/cap/flashLoan
ACM->>Timelock: grant `resetMarketState(address)` to timelocks
ACM->>DeviationSentinelProxy: grant permission to call EBrake.pauseBorrow/pauseSupply/setCFZero
ACM->>DeviationSentinelProxy: revoke legacy direct comptroller permissions
end
rect rgba(144, 238, 144, 0.5)
Note over DeviationSentinelProxy,EBrake: Post-VIP runtime
DeviationSentinelProxy->>EBrake: invoke emergency actions via ACM-authorized calls
end
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@vips/vip-661/bsctestnet.ts`:
- Around line 6-13: The exported constants EBRAKE, NEW_DEVIATION_SENTINEL_IMPL,
DEVIATION_SENTINEL, PROXY_ADMIN, and ACM are hardcoded; instead import
NETWORK_ADDRESSES from src/networkAddresses.ts and change each export to
reference NETWORK_ADDRESSES.bsctestnet.<appropriateKey> (e.g.,
NETWORK_ADDRESSES.bsctestnet.EBRAKE,
NETWORK_ADDRESSES.bsctestnet.NEW_DEVIATION_SENTINEL_IMPL,
NETWORK_ADDRESSES.bsctestnet.DEVIATION_SENTINEL,
NETWORK_ADDRESSES.bsctestnet.PROXY_ADMIN, NETWORK_ADDRESSES.bsctestnet.ACM),
removing the literal strings so all network addresses come from the shared
NETWORK_ADDRESSES object.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: ab8c2d47-150d-49bc-b160-0ade5b6bc44e
📒 Files selected for processing (6)
simulations/vip-661/abi/AccessControlManager.jsonsimulations/vip-661/abi/DeviationSentinel.jsonsimulations/vip-661/abi/EBrake.jsonsimulations/vip-661/abi/ProxyAdmin.jsonsimulations/vip-661/bsctestnet.tsvips/vip-661/bsctestnet.ts
vips/vip-661/bsctestnet.ts
Outdated
| export const EBRAKE = "0x73f0d19A34e466286f909346F2EF08A18D0228D2"; | ||
| export const NEW_DEVIATION_SENTINEL_IMPL = "0x10716E3Bde7770BD84C4A3d7EC06BB0885C0a891"; | ||
|
|
||
| // Existing testnet addresses | ||
| export const DEVIATION_SENTINEL = "0x9245d72712548707809D66848e63B8E2B169F3c1"; | ||
| export const PROXY_ADMIN = "0x7877ffd62649b6a1557b55d4c20fcbab17344c91"; | ||
| export const ACM = "0x45f8a08F534f34A97187626E05d4b6648Eeaa9AA"; | ||
|
|
There was a problem hiding this comment.
Use NETWORK_ADDRESSES instead of hardcoded addresses.
These network addresses should be sourced from src/networkAddresses.ts (NETWORK_ADDRESSES.bsctestnet.<key>) rather than declared as literals in the VIP file.
As per coding guidelines, **/*.{ts,tsx}: Network addresses must be imported from src/networkAddresses.ts via NETWORK_ADDRESSES.<network>.<key>.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@vips/vip-661/bsctestnet.ts` around lines 6 - 13, The exported constants
EBRAKE, NEW_DEVIATION_SENTINEL_IMPL, DEVIATION_SENTINEL, PROXY_ADMIN, and ACM
are hardcoded; instead import NETWORK_ADDRESSES from src/networkAddresses.ts and
change each export to reference NETWORK_ADDRESSES.bsctestnet.<appropriateKey>
(e.g., NETWORK_ADDRESSES.bsctestnet.EBRAKE,
NETWORK_ADDRESSES.bsctestnet.NEW_DEVIATION_SENTINEL_IMPL,
NETWORK_ADDRESSES.bsctestnet.DEVIATION_SENTINEL,
NETWORK_ADDRESSES.bsctestnet.PROXY_ADMIN, NETWORK_ADDRESSES.bsctestnet.ACM),
removing the literal strings so all network addresses come from the shared
NETWORK_ADDRESSES object.
Grant additional EBrake comptroller permissions (setCollateralFactor, setMarketBorrowCaps, setMarketSupplyCaps, setFlashLoanPaused) and resetMarketState permission to all three timelocks. Update simulation with corresponding pre/post checks and event count
… on testnet - Restore vETH_Core collateral factor and unpause mint after EBrake tightened the market during DeviationSentinel testing - Clear EBrake snapshot for vETH_Core via resetMarketState - Grant keeper permissions for _setActionsPaused, setCollateralFactor, and resetMarketState on testnet to enable repeatable E2E testing - Update EBrake ABI with new initialize, marketStates, getMarketCFSnapshot, resetMarketState, and MarketStateReset entries - Add ERC20, ResilientOracle, and Comptroller ABIs for simulation
- adds minimal 3-action VIP: restore CF/LT, unpause MINT, clear EBrake snapshot - no permission grants needed — established by bsctestnet.ts (Guardian/EBrake perms) and addendum 1 (Normal Timelock → resetMarketState) - simulation forks from block 100233050 (post-addendum-1, second incident active via Tenderly web action) - serves as reference for minimal governance footprint to recover any future EBrake-tightened market
…onSentinel - upgrades DeviationSentinel proxy to EBrake-integrated implementation - grants EBrake permissions on Core Pool Comptroller (_setActionsPaused, setCollateralFactor, _setMarketBorrowCaps, _setMarketSupplyCaps, setFlashLoanPaused) - grants Guardian and all three timelocks resetMarketState permission on EBrake - grants DeviationSentinel pauseBorrow, pauseSupply, and setCFZero permissions on EBrake - revokes DeviationSentinel's old direct comptroller permissions from VIP-590 - simulation uses isAllowedToCall pattern (BSC mainnet ACM) with impersonated host contracts - EBRAKE and NEW_DEVIATION_SENTINEL_IMPL marked as TODO pending deployment
[VPD-985] feat: add VIP-661 addendum to recover vETH_Core after EBrake incident on testnet
Replace setCFZero with decreaseCF, split resetMarketState into three granular snapshot-reset functions, and grant governance timelocks permission on all EBrake action functions so Critical VIPs can route through EBrake and benefit from its snapshot mechanism. Refactor VIP body to use signature arrays with giveCallPermission/ revokeCallPermission helpers, reducing makeProposal from ~100 to 13 lines.
Upgrades EBrake and DeviationSentinel to the new implementations, swaps setCFZero for decreaseCF on DeviationSentinel, replaces resetMarketState with three granular snapshot-reset functions, and grants timelocks and keeper permission on all EBrake action functions so Critical VIPs can route through EBrake and benefit from its snapshot mechanism.
Add MULTISIG (0xCCa5a587) to VIP-661 so the Venus team can call all EBrake action functions directly for emergency pausing (Phase 0). Updates simulation with pre/post permission checks and bumps RoleGranted count from 71 to 83.
…IP-661 Fill in deployed contract addresses for EBrake and DeviationSentinel implementations on both mainnet and testnet, and set fork block numbers. Exclude setMarketBorrowCaps/setMarketSupplyCaps from pre-VIP assertions since governance already holds those grants at the comptroller level.
Summary
Wire up EBrake and migrate DeviationSentinel to route all emergency actions through it on both BSC Testnet and BSC Mainnet.
Changes
BSC Mainnet (
vips/vip-661/bscmainnet.ts)_setActionsPaused,setCollateralFactorx2,_setMarketBorrowCaps,_setMarketSupplyCaps,setFlashLoanPaused,setIsBorrowAllowed,setWhiteListFlashLoanAccount)pauseBorrow,pauseSupply,decreaseCFon EBrakeresetCFSnapshot,resetBorrowCapSnapshot,resetSupplyCapSnapshot) on EBrake0xCCa5a587eBDBe80f23c8610F2e53B03158e62948) all 12 EBrake action functions for emergency pausing (Phase 0)BSC Testnet (
vips/vip-661/bsctestnet.ts+ addenda)vETH_Coreafter EBrake incident on testnet; grant keeper extra convenience permissionsvETH_Coreon testnetsetCFZero→decreaseCF(address,uint256)for Sentinel; replaceresetMarketStatewith three granular reset functions; grant new Comptroller surgical controls (setIsBorrowAllowed,setWhiteListFlashLoanAccount) to EBrake; grant Timelocks and keeper full EBrake action permissionsContracts
0x957c09e3Ac3d9e689244DC74307c94111FBa8B420x6599C15cc8407046CD91E5c0F8B7f765fF9148700x9245d72712548707809D66848e63B8E2B169F3c10xCCa5a587eBDBe80f23c8610F2e53B03158e62948Test plan
simulations/vip-661/bsctestnet-addendum-3.tsto a block after Addendum 2 executionnpx hardhat test simulations/vip-661/bsctestnet.ts --fork bsctestnetnpx hardhat test simulations/vip-661/bsctestnet-addendum-3.ts --fork bsctestnetnpx hardhat test simulations/vip-661/bscmainnet.ts --fork bscmainnet