Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GHO CCIP 1.5 Maintenance Upgrade #15

Closed
wants to merge 28 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
faf2023
feat: install aave-ccip at latest commit on aave/ccip#18
DhairyaSethi Oct 18, 2024
488d846
chore: upd remappings, lib/aave-helpers, .assets
DhairyaSethi Oct 18, 2024
1927921
new: add proposal for eth & arb
DhairyaSethi Oct 18, 2024
9cc5769
fix: arb test supply locked invariant
DhairyaSethi Oct 18, 2024
0ed5033
Merge branch 'main' into new/ccip_1_5_maintenance
DhairyaSethi Oct 21, 2024
58e177d
fix: rename, add discussion link
DhairyaSethi Oct 21, 2024
a3310b8
upd: aave-ccip module
DhairyaSethi Oct 28, 2024
a78018d
feat: add proxy pool deployments
DhairyaSethi Oct 28, 2024
f962303
feat: add e2e tests
DhairyaSethi Oct 28, 2024
38a1159
chore: fix license, explicit senders for expectEmit
DhairyaSethi Oct 28, 2024
f199681
ci: override rpc url in secrets
DhairyaSethi Oct 28, 2024
7b2376b
test: proxy pool can off ramp
DhairyaSethi Oct 28, 2024
d4d438e
chore: reorder deps
DhairyaSethi Oct 28, 2024
fc6a51c
nit: utilize existing ierc20 import, style guide, use arb assets for …
DhairyaSethi Oct 29, 2024
f64be60
feat: add rate limit, use gho fascilitator for tests
DhairyaSethi Oct 30, 2024
af02c9e
feat: set in bound rate limit as well
DhairyaSethi Oct 30, 2024
9507080
chore: cleanup
DhairyaSethi Oct 30, 2024
1f15974
test: check proxy initialized version
DhairyaSethi Oct 30, 2024
3954cb7
chore: inBetween => inFlight"
DhairyaSethi Oct 30, 2024
9abb6d3
chore: test name consistency
DhairyaSethi Oct 30, 2024
ced148d
test: dynamically fetch dest gas amt
DhairyaSethi Oct 30, 2024
b1da849
test: execMsg post migration using legacy off ramp
DhairyaSethi Oct 30, 2024
bf4f3e5
test: ccip steward can disable rate limit
DhairyaSethi Oct 30, 2024
a525136
chore: cleanup
DhairyaSethi Oct 30, 2024
be370f6
doc: add comment for fetching all offramps, use RISK_COUNCIL for clarity
DhairyaSethi Oct 31, 2024
8f151e2
test: ownership transfer after migration
DhairyaSethi Oct 31, 2024
00d8306
chore: rm _readRiskAdmin, fix config
DhairyaSethi Nov 1, 2024
870aed7
Merge branch 'main' into new/ccip_1_5_maintenance
DhairyaSethi Nov 4, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import {IProxyPool} from 'src/interfaces/ccip/IProxyPool.sol';
import {IRateLimiter} from 'src/interfaces/ccip/IRateLimiter.sol';
import {ITokenAdminRegistry} from 'src/interfaces/ccip/ITokenAdminRegistry.sol';
import {IGhoToken} from 'src/interfaces/IGhoToken.sol';
import {IGhoCcipSteward} from 'src/interfaces/IGhoCcipSteward.sol';
import {CCIPUtils} from './utils/CCIPUtils.sol';

import {AaveV3Arbitrum_GHOCCIP150Upgrade_20241021} from './AaveV3Arbitrum_GHOCCIP150Upgrade_20241021.sol';
Expand Down Expand Up @@ -50,6 +51,9 @@ contract AaveV3Arbitrum_GHOCCIP150Upgrade_20241021_Test is ProtocolV3TestBase {
address internal constant OFF_RAMP_1_2 = 0x542ba1902044069330e8c5b36A84EC503863722f;
address internal constant OFF_RAMP_1_5 = 0x91e46cc5590A4B9182e47f40006140A7077Dec31;

IGhoCcipSteward internal constant GHO_CCIP_STEWARD =
IGhoCcipSteward(0xb329CEFF2c362F315900d245eC88afd24C4949D5);

event Burned(address indexed sender, uint256 amount);
event Minted(address indexed sender, address indexed recipient, uint256 amount);
event CCIPSendRequested(IInternal.EVM2EVMMessage message);
Expand Down Expand Up @@ -314,6 +318,29 @@ contract AaveV3Arbitrum_GHOCCIP150Upgrade_20241021_Test is ProtocolV3TestBase {
assertEq(_getFacilitatorLevel(address(ghoTokenPool)), facilitatorLevelBefore + amount);
}

function test_stewardCanDisableRateLimit() public {
executePayload(vm, address(proposal));

vm.prank(ghoTokenPool.owner());
ghoTokenPool.setRateLimitAdmin(address(GHO_CCIP_STEWARD));

vm.prank(_readRiskAdmin());
GHO_CCIP_STEWARD.updateRateLimit(ETH_CHAIN_SELECTOR, false, 0, 0, false, 0, 0);

assertEq(
abi.encode(
_tokenBucketToConfig(ghoTokenPool.getCurrentInboundRateLimiterState(ETH_CHAIN_SELECTOR))
),
abi.encode(_getDisabledConfig())
);
assertEq(
abi.encode(
_tokenBucketToConfig(ghoTokenPool.getCurrentOutboundRateLimiterState(ETH_CHAIN_SELECTOR))
),
abi.encode(_getDisabledConfig())
);
}

function _mockCCIPMigration() private {
IRouter router = IRouter(ghoTokenPool.getRouter());
// token registry not set for 1.5 migration
Expand Down Expand Up @@ -393,6 +420,15 @@ contract AaveV3Arbitrum_GHOCCIP150Upgrade_20241021_Test is ProtocolV3TestBase {
return uint8(uint256(vm.load(proxy, bytes32(0))));
}

function _readRiskAdmin() private view returns (address riskAdmin) {
// private immutable at offset 144
address steward = address(GHO_CCIP_STEWARD);
assembly {
extcodecopy(steward, 0, 144, 20) // use scratch space
riskAdmin := shr(96, mload(0)) // correct padding
}
}

function _getFacilitatorLevel(address f) internal view returns (uint256) {
(, uint256 level) = IGhoToken(ARB_GHO_TOKEN).getFacilitatorBucket(f);
return level;
Expand Down Expand Up @@ -424,6 +460,9 @@ contract AaveV3Arbitrum_GHOCCIP150Upgrade_20241021_Test is ProtocolV3TestBase {
assertEq(ITypeAndVersion(ON_RAMP_1_5).typeAndVersion(), 'EVM2EVMOnRamp 1.5.0');
assertEq(ITypeAndVersion(OFF_RAMP_1_2).typeAndVersion(), 'EVM2EVMOffRamp 1.2.0');
assertEq(ITypeAndVersion(OFF_RAMP_1_5).typeAndVersion(), 'EVM2EVMOffRamp 1.5.0');

assertEq(GHO_CCIP_STEWARD.GHO_TOKEN(), ARB_GHO_TOKEN);
assertEq(GHO_CCIP_STEWARD.GHO_TOKEN_POOL(), address(ghoTokenPool));
}

function _getOutboundRefillTime(uint256 amount) private view returns (uint256) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {ITypeAndVersion} from 'src/interfaces/ccip/ITypeAndVersion.sol';
import {IProxyPool} from 'src/interfaces/ccip/IProxyPool.sol';
import {IRateLimiter} from 'src/interfaces/ccip/IRateLimiter.sol';
import {ITokenAdminRegistry} from 'src/interfaces/ccip/ITokenAdminRegistry.sol';
import {IGhoCcipSteward} from 'src/interfaces/IGhoCcipSteward.sol';
import {CCIPUtils} from './utils/CCIPUtils.sol';
import {AaveV3Ethereum_GHOCCIP150Upgrade_20241021} from './AaveV3Ethereum_GHOCCIP150Upgrade_20241021.sol';

Expand All @@ -41,11 +42,15 @@ contract AaveV3Ethereum_GHOCCIP150Upgrade_20241021_Test is ProtocolV3TestBase {
address internal constant ARB_PROXY_POOL = 0x26329558f08cbb40d6a4CCA0E0C67b29D64A8c50;
ITokenAdminRegistry internal constant TOKEN_ADMIN_REGISTRY =
ITokenAdminRegistry(0xb22764f98dD05c789929716D677382Df22C05Cb6);

address internal constant ON_RAMP_1_2 = 0x925228D7B82d883Dde340A55Fe8e6dA56244A22C;
address internal constant ON_RAMP_1_5 = 0x69eCC4E2D8ea56E2d0a05bF57f4Fd6aEE7f2c284;
address internal constant OFF_RAMP_1_2 = 0xeFC4a18af59398FF23bfe7325F2401aD44286F4d;
address internal constant OFF_RAMP_1_5 = 0xdf615eF8D4C64d0ED8Fd7824BBEd2f6a10245aC9;

IGhoCcipSteward internal constant GHO_CCIP_STEWARD =
IGhoCcipSteward(0x101Efb7b9Beb073B1219Cd5473a7C8A2f2EB84f4);

event Locked(address indexed sender, uint256 amount);
event Released(address indexed sender, address indexed recipient, uint256 amount);
event CCIPSendRequested(IInternal.EVM2EVMMessage message);
Expand Down Expand Up @@ -301,6 +306,29 @@ contract AaveV3Ethereum_GHOCCIP150Upgrade_20241021_Test is ProtocolV3TestBase {
ghoTokenPool.releaseOrMint(abi.encode(alice), alice, amount, ARB_CHAIN_SELECTOR, new bytes(0));
}

function test_stewardDisableRateLimit() public {
executePayload(vm, address(proposal));

vm.prank(ghoTokenPool.owner());
ghoTokenPool.setRateLimitAdmin(address(GHO_CCIP_STEWARD));

vm.prank(_readRiskAdmin());
GHO_CCIP_STEWARD.updateRateLimit(ARB_CHAIN_SELECTOR, false, 0, 0, false, 0, 0);

assertEq(
abi.encode(
_tokenBucketToConfig(ghoTokenPool.getCurrentInboundRateLimiterState(ARB_CHAIN_SELECTOR))
),
abi.encode(_getDisabledConfig())
);
assertEq(
abi.encode(
_tokenBucketToConfig(ghoTokenPool.getCurrentOutboundRateLimiterState(ARB_CHAIN_SELECTOR))
),
abi.encode(_getDisabledConfig())
);
}

function _mockCCIPMigration() private {
IRouter router = IRouter(ghoTokenPool.getRouter());
// token registry not set for 1.5 migration
Expand Down Expand Up @@ -383,6 +411,15 @@ contract AaveV3Ethereum_GHOCCIP150Upgrade_20241021_Test is ProtocolV3TestBase {
return uint8(uint256(vm.load(proxy, bytes32(0))));
}

function _readRiskAdmin() private view returns (address riskAdmin) {
// private immutable at offset 144
address steward = address(GHO_CCIP_STEWARD);
assembly {
extcodecopy(steward, 0, 144, 20) // use scratch space
riskAdmin := shr(96, mload(0)) // correct padding
}
}

function _getStaticParams() private view returns (bytes memory) {
return
abi.encode(
Expand Down Expand Up @@ -416,6 +453,9 @@ contract AaveV3Ethereum_GHOCCIP150Upgrade_20241021_Test is ProtocolV3TestBase {
assertEq(ITypeAndVersion(ON_RAMP_1_5).typeAndVersion(), 'EVM2EVMOnRamp 1.5.0');
assertEq(ITypeAndVersion(OFF_RAMP_1_2).typeAndVersion(), 'EVM2EVMOffRamp 1.2.0');
assertEq(ITypeAndVersion(OFF_RAMP_1_5).typeAndVersion(), 'EVM2EVMOffRamp 1.5.0');

assertEq(GHO_CCIP_STEWARD.GHO_TOKEN(), MiscEthereum.GHO_TOKEN);
assertEq(GHO_CCIP_STEWARD.GHO_TOKEN_POOL(), address(ghoTokenPool));
}

function _getOutboundRefillTime(uint256 amount) private view returns (uint256) {
Expand Down
51 changes: 51 additions & 0 deletions src/interfaces/IGhoCcipSteward.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.10;

interface IGhoCcipSteward {
/**
* @notice Updates the CCIP bridge limit
* @dev Only callable by Risk Council
* @param newBridgeLimit The new desired bridge limit
*/
function updateBridgeLimit(uint256 newBridgeLimit) external;

/**
* @notice Updates the CCIP rate limit config
* @dev Only callable by Risk Council
* @dev Rate limit update must be consistent with other pools' rate limit
* @param remoteChainSelector The remote chain selector for which the rate limits apply.
* @param outboundEnabled True if the outbound rate limiter is enabled.
* @param outboundCapacity The outbound rate limiter capacity.
* @param outboundRate The outbound rate limiter rate.
* @param inboundEnabled True if the inbound rate limiter is enabled.
* @param inboundCapacity The inbound rate limiter capacity.
* @param inboundRate The inbound rate limiter rate.
*/
function updateRateLimit(
uint64 remoteChainSelector,
bool outboundEnabled,
uint128 outboundCapacity,
uint128 outboundRate,
bool inboundEnabled,
uint128 inboundCapacity,
uint128 inboundRate
) external;

/**
* @notice Returns the minimum delay that must be respected between parameters update.
* @return The minimum delay between parameter updates (in seconds)
*/
function MINIMUM_DELAY() external view returns (uint256);

/**
* @notice Returns the address of the Gho Token
* @return The address of the GhoToken
*/
function GHO_TOKEN() external view returns (address);

/**
* @notice Returns the address of the Gho CCIP Token Pool
* @return The address of the Gho CCIP Token Pool
*/
function GHO_TOKEN_POOL() external view returns (address);
}
Loading