From 93be177583ba87bbc7103fe9456362f7dd492e92 Mon Sep 17 00:00:00 2001 From: Balamurali Gopalswami Date: Tue, 10 Dec 2024 19:07:43 -0500 Subject: [PATCH] Adding additional test for non 32 bytes destination pool data --- .github/e2e-tests.yml | 17 +++++++++++++++-- .../ccip-tests/actions/ccip_helpers.go | 15 +++++++++++++-- integration-tests/ccip-tests/testconfig/ccip.go | 1 + ...lbtc_mock_deployment_with_32bytes_data.toml} | 1 + ...tc_mock_deployment_with_non32bytes_data.toml | 11 +++++++++++ 5 files changed, 41 insertions(+), 4 deletions(-) rename integration-tests/ccip-tests/testconfig/tomls/{lbtc_mock_deployment.toml => lbtc_mock_deployment_with_32bytes_data.toml} (83%) create mode 100644 integration-tests/ccip-tests/testconfig/tomls/lbtc_mock_deployment_with_non32bytes_data.toml diff --git a/.github/e2e-tests.yml b/.github/e2e-tests.yml index f5bfa134f2..64cfec1e0e 100644 --- a/.github/e2e-tests.yml +++ b/.github/e2e-tests.yml @@ -962,7 +962,7 @@ runner-test-matrix: E2E_TEST_SELECTED_NETWORK: SIMULATED_1,SIMULATED_2 test_config_override_path: integration-tests/ccip-tests/testconfig/tomls/usdc_mock_deployment.toml - - id: ccip-smoke-lbtc + - id: ccip-smoke-lbtc-32bytes-destination-pool-data path: integration-tests/ccip-tests/smoke/ccip_test.go test_env_type: docker runs_on: ubuntu-latest @@ -973,7 +973,20 @@ runner-test-matrix: test_cmd: cd integration-tests/ccip-tests/smoke && go test ccip_test.go -test.run ^TestSmokeCCIPForBidirectionalLane$ -timeout 30m -count=1 -test.parallel=1 -json test_env_vars: E2E_TEST_SELECTED_NETWORK: SIMULATED_1,SIMULATED_2 - test_config_override_path: integration-tests/ccip-tests/testconfig/tomls/lbtc_mock_deployment.toml + test_config_override_path: integration-tests/ccip-tests/testconfig/tomls/lbtc_mock_deployment_with_32bytes_data.toml + + - id: ccip-smoke-lbtc-non32bytes-destination-pool-data + path: integration-tests/ccip-tests/smoke/ccip_test.go + test_env_type: docker + runs_on: ubuntu-latest + triggers: + - PR E2E CCIP Tests + - Merge Queue E2E CCIP Tests + - Nightly E2E Tests + test_cmd: cd integration-tests/ccip-tests/smoke && go test ccip_test.go -test.run ^TestSmokeCCIPForBidirectionalLane$ -timeout 30m -count=1 -test.parallel=1 -json + test_env_vars: + E2E_TEST_SELECTED_NETWORK: SIMULATED_1,SIMULATED_2 + test_config_override_path: integration-tests/ccip-tests/testconfig/tomls/lbtc_mock_deployment_with_non32bytes_data.toml - id: ccip-smoke-db-compatibility path: integration-tests/ccip-tests/smoke/ccip_test.go diff --git a/integration-tests/ccip-tests/actions/ccip_helpers.go b/integration-tests/ccip-tests/actions/ccip_helpers.go index cfb8986c89..fb780e95b4 100644 --- a/integration-tests/ccip-tests/actions/ccip_helpers.go +++ b/integration-tests/ccip-tests/actions/ccip_helpers.go @@ -4,6 +4,7 @@ import ( "context" crypto_rand "crypto/rand" "encoding/base64" + "encoding/hex" "encoding/json" "fmt" "math/big" @@ -88,6 +89,7 @@ const ( // DefaultResubscriptionTimeout denotes the max backoff duration for resubscription for various watch events // if the subscription keeps failing even after this duration, the test will fail DefaultResubscriptionTimeout = 2 * time.Hour + LBTCValidDestPoolData = "9b11457aa29d65e4940b67b7da16bd370d29bf6a3247a28066f93ac407b8b811" ) // TODO: These should be refactored along with the default CCIP test setup to use optional config functions @@ -177,6 +179,7 @@ type CCIPCommon struct { ExistingDeployment bool USDCMockDeployment *bool LBTCMockDeployment *bool + LBTCDestPoolDataAs32Bytes *bool TokenMessenger *common.Address TokenTransmitter *contracts.TokenTransmitter IsConnectionRestoredRecently *atomic.Bool @@ -1006,7 +1009,14 @@ func (ccipModule *CCIPCommon) DeployContracts( ccipModule.BridgeTokenPools = append(ccipModule.BridgeTokenPools, usdcPool) } else if ccipModule.IsLBTCDeployment() && i == 0 { rmnContract := *ccipModule.RMNContract - destPoolData := []byte{0x12, 0x34, 0x56, 0x78} + destPoolData, err := hex.DecodeString(LBTCValidDestPoolData) + if err != nil { + return fmt.Errorf("decoding dest pool data shouldn't fail %w", err) + } + if !pointer.GetBool(ccipModule.LBTCDestPoolDataAs32Bytes) { + destPoolData = []byte{0x12, 0x34, 0x56, 0x78} + } + // lbtcPool, err := ccipModule.tokenDeployer.DeployMockLBTCTokenPoolContract(token.Address(), rmnContract, ccipModule.Router.Instance.Address(), destPoolData) if err != nil { return fmt.Errorf("deploying mock lbtc bridge token pool shouldn't fail %w", err) @@ -1328,6 +1338,7 @@ func DefaultCCIPModule( MulticallEnabled: pointer.GetBool(testGroupConf.MulticallInOneTx), USDCMockDeployment: testGroupConf.USDCMockDeployment, LBTCMockDeployment: testGroupConf.LBTCMockDeployment, + LBTCDestPoolDataAs32Bytes: testGroupConf.LBTCDestPoolDataAs32Bytes, NoOfTokensNeedingDynamicPrice: pointer.GetInt(testGroupConf.TokenConfig.NoOfTokensWithDynamicPrice), poolFunds: testhelpers.Link(5), gasUpdateWatcherMu: &sync.Mutex{}, @@ -4495,7 +4506,7 @@ func SetMockServerWithLBTCAttestation( }{ Attestations: []attestation{ { - MessageHash: "0x9b11457aa29d65e4940b67b7da16bd370d29bf6a3247a28066f93ac407b8b811", //sample hash + MessageHash: "0x" + LBTCValidDestPoolData, //sample hash Status: "NOTARIZATION_STATUS_SESSION_APPROVED", Attestation: "0x0000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000016000000000000000000000000000000000000000000000000000000000000000e45c70a5050000000000000000000000000000000000000000000000000000000000aa36a7000000000000000000000000845f8e3c214d8d0e4d83fc094f302aa26a12a0bc0000000000000000000000000000000000000000000000000000000000014a34000000000000000000000000845f8e3c214d8d0e4d83fc094f302aa26a12a0bc00000000000000000000000062f10ce5b727edf787ea45776bd050308a61150800000000000000000000000000000000000000000000000000000000000003e60000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000001200000000000000000000000000000000000000000000000000000000000000040277eeafba008d767c2636d9428f2ebb13ab29ac70337f4fc34b0f5606767cae546f9be3f12160de6d142e5b3c1c3ebd0bf4298662b32b597d0cc5970c7742fc10000000000000000000000000000000000000000000000000000000000000040bbcd60ecc9e06f2effe7c94161219498a1eb435b419387adadb86ec9a52dfb066ce027532517df7216404049d193a25b85c35edfa3e7c5aa4757bfe84887a3980000000000000000000000000000000000000000000000000000000000000040da4a6dc619b5ca2349783cabecc4efdbc910090d3e234d7b8d0430165f8fae532f9a965ceb85c18bb92e059adefa7ce5835850a705761ab9e026d2db4a13ef9a", }, diff --git a/integration-tests/ccip-tests/testconfig/ccip.go b/integration-tests/ccip-tests/testconfig/ccip.go index 1f50459c43..eb294faec5 100644 --- a/integration-tests/ccip-tests/testconfig/ccip.go +++ b/integration-tests/ccip-tests/testconfig/ccip.go @@ -284,6 +284,7 @@ type CCIPTestGroupConfig struct { ChaosDuration *config.Duration `toml:",omitempty"` USDCMockDeployment *bool `toml:",omitempty"` LBTCMockDeployment *bool `toml:",omitempty"` + LBTCDestPoolDataAs32Bytes *bool `toml:",omitempty"` CommitOCRParams *contracts.OffChainAggregatorV2Config `toml:",omitempty"` ExecOCRParams *contracts.OffChainAggregatorV2Config `toml:",omitempty"` OffRampConfig *OffRampConfig `toml:",omitempty"` diff --git a/integration-tests/ccip-tests/testconfig/tomls/lbtc_mock_deployment.toml b/integration-tests/ccip-tests/testconfig/tomls/lbtc_mock_deployment_with_32bytes_data.toml similarity index 83% rename from integration-tests/ccip-tests/testconfig/tomls/lbtc_mock_deployment.toml rename to integration-tests/ccip-tests/testconfig/tomls/lbtc_mock_deployment_with_32bytes_data.toml index 2b06149830..6f75545693 100644 --- a/integration-tests/ccip-tests/testconfig/tomls/lbtc_mock_deployment.toml +++ b/integration-tests/ccip-tests/testconfig/tomls/lbtc_mock_deployment_with_32bytes_data.toml @@ -2,6 +2,7 @@ [CCIP.Groups] [CCIP.Groups.smoke] LBTCMockDeployment = true +LBTCDestPoolDataAs32Bytes = true [CCIP.Groups.smoke.TokenConfig] NoOfTokensPerChain = 1 diff --git a/integration-tests/ccip-tests/testconfig/tomls/lbtc_mock_deployment_with_non32bytes_data.toml b/integration-tests/ccip-tests/testconfig/tomls/lbtc_mock_deployment_with_non32bytes_data.toml new file mode 100644 index 0000000000..21210acbaf --- /dev/null +++ b/integration-tests/ccip-tests/testconfig/tomls/lbtc_mock_deployment_with_non32bytes_data.toml @@ -0,0 +1,11 @@ +[CCIP] +[CCIP.Groups] +[CCIP.Groups.smoke] +LBTCMockDeployment = true +LBTCDestPoolDataAs32Bytes = false + +[CCIP.Groups.smoke.TokenConfig] +NoOfTokensPerChain = 1 + +[CCIP.Groups.smoke.MsgDetails] +NoOfTokens = 1 \ No newline at end of file