From 2b87923e70190e46d200982f8edb2739fe0ba725 Mon Sep 17 00:00:00 2001 From: CheyenneAtapour Date: Wed, 10 Jul 2024 18:20:50 -0700 Subject: [PATCH] test: rate limit test --- src/contracts/misc/ArbGhoSteward.sol | 7 ++++++- src/contracts/misc/interfaces/IArbGhoSteward.sol | 2 +- src/test/TestArbGhoSteward.t.sol | 2 -- src/test/TestGhoBase.t.sol | 14 ++++++-------- 4 files changed, 13 insertions(+), 12 deletions(-) diff --git a/src/contracts/misc/ArbGhoSteward.sol b/src/contracts/misc/ArbGhoSteward.sol index 67f247a9..04f7dbff 100644 --- a/src/contracts/misc/ArbGhoSteward.sol +++ b/src/contracts/misc/ArbGhoSteward.sol @@ -2,6 +2,7 @@ pragma solidity ^0.8.10; import {Ownable} from '@openzeppelin/contracts/access/Ownable.sol'; +import {IOwnable} from 'ccip/v0.8/shared/interfaces/IOwnable.sol'; import {EnumerableSet} from '@openzeppelin/contracts/utils/structs/EnumerableSet.sol'; import {IPoolAddressesProvider} from '@aave/core-v3/contracts/interfaces/IPoolAddressesProvider.sol'; import {IPoolConfigurator} from '@aave/core-v3/contracts/interfaces/IPoolConfigurator.sol'; @@ -114,7 +115,7 @@ contract ArbGhoSteward is Ownable, IArbGhoSteward { } /// @inheritdoc IArbGhoSteward - function setRateLimit( + function updateRateLimit( uint64 remoteChainSelector, RateLimiter.Config calldata outboundConfig, RateLimiter.Config calldata inboundConfig @@ -176,6 +177,10 @@ contract ArbGhoSteward is Ownable, IArbGhoSteward { .setReserveInterestRateStrategyAddress(GHO_TOKEN, strategy); } + function acceptOwnership(address target) external onlyRiskCouncil { + IOwnable(target).acceptOwnership(); + } + // TODO: Decide what functionality we can keep on Arbitrum of the below /// @inheritdoc IArbGhoSteward diff --git a/src/contracts/misc/interfaces/IArbGhoSteward.sol b/src/contracts/misc/interfaces/IArbGhoSteward.sol index 825212e2..5816b19d 100644 --- a/src/contracts/misc/interfaces/IArbGhoSteward.sol +++ b/src/contracts/misc/interfaces/IArbGhoSteward.sol @@ -26,7 +26,7 @@ interface IArbGhoSteward { * @param outboundConfig The new outbound rate limiter config. * @param inboundConfig The new inbound rate limiter config. */ - function setRateLimit( + function updateRateLimit( uint64 remoteChainSelector, RateLimiter.Config calldata outboundConfig, RateLimiter.Config calldata inboundConfig diff --git a/src/test/TestArbGhoSteward.t.sol b/src/test/TestArbGhoSteward.t.sol index 2a9b7873..08e6dec6 100644 --- a/src/test/TestArbGhoSteward.t.sol +++ b/src/test/TestArbGhoSteward.t.sol @@ -119,7 +119,6 @@ contract TestArbGhoSteward is TestGhoBase { ); } - /* TODO: Rate limit is currently restricted to only the owner function testUpdateRateLimit() public { vm.expectEmit(false, false, false, true); emit ChainConfigured( @@ -144,7 +143,6 @@ contract TestArbGhoSteward is TestGhoBase { RateLimiter.Config({isEnabled: true, capacity: type(uint128).max, rate: 1e15}) ); } - */ function testUpdateFacilitatorBucketCapacity() public { (uint256 currentBucketCapacity, ) = GHO_TOKEN.getFacilitatorBucket(address(GHO_ATOKEN)); diff --git a/src/test/TestGhoBase.t.sol b/src/test/TestGhoBase.t.sol index 0224ff61..acd6e2f4 100644 --- a/src/test/TestGhoBase.t.sol +++ b/src/test/TestGhoBase.t.sol @@ -412,17 +412,15 @@ contract TestGhoBase is Test, Constants, Events { vm.prank(SHORT_EXECUTOR); ARB_GHO_STEWARD.setControlledFacilitator(controlledFacilitators, true); - // Grant roles to steward - //vm.startPrank(OWNER); - // TODO: rate limit admin is basically only owner allowed - //ARB_GHO_TOKEN_POOL.setRateLimitAdmin(address(ARB_GHO_STEWARD)); - // TODO: gho bucket capacity manager - // TODO: AAve risk admin - //vm.stopPrank(); - // Setup Arb GHO Token Pool vm.prank(OWNER); ARB_GHO_TOKEN_POOL.applyChainUpdates(chainUpdate); + + // Transfer ownership from the arb token pool to steward via transfer/acceptOwnership + vm.prank(OWNER); + ARB_GHO_TOKEN_POOL.transferOwnership(address(ARB_GHO_STEWARD)); + vm.prank(RISK_COUNCIL); + ARB_GHO_STEWARD.acceptOwnership(address(ARB_GHO_TOKEN_POOL)); } function getOutboundRateLimiterConfig() public pure returns (RateLimiter.Config memory) {