Skip to content

Commit

Permalink
new: introduce __gap on UpgradeableTokenPool
Browse files Browse the repository at this point in the history
  • Loading branch information
DhairyaSethi committed Dec 23, 2024
1 parent 5cff384 commit f06ecdb
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 18 deletions.
3 changes: 2 additions & 1 deletion contracts/src/v0.8/ccip/pools/GHO/UpgradeableTokenPool.sol
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import {Pool} from "../../libraries/Pool.sol";
import {RateLimiter} from "../../libraries/RateLimiter.sol";

import {IERC20} from "../../../vendor/openzeppelin-solidity/v4.8.3/contracts/token/ERC20/IERC20.sol";
import {IERC20Metadata} from "../../../vendor/openzeppelin-solidity/v4.8.3/contracts/token/ERC20/extensions/IERC20Metadata.sol";
import {IERC165} from "../../../vendor/openzeppelin-solidity/v5.0.2/contracts/utils/introspection/IERC165.sol";
import {EnumerableSet} from "../../../vendor/openzeppelin-solidity/v5.0.2/contracts/utils/structs/EnumerableSet.sol";

Expand Down Expand Up @@ -599,4 +598,6 @@ abstract contract UpgradeableTokenPool is IPoolV1, Ownable2StepMsgSender {
}
}
}

uint256[42] private __gap;
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
```diff
diff --git a/src/v0.8/ccip/pools/TokenPool.sol b/src/v0.8/ccip/pools/GHO/UpgradeableTokenPool.sol
index cd3096f4ef..e77da3feb8 100644
index cd3096f4ef..699b76ec37 100644
--- a/src/v0.8/ccip/pools/TokenPool.sol
+++ b/src/v0.8/ccip/pools/GHO/UpgradeableTokenPool.sol
@@ -1,26 +1,29 @@
@@ -1,26 +1,28 @@
// SPDX-License-Identifier: BUSL-1.1
-pragma solidity 0.8.24;
+pragma solidity ^0.8.0;
Expand All @@ -28,7 +28,6 @@ index cd3096f4ef..e77da3feb8 100644
-import {IERC165} from "../../vendor/openzeppelin-solidity/v5.0.2/contracts/utils/introspection/IERC165.sol";
-import {EnumerableSet} from "../../vendor/openzeppelin-solidity/v5.0.2/contracts/utils/structs/EnumerableSet.sol";
+import {IERC20} from "../../../vendor/openzeppelin-solidity/v4.8.3/contracts/token/ERC20/IERC20.sol";
+import {IERC20Metadata} from "../../../vendor/openzeppelin-solidity/v4.8.3/contracts/token/ERC20/extensions/IERC20Metadata.sol";
+import {IERC165} from "../../../vendor/openzeppelin-solidity/v5.0.2/contracts/utils/introspection/IERC165.sol";
+import {EnumerableSet} from "../../../vendor/openzeppelin-solidity/v5.0.2/contracts/utils/structs/EnumerableSet.sol";

Expand All @@ -46,7 +45,7 @@ index cd3096f4ef..e77da3feb8 100644
/// Example:
/// Assume there is a token with 6 decimals on chain A and 3 decimals on chain B.
/// - 1.234567 tokens are burned on chain A.
@@ -29,7 +32,7 @@ import {EnumerableSet} from "../../vendor/openzeppelin-solidity/v5.0.2/contracts
@@ -29,7 +31,7 @@ import {EnumerableSet} from "../../vendor/openzeppelin-solidity/v5.0.2/contracts
/// 0.000567 tokens.
/// In the case of a burnMint pool on chain A, these funds are burned in the pool on chain A.
/// In the case of a lockRelease pool on chain A, these funds accumulate in the pool on chain A.
Expand All @@ -55,7 +54,7 @@ index cd3096f4ef..e77da3feb8 100644
using EnumerableSet for EnumerableSet.Bytes32Set;
using EnumerableSet for EnumerableSet.AddressSet;
using EnumerableSet for EnumerableSet.UintSet;
@@ -117,34 +120,18 @@ abstract contract TokenPool is IPoolV1, Ownable2StepMsgSender {
@@ -117,34 +119,18 @@ abstract contract TokenPool is IPoolV1, Ownable2StepMsgSender {
/// @dev Can be address(0) if none is configured.
address internal s_rateLimitAdmin;

Expand Down Expand Up @@ -94,7 +93,7 @@ index cd3096f4ef..e77da3feb8 100644
return token == address(i_token);
}

@@ -168,9 +155,7 @@ abstract contract TokenPool is IPoolV1, Ownable2StepMsgSender {
@@ -168,9 +154,7 @@ abstract contract TokenPool is IPoolV1, Ownable2StepMsgSender {

/// @notice Sets the pool's Router
/// @param newRouter The new Router
Expand All @@ -105,7 +104,7 @@ index cd3096f4ef..e77da3feb8 100644
if (newRouter == address(0)) revert ZeroAddressNotAllowed();
address oldRouter = address(s_router);
s_router = IRouter(newRouter);
@@ -179,11 +164,11 @@ abstract contract TokenPool is IPoolV1, Ownable2StepMsgSender {
@@ -179,11 +163,11 @@ abstract contract TokenPool is IPoolV1, Ownable2StepMsgSender {
}

/// @notice Signals which version of the pool interface is supported
Expand All @@ -122,7 +121,7 @@ index cd3096f4ef..e77da3feb8 100644
}

// ================================================================
@@ -199,9 +184,7 @@ abstract contract TokenPool is IPoolV1, Ownable2StepMsgSender {
@@ -199,9 +183,7 @@ abstract contract TokenPool is IPoolV1, Ownable2StepMsgSender {
/// @param lockOrBurnIn The input to validate.
/// @dev This function should always be called before executing a lock or burn. Not doing so would allow
/// for various exploits.
Expand All @@ -133,7 +132,7 @@ index cd3096f4ef..e77da3feb8 100644
if (!isSupportedToken(lockOrBurnIn.localToken)) revert InvalidToken(lockOrBurnIn.localToken);
if (IRMN(i_rmnProxy).isCursed(bytes16(uint128(lockOrBurnIn.remoteChainSelector)))) revert CursedByRMN();
_checkAllowList(lockOrBurnIn.originalSender);
@@ -219,9 +202,7 @@ abstract contract TokenPool is IPoolV1, Ownable2StepMsgSender {
@@ -219,9 +201,7 @@ abstract contract TokenPool is IPoolV1, Ownable2StepMsgSender {
/// @param releaseOrMintIn The input to validate.
/// @dev This function should always be called before executing a release or mint. Not doing so would allow
/// for various exploits.
Expand All @@ -144,7 +143,7 @@ index cd3096f4ef..e77da3feb8 100644
if (!isSupportedToken(releaseOrMintIn.localToken)) revert InvalidToken(releaseOrMintIn.localToken);
if (IRMN(i_rmnProxy).isCursed(bytes16(uint128(releaseOrMintIn.remoteChainSelector)))) revert CursedByRMN();
_onlyOffRamp(releaseOrMintIn.remoteChainSelector);
@@ -247,9 +228,7 @@ abstract contract TokenPool is IPoolV1, Ownable2StepMsgSender {
@@ -247,9 +227,7 @@ abstract contract TokenPool is IPoolV1, Ownable2StepMsgSender {
return abi.encode(i_tokenDecimals);
}

Expand All @@ -155,7 +154,7 @@ index cd3096f4ef..e77da3feb8 100644
// Fallback to the local token decimals if the source pool data is empty. This allows for backwards compatibility.
if (sourcePoolData.length == 0) {
return i_tokenDecimals;
@@ -304,9 +283,7 @@ abstract contract TokenPool is IPoolV1, Ownable2StepMsgSender {
@@ -304,9 +282,7 @@ abstract contract TokenPool is IPoolV1, Ownable2StepMsgSender {
/// @notice Gets the pool address on the remote chain.
/// @param remoteChainSelector Remote chain selector.
/// @dev To support non-evm chains, this value is encoded into bytes
Expand All @@ -166,7 +165,7 @@ index cd3096f4ef..e77da3feb8 100644
bytes32[] memory remotePoolHashes = s_remoteChainConfigs[remoteChainSelector].remotePools.values();

bytes[] memory remotePools = new bytes[](remotePoolHashes.length);
@@ -327,9 +304,7 @@ abstract contract TokenPool is IPoolV1, Ownable2StepMsgSender {
@@ -327,9 +303,7 @@ abstract contract TokenPool is IPoolV1, Ownable2StepMsgSender {
/// @notice Gets the token address on the remote chain.
/// @param remoteChainSelector Remote chain selector.
/// @dev To support non-evm chains, this value is encoded into bytes
Expand All @@ -177,7 +176,7 @@ index cd3096f4ef..e77da3feb8 100644
return s_remoteChainConfigs[remoteChainSelector].remoteTokenAddress;
}

@@ -358,9 +333,7 @@ abstract contract TokenPool is IPoolV1, Ownable2StepMsgSender {
@@ -358,9 +332,7 @@ abstract contract TokenPool is IPoolV1, Ownable2StepMsgSender {
}

/// @inheritdoc IPoolV1
Expand All @@ -188,7 +187,7 @@ index cd3096f4ef..e77da3feb8 100644
return s_remoteChainSelectors.contains(remoteChainSelector);
}

@@ -379,8 +352,7 @@ abstract contract TokenPool is IPoolV1, Ownable2StepMsgSender {
@@ -379,8 +351,7 @@ abstract contract TokenPool is IPoolV1, Ownable2StepMsgSender {
/// @notice Sets the permissions for a list of chains selectors. Actual senders for these chains
/// need to be allowed on the Router to interact with this pool.
/// @param remoteChainSelectorsToRemove A list of chain selectors to remove.
Expand All @@ -198,7 +197,7 @@ index cd3096f4ef..e77da3feb8 100644
/// @dev Only callable by the owner
function applyChainUpdates(
uint64[] calldata remoteChainSelectorsToRemove,
@@ -495,9 +467,7 @@ abstract contract TokenPool is IPoolV1, Ownable2StepMsgSender {
@@ -495,9 +466,7 @@ abstract contract TokenPool is IPoolV1, Ownable2StepMsgSender {
/// @notice Sets the rate limiter admin address.
/// @dev Only callable by the owner.
/// @param rateLimitAdmin The new rate limiter admin address.
Expand All @@ -209,7 +208,7 @@ index cd3096f4ef..e77da3feb8 100644
s_rateLimitAdmin = rateLimitAdmin;
emit RateLimitAdminSet(rateLimitAdmin);
}
@@ -566,18 +536,14 @@ abstract contract TokenPool is IPoolV1, Ownable2StepMsgSender {
@@ -566,18 +535,14 @@ abstract contract TokenPool is IPoolV1, Ownable2StepMsgSender {

/// @notice Checks whether remote chain selector is configured on this contract, and if the msg.sender
/// is a permissioned onRamp for the given chain on the Router.
Expand All @@ -230,7 +229,7 @@ index cd3096f4ef..e77da3feb8 100644
if (!isSupportedChain(remoteChainSelector)) revert ChainNotAllowed(remoteChainSelector);
if (!s_router.isOffRamp(remoteChainSelector, msg.sender)) revert CallerIsNotARampOnRouter(msg.sender);
}
@@ -586,9 +552,7 @@ abstract contract TokenPool is IPoolV1, Ownable2StepMsgSender {
@@ -586,9 +551,7 @@ abstract contract TokenPool is IPoolV1, Ownable2StepMsgSender {
// │ Allowlist │
// ================================================================

Expand All @@ -241,4 +240,11 @@ index cd3096f4ef..e77da3feb8 100644
if (i_allowlistEnabled) {
if (!s_allowlist.contains(sender)) {
revert SenderNotAllowed(sender);
@@ -635,4 +598,6 @@ abstract contract TokenPool is IPoolV1, Ownable2StepMsgSender {
}
}
}
+
+ uint256[42] private __gap;
}
```

0 comments on commit f06ecdb

Please sign in to comment.