Skip to content

Commit

Permalink
Adding additional test for non 32 bytes destination pool data
Browse files Browse the repository at this point in the history
  • Loading branch information
b-gopalswami committed Dec 11, 2024
1 parent d7051cf commit 93be177
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 4 deletions.
17 changes: 15 additions & 2 deletions .github/e2e-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
15 changes: 13 additions & 2 deletions integration-tests/ccip-tests/actions/ccip_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"
crypto_rand "crypto/rand"
"encoding/base64"
"encoding/hex"
"encoding/json"
"fmt"
"math/big"
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -177,6 +179,7 @@ type CCIPCommon struct {
ExistingDeployment bool
USDCMockDeployment *bool
LBTCMockDeployment *bool
LBTCDestPoolDataAs32Bytes *bool
TokenMessenger *common.Address
TokenTransmitter *contracts.TokenTransmitter
IsConnectionRestoredRecently *atomic.Bool
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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{},
Expand Down Expand Up @@ -4495,7 +4506,7 @@ func SetMockServerWithLBTCAttestation(
}{
Attestations: []attestation{
{
MessageHash: "0x9b11457aa29d65e4940b67b7da16bd370d29bf6a3247a28066f93ac407b8b811", //sample hash
MessageHash: "0x" + LBTCValidDestPoolData, //sample hash
Status: "NOTARIZATION_STATUS_SESSION_APPROVED",
Attestation: "0x0000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000016000000000000000000000000000000000000000000000000000000000000000e45c70a5050000000000000000000000000000000000000000000000000000000000aa36a7000000000000000000000000845f8e3c214d8d0e4d83fc094f302aa26a12a0bc0000000000000000000000000000000000000000000000000000000000014a34000000000000000000000000845f8e3c214d8d0e4d83fc094f302aa26a12a0bc00000000000000000000000062f10ce5b727edf787ea45776bd050308a61150800000000000000000000000000000000000000000000000000000000000003e60000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000001200000000000000000000000000000000000000000000000000000000000000040277eeafba008d767c2636d9428f2ebb13ab29ac70337f4fc34b0f5606767cae546f9be3f12160de6d142e5b3c1c3ebd0bf4298662b32b597d0cc5970c7742fc10000000000000000000000000000000000000000000000000000000000000040bbcd60ecc9e06f2effe7c94161219498a1eb435b419387adadb86ec9a52dfb066ce027532517df7216404049d193a25b85c35edfa3e7c5aa4757bfe84887a3980000000000000000000000000000000000000000000000000000000000000040da4a6dc619b5ca2349783cabecc4efdbc910090d3e234d7b8d0430165f8fae532f9a965ceb85c18bb92e059adefa7ce5835850a705761ab9e026d2db4a13ef9a",
},
Expand Down
1 change: 1 addition & 0 deletions integration-tests/ccip-tests/testconfig/ccip.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
[CCIP.Groups]
[CCIP.Groups.smoke]
LBTCMockDeployment = true
LBTCDestPoolDataAs32Bytes = true

[CCIP.Groups.smoke.TokenConfig]
NoOfTokensPerChain = 1
Expand Down
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 93be177

Please sign in to comment.