Skip to content

Commit

Permalink
fix: Remove unneeded revision getter
Browse files Browse the repository at this point in the history
  • Loading branch information
miguelmtzinf committed Jun 7, 2024
1 parent ffc4c20 commit 748d036
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 49 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,4 @@ contract UpgradeableBurnMintTokenPool is Initializable, UpgradeableBurnMintToken
function _burn(uint256 amount) internal virtual override {
IBurnMintERC20(address(i_token)).burn(amount);
}

/// @notice Returns the revision number
/// @return The revision number
function REVISION() public pure virtual returns (uint256) {
return 1;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -263,10 +263,4 @@ contract UpgradeableLockReleaseTokenPool is Initializable, UpgradeableTokenPool,

_setRateLimitConfig(remoteChainSelector, outboundConfig, inboundConfig);
}

/// @notice Returns the revision number
/// @return The revision number
function REVISION() public pure virtual returns (uint256) {
return 1;
}
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
```diff
diff --git a/src/v0.8/ccip/pools/BurnMintTokenPool.sol b/src/v0.8/ccip/pools/GHO/UpgradeableBurnMintTokenPool.sol
index 9af0f22f4c..63044b4d7e 100644
index 9af0f22f4c..58be87812f 100644
--- a/src/v0.8/ccip/pools/BurnMintTokenPool.sol
+++ b/src/v0.8/ccip/pools/GHO/UpgradeableBurnMintTokenPool.sol
@@ -1,29 +1,62 @@
@@ -1,28 +1,55 @@
// SPDX-License-Identifier: BUSL-1.1
-pragma solidity 0.8.19;
+pragma solidity ^0.8.0;
Expand Down Expand Up @@ -75,11 +75,4 @@ index 9af0f22f4c..63044b4d7e 100644
function _burn(uint256 amount) internal virtual override {
IBurnMintERC20(address(i_token)).burn(amount);
}
+
+ /// @notice Returns the revision number
+ /// @return The revision number
+ function REVISION() public pure virtual returns (uint256) {
+ return 1;
+ }
}
```
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
```diff
diff --git a/src/v0.8/ccip/pools/LockReleaseTokenPool.sol b/src/v0.8/ccip/pools/GHO/UpgradeableLockReleaseTokenPool.sol
index 1a17fa0398..9e06e60588 100644
index 1a17fa0398..9a30b1e977 100644
--- a/src/v0.8/ccip/pools/LockReleaseTokenPool.sol
+++ b/src/v0.8/ccip/pools/GHO/UpgradeableLockReleaseTokenPool.sol
@@ -1,26 +1,39 @@
Expand Down Expand Up @@ -187,15 +187,4 @@ index 1a17fa0398..9e06e60588 100644
/// @notice Checks if the pool can accept liquidity.
/// @return true if the pool can accept liquidity, false otherwise.
function canAcceptLiquidity() external view returns (bool) {
@@ -166,4 +263,10 @@ contract LockReleaseTokenPool is TokenPool, ILiquidityContainer, ITypeAndVersion

_setRateLimitConfig(remoteChainSelector, outboundConfig, inboundConfig);
}
+
+ /// @notice Returns the revision number
+ /// @return The revision number
+ function REVISION() public pure virtual returns (uint256) {
+ return 1;
+ }
}
```
8 changes: 0 additions & 8 deletions contracts/src/v0.8/ccip/test/mocks/MockUpgradeable.sol
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,4 @@ contract MockUpgradeable is Initializable {
function initialize() public reinitializer(2) {
// Intentionally left bank
}

/**
* @notice Returns the revision number
* @return The revision number
*/
function REVISION() public pure returns (uint256) {
return 2;
}
}
5 changes: 5 additions & 0 deletions contracts/src/v0.8/ccip/test/pools/GHO/GhoBaseTest.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,11 @@ abstract contract GhoBaseTest is BaseTest {
return address(uint160(uint256(implSlot)));
}

function _getUpgradeableVersion(address proxy) internal view returns (uint8) {
// version is 1st slot
return uint8(uint256(vm.load(proxy, bytes32(uint256(0)))));
}

function _enableLane(UtilsStorage storage s, uint256 fromId, uint256 toId) internal {
// from
UpgradeableTokenPool.ChainUpdate[] memory chainUpdate = new UpgradeableTokenPool.ChainUpdate[](1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -627,7 +627,7 @@ contract GhoTokenPoolEthereum_setBridgeLimitAdmin is GhoTokenPoolEthereumSetup {
contract GhoTokenPoolEthereum_upgradeability is GhoTokenPoolEthereumSetup {
function testInitialization() public {
// Upgradeability
assertEq(s_ghoTokenPool.REVISION(), 1);
assertEq(_getUpgradeableVersion(address(s_ghoTokenPool)), 1);
vm.startPrank(PROXY_ADMIN);
(bool ok, bytes memory result) = address(s_ghoTokenPool).staticcall(
abi.encodeWithSelector(TransparentUpgradeableProxy.admin.selector)
Expand All @@ -654,17 +654,17 @@ contract GhoTokenPoolEthereum_upgradeability is GhoTokenPoolEthereumSetup {
TransparentUpgradeableProxy(payable(address(s_ghoTokenPool))).upgradeToAndCall(address(newImpl), mockImpleParams);

vm.startPrank(OWNER);
assertEq(s_ghoTokenPool.REVISION(), 2);
assertEq(_getUpgradeableVersion(address(s_ghoTokenPool)), 2);
}

function testUpgradeAdminReverts() public {
vm.expectRevert();
TransparentUpgradeableProxy(payable(address(s_ghoTokenPool))).upgradeToAndCall(address(0), bytes(""));
assertEq(s_ghoTokenPool.REVISION(), 1);
assertEq(_getUpgradeableVersion(address(s_ghoTokenPool)), 1);

vm.expectRevert();
TransparentUpgradeableProxy(payable(address(s_ghoTokenPool))).upgradeTo(address(0));
assertEq(s_ghoTokenPool.REVISION(), 1);
assertEq(_getUpgradeableVersion(address(s_ghoTokenPool)), 1);
}

function testChangeAdmin() public {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ contract GhoTokenPoolRemote_releaseOrMint is GhoTokenPoolRemoteSetup {
contract GhoTokenPoolEthereum_upgradeability is GhoTokenPoolRemoteSetup {
function testInitialization() public {
// Upgradeability
assertEq(s_pool.REVISION(), 1);
assertEq(_getUpgradeableVersion(address(s_pool)), 1);
vm.startPrank(PROXY_ADMIN);
(bool ok, bytes memory result) = address(s_pool).staticcall(
abi.encodeWithSelector(TransparentUpgradeableProxy.admin.selector)
Expand All @@ -209,17 +209,17 @@ contract GhoTokenPoolEthereum_upgradeability is GhoTokenPoolRemoteSetup {
TransparentUpgradeableProxy(payable(address(s_pool))).upgradeToAndCall(address(newImpl), mockImpleParams);

vm.startPrank(OWNER);
assertEq(s_pool.REVISION(), 2);
assertEq(_getUpgradeableVersion(address(s_pool)), 2);
}

function testUpgradeAdminReverts() public {
vm.expectRevert();
TransparentUpgradeableProxy(payable(address(s_pool))).upgradeToAndCall(address(0), bytes(""));
assertEq(s_pool.REVISION(), 1);
assertEq(_getUpgradeableVersion(address(s_pool)), 1);

vm.expectRevert();
TransparentUpgradeableProxy(payable(address(s_pool))).upgradeTo(address(0));
assertEq(s_pool.REVISION(), 1);
assertEq(_getUpgradeableVersion(address(s_pool)), 1);
}

function testChangeAdmin() public {
Expand Down

0 comments on commit 748d036

Please sign in to comment.