From 91b8917add9ee945b2bd2d3c3d2979d34bdc5aab Mon Sep 17 00:00:00 2001 From: Adam Hamrick Date: Thu, 29 Aug 2024 09:43:33 -0400 Subject: [PATCH 01/19] Enables out of order execution for E2E Tests --- .../ccip-tests/actions/ccip_helpers.go | 44 +++++++----- .../ccip-tests/chaos/ccip_test.go | 4 +- .../ccip-tests/contracts/contract_deployer.go | 1 + .../ccip-tests/contracts/contract_models.go | 68 +++++++++++++++++-- .../ccip-tests/load/ccip_loadgen.go | 7 +- integration-tests/ccip-tests/load/helper.go | 1 + .../ccip-tests/smoke/ccip_test.go | 41 +++++------ 7 files changed, 120 insertions(+), 46 deletions(-) diff --git a/integration-tests/ccip-tests/actions/ccip_helpers.go b/integration-tests/ccip-tests/actions/ccip_helpers.go index e878233d53..33b5838a5e 100644 --- a/integration-tests/ccip-tests/actions/ccip_helpers.go +++ b/integration-tests/ccip-tests/actions/ccip_helpers.go @@ -1626,7 +1626,7 @@ func (sourceCCIP *SourceCCIPModule) IsRequestTriggeredWithinTimeframe(timeframe if sendRequestedEvents, exists := value.([]*evm_2_evm_onramp.EVM2EVMOnRampCCIPSendRequested); exists { for _, sendRequestedEvent := range sendRequestedEvents { raw := sendRequestedEvent.Raw - hdr, err := sourceCCIP.Common.ChainClient.HeaderByNumber(context.Background(), big.NewInt(int64(raw.BlockNumber))) + hdr, err := sourceCCIP.Common.ChainClient.HeaderByNumber(context.Background(), new(big.Int).SetUint64(raw.BlockNumber)) if err == nil { if hdr.Timestamp.After(lastSeenTimestamp) { foundAt = pointer.ToTime(hdr.Timestamp) @@ -1709,6 +1709,7 @@ func (sourceCCIP *SourceCCIPModule) AssertEventCCIPSendRequested( // CCIPMsg constructs the message for a CCIP request func (sourceCCIP *SourceCCIPModule) CCIPMsg( receiver common.Address, + allowOutOfOrder bool, gasLimit *big.Int, ) (router.ClientEVM2AnyMessage, error) { length := sourceCCIP.MsgDataLength @@ -1750,7 +1751,12 @@ func (sourceCCIP *SourceCCIPModule) CCIPMsg( return router.ClientEVM2AnyMessage{}, fmt.Errorf("failed encoding the receiver address: %w", err) } - extraArgsV1, err := testhelpers.GetEVMExtraArgsV1(gasLimit, false) + var extraArgs []byte + if sourceCCIP.OnRamp.Instance.V1_2_0 != nil { + extraArgs, err = testhelpers.GetEVMExtraArgsV1(gasLimit, allowOutOfOrder) + } else { + extraArgs, err = testhelpers.GetEVMExtraArgsV2(gasLimit, allowOutOfOrder) + } if err != nil { return router.ClientEVM2AnyMessage{}, fmt.Errorf("failed encoding the options field: %w", err) } @@ -1760,13 +1766,14 @@ func (sourceCCIP *SourceCCIPModule) CCIPMsg( Data: []byte(data), TokenAmounts: tokenAndAmounts, FeeToken: common.HexToAddress(sourceCCIP.Common.FeeToken.Address()), - ExtraArgs: extraArgsV1, + ExtraArgs: extraArgs, }, nil } // SendRequest sends a CCIP request to the source chain's router contract func (sourceCCIP *SourceCCIPModule) SendRequest( receiver common.Address, + allowOutOfOrder bool, gasLimit *big.Int, ) (common.Hash, time.Duration, *big.Int, error) { var d time.Duration @@ -1775,7 +1782,7 @@ func (sourceCCIP *SourceCCIPModule) SendRequest( return common.Hash{}, d, nil, fmt.Errorf("failed getting the chain selector: %w", err) } // form the message for transfer - msg, err := sourceCCIP.CCIPMsg(receiver, gasLimit) + msg, err := sourceCCIP.CCIPMsg(receiver, allowOutOfOrder, gasLimit) if err != nil { return common.Hash{}, d, nil, fmt.Errorf("failed forming the ccip msg: %w", err) } @@ -2218,7 +2225,7 @@ func (destCCIP *DestCCIPModule) AssertNoReportAcceptedEventReceived(lggr *zerolo e, exists := value.(*evm_2_evm_offramp.EVM2EVMOffRampExecutionStateChanged) if exists { vLogs := e.Raw - hdr, err := destCCIP.Common.ChainClient.HeaderByNumber(ctx, big.NewInt(int64(vLogs.BlockNumber))) + hdr, err := destCCIP.Common.ChainClient.HeaderByNumber(ctx, new(big.Int).SetUint64(vLogs.BlockNumber)) if err != nil { return true } @@ -2259,7 +2266,7 @@ func (destCCIP *DestCCIPModule) AssertNoExecutionStateChangedEventReceived( e, exists := value.(*contracts.EVM2EVMOffRampExecutionStateChanged) if exists { vLogs := e.LogInfo - hdr, err := destCCIP.Common.ChainClient.HeaderByNumber(ctx, big.NewInt(int64(vLogs.BlockNumber))) + hdr, err := destCCIP.Common.ChainClient.HeaderByNumber(ctx, new(big.Int).SetUint64(vLogs.BlockNumber)) if err != nil { return true } @@ -2288,7 +2295,7 @@ func (destCCIP *DestCCIPModule) AssertEventExecutionStateChanged( reqStat *testreporters.RequestStat, execState testhelpers.MessageExecutionState, ) (uint8, error) { - lggr.Info().Int64("seqNum", int64(seqNum)).Str("Timeout", timeout.String()).Msg("Waiting for ExecutionStateChanged event") + lggr.Info().Uint64("seqNum", seqNum).Str("Timeout", timeout.String()).Msg("Waiting for ExecutionStateChanged event") timer := time.NewTimer(timeout) defer timer.Stop() ticker := time.NewTicker(time.Second) @@ -2306,7 +2313,7 @@ func (destCCIP *DestCCIPModule) AssertEventExecutionStateChanged( destCCIP.ExecStateChangedWatcher.Delete(seqNum) vLogs := e.LogInfo receivedAt := time.Now().UTC() - hdr, err := destCCIP.Common.ChainClient.HeaderByNumber(context.Background(), big.NewInt(int64(vLogs.BlockNumber))) + hdr, err := destCCIP.Common.ChainClient.HeaderByNumber(context.Background(), new(big.Int).SetUint64(vLogs.BlockNumber)) if err == nil { receivedAt = hdr.Timestamp } @@ -2319,7 +2326,7 @@ func (destCCIP *DestCCIPModule) AssertEventExecutionStateChanged( gasUsed = receipt.GasUsed } if testhelpers.MessageExecutionState(e.State) == execState { - lggr.Info().Int64("seqNum", int64(seqNum)).Uint8("ExecutionState", e.State).Msg("ExecutionStateChanged event received") + lggr.Info().Uint64("seqNum", seqNum).Uint8("ExecutionState", e.State).Msg("ExecutionStateChanged event received") reqStat.UpdateState(lggr, seqNum, testreporters.ExecStateChanged, receivedAt.Sub(timeNow), testreporters.Success, &testreporters.TransactionStats{ @@ -2363,7 +2370,7 @@ func (destCCIP *DestCCIPModule) AssertEventReportAccepted( prevEventAt time.Time, reqStat *testreporters.RequestStat, ) (*contracts.CommitStoreReportAccepted, time.Time, error) { - lggr.Info().Int64("seqNum", int64(seqNum)).Str("Timeout", timeout.String()).Msg("Waiting for ReportAccepted event") + lggr.Info().Uint64("seqNum", seqNum).Str("Timeout", timeout.String()).Msg("Waiting for ReportAccepted event") timer := time.NewTimer(timeout) defer timer.Stop() resetTimerCount := 0 @@ -2379,7 +2386,7 @@ func (destCCIP *DestCCIPModule) AssertEventReportAccepted( // if the value is processed, delete it from the map destCCIP.ReportAcceptedWatcher.Delete(seqNum) receivedAt := time.Now().UTC() - hdr, err := destCCIP.Common.ChainClient.HeaderByNumber(context.Background(), big.NewInt(int64(reportAccepted.LogInfo.BlockNumber))) + hdr, err := destCCIP.Common.ChainClient.HeaderByNumber(context.Background(), new(big.Int).SetUint64(reportAccepted.LogInfo.BlockNumber)) if err == nil { receivedAt = hdr.Timestamp } @@ -2488,7 +2495,7 @@ func (destCCIP *DestCCIPModule) AssertReportBlessed( // if the value is processed, delete it from the map destCCIP.ReportBlessedBySeqNum.Delete(seqNum) } - hdr, err := destCCIP.Common.ChainClient.HeaderByNumber(context.Background(), big.NewInt(int64(vLogs.BlockNumber))) + hdr, err := destCCIP.Common.ChainClient.HeaderByNumber(context.Background(), new(big.Int).SetUint64(vLogs.BlockNumber)) if err == nil { receivedAt = hdr.Timestamp } @@ -2536,7 +2543,7 @@ func (destCCIP *DestCCIPModule) AssertSeqNumberExecuted( timeNow time.Time, reqStat *testreporters.RequestStat, ) error { - lggr.Info().Int64("seqNum", int64(seqNumberBefore)).Str("Timeout", timeout.String()).Msg("Waiting to be processed by commit store") + lggr.Info().Uint64("seqNum", seqNumberBefore).Str("Timeout", timeout.String()).Msg("Waiting to be processed by commit store") timer := time.NewTimer(timeout) defer timer.Stop() resetTimerCount := 0 @@ -2790,10 +2797,14 @@ func (lane *CCIPLane) AddToSentReqs(txHash common.Hash, reqStats []*testreporter // Multicall sends multiple ccip-send requests in a single transaction // It will create one transaction for all the requests and will wait for the confirmation -func (lane *CCIPLane) Multicall(noOfRequests int, multiSendAddr common.Address) error { +func (lane *CCIPLane) Multicall( + noOfRequests int, + allowOutOfOrder bool, + multiSendAddr common.Address, +) error { var ccipMultipleMsg []contracts.CCIPMsgData feeToken := common.HexToAddress(lane.Source.Common.FeeToken.Address()) - genericMsg, err := lane.Source.CCIPMsg(lane.Dest.ReceiverDapp.EthAddress, big.NewInt(DefaultDestinationGasLimit)) + genericMsg, err := lane.Source.CCIPMsg(lane.Dest.ReceiverDapp.EthAddress, allowOutOfOrder, big.NewInt(DefaultDestinationGasLimit)) if err != nil { return fmt.Errorf("failed to form the ccip message: %w", err) } @@ -2882,11 +2893,12 @@ func (lane *CCIPLane) Multicall(noOfRequests int, multiSendAddr common.Address) // SendRequests sends individual ccip-send requests in different transactions // It will create noOfRequests transactions -func (lane *CCIPLane) SendRequests(noOfRequests int, gasLimit *big.Int) error { +func (lane *CCIPLane) SendRequests(noOfRequests int, allowOutOfOrder bool, gasLimit *big.Int) error { for i := 1; i <= noOfRequests; i++ { stat := testreporters.NewCCIPRequestStats(int64(lane.NumberOfReq+i), lane.SourceNetworkName, lane.DestNetworkName) txHash, txConfirmationDur, fee, err := lane.Source.SendRequest( lane.Dest.ReceiverDapp.EthAddress, + allowOutOfOrder, gasLimit, ) if err != nil { diff --git a/integration-tests/ccip-tests/chaos/ccip_test.go b/integration-tests/ccip-tests/chaos/ccip_test.go index 4b1dda7a91..79bdf472a9 100644 --- a/integration-tests/ccip-tests/chaos/ccip_test.go +++ b/integration-tests/ccip-tests/chaos/ccip_test.go @@ -124,7 +124,7 @@ func TestChaosCCIP(t *testing.T) { lane.RecordStateBeforeTransfer() // Send the ccip-request and verify ocr2 is running - err := lane.SendRequests(1, big.NewInt(actions.DefaultDestinationGasLimit)) + err := lane.SendRequests(1, false, big.NewInt(actions.DefaultDestinationGasLimit)) require.NoError(t, err) lane.ValidateRequests(nil) @@ -139,7 +139,7 @@ func TestChaosCCIP(t *testing.T) { }) lane.RecordStateBeforeTransfer() // Now send the ccip-request while the chaos is at play - err = lane.SendRequests(numOfRequests, big.NewInt(actions.DefaultDestinationGasLimit)) + err = lane.SendRequests(numOfRequests, false, big.NewInt(actions.DefaultDestinationGasLimit)) require.NoError(t, err) if in.waitForChaosRecovery { // wait for chaos to be recovered before further validation diff --git a/integration-tests/ccip-tests/contracts/contract_deployer.go b/integration-tests/ccip-tests/contracts/contract_deployer.go index c051531fb9..12116ca1a0 100644 --- a/integration-tests/ccip-tests/contracts/contract_deployer.go +++ b/integration-tests/ccip-tests/contracts/contract_deployer.go @@ -1044,6 +1044,7 @@ func (e *CCIPContractsDeployer) DeployOnRamp( MaxPerMsgGasLimit: 4_000_000, DefaultTokenFeeUSDCents: 50, DefaultTokenDestGasOverhead: 125_000, + EnforceOutOfOrder: false, }, evm_2_evm_onramp.RateLimiterConfig{ Capacity: opts.Capacity, diff --git a/integration-tests/ccip-tests/contracts/contract_models.go b/integration-tests/ccip-tests/contracts/contract_models.go index 9b59ce4008..543243d1e5 100644 --- a/integration-tests/ccip-tests/contracts/contract_models.go +++ b/integration-tests/ccip-tests/contracts/contract_models.go @@ -1616,22 +1616,58 @@ func (w OnRampWrapper) ParseCCIPSendRequested(l types.Log) (uint64, error) { return 0, fmt.Errorf("no instance found to parse CCIPSendRequested") } -func (w OnRampWrapper) GetDynamicConfig(opts *bind.CallOpts) (uint32, error) { +// GetDynamicConfig retrieves the dynamic config for the onramp +func (w OnRampWrapper) GetDynamicConfig(opts *bind.CallOpts) (evm_2_evm_onramp.EVM2EVMOnRampDynamicConfig, error) { if w.Latest != nil { cfg, err := w.Latest.GetDynamicConfig(opts) if err != nil { - return 0, err + return evm_2_evm_onramp.EVM2EVMOnRampDynamicConfig{}, err } - return cfg.MaxDataBytes, nil + return cfg, nil } if w.V1_2_0 != nil { cfg, err := w.V1_2_0.GetDynamicConfig(opts) if err != nil { - return 0, err + return evm_2_evm_onramp.EVM2EVMOnRampDynamicConfig{}, err } - return cfg.MaxDataBytes, nil + return evm_2_evm_onramp.EVM2EVMOnRampDynamicConfig{ + Router: cfg.Router, + MaxNumberOfTokensPerMsg: cfg.MaxNumberOfTokensPerMsg, + DestGasOverhead: cfg.DestGasOverhead, + DestGasPerPayloadByte: cfg.DestGasPerPayloadByte, + DestDataAvailabilityOverheadGas: cfg.DestDataAvailabilityOverheadGas, + DestGasPerDataAvailabilityByte: cfg.DestGasPerDataAvailabilityByte, + DestDataAvailabilityMultiplierBps: cfg.DestDataAvailabilityMultiplierBps, + PriceRegistry: cfg.PriceRegistry, + MaxDataBytes: cfg.MaxDataBytes, + MaxPerMsgGasLimit: cfg.MaxPerMsgGasLimit, + }, nil } - return 0, fmt.Errorf("no instance found to get dynamic config") + return evm_2_evm_onramp.EVM2EVMOnRampDynamicConfig{}, fmt.Errorf("no instance found to get dynamic config") +} + +// SetDynamicConfig sets the dynamic config for the onramp +// Note that you cannot set only a single field, you must set all fields or they will be reset to zero values +// You can use GetDynamicConfig to get the current config and modify it as needed +func (w OnRampWrapper) SetDynamicConfig(opts *bind.TransactOpts, dynamicConfig evm_2_evm_onramp.EVM2EVMOnRampDynamicConfig) (*types.Transaction, error) { + if w.Latest != nil { + return w.Latest.SetDynamicConfig(opts, dynamicConfig) + } + if w.V1_2_0 != nil { + return w.V1_2_0.SetDynamicConfig(opts, evm_2_evm_onramp_1_2_0.EVM2EVMOnRampDynamicConfig{ + Router: dynamicConfig.Router, + MaxNumberOfTokensPerMsg: dynamicConfig.MaxNumberOfTokensPerMsg, + DestGasOverhead: dynamicConfig.DestGasOverhead, + DestGasPerPayloadByte: dynamicConfig.DestGasPerPayloadByte, + DestDataAvailabilityOverheadGas: dynamicConfig.DestDataAvailabilityOverheadGas, + DestGasPerDataAvailabilityByte: dynamicConfig.DestGasPerDataAvailabilityByte, + DestDataAvailabilityMultiplierBps: dynamicConfig.DestDataAvailabilityMultiplierBps, + PriceRegistry: dynamicConfig.PriceRegistry, + MaxDataBytes: dynamicConfig.MaxDataBytes, + MaxPerMsgGasLimit: dynamicConfig.MaxPerMsgGasLimit, + }) + } + return nil, fmt.Errorf("no instance found to set dynamic config") } func (w OnRampWrapper) ApplyPoolUpdates(opts *bind.TransactOpts, tokens []common.Address, pools []common.Address) (*types.Transaction, error) { @@ -1820,6 +1856,26 @@ func (onRamp *OnRamp) ApplyPoolUpdates(tokens []common.Address, pools []common.A return onRamp.client.ProcessTransaction(tx) } +// SetDynamicConfig sets the dynamic config for the onramp +// Note that you cannot set only a single field, you must set all fields or they will be reset to zero values +// You can use GetDynamicConfig to get the current config and modify it as needed +func (onRamp *OnRamp) SetDynamicConfig(dynamicConfig evm_2_evm_onramp.EVM2EVMOnRampDynamicConfig) error { + opts, err := onRamp.client.TransactionOpts(onRamp.client.GetDefaultWallet()) + if err != nil { + return fmt.Errorf("failed to get transaction opts: %w", err) + } + tx, err := onRamp.Instance.SetDynamicConfig(opts, dynamicConfig) + if err != nil { + return fmt.Errorf("failed to set dynamic config: %w", err) + } + onRamp.logger.Info(). + Interface("Config", dynamicConfig). + Str("onRamp", onRamp.Address()). + Str(Network, onRamp.client.GetNetworkConfig().Name). + Msg("Setting Dynamic Config in OnRamp") + return onRamp.client.ProcessTransaction(tx) +} + // OffRamp represents the OffRamp CCIP contract on the destination chain type OffRamp struct { client blockchain.EVMClient diff --git a/integration-tests/ccip-tests/load/ccip_loadgen.go b/integration-tests/ccip-tests/load/ccip_loadgen.go index 4ed54a45fd..ec79a0b71f 100644 --- a/integration-tests/ccip-tests/load/ccip_loadgen.go +++ b/integration-tests/ccip-tests/load/ccip_loadgen.go @@ -131,8 +131,9 @@ func (c *CCIPE2ELoad) BeforeAllCall() { c.EOAReceiver = c.msg.Receiver } if c.SendMaxDataIntermittentlyInMsgCount > 0 { - c.MaxDataBytes, err = sourceCCIP.OnRamp.Instance.GetDynamicConfig(nil) + cfg, err := sourceCCIP.OnRamp.Instance.GetDynamicConfig(nil) require.NoError(c.t, err, "failed to fetch dynamic config") + c.MaxDataBytes = cfg.MaxDataBytes } // if the msg is sent via multicall, transfer the token transfer amount to multicall contract if sourceCCIP.Common.MulticallEnabled && @@ -188,11 +189,11 @@ func (c *CCIPE2ELoad) CCIPMsg() (router.ClientEVM2AnyMessage, *testreporters.Req if !msgDetails.IsTokenTransfer() { msg.TokenAmounts = []router.ClientEVMTokenAmount{} } - extraArgsV1, err := testhelpers.GetEVMExtraArgsV1(big.NewInt(gasLimit), false) + extraArgs, err := testhelpers.GetEVMExtraArgsV2(big.NewInt(gasLimit), false) if err != nil { return router.ClientEVM2AnyMessage{}, stats, err } - msg.ExtraArgs = extraArgsV1 + msg.ExtraArgs = extraArgs // if gaslimit is 0, set the receiver to EOA if gasLimit == 0 { msg.Receiver = c.EOAReceiver diff --git a/integration-tests/ccip-tests/load/helper.go b/integration-tests/ccip-tests/load/helper.go index dbb5ffc3e9..20d3e0fee4 100644 --- a/integration-tests/ccip-tests/load/helper.go +++ b/integration-tests/ccip-tests/load/helper.go @@ -207,6 +207,7 @@ func (l *LoadArgs) ValidateCurseFollowedByUncurse() { lane.Source.TransferAmount = []*big.Int{} failedTx, _, _, err := lane.Source.SendRequest( lane.Dest.ReceiverDapp.EthAddress, + false, big.NewInt(actions.DefaultDestinationGasLimit), // gas limit ) if lane.Source.Common.ChainClient.GetNetworkConfig().MinimumConfirmations > 0 { diff --git a/integration-tests/ccip-tests/smoke/ccip_test.go b/integration-tests/ccip-tests/smoke/ccip_test.go index 9a34044a5d..a60dc54b1a 100644 --- a/integration-tests/ccip-tests/smoke/ccip_test.go +++ b/integration-tests/ccip-tests/smoke/ccip_test.go @@ -83,7 +83,7 @@ func TestSmokeCCIPForBidirectionalLane(t *testing.T) { Msgf("Starting lane %s -> %s", tc.lane.SourceNetworkName, tc.lane.DestNetworkName) tc.lane.RecordStateBeforeTransfer() - err := tc.lane.SendRequests(1, gasLimit) + err := tc.lane.SendRequests(1, false, gasLimit) require.NoError(t, err) tc.lane.ValidateRequests() }) @@ -243,6 +243,7 @@ func TestSmokeCCIPRateLimit(t *testing.T) { require.NoError(t, tc.lane.Source.Common.ChainClient.WaitForEvents()) failedTx, _, _, err := tc.lane.Source.SendRequest( tc.lane.Dest.ReceiverDapp.EthAddress, + false, big.NewInt(actions.DefaultDestinationGasLimit), // gas limit ) require.NoError(t, err) @@ -263,7 +264,7 @@ func TestSmokeCCIPRateLimit(t *testing.T) { tc.lane.Logger.Info().Str("tokensToSend", tokensToSend.String()).Msg("99% of Aggregated Capacity") tc.lane.RecordStateBeforeTransfer() src.TransferAmount[0] = tokensToSend - err = tc.lane.SendRequests(1, big.NewInt(actions.DefaultDestinationGasLimit)) + err = tc.lane.SendRequests(1, false, big.NewInt(actions.DefaultDestinationGasLimit)) require.NoError(t, err) // try to send again with amount more than the amount refilled by rate and @@ -271,6 +272,7 @@ func TestSmokeCCIPRateLimit(t *testing.T) { src.TransferAmount[0] = new(big.Int).Mul(AggregatedRateLimitRate, big.NewInt(10)) failedTx, _, _, err = tc.lane.Source.SendRequest( tc.lane.Dest.ReceiverDapp.EthAddress, + false, big.NewInt(actions.DefaultDestinationGasLimit), // gas limit ) tc.lane.Logger.Info().Str("tokensToSend", src.TransferAmount[0].String()).Msg("More than Aggregated Rate") @@ -338,6 +340,7 @@ func TestSmokeCCIPRateLimit(t *testing.T) { failedTx, _, _, err = tc.lane.Source.SendRequest( tc.lane.Dest.ReceiverDapp.EthAddress, + false, big.NewInt(actions.DefaultDestinationGasLimit), // gas limit ) require.NoError(t, err) @@ -358,7 +361,7 @@ func TestSmokeCCIPRateLimit(t *testing.T) { src.TransferAmount[0] = tokensToSend tc.lane.Logger.Info().Str("tokensToSend", tokensToSend.String()).Msg("99% of Token Pool Capacity") tc.lane.RecordStateBeforeTransfer() - err = tc.lane.SendRequests(1, big.NewInt(actions.DefaultDestinationGasLimit)) + err = tc.lane.SendRequests(1, false, big.NewInt(actions.DefaultDestinationGasLimit)) require.NoError(t, err) // try to send again with amount more than the amount refilled by token pool rate and @@ -373,6 +376,7 @@ func TestSmokeCCIPRateLimit(t *testing.T) { require.NoError(t, tc.lane.Source.Common.ChainClient.WaitForEvents()) failedTx, _, _, err = tc.lane.Source.SendRequest( tc.lane.Dest.ReceiverDapp.EthAddress, + false, big.NewInt(actions.DefaultDestinationGasLimit), ) require.NoError(t, err) @@ -499,7 +503,7 @@ func TestSmokeCCIPOnRampLimits(t *testing.T) { src.TransferAmount[aggRateTokenIndex] = big.NewInt(1) src.TransferAmount[bpsAndAggTokenIndex] = big.NewInt(1) tc.lane.RecordStateBeforeTransfer() - err = tc.lane.SendRequests(1, big.NewInt(actions.DefaultDestinationGasLimit)) + err = tc.lane.SendRequests(1, false, big.NewInt(actions.DefaultDestinationGasLimit)) require.NoError(t, err) tc.lane.ValidateRequests() @@ -508,7 +512,7 @@ func TestSmokeCCIPOnRampLimits(t *testing.T) { src.TransferAmount[bpsTokenIndex] = big.NewInt(0) src.TransferAmount[aggRateTokenIndex] = overCapacityAmount src.TransferAmount[bpsAndAggTokenIndex] = big.NewInt(0) - failedTx, _, _, err := tc.lane.Source.SendRequest(tc.lane.Dest.ReceiverDapp.EthAddress, big.NewInt(actions.DefaultDestinationGasLimit)) + failedTx, _, _, err := tc.lane.Source.SendRequest(tc.lane.Dest.ReceiverDapp.EthAddress, false, big.NewInt(actions.DefaultDestinationGasLimit)) require.Error(t, err, "Limited token transfer should immediately revert") errReason, _, err := src.Common.ChainClient.RevertReasonFromTx(failedTx, evm_2_evm_onramp.EVM2EVMOnRampABI) require.NoError(t, err) @@ -520,7 +524,7 @@ func TestSmokeCCIPOnRampLimits(t *testing.T) { src.TransferAmount[aggRateTokenIndex] = big.NewInt(0) src.TransferAmount[bpsAndAggTokenIndex] = overCapacityAmount - failedTx, _, _, err = tc.lane.Source.SendRequest(tc.lane.Dest.ReceiverDapp.EthAddress, big.NewInt(actions.DefaultDestinationGasLimit)) + failedTx, _, _, err = tc.lane.Source.SendRequest(tc.lane.Dest.ReceiverDapp.EthAddress, false, big.NewInt(actions.DefaultDestinationGasLimit)) require.Error(t, err, "Limited token transfer should immediately revert") errReason, _, err = src.Common.ChainClient.RevertReasonFromTx(failedTx, evm_2_evm_onramp.EVM2EVMOnRampABI) require.NoError(t, err) @@ -559,7 +563,7 @@ func TestSmokeCCIPOnRampLimits(t *testing.T) { src.TransferAmount[aggRateTokenIndex] = big.NewInt(0) src.TransferAmount[bpsAndAggTokenIndex] = big.NewInt(0) tc.lane.RecordStateBeforeTransfer() - err = tc.lane.SendRequests(1, big.NewInt(actions.DefaultDestinationGasLimit)) + err = tc.lane.SendRequests(1, false, big.NewInt(actions.DefaultDestinationGasLimit)) require.NoError(t, err) tc.lane.ValidateRequests() @@ -568,7 +572,7 @@ func TestSmokeCCIPOnRampLimits(t *testing.T) { src.TransferAmount[bpsTokenIndex] = big.NewInt(0) src.TransferAmount[aggRateTokenIndex] = capacityLimit src.TransferAmount[bpsAndAggTokenIndex] = big.NewInt(0) - failedTx, _, _, err = tc.lane.Source.SendRequest(tc.lane.Dest.ReceiverDapp.EthAddress, big.NewInt(actions.DefaultDestinationGasLimit)) + failedTx, _, _, err = tc.lane.Source.SendRequest(tc.lane.Dest.ReceiverDapp.EthAddress, false, big.NewInt(actions.DefaultDestinationGasLimit)) require.Error(t, err, "Aggregate rate limited token transfer should immediately revert") errReason, _, err = src.Common.ChainClient.RevertReasonFromTx(failedTx, evm_2_evm_onramp.EVM2EVMOnRampABI) require.NoError(t, err) @@ -580,7 +584,7 @@ func TestSmokeCCIPOnRampLimits(t *testing.T) { src.TransferAmount[aggRateTokenIndex] = big.NewInt(0) src.TransferAmount[bpsAndAggTokenIndex] = capacityLimit - failedTx, _, _, err = tc.lane.Source.SendRequest(tc.lane.Dest.ReceiverDapp.EthAddress, big.NewInt(actions.DefaultDestinationGasLimit)) + failedTx, _, _, err = tc.lane.Source.SendRequest(tc.lane.Dest.ReceiverDapp.EthAddress, false, big.NewInt(actions.DefaultDestinationGasLimit)) require.Error(t, err, "Aggregate rate limited token transfer should immediately revert") errReason, _, err = src.Common.ChainClient.RevertReasonFromTx(failedTx, evm_2_evm_onramp.EVM2EVMOnRampABI) require.NoError(t, err) @@ -694,14 +698,14 @@ func TestSmokeCCIPTokenPoolRateLimits(t *testing.T) { src.TransferAmount[freeTokenIndex] = overCapacityAmount src.TransferAmount[limitedTokenIndex] = big.NewInt(1) tc.lane.RecordStateBeforeTransfer() - err = tc.lane.SendRequests(1, big.NewInt(actions.DefaultDestinationGasLimit)) + err = tc.lane.SendRequests(1, false, big.NewInt(actions.DefaultDestinationGasLimit)) require.NoError(t, err) tc.lane.ValidateRequests() // Send limited token over capacity and ensure it fails src.TransferAmount[freeTokenIndex] = big.NewInt(0) src.TransferAmount[limitedTokenIndex] = overCapacityAmount - failedTx, _, _, err := tc.lane.Source.SendRequest(tc.lane.Dest.ReceiverDapp.EthAddress, big.NewInt(actions.DefaultDestinationGasLimit)) + failedTx, _, _, err := tc.lane.Source.SendRequest(tc.lane.Dest.ReceiverDapp.EthAddress, false, big.NewInt(actions.DefaultDestinationGasLimit)) require.Error(t, err, "Limited token transfer should immediately revert") errReason, _, err := src.Common.ChainClient.RevertReasonFromTx(failedTx, lock_release_token_pool.LockReleaseTokenPoolABI) require.NoError(t, err) @@ -725,14 +729,14 @@ func TestSmokeCCIPTokenPoolRateLimits(t *testing.T) { src.TransferAmount[freeTokenIndex] = overCapacityAmount src.TransferAmount[limitedTokenIndex] = capacityLimit tc.lane.RecordStateBeforeTransfer() - err = tc.lane.SendRequests(1, big.NewInt(actions.DefaultDestinationGasLimit)) + err = tc.lane.SendRequests(1, false, big.NewInt(actions.DefaultDestinationGasLimit)) require.NoError(t, err) tc.lane.ValidateRequests() // Send limited token over rate limit and ensure it fails src.TransferAmount[freeTokenIndex] = big.NewInt(0) src.TransferAmount[limitedTokenIndex] = capacityLimit - failedTx, _, _, err = tc.lane.Source.SendRequest(tc.lane.Dest.ReceiverDapp.EthAddress, big.NewInt(actions.DefaultDestinationGasLimit)) + failedTx, _, _, err = tc.lane.Source.SendRequest(tc.lane.Dest.ReceiverDapp.EthAddress, false, big.NewInt(actions.DefaultDestinationGasLimit)) require.Error(t, err, "Limited token transfer should immediately revert") errReason, _, err = src.Common.ChainClient.RevertReasonFromTx(failedTx, lock_release_token_pool.LockReleaseTokenPoolABI) require.NoError(t, err) @@ -787,7 +791,7 @@ func TestSmokeCCIPMulticall(t *testing.T) { Msgf("Starting lane %s -> %s", tc.lane.SourceNetworkName, tc.lane.DestNetworkName) tc.lane.RecordStateBeforeTransfer() - err := tc.lane.Multicall(TestCfg.TestGroupInput.NoOfSendsInMulticall, tc.lane.Source.Common.MulticallContract) + err := tc.lane.Multicall(TestCfg.TestGroupInput.NoOfSendsInMulticall, false, tc.lane.Source.Common.MulticallContract) require.NoError(t, err) tc.lane.ValidateRequests() }) @@ -838,7 +842,7 @@ func TestSmokeCCIPManuallyExecuteAfterExecutionFailingDueToInsufficientGas(t *te tc.lane.RecordStateBeforeTransfer() // send with insufficient gas for ccip-receive to fail - err := tc.lane.SendRequests(1, big.NewInt(0)) + err := tc.lane.SendRequests(1, false, big.NewInt(0)) require.NoError(t, err) tc.lane.ValidateRequests(actions.ExpectPhaseToFail(testreporters.ExecStateChanged)) // wait for events @@ -946,7 +950,7 @@ func testOffRampRateLimits(t *testing.T, rateLimiterConfig contracts.RateLimiter src.TransferAmount[freeTokenIndex] = overLimitAmount src.TransferAmount[limitedTokenIndex] = overLimitAmount tc.lane.RecordStateBeforeTransfer() - err = tc.lane.SendRequests(1, big.NewInt(actions.DefaultDestinationGasLimit)) + err = tc.lane.SendRequests(1, false, big.NewInt(actions.DefaultDestinationGasLimit)) require.NoError(t, err) tc.lane.ValidateRequests() @@ -963,7 +967,7 @@ func testOffRampRateLimits(t *testing.T, rateLimiterConfig contracts.RateLimiter src.TransferAmount[freeTokenIndex] = overLimitAmount src.TransferAmount[limitedTokenIndex] = big.NewInt(0) tc.lane.RecordStateBeforeTransfer() - err = tc.lane.SendRequests(1, big.NewInt(actions.DefaultDestinationGasLimit)) + err = tc.lane.SendRequests(1, false, big.NewInt(actions.DefaultDestinationGasLimit)) require.NoError(t, err, "Free token transfer failed") tc.lane.ValidateRequests() tc.lane.Logger.Info().Str("Token", freeSrcToken.ContractAddress.Hex()).Msg("Free token transfer succeeded") @@ -972,7 +976,7 @@ func testOffRampRateLimits(t *testing.T, rateLimiterConfig contracts.RateLimiter src.TransferAmount[freeTokenIndex] = big.NewInt(0) src.TransferAmount[limitedTokenIndex] = overLimitAmount tc.lane.RecordStateBeforeTransfer() - err = tc.lane.SendRequests(1, big.NewInt(actions.DefaultDestinationGasLimit)) + err = tc.lane.SendRequests(1, false, big.NewInt(actions.DefaultDestinationGasLimit)) require.NoError(t, err, "Failed to send rate limited token transfer") // We should see the ExecStateChanged phase fail on the OffRamp @@ -1004,5 +1008,4 @@ func testOffRampRateLimits(t *testing.T, rateLimiterConfig contracts.RateLimiter require.NoError(t, err, "Error manually executing transaction after rate limit is lifted") }) } - } From 6e1d6215481535743c1846304316712522981db0 Mon Sep 17 00:00:00 2001 From: Adam Hamrick Date: Thu, 29 Aug 2024 11:49:57 -0400 Subject: [PATCH 02/19] Fix comments --- .../ccip-tests/actions/ccip_helpers.go | 5 ++++- .../ccip-tests/contracts/contract_models.go | 20 ------------------- 2 files changed, 4 insertions(+), 21 deletions(-) diff --git a/integration-tests/ccip-tests/actions/ccip_helpers.go b/integration-tests/ccip-tests/actions/ccip_helpers.go index 33b5838a5e..ad2280b2c0 100644 --- a/integration-tests/ccip-tests/actions/ccip_helpers.go +++ b/integration-tests/ccip-tests/actions/ccip_helpers.go @@ -1752,7 +1752,10 @@ func (sourceCCIP *SourceCCIPModule) CCIPMsg( } var extraArgs []byte - if sourceCCIP.OnRamp.Instance.V1_2_0 != nil { + matchErr := contracts.MatchContractVersionsOrAbove(map[contracts.Name]contracts.Version{ + contracts.OnRampContract: contracts.V1_5_0_dev, + }) + if matchErr != nil { extraArgs, err = testhelpers.GetEVMExtraArgsV1(gasLimit, allowOutOfOrder) } else { extraArgs, err = testhelpers.GetEVMExtraArgsV2(gasLimit, allowOutOfOrder) diff --git a/integration-tests/ccip-tests/contracts/contract_models.go b/integration-tests/ccip-tests/contracts/contract_models.go index 543243d1e5..0b6f33b411 100644 --- a/integration-tests/ccip-tests/contracts/contract_models.go +++ b/integration-tests/ccip-tests/contracts/contract_models.go @@ -1856,26 +1856,6 @@ func (onRamp *OnRamp) ApplyPoolUpdates(tokens []common.Address, pools []common.A return onRamp.client.ProcessTransaction(tx) } -// SetDynamicConfig sets the dynamic config for the onramp -// Note that you cannot set only a single field, you must set all fields or they will be reset to zero values -// You can use GetDynamicConfig to get the current config and modify it as needed -func (onRamp *OnRamp) SetDynamicConfig(dynamicConfig evm_2_evm_onramp.EVM2EVMOnRampDynamicConfig) error { - opts, err := onRamp.client.TransactionOpts(onRamp.client.GetDefaultWallet()) - if err != nil { - return fmt.Errorf("failed to get transaction opts: %w", err) - } - tx, err := onRamp.Instance.SetDynamicConfig(opts, dynamicConfig) - if err != nil { - return fmt.Errorf("failed to set dynamic config: %w", err) - } - onRamp.logger.Info(). - Interface("Config", dynamicConfig). - Str("onRamp", onRamp.Address()). - Str(Network, onRamp.client.GetNetworkConfig().Name). - Msg("Setting Dynamic Config in OnRamp") - return onRamp.client.ProcessTransaction(tx) -} - // OffRamp represents the OffRamp CCIP contract on the destination chain type OffRamp struct { client blockchain.EVMClient From 7d7a6dab10fdcdc7c2f461e2262658e1f1bac91d Mon Sep 17 00:00:00 2001 From: Adam Hamrick Date: Thu, 29 Aug 2024 13:50:18 -0400 Subject: [PATCH 03/19] Fix extra args --- integration-tests/ccip-tests/load/ccip_loadgen.go | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/integration-tests/ccip-tests/load/ccip_loadgen.go b/integration-tests/ccip-tests/load/ccip_loadgen.go index ec79a0b71f..793ca0c953 100644 --- a/integration-tests/ccip-tests/load/ccip_loadgen.go +++ b/integration-tests/ccip-tests/load/ccip_loadgen.go @@ -14,6 +14,7 @@ import ( "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core/types" "github.com/rs/zerolog" + "github.com/smartcontractkit/ccip/integration-tests/ccip-tests/contracts" chain_selectors "github.com/smartcontractkit/chain-selectors" "github.com/smartcontractkit/wasp" "github.com/stretchr/testify/require" @@ -189,7 +190,19 @@ func (c *CCIPE2ELoad) CCIPMsg() (router.ClientEVM2AnyMessage, *testreporters.Req if !msgDetails.IsTokenTransfer() { msg.TokenAmounts = []router.ClientEVMTokenAmount{} } - extraArgs, err := testhelpers.GetEVMExtraArgsV2(big.NewInt(gasLimit), false) + + var ( + extraArgs []byte + err error + ) + matchErr := contracts.MatchContractVersionsOrAbove(map[contracts.Name]contracts.Version{ + contracts.OnRampContract: contracts.V1_5_0_dev, + }) + if matchErr != nil { + extraArgs, err = testhelpers.GetEVMExtraArgsV1(big.NewInt(gasLimit), false) + } else { + extraArgs, err = testhelpers.GetEVMExtraArgsV2(big.NewInt(gasLimit), false) + } if err != nil { return router.ClientEVM2AnyMessage{}, stats, err } From 4d53f64bbbe4aaf3ba97c68b4fc845767f0d7cdb Mon Sep 17 00:00:00 2001 From: Balamurali Gopalswami Date: Tue, 3 Sep 2024 14:28:49 -0400 Subject: [PATCH 04/19] Read AllowOutOfOrder from lane config --- .../ccip-tests/actions/ccip_helpers.go | 45 ++++++------- .../ccip-tests/chaos/ccip_test.go | 4 +- .../ccip-tests/contracts/contract_deployer.go | 2 +- .../ccip-tests/contracts/contract_models.go | 6 +- .../contracts/laneconfig/parse_contracts.go | 1 + .../ccip-tests/load/ccip_loadgen.go | 2 +- integration-tests/ccip-tests/load/helper.go | 6 +- .../ccip-tests/smoke/ccip_test.go | 65 ++++++++----------- 8 files changed, 55 insertions(+), 76 deletions(-) diff --git a/integration-tests/ccip-tests/actions/ccip_helpers.go b/integration-tests/ccip-tests/actions/ccip_helpers.go index ad2280b2c0..68e26fe995 100644 --- a/integration-tests/ccip-tests/actions/ccip_helpers.go +++ b/integration-tests/ccip-tests/actions/ccip_helpers.go @@ -185,6 +185,7 @@ type CCIPCommon struct { gasUpdateWatcherMu *sync.Mutex gasUpdateWatcher map[uint64]*big.Int // key - destchain id; value - timestamp of update GasUpdateEvents []contracts.GasUpdateEvent + AllowOutOfOrder bool } // FreeUpUnusedSpace sets nil to various elements of ccipModule which are only used @@ -273,6 +274,9 @@ func (ccipModule *CCIPCommon) CurseARM() (*types.Transaction, error) { func (ccipModule *CCIPCommon) LoadContractAddresses(conf *laneconfig.LaneConfig, noOfTokens *int) { if conf != nil { + if conf.AllowOutOfOrder { + ccipModule.AllowOutOfOrder = true + } if common.IsHexAddress(conf.FeeToken) { ccipModule.FeeToken = &contracts.LinkToken{ EthAddress: common.HexToAddress(conf.FeeToken), @@ -725,17 +729,16 @@ func (ccipModule *CCIPCommon) WriteLaneConfig(conf *laneconfig.LaneConfig) { for k, v := range ccipModule.PriceAggregators { priceAggrs[k.Hex()] = v.ContractAddress.Hex() } - conf.CommonContracts = laneconfig.CommonContracts{ - FeeToken: ccipModule.FeeToken.Address(), - BridgeTokens: btAddresses, - BridgeTokenPools: btpAddresses, - ARM: ccipModule.RMNContract.Hex(), - Router: ccipModule.Router.Address(), - PriceRegistry: ccipModule.PriceRegistry.Address(), - PriceAggregators: priceAggrs, - WrappedNative: ccipModule.WrappedNative.Hex(), - Multicall: ccipModule.MulticallContract.Hex(), - } + conf.CommonContracts.FeeToken = ccipModule.FeeToken.Address() + conf.CommonContracts.BridgeTokens = btAddresses + conf.CommonContracts.BridgeTokenPools = btpAddresses + conf.CommonContracts.ARM = ccipModule.RMNContract.Hex() + conf.CommonContracts.Router = ccipModule.Router.Address() + conf.CommonContracts.PriceRegistry = ccipModule.PriceRegistry.Address() + conf.CommonContracts.PriceAggregators = priceAggrs + conf.CommonContracts.WrappedNative = ccipModule.WrappedNative.Hex() + conf.CommonContracts.Multicall = ccipModule.MulticallContract.Hex() + if ccipModule.TokenAdminRegistry != nil { conf.CommonContracts.TokenAdminRegistry = ccipModule.TokenAdminRegistry.Address() } @@ -1753,10 +1756,10 @@ func (sourceCCIP *SourceCCIPModule) CCIPMsg( var extraArgs []byte matchErr := contracts.MatchContractVersionsOrAbove(map[contracts.Name]contracts.Version{ - contracts.OnRampContract: contracts.V1_5_0_dev, + contracts.OnRampContract: contracts.V1_5_0, }) if matchErr != nil { - extraArgs, err = testhelpers.GetEVMExtraArgsV1(gasLimit, allowOutOfOrder) + extraArgs, err = testhelpers.GetEVMExtraArgsV1(gasLimit, false) } else { extraArgs, err = testhelpers.GetEVMExtraArgsV2(gasLimit, allowOutOfOrder) } @@ -1774,18 +1777,14 @@ func (sourceCCIP *SourceCCIPModule) CCIPMsg( } // SendRequest sends a CCIP request to the source chain's router contract -func (sourceCCIP *SourceCCIPModule) SendRequest( - receiver common.Address, - allowOutOfOrder bool, - gasLimit *big.Int, -) (common.Hash, time.Duration, *big.Int, error) { +func (sourceCCIP *SourceCCIPModule) SendRequest(receiver common.Address, gasLimit *big.Int) (common.Hash, time.Duration, *big.Int, error) { var d time.Duration destChainSelector, err := chainselectors.SelectorFromChainId(sourceCCIP.DestinationChainId) if err != nil { return common.Hash{}, d, nil, fmt.Errorf("failed getting the chain selector: %w", err) } // form the message for transfer - msg, err := sourceCCIP.CCIPMsg(receiver, allowOutOfOrder, gasLimit) + msg, err := sourceCCIP.CCIPMsg(receiver, sourceCCIP.Common.AllowOutOfOrder, gasLimit) if err != nil { return common.Hash{}, d, nil, fmt.Errorf("failed forming the ccip msg: %w", err) } @@ -2896,14 +2895,10 @@ func (lane *CCIPLane) Multicall( // SendRequests sends individual ccip-send requests in different transactions // It will create noOfRequests transactions -func (lane *CCIPLane) SendRequests(noOfRequests int, allowOutOfOrder bool, gasLimit *big.Int) error { +func (lane *CCIPLane) SendRequests(noOfRequests int, gasLimit *big.Int) error { for i := 1; i <= noOfRequests; i++ { stat := testreporters.NewCCIPRequestStats(int64(lane.NumberOfReq+i), lane.SourceNetworkName, lane.DestNetworkName) - txHash, txConfirmationDur, fee, err := lane.Source.SendRequest( - lane.Dest.ReceiverDapp.EthAddress, - allowOutOfOrder, - gasLimit, - ) + txHash, txConfirmationDur, fee, err := lane.Source.SendRequest(lane.Dest.ReceiverDapp.EthAddress, gasLimit) if err != nil { stat.UpdateState(lane.Logger, 0, testreporters.TX, txConfirmationDur, testreporters.Failure, nil) return fmt.Errorf("could not send request: %w", err) diff --git a/integration-tests/ccip-tests/chaos/ccip_test.go b/integration-tests/ccip-tests/chaos/ccip_test.go index 79bdf472a9..4b1dda7a91 100644 --- a/integration-tests/ccip-tests/chaos/ccip_test.go +++ b/integration-tests/ccip-tests/chaos/ccip_test.go @@ -124,7 +124,7 @@ func TestChaosCCIP(t *testing.T) { lane.RecordStateBeforeTransfer() // Send the ccip-request and verify ocr2 is running - err := lane.SendRequests(1, false, big.NewInt(actions.DefaultDestinationGasLimit)) + err := lane.SendRequests(1, big.NewInt(actions.DefaultDestinationGasLimit)) require.NoError(t, err) lane.ValidateRequests(nil) @@ -139,7 +139,7 @@ func TestChaosCCIP(t *testing.T) { }) lane.RecordStateBeforeTransfer() // Now send the ccip-request while the chaos is at play - err = lane.SendRequests(numOfRequests, false, big.NewInt(actions.DefaultDestinationGasLimit)) + err = lane.SendRequests(numOfRequests, big.NewInt(actions.DefaultDestinationGasLimit)) require.NoError(t, err) if in.waitForChaosRecovery { // wait for chaos to be recovered before further validation diff --git a/integration-tests/ccip-tests/contracts/contract_deployer.go b/integration-tests/ccip-tests/contracts/contract_deployer.go index 12116ca1a0..29799db75e 100644 --- a/integration-tests/ccip-tests/contracts/contract_deployer.go +++ b/integration-tests/ccip-tests/contracts/contract_deployer.go @@ -77,7 +77,7 @@ func MatchContractVersionsOrAbove(requiredContractVersions map[Name]Version) err // if the version is less than 1.5.0, then token admin registry is not needed func NeedTokenAdminRegistry() bool { return MatchContractVersionsOrAbove(map[Name]Version{ - TokenPoolContract: V1_5_0_dev, + TokenPoolContract: V1_5_0, }) == nil } diff --git a/integration-tests/ccip-tests/contracts/contract_models.go b/integration-tests/ccip-tests/contracts/contract_models.go index 0b6f33b411..e553e5e98a 100644 --- a/integration-tests/ccip-tests/contracts/contract_models.go +++ b/integration-tests/ccip-tests/contracts/contract_models.go @@ -112,9 +112,9 @@ const ( var ( V1_2_0 = MustVersion("1.2.0") V1_4_0 = MustVersion("1.4.0") - V1_5_0_dev = MustVersion("1.5.0") - LatestPoolVersion = V1_5_0_dev - Latest = V1_5_0_dev + V1_5_0 = MustVersion("1.5.0") + LatestPoolVersion = V1_5_0 + Latest = V1_5_0 VersionMap = map[Name]Version{ PriceRegistryContract: V1_2_0, OffRampContract: Latest, diff --git a/integration-tests/ccip-tests/contracts/laneconfig/parse_contracts.go b/integration-tests/ccip-tests/contracts/laneconfig/parse_contracts.go index 332bd48ab3..c96cb3dfdc 100644 --- a/integration-tests/ccip-tests/contracts/laneconfig/parse_contracts.go +++ b/integration-tests/ccip-tests/contracts/laneconfig/parse_contracts.go @@ -21,6 +21,7 @@ var ( type CommonContracts struct { IsNativeFeeToken bool `json:"is_native_fee_token,omitempty"` + AllowOutOfOrder bool `json:"allow_out_of_order,omitempty"` // expected to set this value as True for ZK chain source networks IsMockARM bool `json:"is_mock_arm,omitempty"` FeeToken string `json:"fee_token"` BridgeTokens []string `json:"bridge_tokens,omitempty"` diff --git a/integration-tests/ccip-tests/load/ccip_loadgen.go b/integration-tests/ccip-tests/load/ccip_loadgen.go index 793ca0c953..933b1d337d 100644 --- a/integration-tests/ccip-tests/load/ccip_loadgen.go +++ b/integration-tests/ccip-tests/load/ccip_loadgen.go @@ -196,7 +196,7 @@ func (c *CCIPE2ELoad) CCIPMsg() (router.ClientEVM2AnyMessage, *testreporters.Req err error ) matchErr := contracts.MatchContractVersionsOrAbove(map[contracts.Name]contracts.Version{ - contracts.OnRampContract: contracts.V1_5_0_dev, + contracts.OnRampContract: contracts.V1_5_0, }) if matchErr != nil { extraArgs, err = testhelpers.GetEVMExtraArgsV1(big.NewInt(gasLimit), false) diff --git a/integration-tests/ccip-tests/load/helper.go b/integration-tests/ccip-tests/load/helper.go index 20d3e0fee4..1294af0c28 100644 --- a/integration-tests/ccip-tests/load/helper.go +++ b/integration-tests/ccip-tests/load/helper.go @@ -205,11 +205,7 @@ func (l *LoadArgs) ValidateCurseFollowedByUncurse() { // try to send requests on lanes on which curse is applied on source RMN and the request should revert // data-only transfer is sufficient lane.Source.TransferAmount = []*big.Int{} - failedTx, _, _, err := lane.Source.SendRequest( - lane.Dest.ReceiverDapp.EthAddress, - false, - big.NewInt(actions.DefaultDestinationGasLimit), // gas limit - ) + failedTx, _, _, err := lane.Source.SendRequest(lane.Dest.ReceiverDapp.EthAddress, big.NewInt(actions.DefaultDestinationGasLimit)) if lane.Source.Common.ChainClient.GetNetworkConfig().MinimumConfirmations > 0 { require.Error(l.t, err) } else { diff --git a/integration-tests/ccip-tests/smoke/ccip_test.go b/integration-tests/ccip-tests/smoke/ccip_test.go index a60dc54b1a..ccbf0cfe11 100644 --- a/integration-tests/ccip-tests/smoke/ccip_test.go +++ b/integration-tests/ccip-tests/smoke/ccip_test.go @@ -83,7 +83,7 @@ func TestSmokeCCIPForBidirectionalLane(t *testing.T) { Msgf("Starting lane %s -> %s", tc.lane.SourceNetworkName, tc.lane.DestNetworkName) tc.lane.RecordStateBeforeTransfer() - err := tc.lane.SendRequests(1, false, gasLimit) + err := tc.lane.SendRequests(1, gasLimit) require.NoError(t, err) tc.lane.ValidateRequests() }) @@ -243,8 +243,7 @@ func TestSmokeCCIPRateLimit(t *testing.T) { require.NoError(t, tc.lane.Source.Common.ChainClient.WaitForEvents()) failedTx, _, _, err := tc.lane.Source.SendRequest( tc.lane.Dest.ReceiverDapp.EthAddress, - false, - big.NewInt(actions.DefaultDestinationGasLimit), // gas limit + big.NewInt(actions.DefaultDestinationGasLimit), ) require.NoError(t, err) require.Error(t, tc.lane.Source.Common.ChainClient.WaitForEvents()) @@ -264,17 +263,13 @@ func TestSmokeCCIPRateLimit(t *testing.T) { tc.lane.Logger.Info().Str("tokensToSend", tokensToSend.String()).Msg("99% of Aggregated Capacity") tc.lane.RecordStateBeforeTransfer() src.TransferAmount[0] = tokensToSend - err = tc.lane.SendRequests(1, false, big.NewInt(actions.DefaultDestinationGasLimit)) + err = tc.lane.SendRequests(1, big.NewInt(actions.DefaultDestinationGasLimit)) require.NoError(t, err) // try to send again with amount more than the amount refilled by rate and // this should fail, as the refill rate is not enough to refill the capacity src.TransferAmount[0] = new(big.Int).Mul(AggregatedRateLimitRate, big.NewInt(10)) - failedTx, _, _, err = tc.lane.Source.SendRequest( - tc.lane.Dest.ReceiverDapp.EthAddress, - false, - big.NewInt(actions.DefaultDestinationGasLimit), // gas limit - ) + failedTx, _, _, err = tc.lane.Source.SendRequest(tc.lane.Dest.ReceiverDapp.EthAddress, big.NewInt(actions.DefaultDestinationGasLimit)) tc.lane.Logger.Info().Str("tokensToSend", src.TransferAmount[0].String()).Msg("More than Aggregated Rate") require.NoError(t, err) require.Error(t, tc.lane.Source.Common.ChainClient.WaitForEvents()) @@ -338,11 +333,7 @@ func TestSmokeCCIPRateLimit(t *testing.T) { src.TransferAmount[0] = tokensToSend tc.lane.Logger.Info().Str("tokensToSend", tokensToSend.String()).Msg("More than Token Pool Capacity") - failedTx, _, _, err = tc.lane.Source.SendRequest( - tc.lane.Dest.ReceiverDapp.EthAddress, - false, - big.NewInt(actions.DefaultDestinationGasLimit), // gas limit - ) + failedTx, _, _, err = tc.lane.Source.SendRequest(tc.lane.Dest.ReceiverDapp.EthAddress, big.NewInt(actions.DefaultDestinationGasLimit)) require.NoError(t, err) require.Error(t, tc.lane.Source.Common.ChainClient.WaitForEvents()) errReason, v, err = tc.lane.Source.Common.ChainClient.RevertReasonFromTx(failedTx, lock_release_token_pool.LockReleaseTokenPoolABI) @@ -361,7 +352,7 @@ func TestSmokeCCIPRateLimit(t *testing.T) { src.TransferAmount[0] = tokensToSend tc.lane.Logger.Info().Str("tokensToSend", tokensToSend.String()).Msg("99% of Token Pool Capacity") tc.lane.RecordStateBeforeTransfer() - err = tc.lane.SendRequests(1, false, big.NewInt(actions.DefaultDestinationGasLimit)) + err = tc.lane.SendRequests(1, big.NewInt(actions.DefaultDestinationGasLimit)) require.NoError(t, err) // try to send again with amount more than the amount refilled by token pool rate and @@ -374,11 +365,7 @@ func TestSmokeCCIPRateLimit(t *testing.T) { src.Common.ChainClient.GetDefaultWallet(), src.Common.Router.Address(), src.TransferAmount[0]), ) require.NoError(t, tc.lane.Source.Common.ChainClient.WaitForEvents()) - failedTx, _, _, err = tc.lane.Source.SendRequest( - tc.lane.Dest.ReceiverDapp.EthAddress, - false, - big.NewInt(actions.DefaultDestinationGasLimit), - ) + failedTx, _, _, err = tc.lane.Source.SendRequest(tc.lane.Dest.ReceiverDapp.EthAddress, big.NewInt(actions.DefaultDestinationGasLimit)) require.NoError(t, err) require.Error(t, tc.lane.Source.Common.ChainClient.WaitForEvents()) errReason, v, err = tc.lane.Source.Common.ChainClient.RevertReasonFromTx(failedTx, lock_release_token_pool.LockReleaseTokenPoolABI) @@ -407,8 +394,8 @@ func TestSmokeCCIPOnRampLimits(t *testing.T) { "This test modifies contract state. Before running it, ensure you are willing and able to do so.", ) err := contracts.MatchContractVersionsOrAbove(map[contracts.Name]contracts.Version{ - contracts.OffRampContract: contracts.V1_5_0_dev, - contracts.OnRampContract: contracts.V1_5_0_dev, + contracts.OffRampContract: contracts.V1_5_0, + contracts.OnRampContract: contracts.V1_5_0, }) require.NoError(t, err, "Required contract versions not met") @@ -503,7 +490,7 @@ func TestSmokeCCIPOnRampLimits(t *testing.T) { src.TransferAmount[aggRateTokenIndex] = big.NewInt(1) src.TransferAmount[bpsAndAggTokenIndex] = big.NewInt(1) tc.lane.RecordStateBeforeTransfer() - err = tc.lane.SendRequests(1, false, big.NewInt(actions.DefaultDestinationGasLimit)) + err = tc.lane.SendRequests(1, big.NewInt(actions.DefaultDestinationGasLimit)) require.NoError(t, err) tc.lane.ValidateRequests() @@ -512,7 +499,7 @@ func TestSmokeCCIPOnRampLimits(t *testing.T) { src.TransferAmount[bpsTokenIndex] = big.NewInt(0) src.TransferAmount[aggRateTokenIndex] = overCapacityAmount src.TransferAmount[bpsAndAggTokenIndex] = big.NewInt(0) - failedTx, _, _, err := tc.lane.Source.SendRequest(tc.lane.Dest.ReceiverDapp.EthAddress, false, big.NewInt(actions.DefaultDestinationGasLimit)) + failedTx, _, _, err := tc.lane.Source.SendRequest(tc.lane.Dest.ReceiverDapp.EthAddress, big.NewInt(actions.DefaultDestinationGasLimit)) require.Error(t, err, "Limited token transfer should immediately revert") errReason, _, err := src.Common.ChainClient.RevertReasonFromTx(failedTx, evm_2_evm_onramp.EVM2EVMOnRampABI) require.NoError(t, err) @@ -524,7 +511,7 @@ func TestSmokeCCIPOnRampLimits(t *testing.T) { src.TransferAmount[aggRateTokenIndex] = big.NewInt(0) src.TransferAmount[bpsAndAggTokenIndex] = overCapacityAmount - failedTx, _, _, err = tc.lane.Source.SendRequest(tc.lane.Dest.ReceiverDapp.EthAddress, false, big.NewInt(actions.DefaultDestinationGasLimit)) + failedTx, _, _, err = tc.lane.Source.SendRequest(tc.lane.Dest.ReceiverDapp.EthAddress, big.NewInt(actions.DefaultDestinationGasLimit)) require.Error(t, err, "Limited token transfer should immediately revert") errReason, _, err = src.Common.ChainClient.RevertReasonFromTx(failedTx, evm_2_evm_onramp.EVM2EVMOnRampABI) require.NoError(t, err) @@ -563,7 +550,7 @@ func TestSmokeCCIPOnRampLimits(t *testing.T) { src.TransferAmount[aggRateTokenIndex] = big.NewInt(0) src.TransferAmount[bpsAndAggTokenIndex] = big.NewInt(0) tc.lane.RecordStateBeforeTransfer() - err = tc.lane.SendRequests(1, false, big.NewInt(actions.DefaultDestinationGasLimit)) + err = tc.lane.SendRequests(1, big.NewInt(actions.DefaultDestinationGasLimit)) require.NoError(t, err) tc.lane.ValidateRequests() @@ -572,7 +559,7 @@ func TestSmokeCCIPOnRampLimits(t *testing.T) { src.TransferAmount[bpsTokenIndex] = big.NewInt(0) src.TransferAmount[aggRateTokenIndex] = capacityLimit src.TransferAmount[bpsAndAggTokenIndex] = big.NewInt(0) - failedTx, _, _, err = tc.lane.Source.SendRequest(tc.lane.Dest.ReceiverDapp.EthAddress, false, big.NewInt(actions.DefaultDestinationGasLimit)) + failedTx, _, _, err = tc.lane.Source.SendRequest(tc.lane.Dest.ReceiverDapp.EthAddress, big.NewInt(actions.DefaultDestinationGasLimit)) require.Error(t, err, "Aggregate rate limited token transfer should immediately revert") errReason, _, err = src.Common.ChainClient.RevertReasonFromTx(failedTx, evm_2_evm_onramp.EVM2EVMOnRampABI) require.NoError(t, err) @@ -584,7 +571,7 @@ func TestSmokeCCIPOnRampLimits(t *testing.T) { src.TransferAmount[aggRateTokenIndex] = big.NewInt(0) src.TransferAmount[bpsAndAggTokenIndex] = capacityLimit - failedTx, _, _, err = tc.lane.Source.SendRequest(tc.lane.Dest.ReceiverDapp.EthAddress, false, big.NewInt(actions.DefaultDestinationGasLimit)) + failedTx, _, _, err = tc.lane.Source.SendRequest(tc.lane.Dest.ReceiverDapp.EthAddress, big.NewInt(actions.DefaultDestinationGasLimit)) require.Error(t, err, "Aggregate rate limited token transfer should immediately revert") errReason, _, err = src.Common.ChainClient.RevertReasonFromTx(failedTx, evm_2_evm_onramp.EVM2EVMOnRampABI) require.NoError(t, err) @@ -628,8 +615,8 @@ func TestSmokeCCIPTokenPoolRateLimits(t *testing.T) { "This test modifies contract state. Before running it, ensure you are willing and able to do so.", ) err := contracts.MatchContractVersionsOrAbove(map[contracts.Name]contracts.Version{ - contracts.OffRampContract: contracts.V1_5_0_dev, - contracts.OnRampContract: contracts.V1_5_0_dev, + contracts.OffRampContract: contracts.V1_5_0, + contracts.OnRampContract: contracts.V1_5_0, }) require.NoError(t, err, "Required contract versions not met") @@ -698,14 +685,14 @@ func TestSmokeCCIPTokenPoolRateLimits(t *testing.T) { src.TransferAmount[freeTokenIndex] = overCapacityAmount src.TransferAmount[limitedTokenIndex] = big.NewInt(1) tc.lane.RecordStateBeforeTransfer() - err = tc.lane.SendRequests(1, false, big.NewInt(actions.DefaultDestinationGasLimit)) + err = tc.lane.SendRequests(1, big.NewInt(actions.DefaultDestinationGasLimit)) require.NoError(t, err) tc.lane.ValidateRequests() // Send limited token over capacity and ensure it fails src.TransferAmount[freeTokenIndex] = big.NewInt(0) src.TransferAmount[limitedTokenIndex] = overCapacityAmount - failedTx, _, _, err := tc.lane.Source.SendRequest(tc.lane.Dest.ReceiverDapp.EthAddress, false, big.NewInt(actions.DefaultDestinationGasLimit)) + failedTx, _, _, err := tc.lane.Source.SendRequest(tc.lane.Dest.ReceiverDapp.EthAddress, big.NewInt(actions.DefaultDestinationGasLimit)) require.Error(t, err, "Limited token transfer should immediately revert") errReason, _, err := src.Common.ChainClient.RevertReasonFromTx(failedTx, lock_release_token_pool.LockReleaseTokenPoolABI) require.NoError(t, err) @@ -729,14 +716,14 @@ func TestSmokeCCIPTokenPoolRateLimits(t *testing.T) { src.TransferAmount[freeTokenIndex] = overCapacityAmount src.TransferAmount[limitedTokenIndex] = capacityLimit tc.lane.RecordStateBeforeTransfer() - err = tc.lane.SendRequests(1, false, big.NewInt(actions.DefaultDestinationGasLimit)) + err = tc.lane.SendRequests(1, big.NewInt(actions.DefaultDestinationGasLimit)) require.NoError(t, err) tc.lane.ValidateRequests() // Send limited token over rate limit and ensure it fails src.TransferAmount[freeTokenIndex] = big.NewInt(0) src.TransferAmount[limitedTokenIndex] = capacityLimit - failedTx, _, _, err = tc.lane.Source.SendRequest(tc.lane.Dest.ReceiverDapp.EthAddress, false, big.NewInt(actions.DefaultDestinationGasLimit)) + failedTx, _, _, err = tc.lane.Source.SendRequest(tc.lane.Dest.ReceiverDapp.EthAddress, big.NewInt(actions.DefaultDestinationGasLimit)) require.Error(t, err, "Limited token transfer should immediately revert") errReason, _, err = src.Common.ChainClient.RevertReasonFromTx(failedTx, lock_release_token_pool.LockReleaseTokenPoolABI) require.NoError(t, err) @@ -842,7 +829,7 @@ func TestSmokeCCIPManuallyExecuteAfterExecutionFailingDueToInsufficientGas(t *te tc.lane.RecordStateBeforeTransfer() // send with insufficient gas for ccip-receive to fail - err := tc.lane.SendRequests(1, false, big.NewInt(0)) + err := tc.lane.SendRequests(1, big.NewInt(0)) require.NoError(t, err) tc.lane.ValidateRequests(actions.ExpectPhaseToFail(testreporters.ExecStateChanged)) // wait for events @@ -883,7 +870,7 @@ func testOffRampRateLimits(t *testing.T, rateLimiterConfig contracts.RateLimiter "This test modifies contract state. Before running it, ensure you are willing and able to do so.", ) err := contracts.MatchContractVersionsOrAbove(map[contracts.Name]contracts.Version{ - contracts.OffRampContract: contracts.V1_5_0_dev, + contracts.OffRampContract: contracts.V1_5_0, }) require.NoError(t, err, "Required contract versions not met") require.False(t, pointer.GetBool(TestCfg.TestGroupInput.ExistingDeployment), "This test modifies contract state and cannot be run on existing deployments") @@ -950,7 +937,7 @@ func testOffRampRateLimits(t *testing.T, rateLimiterConfig contracts.RateLimiter src.TransferAmount[freeTokenIndex] = overLimitAmount src.TransferAmount[limitedTokenIndex] = overLimitAmount tc.lane.RecordStateBeforeTransfer() - err = tc.lane.SendRequests(1, false, big.NewInt(actions.DefaultDestinationGasLimit)) + err = tc.lane.SendRequests(1, big.NewInt(actions.DefaultDestinationGasLimit)) require.NoError(t, err) tc.lane.ValidateRequests() @@ -967,7 +954,7 @@ func testOffRampRateLimits(t *testing.T, rateLimiterConfig contracts.RateLimiter src.TransferAmount[freeTokenIndex] = overLimitAmount src.TransferAmount[limitedTokenIndex] = big.NewInt(0) tc.lane.RecordStateBeforeTransfer() - err = tc.lane.SendRequests(1, false, big.NewInt(actions.DefaultDestinationGasLimit)) + err = tc.lane.SendRequests(1, big.NewInt(actions.DefaultDestinationGasLimit)) require.NoError(t, err, "Free token transfer failed") tc.lane.ValidateRequests() tc.lane.Logger.Info().Str("Token", freeSrcToken.ContractAddress.Hex()).Msg("Free token transfer succeeded") @@ -976,7 +963,7 @@ func testOffRampRateLimits(t *testing.T, rateLimiterConfig contracts.RateLimiter src.TransferAmount[freeTokenIndex] = big.NewInt(0) src.TransferAmount[limitedTokenIndex] = overLimitAmount tc.lane.RecordStateBeforeTransfer() - err = tc.lane.SendRequests(1, false, big.NewInt(actions.DefaultDestinationGasLimit)) + err = tc.lane.SendRequests(1, big.NewInt(actions.DefaultDestinationGasLimit)) require.NoError(t, err, "Failed to send rate limited token transfer") // We should see the ExecStateChanged phase fail on the OffRamp From 85b0545aea911a0bd52dd79fadc8483264b53ec7 Mon Sep 17 00:00:00 2001 From: Balamurali Gopalswami Date: Tue, 3 Sep 2024 14:43:37 -0400 Subject: [PATCH 05/19] Fix in multicall test as well --- integration-tests/ccip-tests/actions/ccip_helpers.go | 9 +++------ integration-tests/ccip-tests/smoke/ccip_test.go | 4 ++-- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/integration-tests/ccip-tests/actions/ccip_helpers.go b/integration-tests/ccip-tests/actions/ccip_helpers.go index 68e26fe995..8b449364be 100644 --- a/integration-tests/ccip-tests/actions/ccip_helpers.go +++ b/integration-tests/ccip-tests/actions/ccip_helpers.go @@ -2799,14 +2799,11 @@ func (lane *CCIPLane) AddToSentReqs(txHash common.Hash, reqStats []*testreporter // Multicall sends multiple ccip-send requests in a single transaction // It will create one transaction for all the requests and will wait for the confirmation -func (lane *CCIPLane) Multicall( - noOfRequests int, - allowOutOfOrder bool, - multiSendAddr common.Address, -) error { +func (lane *CCIPLane) Multicall(noOfRequests int, multiSendAddr common.Address) error { var ccipMultipleMsg []contracts.CCIPMsgData feeToken := common.HexToAddress(lane.Source.Common.FeeToken.Address()) - genericMsg, err := lane.Source.CCIPMsg(lane.Dest.ReceiverDapp.EthAddress, allowOutOfOrder, big.NewInt(DefaultDestinationGasLimit)) + genericMsg, err := lane.Source.CCIPMsg(lane.Dest.ReceiverDapp.EthAddress, lane.Source.Common.AllowOutOfOrder, + big.NewInt(DefaultDestinationGasLimit)) if err != nil { return fmt.Errorf("failed to form the ccip message: %w", err) } diff --git a/integration-tests/ccip-tests/smoke/ccip_test.go b/integration-tests/ccip-tests/smoke/ccip_test.go index ccbf0cfe11..f0d5da11a5 100644 --- a/integration-tests/ccip-tests/smoke/ccip_test.go +++ b/integration-tests/ccip-tests/smoke/ccip_test.go @@ -243,7 +243,7 @@ func TestSmokeCCIPRateLimit(t *testing.T) { require.NoError(t, tc.lane.Source.Common.ChainClient.WaitForEvents()) failedTx, _, _, err := tc.lane.Source.SendRequest( tc.lane.Dest.ReceiverDapp.EthAddress, - big.NewInt(actions.DefaultDestinationGasLimit), + big.NewInt(actions.DefaultDestinationGasLimit), ) require.NoError(t, err) require.Error(t, tc.lane.Source.Common.ChainClient.WaitForEvents()) @@ -778,7 +778,7 @@ func TestSmokeCCIPMulticall(t *testing.T) { Msgf("Starting lane %s -> %s", tc.lane.SourceNetworkName, tc.lane.DestNetworkName) tc.lane.RecordStateBeforeTransfer() - err := tc.lane.Multicall(TestCfg.TestGroupInput.NoOfSendsInMulticall, false, tc.lane.Source.Common.MulticallContract) + err := tc.lane.Multicall(TestCfg.TestGroupInput.NoOfSendsInMulticall, tc.lane.Source.Common.MulticallContract) require.NoError(t, err) tc.lane.ValidateRequests() }) From ee3659abaf751901b032e46f1c300aff34f90867 Mon Sep 17 00:00:00 2001 From: Balamurali Gopalswami Date: Tue, 3 Sep 2024 15:52:56 -0400 Subject: [PATCH 06/19] Allow out of order globally for local test --- integration-tests/ccip-tests/actions/ccip_helpers.go | 8 ++++++++ integration-tests/ccip-tests/testconfig/README.md | 4 ++++ integration-tests/ccip-tests/testconfig/ccip.go | 1 + .../ccip-tests/testconfig/tomls/ccip-default.toml | 4 ++++ 4 files changed, 17 insertions(+) diff --git a/integration-tests/ccip-tests/actions/ccip_helpers.go b/integration-tests/ccip-tests/actions/ccip_helpers.go index 8b449364be..e8898816ea 100644 --- a/integration-tests/ccip-tests/actions/ccip_helpers.go +++ b/integration-tests/ccip-tests/actions/ccip_helpers.go @@ -3503,6 +3503,7 @@ func (lane *CCIPLane) DeployNewCCIPLane( srcConf = lane.SrcNetworkLaneCfg destConf = lane.DstNetworkLaneCfg commitAndExecOnSameDON = pointer.GetBool(testConf.CommitAndExecuteOnSameDON) + allowOutOfOrder = pointer.GetBool(testConf.AllowOutOfOrder) withPipeline = pointer.GetBool(testConf.TokenConfig.WithPipeline) configureCLNodes = !pointer.GetBool(testConf.ExistingDeployment) ) @@ -3517,6 +3518,13 @@ func (lane *CCIPLane) DeployNewCCIPLane( if err != nil { return fmt.Errorf("failed to create source module: %w", err) } + + // If AllowOutOfOrder is set globally in test config, then assumption is to set it for every lane. + //However, if this is set as false, and set as true for specific chain in lane_configs then apply it + //only for a lane where source network is of that chain. + if allowOutOfOrder { + lane.Source.Common.AllowOutOfOrder = true + } lane.Dest, err = DefaultDestinationCCIPModule( lane.Logger, testConf, destChainClient, sourceChainClient.GetChainID().Uint64(), diff --git a/integration-tests/ccip-tests/testconfig/README.md b/integration-tests/ccip-tests/testconfig/README.md index bcf468a36c..474ac2a3af 100644 --- a/integration-tests/ccip-tests/testconfig/README.md +++ b/integration-tests/ccip-tests/testconfig/README.md @@ -473,6 +473,10 @@ Specifies whether to set up bi-directional lanes between networks. Specifies whether commit and execution jobs are to be run on the same Chainlink node. +### CCIP.Groups.[testgroup].AllowOutOfOrder + +Specifies whether out of order execution is allowed globally for all the chains. + ### CCIP.Groups.[testgroup].NoOfCommitNodes Specifies the number of nodes on which commit jobs are to be run. This needs to be lesser than the total number of nodes mentioned in [CCIP.Env.NewCLCluster.NoOfNodes](#ccipenvnewclclusternoofnodes) or [CCIP.Env.ExistingCLCluster.NoOfNodes](#ccipenvexistingclclusternoofnodes). diff --git a/integration-tests/ccip-tests/testconfig/ccip.go b/integration-tests/ccip-tests/testconfig/ccip.go index 7d9419828e..6cb508bef3 100644 --- a/integration-tests/ccip-tests/testconfig/ccip.go +++ b/integration-tests/ccip-tests/testconfig/ccip.go @@ -257,6 +257,7 @@ type CCIPTestGroupConfig struct { KeepEnvAlive *bool `toml:",omitempty"` BiDirectionalLane *bool `toml:",omitempty"` CommitAndExecuteOnSameDON *bool `toml:",omitempty"` + AllowOutOfOrder *bool `toml:",omitempty"` // To set out of order execution globally NoOfCommitNodes int `toml:",omitempty"` MsgDetails *MsgDetails `toml:",omitempty"` TokenConfig *TokenConfig `toml:",omitempty"` diff --git a/integration-tests/ccip-tests/testconfig/tomls/ccip-default.toml b/integration-tests/ccip-tests/testconfig/tomls/ccip-default.toml index 076c334e07..bd885a5840 100644 --- a/integration-tests/ccip-tests/testconfig/tomls/ccip-default.toml +++ b/integration-tests/ccip-tests/testconfig/tomls/ccip-default.toml @@ -244,6 +244,8 @@ version = "ccip-develop" KeepEnvAlive = false # if true, the test will not tear down the test environment after the test is finished CommitAndExecuteOnSameDON = true # if true, and the test is building the env from scratch, same chainlink nodes will be used for Commit and Execution jobs. # Otherwise Commit and execution jobs will be set up in different nodes based on the number of nodes specified in NoOfCommitNodes and CCIP.Env.NewCLCluster.NoOfNodes +AllowOutOfOrder = true # if true, all the lanes will allow out of order execution and it +# overrides settings from lane_config. To allow out of order execution per lane, then send "allow_out_of_order":true, similar to is_native_fee_token variable. BiDirectionalLane = true # True uses both the lanes. If bidirectional is false only one way lane is set up. NoOfCommitNodes = 5 # no of chainlink nodes with Commit job PhaseTimeout = '10m' # Duration to wait for the each phase validation(SendRequested, Commit, RMN Blessing, Execution) to time-out. @@ -297,6 +299,7 @@ CCIPOwnerTokens = false # if true, the test will use deploy the tokens by the CC KeepEnvAlive = false # same as above CommitAndExecuteOnSameDON = true # same as above +AllowOutOfOrder = true # same as above BiDirectionalLane = true # same as above NoOfCommitNodes = 5 # same as above PhaseTimeout = '10m' # same as above @@ -407,6 +410,7 @@ CCIPOwnerTokens = false # if true, the test will use deploy the tokens by the CC #NetworkPairs = ['SEPOLIA,OPTIMISM_GOERLI','SEPOLIA,POLYGON_MUMBAI','AVALANCHE_FUJI,SEPOLIA','SEPOLIA,BASE_GOERLI','SEPOLIA,BSC_TESTNET','SEPOLIA,WEMIX_TESTNET','AVALANCHE_FUJI,OPTIMISM_GOERLI','AVALANCHE_FUJI,POLYGON_MUMBAI','AVALANCHE_FUJI,BSC_TESTNET','AVALANCHE_FUJI,BASE_GOERLI','OPTIMISM_GOERLI,BASE_GOERLI','OPTIMISM_GOERLI,POLYGON_MUMBAI','BSC_TESTNET,POLYGON_MUMBAI','BSC_TESTNET,BASE_GOERLI','WEMIX_TESTNET,KROMA_SEPOLIA'] KeepEnvAlive = false CommitAndExecuteOnSameDON = false +AllowOutOfOrder = true BiDirectionalLane = true NoOfCommitNodes = 5 PhaseTimeout = '50m' From 3ada337d14eaab83e552024c53b4e589c283e95e Mon Sep 17 00:00:00 2001 From: Balamurali Gopalswami Date: Tue, 3 Sep 2024 15:56:03 -0400 Subject: [PATCH 07/19] Setting it as false by default --- integration-tests/ccip-tests/testconfig/tomls/ccip-default.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/integration-tests/ccip-tests/testconfig/tomls/ccip-default.toml b/integration-tests/ccip-tests/testconfig/tomls/ccip-default.toml index bd885a5840..9c8be5594e 100644 --- a/integration-tests/ccip-tests/testconfig/tomls/ccip-default.toml +++ b/integration-tests/ccip-tests/testconfig/tomls/ccip-default.toml @@ -244,7 +244,7 @@ version = "ccip-develop" KeepEnvAlive = false # if true, the test will not tear down the test environment after the test is finished CommitAndExecuteOnSameDON = true # if true, and the test is building the env from scratch, same chainlink nodes will be used for Commit and Execution jobs. # Otherwise Commit and execution jobs will be set up in different nodes based on the number of nodes specified in NoOfCommitNodes and CCIP.Env.NewCLCluster.NoOfNodes -AllowOutOfOrder = true # if true, all the lanes will allow out of order execution and it +AllowOutOfOrder = false # if true, all the lanes will allow out of order execution and it # overrides settings from lane_config. To allow out of order execution per lane, then send "allow_out_of_order":true, similar to is_native_fee_token variable. BiDirectionalLane = true # True uses both the lanes. If bidirectional is false only one way lane is set up. NoOfCommitNodes = 5 # no of chainlink nodes with Commit job From 5e43c01fabbecf51e77afd4a7f8132cac33edbe7 Mon Sep 17 00:00:00 2001 From: Balamurali Gopalswami Date: Tue, 3 Sep 2024 18:14:31 -0400 Subject: [PATCH 08/19] Update in load setup as well --- integration-tests/ccip-tests/load/ccip_loadgen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/integration-tests/ccip-tests/load/ccip_loadgen.go b/integration-tests/ccip-tests/load/ccip_loadgen.go index 933b1d337d..c7708d0c46 100644 --- a/integration-tests/ccip-tests/load/ccip_loadgen.go +++ b/integration-tests/ccip-tests/load/ccip_loadgen.go @@ -201,7 +201,7 @@ func (c *CCIPE2ELoad) CCIPMsg() (router.ClientEVM2AnyMessage, *testreporters.Req if matchErr != nil { extraArgs, err = testhelpers.GetEVMExtraArgsV1(big.NewInt(gasLimit), false) } else { - extraArgs, err = testhelpers.GetEVMExtraArgsV2(big.NewInt(gasLimit), false) + extraArgs, err = testhelpers.GetEVMExtraArgsV2(big.NewInt(gasLimit), c.Lane.Source.Common.AllowOutOfOrder) } if err != nil { return router.ClientEVM2AnyMessage{}, stats, err From d5d816ba034fc7114ef9ee700878ac6c4fa9481f Mon Sep 17 00:00:00 2001 From: Adam Hamrick Date: Tue, 10 Sep 2024 12:17:51 -0400 Subject: [PATCH 09/19] Changes batching strategy based on OOO Execution (#1423) --- .../ocr2/plugins/ccip/testhelpers/ccip_contracts.go | 2 ++ core/services/ocr2/plugins/ccip/testhelpers/config.go | 1 + .../testhelpers/testhelpers_1_4_0/ccip_contracts_1_4_0.go | 2 ++ .../ccip/testhelpers/testhelpers_1_4_0/config_1_4_0.go | 1 + integration-tests/ccip-tests/actions/ccip_helpers.go | 8 ++++++++ .../ccip-tests/contracts/contract_deployer.go | 4 ++++ 6 files changed, 18 insertions(+) diff --git a/core/services/ocr2/plugins/ccip/testhelpers/ccip_contracts.go b/core/services/ocr2/plugins/ccip/testhelpers/ccip_contracts.go index e1aed59053..f5f27714fc 100644 --- a/core/services/ocr2/plugins/ccip/testhelpers/ccip_contracts.go +++ b/core/services/ocr2/plugins/ccip/testhelpers/ccip_contracts.go @@ -150,6 +150,7 @@ func NewExecOffchainConfig( RelativeBoostPerWaitHour float64, InflightCacheExpiry config.Duration, RootSnoozeTime config.Duration, + BatchingStrategyID uint32, // 0 = Standard, 1 = Out of Order ) ExecOffchainConfig { return ExecOffchainConfig{v1_2_0.JSONExecOffchainConfig{ DestOptimisticConfirmations: DestOptimisticConfirmations, @@ -157,6 +158,7 @@ func NewExecOffchainConfig( RelativeBoostPerWaitHour: RelativeBoostPerWaitHour, InflightCacheExpiry: InflightCacheExpiry, RootSnoozeTime: RootSnoozeTime, + BatchingStrategyID: BatchingStrategyID, }} } diff --git a/core/services/ocr2/plugins/ccip/testhelpers/config.go b/core/services/ocr2/plugins/ccip/testhelpers/config.go index c9d1ca5a12..4dcb627347 100644 --- a/core/services/ocr2/plugins/ccip/testhelpers/config.go +++ b/core/services/ocr2/plugins/ccip/testhelpers/config.go @@ -70,6 +70,7 @@ func (c *CCIPContracts) createExecOffchainConfig(t *testing.T, inflightCacheExpi 0.07, *config.MustNewDuration(inflightCacheExpiry), *config.MustNewDuration(rootSnoozeTime), + uint32(0), ).Encode() require.NoError(t, err) return config diff --git a/core/services/ocr2/plugins/ccip/testhelpers/testhelpers_1_4_0/ccip_contracts_1_4_0.go b/core/services/ocr2/plugins/ccip/testhelpers/testhelpers_1_4_0/ccip_contracts_1_4_0.go index b8db2dfff7..9906a7b365 100644 --- a/core/services/ocr2/plugins/ccip/testhelpers/testhelpers_1_4_0/ccip_contracts_1_4_0.go +++ b/core/services/ocr2/plugins/ccip/testhelpers/testhelpers_1_4_0/ccip_contracts_1_4_0.go @@ -157,6 +157,7 @@ func NewExecOffchainConfig( RelativeBoostPerWaitHour float64, InflightCacheExpiry config.Duration, RootSnoozeTime config.Duration, + BatchingStrategyID uint32, ) ExecOffchainConfig { return ExecOffchainConfig{v1_2_0.JSONExecOffchainConfig{ DestOptimisticConfirmations: DestOptimisticConfirmations, @@ -164,6 +165,7 @@ func NewExecOffchainConfig( RelativeBoostPerWaitHour: RelativeBoostPerWaitHour, InflightCacheExpiry: InflightCacheExpiry, RootSnoozeTime: RootSnoozeTime, + BatchingStrategyID: BatchingStrategyID, }} } diff --git a/core/services/ocr2/plugins/ccip/testhelpers/testhelpers_1_4_0/config_1_4_0.go b/core/services/ocr2/plugins/ccip/testhelpers/testhelpers_1_4_0/config_1_4_0.go index 666ad79e59..087c21e933 100644 --- a/core/services/ocr2/plugins/ccip/testhelpers/testhelpers_1_4_0/config_1_4_0.go +++ b/core/services/ocr2/plugins/ccip/testhelpers/testhelpers_1_4_0/config_1_4_0.go @@ -68,6 +68,7 @@ func (c *CCIPContracts) createExecOffchainConfig(t *testing.T, inflightCacheExpi 0.07, *config.MustNewDuration(inflightCacheExpiry), *config.MustNewDuration(rootSnoozeTime), + uint32(0), ).Encode() require.NoError(t, err) return config diff --git a/integration-tests/ccip-tests/actions/ccip_helpers.go b/integration-tests/ccip-tests/actions/ccip_helpers.go index e8898816ea..39cbf9b557 100644 --- a/integration-tests/ccip-tests/actions/ccip_helpers.go +++ b/integration-tests/ccip-tests/actions/ccip_helpers.go @@ -61,6 +61,7 @@ import ( "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ccip/generated/rmn_contract" "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ccip/generated/router" "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ccip/generated/token_pool" + "github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/ccip/ccipexec" "github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/ccip/config" "github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/ccip/testhelpers" integrationtesthelpers "github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/ccip/testhelpers/integration" @@ -3776,6 +3777,12 @@ func SetOCR2Config( if len(execNodes) > 0 { nodes = execNodes } + + // Use out of order batching strategy if we expect to be sending out of order messages + batchingStrategyID := ccipexec.BestEffortBatchingStrategyID + if pointer.GetBool(testConf.AllowOutOfOrder) { + batchingStrategyID = ccipexec.ZKOverflowBatchingStrategyID + } if destCCIP.OffRamp != nil { execOffchainCfg, err := contracts.NewExecOffchainConfig( 1, @@ -3783,6 +3790,7 @@ func SetOCR2Config( 0.7, *inflightExpiryExec, *commonconfig.MustNewDuration(RootSnoozeTime), + batchingStrategyID, ) if err != nil { return fmt.Errorf("failed to create exec offchain config: %w", err) diff --git a/integration-tests/ccip-tests/contracts/contract_deployer.go b/integration-tests/ccip-tests/contracts/contract_deployer.go index 29799db75e..3e8cece852 100644 --- a/integration-tests/ccip-tests/contracts/contract_deployer.go +++ b/integration-tests/ccip-tests/contracts/contract_deployer.go @@ -1466,12 +1466,14 @@ func NewExecOnchainConfig( } } +// NewExecOffchainConfig creates a config for the OffChain portion of how CCIP operates func NewExecOffchainConfig( destOptimisticConfirmations uint32, batchGasLimit uint32, relativeBoostPerWaitHour float64, inflightCacheExpiry config.Duration, rootSnoozeTime config.Duration, + batchingStrategyID uint32, // See ccipexec package ) (ccipconfig.OffchainConfig, error) { switch VersionMap[OffRampContract] { case Latest: @@ -1481,6 +1483,7 @@ func NewExecOffchainConfig( relativeBoostPerWaitHour, inflightCacheExpiry, rootSnoozeTime, + batchingStrategyID, ), nil case V1_2_0: return testhelpers_1_4_0.NewExecOffchainConfig( @@ -1489,6 +1492,7 @@ func NewExecOffchainConfig( relativeBoostPerWaitHour, inflightCacheExpiry, rootSnoozeTime, + batchingStrategyID, ), nil default: return nil, fmt.Errorf("version not supported: %s", VersionMap[OffRampContract]) From a30ac0adb29079a683fc9e0ed80c2da1b72b8b74 Mon Sep 17 00:00:00 2001 From: Adam Hamrick Date: Tue, 10 Sep 2024 15:59:25 -0400 Subject: [PATCH 10/19] Rename reorg tests in CI --- .github/workflows/integration-tests.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index b03f30c979..38fbd88c6f 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -373,21 +373,21 @@ jobs: file: ccip run: -run ^TestSmokeCCIPForBidirectionalLane$ config_path: ./integration-tests/ccip-tests/testconfig/tomls/leader-lane.toml - - name: ccip-smoke-reorg + - name: ccip-smoke-reorg-bidirectional nodes: 1 dir: ccip-tests/smoke os: ubuntu-latest file: ccip run: -run ^TestSmokeCCIPReorgBelowFinality$ -v config_path: ./integration-tests/ccip-tests/testconfig/tomls/ccip-reorg.toml - - name: ccip-smoke-reorg + - name: ccip-smoke-reorg-below-finality nodes: 1 dir: ccip-tests/smoke os: ubuntu-latest file: ccip run: -run ^TestSmokeCCIPReorgAboveFinalityAtDestination$ -v config_path: ./integration-tests/ccip-tests/testconfig/tomls/ccip-reorg.toml - - name: ccip-smoke-reorg + - name: ccip-smoke-reorg-above-finality nodes: 1 dir: ccip-tests/smoke os: ubuntu-latest From 1947bc414881da290f05102f93eb715d45d7bf1e Mon Sep 17 00:00:00 2001 From: Adam Hamrick Date: Tue, 10 Sep 2024 17:02:13 -0400 Subject: [PATCH 11/19] Set allow out of order to false by default --- .../ccip-tests/testconfig/tomls/ccip-default.toml | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/integration-tests/ccip-tests/testconfig/tomls/ccip-default.toml b/integration-tests/ccip-tests/testconfig/tomls/ccip-default.toml index 9c8be5594e..15bf443bca 100644 --- a/integration-tests/ccip-tests/testconfig/tomls/ccip-default.toml +++ b/integration-tests/ccip-tests/testconfig/tomls/ccip-default.toml @@ -27,7 +27,7 @@ ethereum_version = "eth1" # geth, besu, erigon or nethermind execution_layer = "geth" # eth2-only, if set to true environment startup will wait until at least 1 epoch has been finalised -wait_for_finalization=false +wait_for_finalization = false [CCIP.Env.PrivateEthereumNetworks.SIMULATED_1.EthereumChainConfig] # eth2-only, the lower the value the faster the block production (3 is minimum) @@ -244,8 +244,7 @@ version = "ccip-develop" KeepEnvAlive = false # if true, the test will not tear down the test environment after the test is finished CommitAndExecuteOnSameDON = true # if true, and the test is building the env from scratch, same chainlink nodes will be used for Commit and Execution jobs. # Otherwise Commit and execution jobs will be set up in different nodes based on the number of nodes specified in NoOfCommitNodes and CCIP.Env.NewCLCluster.NoOfNodes -AllowOutOfOrder = false # if true, all the lanes will allow out of order execution and it -# overrides settings from lane_config. To allow out of order execution per lane, then send "allow_out_of_order":true, similar to is_native_fee_token variable. +AllowOutOfOrder = false # if true, all lanes will set all transactions to allow out of order execution. This setting overrides individual settings from lane_config. To allow out of order execution per lane, then send "allow_out_of_order":true, similar to is_native_fee_token variable. BiDirectionalLane = true # True uses both the lanes. If bidirectional is false only one way lane is set up. NoOfCommitNodes = 5 # no of chainlink nodes with Commit job PhaseTimeout = '10m' # Duration to wait for the each phase validation(SendRequested, Commit, RMN Blessing, Execution) to time-out. @@ -277,7 +276,7 @@ TimeoutForPriceUpdate = '15m' # Duration to wait for the price update to time-ou # Now testing only with dynamic price getter (no pipeline). # Could be removed once the pipeline is completely removed. WithPipeline = false -NoOfTokensPerChain = 2 # number of bridge tokens to be deployed per network; if MsgType = 'Token'/'DataWithToken' +NoOfTokensPerChain = 2 # number of bridge tokens to be deployed per network; if MsgType = 'Token'/'DataWithToken' CCIPOwnerTokens = false # if true, the test will use deploy the tokens by the CCIPOwner, otherwise the tokens will be deployed by a non-owner account, only applicable for 1.5 pools and onwards #NoOfTokensWithDynamicPrice = 15 # number of tokens with dynamic price to be deployed @@ -299,7 +298,7 @@ CCIPOwnerTokens = false # if true, the test will use deploy the tokens by the CC KeepEnvAlive = false # same as above CommitAndExecuteOnSameDON = true # same as above -AllowOutOfOrder = true # same as above +AllowOutOfOrder = false # same as above BiDirectionalLane = true # same as above NoOfCommitNodes = 5 # same as above PhaseTimeout = '10m' # same as above @@ -358,7 +357,7 @@ TimeoutForPriceUpdate = '15m' # Duration to wait for the price update to time-ou # Now testing only with dynamic price getter (no pipeline). # Could be removed once the pipeline is completely removed. WithPipeline = false -NoOfTokensPerChain = 2 # number of bridge tokens to be deployed per network; if MsgType = 'Token'/'DataWithToken' +NoOfTokensPerChain = 2 # number of bridge tokens to be deployed per network; if MsgType = 'Token'/'DataWithToken' CCIPOwnerTokens = false # if true, the test will use deploy the tokens by the CCIPOwner, otherwise the tokens and pools will be deployed by a non-owner account, # only applicable for 1.5 pools and onwards, if you are running with pre-1.5 pools, then set this to true to deploy token pools by CCIPOwner, otherwise # the test will fail @@ -410,7 +409,7 @@ CCIPOwnerTokens = false # if true, the test will use deploy the tokens by the CC #NetworkPairs = ['SEPOLIA,OPTIMISM_GOERLI','SEPOLIA,POLYGON_MUMBAI','AVALANCHE_FUJI,SEPOLIA','SEPOLIA,BASE_GOERLI','SEPOLIA,BSC_TESTNET','SEPOLIA,WEMIX_TESTNET','AVALANCHE_FUJI,OPTIMISM_GOERLI','AVALANCHE_FUJI,POLYGON_MUMBAI','AVALANCHE_FUJI,BSC_TESTNET','AVALANCHE_FUJI,BASE_GOERLI','OPTIMISM_GOERLI,BASE_GOERLI','OPTIMISM_GOERLI,POLYGON_MUMBAI','BSC_TESTNET,POLYGON_MUMBAI','BSC_TESTNET,BASE_GOERLI','WEMIX_TESTNET,KROMA_SEPOLIA'] KeepEnvAlive = false CommitAndExecuteOnSameDON = false -AllowOutOfOrder = true +AllowOutOfOrder = false BiDirectionalLane = true NoOfCommitNodes = 5 PhaseTimeout = '50m' From 20e967daf37a9bb6881c472e85565eaabea62ddf Mon Sep 17 00:00:00 2001 From: Adam Hamrick Date: Fri, 13 Sep 2024 09:55:25 -0400 Subject: [PATCH 12/19] Debug --- integration-tests/ccip-tests/load/ccip_loadgen.go | 1 + 1 file changed, 1 insertion(+) diff --git a/integration-tests/ccip-tests/load/ccip_loadgen.go b/integration-tests/ccip-tests/load/ccip_loadgen.go index c7708d0c46..fa6a113ec7 100644 --- a/integration-tests/ccip-tests/load/ccip_loadgen.go +++ b/integration-tests/ccip-tests/load/ccip_loadgen.go @@ -195,6 +195,7 @@ func (c *CCIPE2ELoad) CCIPMsg() (router.ClientEVM2AnyMessage, *testreporters.Req extraArgs []byte err error ) + // v1.5.0 and later starts using V2 extra args matchErr := contracts.MatchContractVersionsOrAbove(map[contracts.Name]contracts.Version{ contracts.OnRampContract: contracts.V1_5_0, }) From f22bd55787f2f47962ea9a46a758d8fafb8067e2 Mon Sep 17 00:00:00 2001 From: Adam Hamrick Date: Fri, 13 Sep 2024 13:24:25 -0400 Subject: [PATCH 13/19] Debug --- .github/workflows/ccip-load-tests.yml | 1 - .../ccip-tests/load/ccip_loadgen.go | 28 +++++++++---------- 2 files changed, 14 insertions(+), 15 deletions(-) diff --git a/.github/workflows/ccip-load-tests.yml b/.github/workflows/ccip-load-tests.yml index 633effd86c..a9b1af2f30 100644 --- a/.github/workflows/ccip-load-tests.yml +++ b/.github/workflows/ccip-load-tests.yml @@ -14,7 +14,6 @@ on: description: 'Key to run tests with custom test secrets' required: false type: string - pull_request: # DEBUG: Checking run conditions # Only run 1 of this workflow at a time per PR concurrency: diff --git a/integration-tests/ccip-tests/load/ccip_loadgen.go b/integration-tests/ccip-tests/load/ccip_loadgen.go index fa6a113ec7..c48ac4732c 100644 --- a/integration-tests/ccip-tests/load/ccip_loadgen.go +++ b/integration-tests/ccip-tests/load/ccip_loadgen.go @@ -14,7 +14,6 @@ import ( "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core/types" "github.com/rs/zerolog" - "github.com/smartcontractkit/ccip/integration-tests/ccip-tests/contracts" chain_selectors "github.com/smartcontractkit/chain-selectors" "github.com/smartcontractkit/wasp" "github.com/stretchr/testify/require" @@ -191,19 +190,20 @@ func (c *CCIPE2ELoad) CCIPMsg() (router.ClientEVM2AnyMessage, *testreporters.Req msg.TokenAmounts = []router.ClientEVMTokenAmount{} } - var ( - extraArgs []byte - err error - ) - // v1.5.0 and later starts using V2 extra args - matchErr := contracts.MatchContractVersionsOrAbove(map[contracts.Name]contracts.Version{ - contracts.OnRampContract: contracts.V1_5_0, - }) - if matchErr != nil { - extraArgs, err = testhelpers.GetEVMExtraArgsV1(big.NewInt(gasLimit), false) - } else { - extraArgs, err = testhelpers.GetEVMExtraArgsV2(big.NewInt(gasLimit), c.Lane.Source.Common.AllowOutOfOrder) - } + // var ( + // extraArgs []byte + // err error + // ) + // // v1.5.0 and later starts using V2 extra args + // matchErr := contracts.MatchContractVersionsOrAbove(map[contracts.Name]contracts.Version{ + // contracts.OnRampContract: contracts.V1_5_0, + // }) + // if matchErr != nil { + // extraArgs, err = testhelpers.GetEVMExtraArgsV1(big.NewInt(gasLimit), false) + // } else { + // extraArgs, err = testhelpers.GetEVMExtraArgsV2(big.NewInt(gasLimit), c.Lane.Source.Common.AllowOutOfOrder) + // } + extraArgs, err := testhelpers.GetEVMExtraArgsV1(big.NewInt(gasLimit), false) if err != nil { return router.ClientEVM2AnyMessage{}, stats, err } From 34ca4e504b677db6f2db79ce429d962156fbbe46 Mon Sep 17 00:00:00 2001 From: Adam Hamrick Date: Fri, 13 Sep 2024 13:48:39 -0400 Subject: [PATCH 14/19] More debug --- .../ccip-tests/load/ccip_loadgen.go | 29 ++++++++++--------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/integration-tests/ccip-tests/load/ccip_loadgen.go b/integration-tests/ccip-tests/load/ccip_loadgen.go index c48ac4732c..297e78befd 100644 --- a/integration-tests/ccip-tests/load/ccip_loadgen.go +++ b/integration-tests/ccip-tests/load/ccip_loadgen.go @@ -14,6 +14,7 @@ import ( "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core/types" "github.com/rs/zerolog" + "github.com/smartcontractkit/ccip/integration-tests/ccip-tests/contracts" chain_selectors "github.com/smartcontractkit/chain-selectors" "github.com/smartcontractkit/wasp" "github.com/stretchr/testify/require" @@ -190,20 +191,20 @@ func (c *CCIPE2ELoad) CCIPMsg() (router.ClientEVM2AnyMessage, *testreporters.Req msg.TokenAmounts = []router.ClientEVMTokenAmount{} } - // var ( - // extraArgs []byte - // err error - // ) - // // v1.5.0 and later starts using V2 extra args - // matchErr := contracts.MatchContractVersionsOrAbove(map[contracts.Name]contracts.Version{ - // contracts.OnRampContract: contracts.V1_5_0, - // }) - // if matchErr != nil { - // extraArgs, err = testhelpers.GetEVMExtraArgsV1(big.NewInt(gasLimit), false) - // } else { - // extraArgs, err = testhelpers.GetEVMExtraArgsV2(big.NewInt(gasLimit), c.Lane.Source.Common.AllowOutOfOrder) - // } - extraArgs, err := testhelpers.GetEVMExtraArgsV1(big.NewInt(gasLimit), false) + var ( + extraArgs []byte + err error + ) + // v1.5.0 and later starts using V2 extra args + matchErr := contracts.MatchContractVersionsOrAbove(map[contracts.Name]contracts.Version{ + contracts.OnRampContract: contracts.V1_5_0, + }) + c.Lane.Logger.Info().Err(matchErr).Interface("Version Map", contracts.VersionMap).Msg("// DEBUG: matchErr") + if matchErr != nil { + extraArgs, err = testhelpers.GetEVMExtraArgsV1(big.NewInt(gasLimit), false) + } else { + extraArgs, err = testhelpers.GetEVMExtraArgsV2(big.NewInt(gasLimit), c.Lane.Source.Common.AllowOutOfOrder) + } if err != nil { return router.ClientEVM2AnyMessage{}, stats, err } From 5f2a2c86149d8690acc69c20e2f7b067ecb7ed46 Mon Sep 17 00:00:00 2001 From: Adam Hamrick Date: Fri, 13 Sep 2024 14:12:36 -0400 Subject: [PATCH 15/19] No more debug? --- integration-tests/ccip-tests/load/ccip_loadgen.go | 1 - 1 file changed, 1 deletion(-) diff --git a/integration-tests/ccip-tests/load/ccip_loadgen.go b/integration-tests/ccip-tests/load/ccip_loadgen.go index 297e78befd..fa6a113ec7 100644 --- a/integration-tests/ccip-tests/load/ccip_loadgen.go +++ b/integration-tests/ccip-tests/load/ccip_loadgen.go @@ -199,7 +199,6 @@ func (c *CCIPE2ELoad) CCIPMsg() (router.ClientEVM2AnyMessage, *testreporters.Req matchErr := contracts.MatchContractVersionsOrAbove(map[contracts.Name]contracts.Version{ contracts.OnRampContract: contracts.V1_5_0, }) - c.Lane.Logger.Info().Err(matchErr).Interface("Version Map", contracts.VersionMap).Msg("// DEBUG: matchErr") if matchErr != nil { extraArgs, err = testhelpers.GetEVMExtraArgsV1(big.NewInt(gasLimit), false) } else { From 36168c66b542568ea03cd49059de3a23ba0f79f8 Mon Sep 17 00:00:00 2001 From: Adam Hamrick Date: Fri, 13 Sep 2024 16:19:36 -0400 Subject: [PATCH 16/19] More debug?! --- integration-tests/ccip-tests/load/ccip_loadgen.go | 1 + 1 file changed, 1 insertion(+) diff --git a/integration-tests/ccip-tests/load/ccip_loadgen.go b/integration-tests/ccip-tests/load/ccip_loadgen.go index fa6a113ec7..f60ae6b3b9 100644 --- a/integration-tests/ccip-tests/load/ccip_loadgen.go +++ b/integration-tests/ccip-tests/load/ccip_loadgen.go @@ -199,6 +199,7 @@ func (c *CCIPE2ELoad) CCIPMsg() (router.ClientEVM2AnyMessage, *testreporters.Req matchErr := contracts.MatchContractVersionsOrAbove(map[contracts.Name]contracts.Version{ contracts.OnRampContract: contracts.V1_5_0, }) + c.Lane.Logger.Info().Err(matchErr).Interface("Version Map", contracts.VersionMap).Msg("// DEBUG: Debugging match err and results") if matchErr != nil { extraArgs, err = testhelpers.GetEVMExtraArgsV1(big.NewInt(gasLimit), false) } else { From 9a251ca61cb802e8a4e5cf6e9436fe5f858b519b Mon Sep 17 00:00:00 2001 From: Adam Hamrick Date: Mon, 16 Sep 2024 09:12:18 -0400 Subject: [PATCH 17/19] Hack --- integration-tests/ccip-tests/load/ccip_loadgen.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/integration-tests/ccip-tests/load/ccip_loadgen.go b/integration-tests/ccip-tests/load/ccip_loadgen.go index f60ae6b3b9..34a0094455 100644 --- a/integration-tests/ccip-tests/load/ccip_loadgen.go +++ b/integration-tests/ccip-tests/load/ccip_loadgen.go @@ -199,8 +199,11 @@ func (c *CCIPE2ELoad) CCIPMsg() (router.ClientEVM2AnyMessage, *testreporters.Req matchErr := contracts.MatchContractVersionsOrAbove(map[contracts.Name]contracts.Version{ contracts.OnRampContract: contracts.V1_5_0, }) - c.Lane.Logger.Info().Err(matchErr).Interface("Version Map", contracts.VersionMap).Msg("// DEBUG: Debugging match err and results") - if matchErr != nil { + // TODO: The CCIP Offchain upgrade tests make the AllowOutOfOrder flag tricky in this case. + // It runs with out of date contract versions at first, then upgrades them. So transactions will assume that the new contracts are there + // before being deployed. So setting v2 args will break the test. This is a bit of a hack to get around that. + // The test will soon be deprecated, so a temporary solution is fine. + if matchErr != nil && !c.Lane.Source.Common.AllowOutOfOrder { extraArgs, err = testhelpers.GetEVMExtraArgsV1(big.NewInt(gasLimit), false) } else { extraArgs, err = testhelpers.GetEVMExtraArgsV2(big.NewInt(gasLimit), c.Lane.Source.Common.AllowOutOfOrder) From e501a9b4c8bb7f0979f60c5f7d5d62670d136184 Mon Sep 17 00:00:00 2001 From: Adam Hamrick Date: Mon, 16 Sep 2024 09:49:47 -0400 Subject: [PATCH 18/19] Or not and --- integration-tests/ccip-tests/load/ccip_loadgen.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/integration-tests/ccip-tests/load/ccip_loadgen.go b/integration-tests/ccip-tests/load/ccip_loadgen.go index 34a0094455..c4fadfba5e 100644 --- a/integration-tests/ccip-tests/load/ccip_loadgen.go +++ b/integration-tests/ccip-tests/load/ccip_loadgen.go @@ -203,7 +203,8 @@ func (c *CCIPE2ELoad) CCIPMsg() (router.ClientEVM2AnyMessage, *testreporters.Req // It runs with out of date contract versions at first, then upgrades them. So transactions will assume that the new contracts are there // before being deployed. So setting v2 args will break the test. This is a bit of a hack to get around that. // The test will soon be deprecated, so a temporary solution is fine. - if matchErr != nil && !c.Lane.Source.Common.AllowOutOfOrder { + c.Lane.Logger.Info().Err(matchErr).Interface("Contract Versions", contracts.VersionMap).Bool("AllowOutOfOrder", c.Lane.Source.Common.AllowOutOfOrder).Msg("// DEBUG: matchErr") + if matchErr != nil || !c.Lane.Source.Common.AllowOutOfOrder { extraArgs, err = testhelpers.GetEVMExtraArgsV1(big.NewInt(gasLimit), false) } else { extraArgs, err = testhelpers.GetEVMExtraArgsV2(big.NewInt(gasLimit), c.Lane.Source.Common.AllowOutOfOrder) From 7ebdcf8016a9bb77501b0a0b5ba67daa64be3674 Mon Sep 17 00:00:00 2001 From: Adam Hamrick Date: Mon, 16 Sep 2024 10:43:33 -0400 Subject: [PATCH 19/19] Remove debug --- integration-tests/ccip-tests/load/ccip_loadgen.go | 1 - 1 file changed, 1 deletion(-) diff --git a/integration-tests/ccip-tests/load/ccip_loadgen.go b/integration-tests/ccip-tests/load/ccip_loadgen.go index c4fadfba5e..7064aac848 100644 --- a/integration-tests/ccip-tests/load/ccip_loadgen.go +++ b/integration-tests/ccip-tests/load/ccip_loadgen.go @@ -203,7 +203,6 @@ func (c *CCIPE2ELoad) CCIPMsg() (router.ClientEVM2AnyMessage, *testreporters.Req // It runs with out of date contract versions at first, then upgrades them. So transactions will assume that the new contracts are there // before being deployed. So setting v2 args will break the test. This is a bit of a hack to get around that. // The test will soon be deprecated, so a temporary solution is fine. - c.Lane.Logger.Info().Err(matchErr).Interface("Contract Versions", contracts.VersionMap).Bool("AllowOutOfOrder", c.Lane.Source.Common.AllowOutOfOrder).Msg("// DEBUG: matchErr") if matchErr != nil || !c.Lane.Source.Common.AllowOutOfOrder { extraArgs, err = testhelpers.GetEVMExtraArgsV1(big.NewInt(gasLimit), false) } else {