Skip to content

[VPD-1118] feat: VIP-666 + VIP-667 — DeviationSentinel + EBrakeV2 on Ethereum, Arbitrum One, Base#702

Open
Debugger022 wants to merge 15 commits intomainfrom
feat/VPD-1118
Open

[VPD-1118] feat: VIP-666 + VIP-667 — DeviationSentinel + EBrakeV2 on Ethereum, Arbitrum One, Base#702
Debugger022 wants to merge 15 commits intomainfrom
feat/VPD-1118

Conversation

@Debugger022
Copy link
Copy Markdown
Contributor

@Debugger022 Debugger022 commented Apr 27, 2026

Summary

  • Adds the DeviationSentinel + EBrakeV2 Emergency Brake stack to Ethereum, Arbitrum One, and Base, mirroring the BSC setup from VIP-590 + VIP-610
  • VIP-616 handles ownership + permissions, VIP-617 handles governance EBrake action grants + market wiring
  • CurveOracle (Ethereum) prices eBTC via get_dy() instantaneous swap output rather than the EMA price_oracle, so manipulation is captured immediately
  • Adds a per-chain LayerZero payload size guard inside makeProposal so oversized cross-chain VIPs fail at simulation/CI rather than at propose/proposeOnTestnet time

Changes

VIP-616 (Bootstrap & Permissions)

  • Accept ownership of DeviationSentinel, SentinelOracle, UniswapOracle, EBrakeV2, CurveOracle (Ethereum), AerodromeSlipstreamOracle (Base)
  • Grant Guardian + 3 Timelocks admin permissions on all oracle contracts
  • Grant EBrakeV2 the 4 IL-supported Comptroller permissions
  • Grant DeviationSentinel the 3 EBrake action permissions (pauseBorrow, pauseSupply, decreaseCF)
  • Grant Guardian + Timelocks granular snapshot-reset permissions on EBrake
  • Grant per-chain Multisig Pauser the 8 IL-supported EBrake action functions
  • Whitelist Keeper + Guardian + Timelocks as trusted keepers on DeviationSentinel

VIP-617 (Governance Actions & Market Wiring)

  • Grant Guardian + Timelocks the 8 IL-supported EBrake action functions
  • Wire 10 Ethereum markets (9 Uniswap V3 + 1 CurveOracle / eBTC), 5 Arbitrum One markets, 4 Base markets (2 Uniswap V3 + 2 Aerodrome Slipstream) on their DEX oracle → SentinelOracle → DeviationSentinel with 10% deviation threshold

Framework

  • src/utils.ts: makeProposal now computes the payloadWithId envelope size for each per-chain LZ message and throws when it exceeds the destination chain's DEFAULT_PAYLOAD_SIZE_LIMIT. Catches the on-chain Relayer: _payloadSize tooooo big revert that local simulations otherwise miss.

Per-chain LZ payload size limits (verified on-chain)

Queried DEFAULT_PAYLOAD_SIZE_LIMIT() and payloadSizeLimitLookup(srcChainId) on every Venus OmnichainGovernanceExecutor. Source LZ chain ID = 102 (BSC mainnet) for mainnets, 10102 (BSC testnet) for testnets.

Network Executor DEFAULT Lookup(src) Effective
ethereum 0xd70ffB56E4763078b8B814C0B48938F35D83bE0C 10000 0 10000 (default)
arbitrumone 0xc1858cCE6c28295Efd3eE742795bDa316D7c7526 10000 0 10000 (default)
opmainnet 0x09b11b1CAdC08E239970A8993783f0f8EeC60ABf 10000 0 10000 (default)
basemainnet 0xE7C56EaA4b6eafCe787B3E1AB8BCa0BC6CBDDb9e 10000 0 10000 (default)
zksyncmainnet 0xA1b56f19CA5E5b15EF29d38238930Ce9f0235312 10000 0 10000 (default)
opbnbmainnet 0x82598878Adc43F1013A27484E61ad663c5d50A03 10000 0 10000 (default)
unichainmainnet 0x3E281461efb3D53EC20DB207674373Ed8Ef3BbA9 10000 0 10000 (default)
sepolia 0xD9B18a43Ee9964061c1A1925Aa907462F0249109 10000 0 10000 (default)
arbitrumsepolia 0xcf3e6972a8e9c53D33b642a2592938944956f138 10000 0 10000 (default)
opsepolia 0xC7D6D33adcdBfccD416C3aAB1878360ea8b79ac6 10000 0 10000 (default)
basesepolia 0xDD59be81B3B5BFa391bDA3a84c9f5233BfEF52a4 10000 0 10000 (default)
opbnbtestnet 0x0aa644c4408268E9fED5089A113470B6e706bc0C 10000 0 10000 (default)

All 12 destination executors return identical 10,000-byte caps with no per-source override, so the framework hardcodes a single LZ_PAYLOAD_SIZE_LIMIT = 10_000 constant. If any chain later configures a payloadSizeLimitLookup override, the comment in utils.ts flags the migration path.

Infra

  • Add ACCESS_CONTROL_MANAGER to networkAddresses.ts for Arbitrum One, ZkSync, and Base
  • CurveOracle PoolConfig updated to 5-field struct: adds refCoinIndex + assetDecimals for get_dy() pricing

Test plan

npx hardhat test simulations/vip-616/ethereum.ts --fork ethereum
npx hardhat test simulations/vip-616/arbitrumone.ts --fork arbitrumone
npx hardhat test simulations/vip-616/basemainnet.ts --fork basemainnet
npx hardhat test simulations/vip-617/ethereum.ts --fork ethereum
npx hardhat test simulations/vip-617/arbitrumone.ts --fork arbitrumone
npx hardhat test simulations/vip-617/basemainnet.ts --fork basemainnet

- Wires DeviationSentinel + EBrakeV2 + SentinelOracle +
  UniswapOracle on Ethereum, Arbitrum One, zkSync Era, and Base
- Grants only the IL-supported subset of EBrake action functions
  since these chains use isIsolatedPool=true (Diamond-only fns
  would revert)
- Add ACCESS_CONTROL_MANAGER for arbitrumone, zksyncmainnet, and
  basemainnet to networkAddresses.ts
- Include cross-chain simulation suite with pre/post permission,
  ownership, and functional sanity checks; auto-skips when
  placeholder addresses are unfilled
@Debugger022 Debugger022 self-assigned this Apr 28, 2026
DeviationSentinel, EBrake, SentinelOracle, and UniswapOracle proxies sourced
from venus-periphery PR #65 (feat/VPD-1134). Keeper and multisig pauser reuse
the same BSC mainnet addresses (keeper: 0x57fa…, multisig: 0xCCa5…).
- Remove ZKSYNCMAINNET_CONFIG import and NETWORKS array entry
- Update proposal title from 4 chains to 3 (Ethereum, Arbitrum One, Base)
- Update description and summary to reflect 3-chain deployment
- Reduce permission event count from 332 to 249 (83 per chain × 3)
- Update market count line: remove zkSync market count reference
- Set realistic fork block numbers for remaining 3 chains
- Delete market.md (was scoped to 4-chain proposal)
- Monolithic VIP-666 (122 cmds/chain) exceeded Ethereum's 30M block
  gas limit with the LayerZero adapter param. Split into VIP-666
  (bootstrap + permissions, 60 cmds/chain) and new VIP-667
  (governance EBrake actions + per-market wiring).
- Drop eBTC (Ethereum) and cbBTC + wstETH (Base) from monitored
  markets. Their only liquid pools (Curve / Aerodrome Slipstream)
  are not Uniswap V3 ABI-compatible — UniswapOracle would silently
  revert at handleDeviation time. Re-include once dedicated
  CurveOracle / SlipstreamOracle adapters are deployed.
- Simulation hardening: bump Chainlink/RedStone tokenConfig
  staleness to 1y so post-time-warp price reads keep validating;
  add zero-address validity guard; add end-to-end
  checkPriceDeviation pre-flight (LBTC skipped due to OneJumpOracle
  fork-time fragility, production unaffected).
@Debugger022 Debugger022 changed the title feat: add VIP-666 to configure DeviationSentinel + EBrakeV2 [VPD-1118]: add VIP-666 to configure DeviationSentinel + EBrakeV2 Apr 29, 2026
- Bootstrap CurveOracle (Ethereum) + AerodromeSlipstreamOracle (Base)
  in VIP-666: acceptOwnership + setPoolConfig admin grants for
  Guardian + 3 Timelocks. These markets were previously commented out
  because their only liquid pools were not Uniswap V3 ABI-compatible
  — the dedicated adapters from venus-periphery PR #66 unblock them.
- Add an `oracleType` discriminator on MonitoredMarket so VIP-667's
  wiring loop branches between UniswapOracle / CurveOracle (4-arg
  setPoolConfig with coinIndex + referenceToken) / AerodromeSlipstream
  (Uniswap-shaped 2-arg setPoolConfig).
- Bump VIP-667 fork blocks past the new oracle deployments
  (Eth ≥ 24985630, Base ≥ 45337626).
- Sim note: UniswapOracle and AerodromeSlipstreamOracle share the
  `PoolConfigUpdated(address,address)` topic, so the post-execution
  event-count assertion sums Uniswap + Aerodrome markets under one
  ABI filter; CurveOracle's 4-arg variant is checked separately.
@Debugger022 Debugger022 changed the title [VPD-1118]: add VIP-666 to configure DeviationSentinel + EBrakeV2 [VPD-1118] feat: VIP-666 + VIP-667 — DeviationSentinel + EBrakeV2 on Ethereum, Arbitrum One, Base Apr 29, 2026
@Debugger022 Debugger022 marked this pull request as ready for review April 29, 2026 14:39
Comment thread vips/vip-617/bscmainnet.ts Outdated
Debugger022 and others added 6 commits April 30, 2026 18:12
Replace price_oracle() EMA with get_dy() instantaneous swap output.
New PoolConfig adds refCoinIndex and assetDecimals fields; setPoolConfig
signature updated to (address,address,uint8,uint8,address,uint8).
Redeploy proxy to 0x9F508F3 and bump Ethereum fork blocks to 24992834+.
…EBrake

- Minimal 22-command VIP (bsctestnet.ts) targeting Sepolia via LZ —
  fits within the testnet relayer's ~10 KB payload ceiling; the full
  governance admin set is deferred to mainnet VIPs
- Deploys ownership, EBrake→Comptroller and Sentinel→EBrake wiring,
  trusted keeper whitelist (deployer EOA + on-chain keeper), deployer
  extra permissions for the E2E reset cycle, and market config for
  WETH + WBTC at 10% threshold
- Sepolia address config (addresses/sepolia.ts) with deployed contract
  addresses and keeper set to match the BSC testnet keeper address
- Fork simulation (simulations/vip-666/sepolia.ts) covering pre/post
  VIP state: ownership, permissions, trusted keepers, market config
- Adds WETH address to src/networkAddresses.ts sepolia entry
Cross-chain commands fail at on-chain estimateFees with 'Relayer:
_payloadSize tooooo big' when the encoded payload exceeds 10,000 bytes,
but local simulations bypass the Relayer and pass silently. Compute the
payloadWithId envelope size during proposal build and throw with the
offending dstChainId + command count so oversized VIPs fail in CI rather
than at proposeOnTestnet/propose time.
…trap

- Cross-chain payload for VIP-616 + VIP-617 combined exceeds the LZ V1
  RelayerV2 ~10 KB ceiling; encode all ACM grants and market wiring inside
  per-chain DeviationSentinelConfigurator so each chain needs only ~6
  cross-chain commands instead of 100+ ACM grants
- Merge vip-617 scope into vip-616 — configurator runs both bootstraps
  atomically in a single execute() call, no second VIP needed
- Fix ACM bootstrap: VIP must grant DEFAULT_ADMIN_ROLE (not per-sig perms);
  Venus ACM.giveCallPermission wraps OZ grantRole which requires that role,
  per-sig grants caused execute() to revert on the first self-grant call
- Add full fork simulation suite for Ethereum, Arbitrum One, and Base:
  pre/post ownership, ACM permissions, market wiring, and end-to-end
  SentinelOracle / checkPriceDeviation assertions
signature: "execute()",
params: [],
dstChainId,
},
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why dont we revoke permission ? 🤔

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nvm, saw its done in configurator

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.

2 participants