Skip to content

Commit

Permalink
CCIP-4656 Via ir ccip (#15405)
Browse files Browse the repository at this point in the history
* turn on via-ir and set Sol version to 0.8.26

* fix ir over-optimization & stack too deep

* rebase and gen new snap

* Gen wrappers & set Sol version to 0.8.26

* use ^0.8.24

* gen wrappers

* fix test & solhint

* [Bot] Update changeset file with jira issues

* rebase

* fix merge

* bump non-offramp opts to 50k

* bump opts to 80k

---------

Co-authored-by: app-token-issuer-infra-releng[bot] <120227048+app-token-issuer-infra-releng[bot]@users.noreply.github.com>
  • Loading branch information
1 parent 043a5ab commit 16f1529
Show file tree
Hide file tree
Showing 280 changed files with 747 additions and 769 deletions.
10 changes: 10 additions & 0 deletions contracts/.changeset/tame-cycles-ring.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
'@chainlink/contracts': patch
---

enable via-ir in CCIP compilation


PR issue: CCIP-4656

Solidity Review issue: CCIP-3966
13 changes: 12 additions & 1 deletion contracts/foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,23 @@ multiline_func_header = "params_first"
sort_imports = true
single_line_statement_blocks = "preserve"

# This profile should be used for testing CCIP locally and in CI.
[profile.ccip]
solc_version = '0.8.24'
solc_version = '0.8.26'
src = 'src/v0.8/ccip'
test = 'src/v0.8/ccip/test'
evm_version = 'paris'
optimizer_runs = 500

# This profile should be used prior to any release to ensure the tests are passing with via-ir enabled. Enabling via-ir
# locally or in CI will slow down the compilation process, so it is not recommended to use it for everyday development.
[profile.ccip-viair]
solc_version = '0.8.26'
src = 'src/v0.8/ccip'
test = 'src/v0.8/ccip/test'
evm_version = 'paris'
optimizer_runs = 800
via_ir = true

[profile.functions]
solc_version = '0.8.19'
Expand Down
723 changes: 361 additions & 362 deletions contracts/gas-snapshots/ccip.gas-snapshot

Large diffs are not rendered by default.

12 changes: 5 additions & 7 deletions contracts/scripts/native_solc_compile_all_ccip
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@ echo " ┌───────────────────────
echo " │ Compiling CCIP contracts... │"
echo " └──────────────────────────────────────────────┘"

SOLC_VERSION="0.8.24"
OPTIMIZE_RUNS=26000
OPTIMIZE_RUNS_OFFRAMP=500
SOLC_VERSION="0.8.26"
OPTIMIZE_RUNS=80000
# This has to match the value in the `ccip-viair` foundry profile.
OPTIMIZE_RUNS_OFFRAMP=800


SCRIPTPATH="$( cd "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
Expand All @@ -32,17 +33,14 @@ compileContract () {
;;
esac

solc --overwrite --optimize --optimize-runs $optimize_runs --metadata-hash none \
solc --overwrite --via-ir --optimize --optimize-runs $optimize_runs --metadata-hash none \
-o "$ROOT"/contracts/solc/v$SOLC_VERSION/"$contract" \
--abi --bin --allow-paths "$ROOT"/contracts/src/v0.8 \
--bin-runtime --hashes --metadata --metadata-literal --combined-json abi,hashes,metadata,srcmap,srcmap-runtime \
--evm-version paris \
"$ROOT"/contracts/src/v0.8/"$1"
}


# Solc produces and overwrites intermediary contracts.
# Contracts should be ordered in reverse-import-complexity-order to minimize overwrite risks.
compileContract ccip/offRamp/OffRamp.sol
compileContract ccip/FeeQuoter.sol
compileContract ccip/onRamp/OnRamp.sol
Expand Down
2 changes: 1 addition & 1 deletion contracts/src/v0.8/ccip/FeeQuoter.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.24;
pragma solidity ^0.8.24;

import {IReceiver} from "../keystone/interfaces/IReceiver.sol";
import {ITypeAndVersion} from "../shared/interfaces/ITypeAndVersion.sol";
Expand Down
2 changes: 1 addition & 1 deletion contracts/src/v0.8/ccip/MultiAggregateRateLimiter.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.24;
pragma solidity ^0.8.24;

import {ITypeAndVersion} from "../shared/interfaces/ITypeAndVersion.sol";
import {IFeeQuoter} from "./interfaces/IFeeQuoter.sol";
Expand Down
2 changes: 1 addition & 1 deletion contracts/src/v0.8/ccip/NonceManager.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.24;
pragma solidity ^0.8.24;

import {ITypeAndVersion} from "../shared/interfaces/ITypeAndVersion.sol";
import {IEVM2AnyOnRamp} from "./interfaces/IEVM2AnyOnRamp.sol";
Expand Down
2 changes: 1 addition & 1 deletion contracts/src/v0.8/ccip/Router.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.24;
pragma solidity ^0.8.24;

import {ITypeAndVersion} from "../shared/interfaces/ITypeAndVersion.sol";
import {IAny2EVMMessageReceiver} from "./interfaces/IAny2EVMMessageReceiver.sol";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.24;
pragma solidity ^0.8.24;

import {ITypeAndVersion} from "../../shared/interfaces/ITypeAndVersion.sol";

Expand Down
2 changes: 1 addition & 1 deletion contracts/src/v0.8/ccip/capability/CCIPHome.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.24;
pragma solidity ^0.8.24;

import {ICapabilityConfiguration} from "../../keystone/interfaces/ICapabilityConfiguration.sol";
import {INodeInfoProvider} from "../../keystone/interfaces/INodeInfoProvider.sol";
Expand Down
2 changes: 1 addition & 1 deletion contracts/src/v0.8/ccip/offRamp/OffRamp.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.24;
pragma solidity ^0.8.24;

import {ITypeAndVersion} from "../../shared/interfaces/ITypeAndVersion.sol";
import {IAny2EVMMessageReceiver} from "../interfaces/IAny2EVMMessageReceiver.sol";
Expand Down
2 changes: 1 addition & 1 deletion contracts/src/v0.8/ccip/onRamp/OnRamp.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.24;
pragma solidity ^0.8.24;

import {ITypeAndVersion} from "../../shared/interfaces/ITypeAndVersion.sol";
import {IEVM2AnyOnRampClient} from "../interfaces/IEVM2AnyOnRampClient.sol";
Expand Down
2 changes: 1 addition & 1 deletion contracts/src/v0.8/ccip/pools/BurnFromMintTokenPool.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.24;
pragma solidity ^0.8.24;

import {ITypeAndVersion} from "../../shared/interfaces/ITypeAndVersion.sol";
import {IBurnMintERC20} from "../../shared/token/ERC20/IBurnMintERC20.sol";
Expand Down
2 changes: 1 addition & 1 deletion contracts/src/v0.8/ccip/pools/BurnMintTokenPool.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.24;
pragma solidity ^0.8.24;

import {ITypeAndVersion} from "../../shared/interfaces/ITypeAndVersion.sol";
import {IBurnMintERC20} from "../../shared/token/ERC20/IBurnMintERC20.sol";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.24;
pragma solidity ^0.8.24;

import {IBurnMintERC20} from "../../shared/token/ERC20/IBurnMintERC20.sol";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.24;
pragma solidity ^0.8.24;

import {ITypeAndVersion} from "../../shared/interfaces/ITypeAndVersion.sol";
import {IBurnMintERC20} from "../../shared/token/ERC20/IBurnMintERC20.sol";
Expand Down
2 changes: 1 addition & 1 deletion contracts/src/v0.8/ccip/pools/LockReleaseTokenPool.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.24;
pragma solidity ^0.8.24;

import {ILiquidityContainer} from "../../liquiditymanager/interfaces/ILiquidityContainer.sol";
import {ITypeAndVersion} from "../../shared/interfaces/ITypeAndVersion.sol";
Expand Down
2 changes: 1 addition & 1 deletion contracts/src/v0.8/ccip/pools/TokenPool.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.24;
pragma solidity ^0.8.24;

import {IPoolV1} from "../interfaces/IPool.sol";
import {IRMN} from "../interfaces/IRMN.sol";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.24;
pragma solidity ^0.8.24;

import {IBurnMintERC20} from "../../../shared/token/ERC20/IBurnMintERC20.sol";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.24;
pragma solidity ^0.8.24;

import {ILiquidityContainer} from "../../../liquiditymanager/interfaces/ILiquidityContainer.sol";
import {ITokenMessenger} from "../USDC/ITokenMessenger.sol";
Expand Down
2 changes: 1 addition & 1 deletion contracts/src/v0.8/ccip/pools/USDC/USDCBridgeMigrator.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.24;
pragma solidity ^0.8.24;

import {Ownable2StepMsgSender} from "../../../shared/access/Ownable2StepMsgSender.sol";
import {IBurnMintERC20} from "../../../shared/token/ERC20/IBurnMintERC20.sol";
Expand Down
2 changes: 1 addition & 1 deletion contracts/src/v0.8/ccip/pools/USDC/USDCTokenPool.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.24;
pragma solidity ^0.8.24;

import {ITypeAndVersion} from "../../../shared/interfaces/ITypeAndVersion.sol";
import {IMessageTransmitter} from "./IMessageTransmitter.sol";
Expand Down
2 changes: 1 addition & 1 deletion contracts/src/v0.8/ccip/rmn/ARMProxy.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.24;
pragma solidity ^0.8.24;

import {ITypeAndVersion} from "../../shared/interfaces/ITypeAndVersion.sol";

Expand Down
2 changes: 1 addition & 1 deletion contracts/src/v0.8/ccip/rmn/RMNHome.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.24;
pragma solidity ^0.8.24;

import {ITypeAndVersion} from "../../shared/interfaces/ITypeAndVersion.sol";

Expand Down
2 changes: 1 addition & 1 deletion contracts/src/v0.8/ccip/rmn/RMNRemote.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.24;
pragma solidity ^0.8.24;

import {ITypeAndVersion} from "../../shared/interfaces/ITypeAndVersion.sol";
import {IRMN} from "../interfaces/IRMN.sol";
Expand Down
2 changes: 1 addition & 1 deletion contracts/src/v0.8/ccip/test/BaseTest.t.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.24;
pragma solidity ^0.8.24;

// Imports to any non-library are not allowed due to the significant cascading
// compile time increase they cause when imported into this base test.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.24;
pragma solidity ^0.8.24;

import {NonceManager} from "../../NonceManager.sol";
import {OnRampSetup} from "../onRamp/OnRamp/OnRampSetup.t.sol";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.24;
pragma solidity ^0.8.24;

import {NonceManager} from "../../NonceManager.sol";
import {Internal} from "../../libraries/Internal.sol";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.24;
pragma solidity ^0.8.24;

import {NonceManager} from "../../NonceManager.sol";
import {BaseTest} from "../BaseTest.t.sol";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.24;
pragma solidity ^0.8.24;

import {IEVM2AnyOnRamp} from "../../interfaces/IEVM2AnyOnRamp.sol";

Expand Down
2 changes: 1 addition & 1 deletion contracts/src/v0.8/ccip/test/TokenSetup.t.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.24;
pragma solidity ^0.8.24;

import {BurnMintERC20} from "../../shared/token/ERC20/BurnMintERC20.sol";
import {BurnMintTokenPool} from "../pools/BurnMintTokenPool.sol";
Expand Down
2 changes: 1 addition & 1 deletion contracts/src/v0.8/ccip/test/WETH9.sol
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
pragma solidity 0.8.24;
pragma solidity ^0.8.24;

// solhint-disable
contract WETH9 {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.24;
pragma solidity ^0.8.24;

import {PingPongDemo} from "../../../applications/PingPongDemo.sol";
import {Client} from "../../../libraries/Client.sol";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.24;
pragma solidity ^0.8.24;

import {PingPongDappSetup} from "./PingPongDappSetup.t.sol";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.24;
pragma solidity ^0.8.24;

import {PingPongDappSetup} from "./PingPongDappSetup.t.sol";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.24;
pragma solidity ^0.8.24;

import {PingPongDappSetup} from "./PingPongDappSetup.t.sol";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.24;
pragma solidity ^0.8.24;

import {PingPongDemo} from "../../../applications/PingPongDemo.sol";
import {PingPongDappSetup} from "./PingPongDappSetup.t.sol";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.24;
pragma solidity ^0.8.24;

import {PingPongDappSetup} from "./PingPongDappSetup.t.sol";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.24;
pragma solidity ^0.8.24;

import {PingPongDemo} from "../../../applications/PingPongDemo.sol";
import {Internal} from "../../../libraries/Internal.sol";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.24;
pragma solidity ^0.8.24;

import {PingPongDemo} from "../../../applications/PingPongDemo.sol";
import {OnRampSetup} from "../../onRamp/OnRamp/OnRampSetup.t.sol";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.24;
pragma solidity ^0.8.24;

import {IRouterClient} from "../../../interfaces/IRouterClient.sol";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.24;
pragma solidity ^0.8.24;

import {Client} from "../../../libraries/Client.sol";
import {OnRamp} from "../../../onRamp/OnRamp.sol";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.24;
pragma solidity ^0.8.24;

import {Pool} from "../../../libraries/Pool.sol";
import {TokenPool} from "../../../pools/TokenPool.sol";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.24;
pragma solidity ^0.8.24;

import {INodeInfoProvider} from "../../../../keystone/interfaces/INodeInfoProvider.sol";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.24;
pragma solidity ^0.8.24;

import {CCIPHome} from "../../../capability/CCIPHome.sol";
import {Internal} from "../../../libraries/Internal.sol";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.24;
pragma solidity ^0.8.24;

import {CCIPHome} from "../../../capability/CCIPHome.sol";
import {CCIPHomeTestSetup} from "./CCIPHomeTestSetup.t.sol";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.24;
pragma solidity ^0.8.24;

import {CCIPHome} from "../../../capability/CCIPHome.sol";
import {Internal} from "../../../libraries/Internal.sol";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.24;
pragma solidity ^0.8.24;

import {CCIPHomeTestSetup} from "./CCIPHomeTestSetup.t.sol";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.24;
pragma solidity ^0.8.24;

import {CCIPHome} from "../../../capability/CCIPHome.sol";
import {Internal} from "../../../libraries/Internal.sol";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.24;
pragma solidity ^0.8.24;

import {CCIPHome} from "../../../capability/CCIPHome.sol";
import {Internal} from "../../../libraries/Internal.sol";
Expand Down
Loading

0 comments on commit 16f1529

Please sign in to comment.