Skip to content
This repository was archived by the owner on Mar 14, 2025. It is now read-only.

Commit 2bd8c76

Browse files
bukata-sab-gopalswamirstoutfriedemannfMadalosso
authored
cherry-pick: CCIP-4408: E2E test for LBTC (#1578)
cherry-pick da91f6f --------- Co-authored-by: Balamurali Gopalswami <[email protected]> Co-authored-by: Ryan Stout <[email protected]> Co-authored-by: Friedemann Fürst <[email protected]> Co-authored-by: Otávio Migliavacca Madalosso <[email protected]> Co-authored-by: app-token-issuer-infra-releng[bot] <120227048+app-token-issuer-infra-releng[bot]@users.noreply.github.com>
1 parent f6a9169 commit 2bd8c76

File tree

19 files changed

+3087
-13
lines changed

19 files changed

+3087
-13
lines changed

.github/e2e-tests.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -962,6 +962,32 @@ runner-test-matrix:
962962
E2E_TEST_SELECTED_NETWORK: SIMULATED_1,SIMULATED_2
963963
test_config_override_path: integration-tests/ccip-tests/testconfig/tomls/usdc_mock_deployment.toml
964964

965+
- id: ccip-smoke-lbtc-32bytes-destination-pool-data
966+
path: integration-tests/ccip-tests/smoke/ccip_test.go
967+
test_env_type: docker
968+
runs_on: ubuntu-latest
969+
triggers:
970+
- PR E2E CCIP Tests
971+
- Merge Queue E2E CCIP Tests
972+
- Nightly E2E Tests
973+
test_cmd: cd integration-tests/ccip-tests/smoke && go test ccip_test.go -test.run ^TestSmokeCCIPForBidirectionalLane$ -timeout 30m -count=1 -test.parallel=1 -json
974+
test_env_vars:
975+
E2E_TEST_SELECTED_NETWORK: SIMULATED_1,SIMULATED_2
976+
test_config_override_path: integration-tests/ccip-tests/testconfig/tomls/lbtc_mock_deployment_with_32bytes_data.toml
977+
978+
- id: ccip-smoke-lbtc-non32bytes-destination-pool-data
979+
path: integration-tests/ccip-tests/smoke/ccip_test.go
980+
test_env_type: docker
981+
runs_on: ubuntu-latest
982+
triggers:
983+
- PR E2E CCIP Tests
984+
- Merge Queue E2E CCIP Tests
985+
- Nightly E2E Tests
986+
test_cmd: cd integration-tests/ccip-tests/smoke && go test ccip_test.go -test.run ^TestSmokeCCIPForBidirectionalLane$ -timeout 30m -count=1 -test.parallel=1 -json
987+
test_env_vars:
988+
E2E_TEST_SELECTED_NETWORK: SIMULATED_1,SIMULATED_2
989+
test_config_override_path: integration-tests/ccip-tests/testconfig/tomls/lbtc_mock_deployment_with_non32bytes_data.toml
990+
965991
- id: ccip-smoke-db-compatibility
966992
path: integration-tests/ccip-tests/smoke/ccip_test.go
967993
test_env_type: docker

contracts/scripts/native_solc_compile_all_ccip

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ compileContract ccip/test/helpers/receivers/MaybeRevertMessageReceiver.sol
9696
compileContract ccip/test/helpers/MultiOCR3Helper.sol
9797
compileContract ccip/test/mocks/MockE2EUSDCTokenMessenger.sol
9898
compileContract ccip/test/mocks/MockE2EUSDCTransmitter.sol
99+
compileContract ccip/test/mocks/MockLBTCTokenPool.sol
99100
compileContract ccip/test/WETH9.sol
100101

101102

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
// SPDX-License-Identifier: BUSL-1.1
2+
pragma solidity 0.8.24;
3+
4+
import {ITypeAndVersion} from "../../../shared/interfaces/ITypeAndVersion.sol";
5+
import {IBurnMintERC20} from "../../../shared/token/ERC20/IBurnMintERC20.sol";
6+
7+
import {Pool} from "../../libraries/Pool.sol";
8+
import {TokenPool} from "../../pools/TokenPool.sol";
9+
10+
import {IERC20} from "../../../vendor/openzeppelin-solidity/v4.8.3/contracts/token/ERC20/IERC20.sol";
11+
import {SafeERC20} from "../../../vendor/openzeppelin-solidity/v4.8.3/contracts/token/ERC20/utils/SafeERC20.sol";
12+
13+
/// @notice This mock contract facilitates testing of LBTC token transfers by burning and minting tokens.
14+
contract MockLBTCTokenPool is TokenPool, ITypeAndVersion {
15+
using SafeERC20 for IERC20;
16+
17+
string public constant override typeAndVersion = "MockLBTCTokenPool 1.5.1";
18+
19+
// This variable i_destPoolData will have either a 32-byte or non-32-byte value, which will change the off-chain behavior.
20+
// If it is 32 bytes, the off-chain will consider it as attestation enabled and call the attestation API.
21+
// If it is non-32 bytes, the off-chain will consider it as attestation disabled.
22+
bytes public i_destPoolData;
23+
24+
constructor(
25+
IERC20 token,
26+
address[] memory allowlist,
27+
address rmnProxy,
28+
address router,
29+
bytes memory destPoolData
30+
) TokenPool(token, allowlist, rmnProxy, router) {
31+
i_destPoolData = destPoolData;
32+
}
33+
34+
function lockOrBurn(
35+
Pool.LockOrBurnInV1 calldata lockOrBurnIn
36+
) public virtual override returns (Pool.LockOrBurnOutV1 memory) {
37+
IBurnMintERC20(address(i_token)).burn(lockOrBurnIn.amount);
38+
emit Burned(msg.sender, lockOrBurnIn.amount);
39+
40+
return
41+
Pool.LockOrBurnOutV1({
42+
destTokenAddress: getRemoteToken(
43+
lockOrBurnIn.remoteChainSelector
44+
),
45+
destPoolData: i_destPoolData
46+
});
47+
}
48+
49+
function releaseOrMint(
50+
Pool.ReleaseOrMintInV1 calldata releaseOrMintIn
51+
) public virtual override returns (Pool.ReleaseOrMintOutV1 memory) {
52+
IBurnMintERC20(address(i_token)).mint(releaseOrMintIn.receiver, releaseOrMintIn.amount);
53+
54+
emit Minted(
55+
msg.sender,
56+
releaseOrMintIn.receiver,
57+
releaseOrMintIn.amount
58+
);
59+
60+
return
61+
Pool.ReleaseOrMintOutV1({
62+
destinationAmount: releaseOrMintIn.amount
63+
});
64+
}
65+
}
66+

core/gethwrappers/ccip/generated/mock_lbtc_token_pool/mock_lbtc_token_pool.go

Lines changed: 2713 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

core/gethwrappers/ccip/generation/generated-wrapper-dependency-versions-do-not-edit.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ lock_release_token_pool: ../../../contracts/solc/v0.8.24/LockReleaseTokenPool/Lo
1818
lock_release_token_pool_and_proxy: ../../../contracts/solc/v0.8.24/LockReleaseTokenPoolAndProxy/LockReleaseTokenPoolAndProxy.abi ../../../contracts/solc/v0.8.24/LockReleaseTokenPoolAndProxy/LockReleaseTokenPoolAndProxy.bin e632b08be0fbd1d013e8b3a9d75293d0d532b83071c531ff2be1deec1fa48ec1
1919
maybe_revert_message_receiver: ../../../contracts/solc/v0.8.24/MaybeRevertMessageReceiver/MaybeRevertMessageReceiver.abi ../../../contracts/solc/v0.8.24/MaybeRevertMessageReceiver/MaybeRevertMessageReceiver.bin d73956c26232ebcc4a5444429fa99cbefed960e323be9b5a24925885c2e477d5
2020
message_hasher: ../../../contracts/solc/v0.8.24/MessageHasher/MessageHasher.abi ../../../contracts/solc/v0.8.24/MessageHasher/MessageHasher.bin 0a2661da24147160383ad61d56a258515d1cc07f5e0f471ec5cbb4bccaf82389
21+
mock_lbtc_token_pool: ../../../contracts/solc/v0.8.24/MockLBTCTokenPool/MockLBTCTokenPool.abi ../../../contracts/solc/v0.8.24/MockLBTCTokenPool/MockLBTCTokenPool.bin 292f178fcde42d91d1fe33a0c6853fa3174e3bb0e3165fe3354d83ee40357613
2122
mock_usdc_token_messenger: ../../../contracts/solc/v0.8.24/MockE2EUSDCTokenMessenger/MockE2EUSDCTokenMessenger.abi ../../../contracts/solc/v0.8.24/MockE2EUSDCTokenMessenger/MockE2EUSDCTokenMessenger.bin d976651d36b33ac2196b32b9d2f4fa6690c6a18d41b621365659fce1c1d1e737
2223
mock_usdc_token_transmitter: ../../../contracts/solc/v0.8.24/MockE2EUSDCTransmitter/MockE2EUSDCTransmitter.abi ../../../contracts/solc/v0.8.24/MockE2EUSDCTransmitter/MockE2EUSDCTransmitter.bin be0dbc3e475741ea0b7a54ec2b935a321b428baa9f4ce18180a87fb38bb87de2
2324
mock_v3_aggregator_contract: ../../../contracts/solc/v0.8.24/MockV3Aggregator/MockV3Aggregator.abi ../../../contracts/solc/v0.8.24/MockV3Aggregator/MockV3Aggregator.bin 518e19efa2ff52b0fefd8e597b05765317ee7638189bfe34ca43de2f6599faf4

core/gethwrappers/ccip/go_generate.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ package ccip
4444
//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
4545
//go:generate go run ../generation/generate/wrap.go ../../../contracts/solc/v0.8.24/MockE2EUSDCTokenMessenger/MockE2EUSDCTokenMessenger.abi ../../../contracts/solc/v0.8.24/MockE2EUSDCTokenMessenger/MockE2EUSDCTokenMessenger.bin MockE2EUSDCTokenMessenger mock_usdc_token_messenger
4646
//go:generate go run ../generation/generate/wrap.go ../../../contracts/solc/v0.8.24/MockE2EUSDCTransmitter/MockE2EUSDCTransmitter.abi ../../../contracts/solc/v0.8.24/MockE2EUSDCTransmitter/MockE2EUSDCTransmitter.bin MockE2EUSDCTransmitter mock_usdc_token_transmitter
47+
//go:generate go run ../generation/generate/wrap.go ../../../contracts/solc/v0.8.24/MockLBTCTokenPool/MockLBTCTokenPool.abi ../../../contracts/solc/v0.8.24/MockLBTCTokenPool/MockLBTCTokenPool.bin MockLBTCTokenPool mock_lbtc_token_pool
4748

4849
// EncodingUtils
4950
//go:generate go run ../generation/generate/wrap.go ../../../contracts/solc/v0.8.24/ICCIPEncodingUtils/ICCIPEncodingUtils.abi ../../../contracts/solc/v0.8.24/ICCIPEncodingUtils/ICCIPEncodingUtils.bin EncodingUtils ccip_encoding_utils

core/scripts/go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -355,8 +355,8 @@ github.com/fatih/color v1.17.0 h1:GlRw1BRJxkpqUCBKzKOw098ed57fEsKeNjpTe3cSjK4=
355355
github.com/fatih/color v1.17.0/go.mod h1:YZ7TlrGPkiz6ku9fK3TLD/pl3CpsiFyu8N92HLgmosI=
356356
github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg=
357357
github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U=
358-
github.com/fjl/memsize v0.0.0-20190710130421-bcb5799ab5e5 h1:FtmdgXiUlNeRsoNMFlKLDt+S+6hbjVMEW6RGQ7aUf7c=
359-
github.com/fjl/memsize v0.0.0-20190710130421-bcb5799ab5e5/go.mod h1:VvhXpOYNQvB+uIk2RvXzuaQtkQJzzIx6lSBe1xv7hi0=
358+
github.com/fjl/memsize v0.0.2 h1:27txuSD9or+NZlnOWdKUxeBzTAUkWCVh+4Gf2dWFOzA=
359+
github.com/fjl/memsize v0.0.2/go.mod h1:VvhXpOYNQvB+uIk2RvXzuaQtkQJzzIx6lSBe1xv7hi0=
360360
github.com/fortytw2/leaktest v1.3.0 h1:u8491cBMTQ8ft8aeV+adlcytMZylmA5nnwwkRZjI8vw=
361361
github.com/fortytw2/leaktest v1.3.0/go.mod h1:jDsjWgpAGjm2CA7WthBh/CdZYEPF31XHquHwclZch5g=
362362
github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8=

core/services/ocr2/plugins/ccip/testhelpers/integration/jobspec.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,7 @@ type CCIPJobSpecParams struct {
170170
DestStartBlock uint64
171171
USDCAttestationAPI string
172172
USDCConfig *config.USDCConfig
173+
LBTCConfig *config.LBTCConfig
173174
P2PV2Bootstrappers pq.StringArray
174175
}
175176

@@ -295,6 +296,11 @@ func (params CCIPJobSpecParams) ExecutionJobSpec() (*OCR2TaskJobSpec, error) {
295296
ocrSpec.PluginConfig["USDCConfig.SourceMessageTransmitterAddress"] = fmt.Sprintf(`"%s"`, params.USDCConfig.SourceMessageTransmitterAddress)
296297
ocrSpec.PluginConfig["USDCConfig.AttestationAPITimeoutSeconds"] = params.USDCConfig.AttestationAPITimeoutSeconds
297298
}
299+
if params.LBTCConfig != nil {
300+
ocrSpec.PluginConfig["LBTCConfig.AttestationAPI"] = fmt.Sprintf(`"%s"`, params.LBTCConfig.AttestationAPI)
301+
ocrSpec.PluginConfig["LBTCConfig.SourceTokenAddress"] = fmt.Sprintf(`"%s"`, params.LBTCConfig.SourceTokenAddress)
302+
ocrSpec.PluginConfig["LBTCConfig.AttestationAPITimeoutSeconds"] = params.LBTCConfig.AttestationAPITimeoutSeconds
303+
}
298304
return &OCR2TaskJobSpec{
299305
OCR2OracleSpec: ocrSpec,
300306
JobType: "offchainreporting2",

go.mod

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,7 @@ require (
198198
github.com/dustin/go-humanize v1.0.1 // indirect
199199
github.com/dvsekhvalnov/jose2go v1.7.0 // indirect
200200
github.com/ethereum/c-kzg-4844 v0.4.0 // indirect
201+
github.com/fjl/memsize v0.0.2 // indirect
201202
github.com/fsnotify/fsnotify v1.7.0 // indirect
202203
github.com/gabriel-vasile/mimetype v1.4.3 // indirect
203204
github.com/gagliardetto/binary v0.7.7 // indirect

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -333,8 +333,8 @@ github.com/fatih/color v1.17.0 h1:GlRw1BRJxkpqUCBKzKOw098ed57fEsKeNjpTe3cSjK4=
333333
github.com/fatih/color v1.17.0/go.mod h1:YZ7TlrGPkiz6ku9fK3TLD/pl3CpsiFyu8N92HLgmosI=
334334
github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg=
335335
github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U=
336-
github.com/fjl/memsize v0.0.0-20190710130421-bcb5799ab5e5 h1:FtmdgXiUlNeRsoNMFlKLDt+S+6hbjVMEW6RGQ7aUf7c=
337-
github.com/fjl/memsize v0.0.0-20190710130421-bcb5799ab5e5/go.mod h1:VvhXpOYNQvB+uIk2RvXzuaQtkQJzzIx6lSBe1xv7hi0=
336+
github.com/fjl/memsize v0.0.2 h1:27txuSD9or+NZlnOWdKUxeBzTAUkWCVh+4Gf2dWFOzA=
337+
github.com/fjl/memsize v0.0.2/go.mod h1:VvhXpOYNQvB+uIk2RvXzuaQtkQJzzIx6lSBe1xv7hi0=
338338
github.com/fortytw2/leaktest v1.3.0 h1:u8491cBMTQ8ft8aeV+adlcytMZylmA5nnwwkRZjI8vw=
339339
github.com/fortytw2/leaktest v1.3.0/go.mod h1:jDsjWgpAGjm2CA7WthBh/CdZYEPF31XHquHwclZch5g=
340340
github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8=

0 commit comments

Comments
 (0)