From 8b1553e6f253bc525ffeb42c775f97cb12b65f66 Mon Sep 17 00:00:00 2001 From: Josh Date: Tue, 26 Nov 2024 11:09:34 -0500 Subject: [PATCH] simplify test setups --- contracts/gas-snapshots/ccip.gas-snapshot | 4 ++-- .../TokenPool.setChainRateLimiterConfigs.t.sol | 16 ++-------------- 2 files changed, 4 insertions(+), 16 deletions(-) diff --git a/contracts/gas-snapshots/ccip.gas-snapshot b/contracts/gas-snapshots/ccip.gas-snapshot index d3bda529e2e..10ada2ab388 100644 --- a/contracts/gas-snapshots/ccip.gas-snapshot +++ b/contracts/gas-snapshots/ccip.gas-snapshot @@ -720,8 +720,8 @@ TokenPool_parseRemoteDecimals:test_parseRemoteDecimals_NoDecimalsDefaultsToLocal TokenPool_removeRemotePool:test_InvalidRemotePoolForChain_Revert() (gas: 17432) TokenPool_removeRemotePool:test_NonExistentChain_Revert() (gas: 14277) TokenPool_removeRemotePool:test_removeRemotePool_Success() (gas: 188430) -TokenPool_setChainRateLimiterConfigs:test_MismatchedArrayLengths_Revert() (gas: 25014) -TokenPool_setChainRateLimiterConfigs:test_NonExistentChain_Revert() (gas: 19823) +TokenPool_setChainRateLimiterConfigs:test_MismatchedArrayLengths_Revert() (gas: 23786) +TokenPool_setChainRateLimiterConfigs:test_NonExistentChain_Revert() (gas: 19337) TokenPool_setChainRateLimiterConfigs:test_OnlyOwnerOrRateLimitAdmin_Revert() (gas: 16424) TokenPool_setRateLimitAdmin:test_SetRateLimitAdmin_Revert() (gas: 11024) TokenPool_setRateLimitAdmin:test_SetRateLimitAdmin_Success() (gas: 37672) diff --git a/contracts/src/v0.8/ccip/test/pools/TokenPool/TokenPool.setChainRateLimiterConfigs.t.sol b/contracts/src/v0.8/ccip/test/pools/TokenPool/TokenPool.setChainRateLimiterConfigs.t.sol index 6df82ed9ee6..716e06734ee 100644 --- a/contracts/src/v0.8/ccip/test/pools/TokenPool/TokenPool.setChainRateLimiterConfigs.t.sol +++ b/contracts/src/v0.8/ccip/test/pools/TokenPool/TokenPool.setChainRateLimiterConfigs.t.sol @@ -102,10 +102,7 @@ contract TokenPool_setChainRateLimiterConfigs is TokenPoolSetup { chainSelectors[0] = wrongChainSelector; RateLimiter.Config[] memory newOutboundConfigs = new RateLimiter.Config[](1); - newOutboundConfigs[0] = _getOutboundRateLimiterConfig(); - RateLimiter.Config[] memory newInboundConfigs = new RateLimiter.Config[](1); - newInboundConfigs[0] = _getInboundRateLimiterConfig(); vm.expectRevert(abi.encodeWithSelector(TokenPool.NonExistentChain.selector, wrongChainSelector)); s_tokenPool.setChainRateLimiterConfigs(chainSelectors, newOutboundConfigs, newInboundConfigs); @@ -113,28 +110,19 @@ contract TokenPool_setChainRateLimiterConfigs is TokenPoolSetup { function test_MismatchedArrayLengths_Revert() public { uint64[] memory chainSelectors = new uint64[](1); - chainSelectors[0] = DEST_CHAIN_SELECTOR; RateLimiter.Config[] memory newOutboundConfigs = new RateLimiter.Config[](1); - newOutboundConfigs[0] = _getOutboundRateLimiterConfig(); - RateLimiter.Config[] memory newInboundConfigs = new RateLimiter.Config[](2); - newInboundConfigs[0] = _getInboundRateLimiterConfig(); - newInboundConfigs[1] = _getInboundRateLimiterConfig(); // test mismatched array lengths between rate limiters vm.expectRevert(abi.encodeWithSelector(TokenPool.MismatchedArrayLengths.selector)); s_tokenPool.setChainRateLimiterConfigs(chainSelectors, newOutboundConfigs, newInboundConfigs); newInboundConfigs = new RateLimiter.Config[](1); - newInboundConfigs[0] = _getInboundRateLimiterConfig(); - - uint64[] memory chainSelectors2 = new uint64[](2); - chainSelectors2[0] = DEST_CHAIN_SELECTOR; - chainSelectors2[1] = DEST_CHAIN_SELECTOR; + chainSelectors = new uint64[](2); // test mismatched array lengths between chain selectors and rate limiters vm.expectRevert(abi.encodeWithSelector(TokenPool.MismatchedArrayLengths.selector)); - s_tokenPool.setChainRateLimiterConfigs(chainSelectors2, newOutboundConfigs, newInboundConfigs); + s_tokenPool.setChainRateLimiterConfigs(chainSelectors, newOutboundConfigs, newInboundConfigs); } }