Skip to content

Commit

Permalink
Add CCIPReader e2e tests using simulated backend (#1209)
Browse files Browse the repository at this point in the history
Add CCIPReader e2e tests using the simulated backend.

First merge: smartcontractkit/chainlink-ccip#48
and update commitHash of chainlink-common dependency in this branch.
  • Loading branch information
dimkouv authored Jul 30, 2024
1 parent b212fba commit e0a5bc2
Show file tree
Hide file tree
Showing 14 changed files with 1,236 additions and 12 deletions.
5 changes: 5 additions & 0 deletions contracts/scripts/native_solc_compile_all_ccip
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ compileContract () {
echo "OnRamp uses $OPTIMIZE_RUNS_ONRAMP optimizer runs."
optimize_runs=$OPTIMIZE_RUNS_ONRAMP
;;
"ccip/test/helpers/CCIPReaderTester.sol")
echo "CCIPReaderTester uses 1 optimizer runs for reduced contract size."
optimize_runs=1
;;
esac

solc --overwrite --optimize --optimize-runs $optimize_runs --metadata-hash none \
Expand Down Expand Up @@ -83,6 +87,7 @@ compileContract ccip/NonceManager.sol
compileContract ccip/test/helpers/BurnMintERC677Helper.sol
compileContract ccip/test/helpers/CommitStoreHelper.sol
compileContract ccip/test/helpers/MessageHasher.sol
compileContract ccip/test/helpers/CCIPReaderTester.sol
compileContract ccip/test/helpers/ReportCodec.sol
compileContract ccip/test/helpers/receivers/MaybeRevertMessageReceiver.sol
compileContract ccip/test/helpers/MultiOCR3Helper.sol
Expand Down
55 changes: 55 additions & 0 deletions contracts/src/v0.8/ccip/test/helpers/CCIPReaderTester.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.24;

import {Internal} from "../../libraries/Internal.sol";
import {EVM2EVMMultiOffRamp} from "../../offRamp/EVM2EVMMultiOffRamp.sol";

contract CCIPReaderTester {
event CCIPSendRequested(uint64 indexed destChainSelector, Internal.EVM2AnyRampMessage message);

mapping(uint64 sourceChainSelector => EVM2EVMMultiOffRamp.SourceChainConfig sourceChainConfig) internal
s_sourceChainConfigs;

function getSourceChainConfig(uint64 sourceChainSelector)
external
view
returns (EVM2EVMMultiOffRamp.SourceChainConfig memory)
{
return s_sourceChainConfigs[sourceChainSelector];
}

function setSourceChainConfig(
uint64 sourceChainSelector,
EVM2EVMMultiOffRamp.SourceChainConfig memory sourceChainConfig
) external {
s_sourceChainConfigs[sourceChainSelector] = sourceChainConfig;
}

function emitCCIPSendRequested(uint64 destChainSelector, Internal.EVM2AnyRampMessage memory message) external {
emit CCIPSendRequested(destChainSelector, message);
}

event ExecutionStateChanged(
uint64 indexed sourceChainSelector,
uint64 indexed sequenceNumber,
bytes32 indexed messageId,
Internal.MessageExecutionState state,
bytes returnData
);

function emitExecutionStateChanged(
uint64 sourceChainSelector,
uint64 sequenceNumber,
bytes32 messageId,
Internal.MessageExecutionState state,
bytes memory returnData
) external {
emit ExecutionStateChanged(sourceChainSelector, sequenceNumber, messageId, state, returnData);
}

event CommitReportAccepted(EVM2EVMMultiOffRamp.CommitReport report);

function emitCommitReportAccepted(EVM2EVMMultiOffRamp.CommitReport memory report) external {
emit CommitReportAccepted(report);
}
}

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ burn_mint_token_pool: ../../../contracts/solc/v0.8.24/BurnMintTokenPool/BurnMint
burn_mint_token_pool_and_proxy: ../../../contracts/solc/v0.8.24/BurnMintTokenPoolAndProxy/BurnMintTokenPoolAndProxy.abi ../../../contracts/solc/v0.8.24/BurnMintTokenPoolAndProxy/BurnMintTokenPoolAndProxy.bin 17bcd03828f43f50028bc4d66fdfb0cf576aaf28895d8f86c6ff598159a0cd64
burn_with_from_mint_token_pool: ../../../contracts/solc/v0.8.24/BurnWithFromMintTokenPool/BurnWithFromMintTokenPool.abi ../../../contracts/solc/v0.8.24/BurnWithFromMintTokenPool/BurnWithFromMintTokenPool.bin 6f40135e1488097eafa843839a719fe9a3c21354565b64eb377a24a0a55782ef
ccip_config: ../../../contracts/solc/v0.8.24/CCIPConfig/CCIPConfig.abi ../../../contracts/solc/v0.8.24/CCIPConfig/CCIPConfig.bin c06c1cf1d004a803585a2c9d7a71ee5997b5fca86c2e111335cb8b930d9e3b5a
ccip_reader_tester: ../../../contracts/solc/v0.8.24/CCIPReaderTester/CCIPReaderTester.abi ../../../contracts/solc/v0.8.24/CCIPReaderTester/CCIPReaderTester.bin 02be3227883ca4b69383892d27ba7a9af747151a06f4815d18ccd8aaf89b4fb9
commit_store: ../../../contracts/solc/v0.8.24/CommitStore/CommitStore.abi ../../../contracts/solc/v0.8.24/CommitStore/CommitStore.bin ddc26c10c2a52b59624faae9005827b09b98db4566887a736005e8cc37cf8a51
commit_store_helper: ../../../contracts/solc/v0.8.24/CommitStoreHelper/CommitStoreHelper.abi ../../../contracts/solc/v0.8.24/CommitStoreHelper/CommitStoreHelper.bin ebd8aac686fa28a71d4212bcd25a28f8f640d50dce5e50498b2f6b8534890b69
ether_sender_receiver: ../../../contracts/solc/v0.8.24/EtherSenderReceiver/EtherSenderReceiver.abi ../../../contracts/solc/v0.8.24/EtherSenderReceiver/EtherSenderReceiver.bin 09510a3f773f108a3c231e8d202835c845ded862d071ec54c4f89c12d868b8de
Expand Down
1 change: 1 addition & 0 deletions core/gethwrappers/ccip/go_generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ package ccip
//go:generate go run ../generation/generate/wrap.go ../../../contracts/solc/v0.8.24/SelfFundedPingPong/SelfFundedPingPong.abi ../../../contracts/solc/v0.8.24/SelfFundedPingPong/SelfFundedPingPong.bin SelfFundedPingPong self_funded_ping_pong
//go:generate go run ../generation/generate/wrap.go ../../../contracts/solc/v0.8.24/MessageHasher/MessageHasher.abi ../../../contracts/solc/v0.8.24/MessageHasher/MessageHasher.bin MessageHasher message_hasher
//go:generate go run ../generation/generate/wrap.go ../../../contracts/solc/v0.8.24/MultiOCR3Helper/MultiOCR3Helper.abi ../../../contracts/solc/v0.8.24/MultiOCR3Helper/MultiOCR3Helper.bin MultiOCR3Helper multi_ocr3_helper
//go:generate go run ../generation/generate/wrap.go ../../../contracts/solc/v0.8.24/CCIPReaderTester/CCIPReaderTester.abi ../../../contracts/solc/v0.8.24/CCIPReaderTester/CCIPReaderTester.bin CCIPReaderTester ccip_reader_tester
//go:generate go run ../generation/generate/wrap.go ../../../contracts/solc/v0.8.24/ReportCodec/ReportCodec.abi ../../../contracts/solc/v0.8.24/ReportCodec/ReportCodec.bin ReportCodec report_codec
//go:generate go run ../generation/generate/wrap.go ../../../contracts/solc/v0.8.24/EtherSenderReceiver/EtherSenderReceiver.abi ../../../contracts/solc/v0.8.24/EtherSenderReceiver/EtherSenderReceiver.bin EtherSenderReceiver ether_sender_receiver
//go:generate go run ../generation/generate/wrap.go ../../../contracts/solc/v0.8.24/WETH9/WETH9.abi ../../../contracts/solc/v0.8.24/WETH9/WETH9.bin WETH9 weth9
Expand Down
2 changes: 1 addition & 1 deletion core/scripts/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ require (
github.com/sethvargo/go-retry v0.2.4 // indirect
github.com/shirou/gopsutil v3.21.11+incompatible // indirect
github.com/shirou/gopsutil/v3 v3.24.3 // indirect
github.com/smartcontractkit/chainlink-ccip v0.0.0-20240725105722-fb2380a3f739 // indirect
github.com/smartcontractkit/chainlink-ccip v0.0.0-20240729211818-87f9bb698f6e // indirect
github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240710121324-3ed288aa9b45 // indirect
github.com/smartcontractkit/chainlink-data-streams v0.0.0-20240718160222-2dc0c8136bfa // indirect
github.com/smartcontractkit/chainlink-feeds v0.0.0-20240710170203-5b41615da827 // indirect
Expand Down
4 changes: 2 additions & 2 deletions core/scripts/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1070,8 +1070,8 @@ github.com/smartcontractkit/chain-selectors v1.0.19 h1:y82TyWaOA6gSvi26bbyDYgfZv
github.com/smartcontractkit/chain-selectors v1.0.19/go.mod h1:d4Hi+E1zqjy9HqMkjBE5q1vcG9VGgxf5VxiRHfzi2kE=
github.com/smartcontractkit/chainlink-automation v1.0.4 h1:iyW181JjKHLNMnDleI8umfIfVVlwC7+n5izbLSFgjw8=
github.com/smartcontractkit/chainlink-automation v1.0.4/go.mod h1:u4NbPZKJ5XiayfKHD/v3z3iflQWqvtdhj13jVZXj/cM=
github.com/smartcontractkit/chainlink-ccip v0.0.0-20240725105722-fb2380a3f739 h1:eYe/NS0b97yJV5ffLB+v6ww6R9FcUZV1k07tuArhCdY=
github.com/smartcontractkit/chainlink-ccip v0.0.0-20240725105722-fb2380a3f739/go.mod h1:K67FldZZmg+//7yyI0yBMXEw6uvYevTj/ErBEvXaBXM=
github.com/smartcontractkit/chainlink-ccip v0.0.0-20240729211818-87f9bb698f6e h1:aFYsUujFGiVwPAlvG94GHMIaLm8AFQ0V+d10AQD9ogY=
github.com/smartcontractkit/chainlink-ccip v0.0.0-20240729211818-87f9bb698f6e/go.mod h1:K67FldZZmg+//7yyI0yBMXEw6uvYevTj/ErBEvXaBXM=
github.com/smartcontractkit/chainlink-common v0.2.1-0.20240717132349-ee5af9b79834 h1:pTf4xdcmiWBqWZ6rTy2RMTDBzhHk89VC1pM7jXKQztI=
github.com/smartcontractkit/chainlink-common v0.2.1-0.20240717132349-ee5af9b79834/go.mod h1:fh9eBbrReCmv31bfz52ENCAMa7nTKQbdhb2B3+S2VGo=
github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240710121324-3ed288aa9b45 h1:NBQLtqk8zsyY4qTJs+NElI3aDFTcAo83JHvqD04EvB0=
Expand Down
Loading

0 comments on commit e0a5bc2

Please sign in to comment.