From 68e504baeb2b3ec9a02927973e72e46f32f9efe0 Mon Sep 17 00:00:00 2001 From: miguelmtzinf Date: Thu, 18 Jul 2024 09:23:07 +0200 Subject: [PATCH 1/3] diff: Update diff for UpgradeableBurnMintTokenPool --- .../UpgradeableBurnMintTokenPool_diff.md | 53 +++++++++++++++---- 1 file changed, 44 insertions(+), 9 deletions(-) diff --git a/contracts/src/v0.8/ccip/pools/GHO/diffs/UpgradeableBurnMintTokenPool_diff.md b/contracts/src/v0.8/ccip/pools/GHO/diffs/UpgradeableBurnMintTokenPool_diff.md index 05c3be4d06..066847e4f8 100644 --- a/contracts/src/v0.8/ccip/pools/GHO/diffs/UpgradeableBurnMintTokenPool_diff.md +++ b/contracts/src/v0.8/ccip/pools/GHO/diffs/UpgradeableBurnMintTokenPool_diff.md @@ -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..58be87812f 100644 +index 9af0f22f4c..a46ff915e5 100644 --- a/src/v0.8/ccip/pools/BurnMintTokenPool.sol +++ b/src/v0.8/ccip/pools/GHO/UpgradeableBurnMintTokenPool.sol -@@ -1,28 +1,55 @@ +@@ -1,28 +1,90 @@ // SPDX-License-Identifier: BUSL-1.1 -pragma solidity 0.8.19; +pragma solidity ^0.8.0; @@ -16,15 +16,10 @@ index 9af0f22f4c..58be87812f 100644 -import {BurnMintTokenPoolAbstract} from "./BurnMintTokenPoolAbstract.sol"; +import {ITypeAndVersion} from "../../../shared/interfaces/ITypeAndVersion.sol"; +import {IBurnMintERC20} from "../../../shared/token/ERC20/IBurnMintERC20.sol"; - --/// @notice This pool mints and burns a 3rd-party token. --/// @dev Pool whitelisting mode is set in the constructor and cannot be modified later. --/// It either accepts any address as originalSender, or only accepts whitelisted originalSender. --/// The only way to change whitelisting mode is to deploy a new pool. --/// If that is expected, please make sure the token's burner/minter roles are adjustable. --contract BurnMintTokenPool is BurnMintTokenPoolAbstract, ITypeAndVersion { ++ +import {UpgradeableTokenPool} from "./UpgradeableTokenPool.sol"; +import {UpgradeableBurnMintTokenPoolAbstract} from "./UpgradeableBurnMintTokenPoolAbstract.sol"; ++import {RateLimiter} from "../../libraries/RateLimiter.sol"; + +import {IRouter} from "../../interfaces/IRouter.sol"; + @@ -35,8 +30,20 @@ index 9af0f22f4c..58be87812f 100644 +/// - Implementation of Initializable to allow upgrades +/// - Move of allowlist and router definition to initialization stage +contract UpgradeableBurnMintTokenPool is Initializable, UpgradeableBurnMintTokenPoolAbstract, ITypeAndVersion { ++ error Unauthorized(address caller); + +-/// @notice This pool mints and burns a 3rd-party token. +-/// @dev Pool whitelisting mode is set in the constructor and cannot be modified later. +-/// It either accepts any address as originalSender, or only accepts whitelisted originalSender. +-/// The only way to change whitelisting mode is to deploy a new pool. +-/// If that is expected, please make sure the token's burner/minter roles are adjustable. +-contract BurnMintTokenPool is BurnMintTokenPoolAbstract, ITypeAndVersion { string public constant override typeAndVersion = "BurnMintTokenPool 1.4.0"; ++ /// @notice The address of the rate limiter admin. ++ /// @dev Can be address(0) if none is configured. ++ address internal s_rateLimitAdmin; ++ + /// @dev Constructor + /// @param token The bridgeable token that is managed by this pool. + /// @param armProxy The address of the arm proxy @@ -71,6 +78,34 @@ index 9af0f22f4c..58be87812f 100644 + } + } + ++ /// @notice Sets the rate limiter admin address. ++ /// @dev Only callable by the owner. ++ /// @param rateLimitAdmin The new rate limiter admin address. ++ function setRateLimitAdmin(address rateLimitAdmin) external onlyOwner { ++ s_rateLimitAdmin = rateLimitAdmin; ++ } ++ ++ /// @notice Gets the rate limiter admin address. ++ function getRateLimitAdmin() external view returns (address) { ++ return s_rateLimitAdmin; ++ } ++ ++ /// @notice Sets the rate limiter admin address. ++ /// @dev Only callable by the owner or the rate limiter admin. NOTE: overwrites the normal ++ /// onlyAdmin check in the base implementation to also allow the rate limiter admin. ++ /// @param remoteChainSelector The remote chain selector for which the rate limits apply. ++ /// @param outboundConfig The new outbound rate limiter config. ++ /// @param inboundConfig The new inbound rate limiter config. ++ function setChainRateLimiterConfig( ++ uint64 remoteChainSelector, ++ RateLimiter.Config memory outboundConfig, ++ RateLimiter.Config memory inboundConfig ++ ) external override { ++ if (msg.sender != s_rateLimitAdmin && msg.sender != owner()) revert Unauthorized(msg.sender); ++ ++ _setRateLimitConfig(remoteChainSelector, outboundConfig, inboundConfig); ++ } ++ + /// @inheritdoc UpgradeableBurnMintTokenPoolAbstract function _burn(uint256 amount) internal virtual override { IBurnMintERC20(address(i_token)).burn(amount); From 393649d9e40d3ed418ac9e87c47f1cc901242d8d Mon Sep 17 00:00:00 2001 From: miguelmtzinf Date: Thu, 18 Jul 2024 09:32:27 +0200 Subject: [PATCH 2/3] ci: Fix ci --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 5f535d2ef2..ae5c6f11b8 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -13,7 +13,7 @@ jobs: product: [ccip] name: Foundry Tests ${{ matrix.product }} # See https://github.com/foundry-rs/foundry/issues/3827 - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest # The if statements for steps after checkout repo is workaround for # passing required check for PRs that don't have filtered changes. From 3ddfc853660e9f71e0a2873e75bc7313228eb163 Mon Sep 17 00:00:00 2001 From: miguelmtzinf Date: Thu, 18 Jul 2024 10:35:41 +0200 Subject: [PATCH 3/3] ci: Fix ci --- .github/actions/setup-nodejs/action.yaml | 8 ++++---- .github/workflows/tests.yml | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/actions/setup-nodejs/action.yaml b/.github/actions/setup-nodejs/action.yaml index da605ac769..8e20784341 100644 --- a/.github/actions/setup-nodejs/action.yaml +++ b/.github/actions/setup-nodejs/action.yaml @@ -7,13 +7,13 @@ description: Setup pnpm for contracts runs: using: composite steps: - - uses: pnpm/action-setup@c3b53f6a16e57305370b4ae5a540c2077a1d50dd # v2.2.4 + - uses: pnpm/action-setup@a3252b78c470c02df07e9d59298aecedc3ccdd6d # v3.0.0 with: - version: ^7.0.0 + version: ^9.0.0 - - uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 # v4.0.0 + - uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2 with: - node-version: "16" + node-version: "20" cache: "pnpm" cache-dependency-path: "contracts/pnpm-lock.yaml" diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index ae5c6f11b8..5f535d2ef2 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -13,7 +13,7 @@ jobs: product: [ccip] name: Foundry Tests ${{ matrix.product }} # See https://github.com/foundry-rs/foundry/issues/3827 - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 # The if statements for steps after checkout repo is workaround for # passing required check for PRs that don't have filtered changes.