Skip to content

[WONT MERGE][VPD-1151] [VPD-1118] feat: add DeviationSentinelConfigurator helpers contract for vip-616#67

Closed
Debugger022 wants to merge 7 commits into
developfrom
feat/VPD-1118
Closed

[WONT MERGE][VPD-1151] [VPD-1118] feat: add DeviationSentinelConfigurator helpers contract for vip-616#67
Debugger022 wants to merge 7 commits into
developfrom
feat/VPD-1118

Conversation

@Debugger022
Copy link
Copy Markdown
Contributor

Description

Adds the per-chain DeviationSentinelConfigurator helper contracts and their fork tests. Each helper packages the entire VIP-616 + VIP-617 bootstrap (ACM grants, EBrake permissions, multisig pauser permissions, trusted-keeper whitelisting, per-market deviation wiring) into a single execute() call.

This is what allows the cross-chain VIPs to fit under LayerZero V1's RelayerV2 ~10KB payload ceiling — encoding ~100 ACM grants and per-market wiring directly inside Solidity collapses each chain's VIP to ~6 commands (acceptOwnerships + helper.execute()).

Changes

Contracts (contracts/helpers/)

  • DeviationSentinelConfigurator.sol — abstract base; every grant/revoke pattern shared across chains, plus the Uniswap V3 market wiring primitive.
  • DeviationSentinelConfiguratorEthereum.sol — 9 Uniswap V3 markets + 1 Curve StableSwap-NG market (eBTC priced via the eBTC/WBTC Curve pool).
  • DeviationSentinelConfiguratorArbitrumOne.sol — 5 Uniswap V3 markets, no extra DEX oracles.
  • DeviationSentinelConfiguratorBaseMainnet.sol — 2 Uniswap V3 + 2 Aerodrome Slipstream markets (cbBTC, wstETH).
  • IDeviationSentinelConfigurator.sol — shared external interfaces (ACM, DeviationSentinel, SentinelOracle, IDexPoolOracle, ICurveOracle).

Tests (tests/hardhat/Fork/Configurator/)

  • Parametrized fork suite covering all three chains: ownership normalization, ACM DEFAULT_ADMIN_ROLE setup, execute(), then assertions over governance permission grants, EBrake action perms, trusted keepers, per-market wiring, and helper self-retirement.
  • One ~20-line entry file per chain; chain differences live entirely in configs.ts.

Build config

  • hardhat.config.ts — pin Arbitrum (One + Sepolia) to Shanghai. Arbitrum block headers omit EIP-4844 blob fields, so EDR's Cancun decoder panics with Header(ExcessBlobGasNotSet) on recent blocks.

Trust model

  • execute() is gated by msg.sender == NORMAL_TIMELOCK().
  • The wrapping VIP grants the helper DEFAULT_ADMIN_ROLE on the local ACM and acceptOwnership()s every contract the helper admins.
  • During execute() the helper transiently self-grants the periphery-side admin perms it needs, fans out all governance / EBrake / keeper grants, wires every monitored market, then revokes its transient perms and renounces DEFAULT_ADMIN_ROLE on the ACM.
  • After execute() the helper has no remaining authority — re-running it reverts on the very first self-grant. No follow-up cleanup VIP needed.

Test plan

  • FORKED_NETWORK=ethereum npx hardhat test tests/hardhat/Fork/Configurator/ethereum.ts
  • FORKED_NETWORK=arbitrumone npx hardhat test tests/hardhat/Fork/Configurator/arbitrumone.ts
  • FORKED_NETWORK=basemainnet npx hardhat test tests/hardhat/Fork/Configurator/basemainnet.ts
  • Companion VIP simulation in vips/ repo (VIP-616 + VIP-617) green against the deployed configurator addresses.

Debugger022 and others added 5 commits May 4, 2026 17:32
- Combined VIP-616 + VIP-617 cross-chain payload would exceed LayerZero
  V1's ~10KB RelayerV2 ceiling; encoding grants and per-market wiring
  in Solidity drops each chain's VIP to ~6 commands
- execute() is atomic and gated by NORMAL_TIMELOCK: self-grants transient
  ACM perms, fans out admin grants to Guardian + 3 Timelocks + EBrake +
  multisig pauser, wires every monitored market, then self-revokes
- Renounces DEFAULT_ADMIN_ROLE on the ACM at the end so the helper
  retires permanently in one tx with no follow-up cleanup VIP
- Abstract base + per-chain children: Ethereum adds CurveOracle (eBTC),
  Base adds AerodromeSlipstreamOracle (cbBTC, wstETH), Arbitrum routes
  its 5 markets through UniswapOracle only
- Cover the full execute() path on Ethereum, Arbitrum One, and Base:
  ownership normalization, ACM DEFAULT_ADMIN_ROLE grant, per-market
  wiring across UniswapOracle/CurveOracle/AerodromeSlipstreamOracle,
  and helper self-retirement (renounce + transient revokes)
- Shared fixture + parametrized factories so each per-chain entry
  file is ~20 lines; chain differences live entirely in configs.ts
- accessControlTests run on a fresh helper before execute() so the
  OnlyTimelock revert path is meaningful; remaining suites share a
  before-hook that calls execute() once
- Curve markets skip the direct DEX-oracle pool check: CurveOracle
  uses a struct rather than a flat tokenPools mapping, and execute()
  is atomic, so the SentinelOracle assertion implies setPoolConfig
  succeeded
@Debugger022 Debugger022 marked this pull request as ready for review May 4, 2026 13:31
Copy link
Copy Markdown

@claude claude Bot left a comment

Choose a reason for hiding this comment

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

Claude Code Review

This repository is configured for manual code reviews. Comment @claude review to trigger a review and subscribe this PR to future pushes, or @claude review once for a one-time review.

Tip: disable this comment in your organization's Code Review settings.

@Debugger022 Debugger022 self-assigned this May 4, 2026
@Debugger022 Debugger022 changed the title [VPD-1118] feat: add DeviationSentinelConfigurator helpers contract for vip-616 [VPD-1151] [VPD-1118] feat: add DeviationSentinelConfigurator helpers contract for vip-616 May 4, 2026
Copy link
Copy Markdown
Contributor

@fred-venus fred-venus left a comment

Choose a reason for hiding this comment

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

one-off contract, won't merge

@fred-venus fred-venus marked this pull request as draft May 5, 2026 03:12
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 5, 2026

Code Coverage

Package Line Rate Branch Rate Health
contracts 100% 100%
contracts.DeviationSentinel 100% 100%
contracts.DeviationSentinel.Oracles 96% 93%
contracts.EmergencyBrake 0% 0%
contracts.Interfaces 100% 100%
contracts.LeverageManager 94% 80%
contracts.Libraries 29% 33%
contracts.PositionSwapper 0% 0%
contracts.RelativePositionManager 91% 64%
contracts.SwapHelper 100% 100%
contracts.SwapRouter 79% 55%
contracts.helpers 0% 0%
contracts.pendle-pt-fixed-rate-vault 0% 0%
contracts.pendle-pt-fixed-rate-vault.interfaces 100% 100%
contracts.pendle-pt-fixed-rate-vault.test 0% 0%
Summary 58% (942 / 1627) 50% (467 / 936)

@fred-venus fred-venus changed the title [VPD-1151] [VPD-1118] feat: add DeviationSentinelConfigurator helpers contract for vip-616 [WONT MERGE][VPD-1151] [VPD-1118] feat: add DeviationSentinelConfigurator helpers contract for vip-616 May 6, 2026
@fred-venus fred-venus closed this May 6, 2026
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