From 29f7edf3ce0e9f91cf0293c286640e3a42516bec Mon Sep 17 00:00:00 2001 From: Valerii Kabisov <172247313+valerii-kabisov-cll@users.noreply.github.com> Date: Fri, 4 Oct 2024 22:58:42 +0900 Subject: [PATCH 1/2] Do not return the error in case if onRamp not initialized (#1487) ## Motivation For the exec provider, in some cases, the onRamp reader is not initialized. For immediate reaction, we need to allow execution without blocking in cases if onRamp is not initialized. It fails due the issue when onRampReader is not initialized for execProvider. This fix should fix this issue. In case the onRamp reader is not initialized, the module will return 0 values and DAGasEstimator will behave as it worked before this feature been implemented. --- .../services/ocr2/plugins/ccip/estimatorconfig/config.go | 3 +-- .../ocr2/plugins/ccip/estimatorconfig/config_test.go | 9 ++++++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/core/services/ocr2/plugins/ccip/estimatorconfig/config.go b/core/services/ocr2/plugins/ccip/estimatorconfig/config.go index 0e66f4fb39..4737bd33e8 100644 --- a/core/services/ocr2/plugins/ccip/estimatorconfig/config.go +++ b/core/services/ocr2/plugins/ccip/estimatorconfig/config.go @@ -2,7 +2,6 @@ package estimatorconfig import ( "context" - "errors" "math/big" "github.com/smartcontractkit/chainlink-common/pkg/types/ccip" @@ -42,7 +41,7 @@ func (c *FeeEstimatorConfigService) SetOnRampReader(reader ccip.OnRampReader) { // GetDynamicConfig should be cached in the onRamp reader to avoid unnecessary on-chain calls func (c *FeeEstimatorConfigService) GetDataAvailabilityConfig(ctx context.Context) (destDataAvailabilityOverheadGas, destGasPerDataAvailabilityByte, destDataAvailabilityMultiplierBps int64, err error) { if c.onRampReader == nil { - return 0, 0, 0, errors.New("no OnRampReader has been configured") + return 0, 0, 0, nil } cfg, err := c.onRampReader.GetDynamicConfig(ctx) diff --git a/core/services/ocr2/plugins/ccip/estimatorconfig/config_test.go b/core/services/ocr2/plugins/ccip/estimatorconfig/config_test.go index 0ed7510591..3ecd88ae3b 100644 --- a/core/services/ocr2/plugins/ccip/estimatorconfig/config_test.go +++ b/core/services/ocr2/plugins/ccip/estimatorconfig/config_test.go @@ -24,8 +24,11 @@ func TestFeeEstimatorConfigService(t *testing.T) { var expectedDestDataAvailabilityMultiplierBps int64 = 3 onRampReader := mocks.NewOnRampReader(t) - _, _, _, err := svc.GetDataAvailabilityConfig(ctx) - require.Error(t, err) + destDataAvailabilityOverheadGas, destGasPerDataAvailabilityByte, destDataAvailabilityMultiplierBps, err := svc.GetDataAvailabilityConfig(ctx) + require.NoError(t, err) // if onRampReader not set, return nil error and 0 values + require.EqualValues(t, 0, destDataAvailabilityOverheadGas) + require.EqualValues(t, 0, destGasPerDataAvailabilityByte) + require.EqualValues(t, 0, destDataAvailabilityMultiplierBps) svc.SetOnRampReader(onRampReader) onRampReader.On("GetDynamicConfig", ctx). @@ -35,7 +38,7 @@ func TestFeeEstimatorConfigService(t *testing.T) { DestDataAvailabilityMultiplierBps: uint16(expectedDestDataAvailabilityMultiplierBps), }, nil).Once() - destDataAvailabilityOverheadGas, destGasPerDataAvailabilityByte, destDataAvailabilityMultiplierBps, err := svc.GetDataAvailabilityConfig(ctx) + destDataAvailabilityOverheadGas, destGasPerDataAvailabilityByte, destDataAvailabilityMultiplierBps, err = svc.GetDataAvailabilityConfig(ctx) require.NoError(t, err) require.Equal(t, expectedDestDataAvailabilityOverheadGas, destDataAvailabilityOverheadGas) require.Equal(t, expectedDestGasPerDataAvailabilityByte, destGasPerDataAvailabilityByte) From ace434b861f94a1a4278a82818ed158110c37892 Mon Sep 17 00:00:00 2001 From: Jordan Krage Date: Fri, 4 Oct 2024 09:57:26 -0500 Subject: [PATCH 2/2] integration-tests: restore original module name; remove self-replace (#1478) ## Motivation The module import path for `integration-tests` was split brained between: - github.com/smartcontractkit/chainlink/integration-tests - github.com/smartcontractkit/ccip/integration-tests And patched with a self-replace: ``` github.com/smartcontractkit/chainlink/integration-tests => ../integration-tests ``` Which was breaking `gomods` ## Solution This PR removes the replace and restores the original import path, and re-enables gomods. --- GNUmakefile | 18 +++++------------- .../ccip-tests/load/ccip_loadgen.go | 13 ++++++------- integration-tests/docker/cmd/main.go | 2 +- integration-tests/go.mod | 4 +--- integration-tests/web/sdk/client/client.go | 4 ++-- 5 files changed, 15 insertions(+), 26 deletions(-) diff --git a/GNUmakefile b/GNUmakefile index 5804d2c9d4..62af10572d 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -27,12 +27,8 @@ gomod: ## Ensure chainlink's go dependencies are installed. go mod download .PHONY: gomodtidy -gomodtidy: ## Run go mod tidy on all modules. - go mod tidy - cd ./core/scripts && go mod tidy - cd ./integration-tests && go mod tidy - cd ./integration-tests/load && go mod tidy - cd ./dashboard-lib && go mod tidy +gomodtidy: gomods ## Run go mod tidy on all modules. + gomods tidy .PHONY: docs docs: ## Install and run pkgsite to view Go docs @@ -93,12 +89,8 @@ abigen: ## Build & install abigen. ./tools/bin/build_abigen .PHONY: generate -generate: pnpmdep abigen codecgen mockery protoc ## Execute all go:generate commands. - go generate -x ./... - cd ./core/scripts && go generate -x ./... - cd ./integration-tests && go generate -x ./... - cd ./integration-tests/load && go generate -x ./... - cd ./dashboard-lib && go generate -x ./... +generate: pnpmdep abigen codecgen mockery protoc gomods ## Execute all go:generate commands. + gomods -w go generate -x ./... mockery .PHONY: rm-mocked @@ -140,7 +132,7 @@ presubmit: ## Format go files and imports. .PHONY: gomods gomods: ## Install gomods - go install github.com/jmank88/gomods@v0.1.1 + go install github.com/jmank88/gomods@v0.1.5 .PHONY: mockery mockery: $(mockery) ## Install mockery. diff --git a/integration-tests/ccip-tests/load/ccip_loadgen.go b/integration-tests/ccip-tests/load/ccip_loadgen.go index 89804dbf8a..8a3059feca 100644 --- a/integration-tests/ccip-tests/load/ccip_loadgen.go +++ b/integration-tests/ccip-tests/load/ccip_loadgen.go @@ -10,28 +10,27 @@ import ( "testing" "time" - "github.com/smartcontractkit/chainlink-testing-framework/lib/utils/testcontext" - "github.com/AlekSi/pointer" "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/stretchr/testify/require" "go.uber.org/atomic" + chain_selectors "github.com/smartcontractkit/chain-selectors" + + "github.com/smartcontractkit/chainlink-testing-framework/lib/utils/testcontext" "github.com/smartcontractkit/chainlink-testing-framework/wasp" "github.com/smartcontractkit/chainlink-common/pkg/config" + "github.com/smartcontractkit/chainlink/integration-tests/ccip-tests/actions" + "github.com/smartcontractkit/chainlink/integration-tests/ccip-tests/contracts" "github.com/smartcontractkit/chainlink/integration-tests/ccip-tests/testconfig" + "github.com/smartcontractkit/chainlink/integration-tests/ccip-tests/testreporters" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/utils" "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ccip/generated/router" "github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/ccip/testhelpers" - - "github.com/smartcontractkit/chainlink/integration-tests/ccip-tests/actions" - "github.com/smartcontractkit/chainlink/integration-tests/ccip-tests/testreporters" ) // CCIPLaneOptimized is a light-weight version of CCIPLane, It only contains elements which are used during load triggering and validation diff --git a/integration-tests/docker/cmd/main.go b/integration-tests/docker/cmd/main.go index 2d61904f3e..e10a82d5cc 100644 --- a/integration-tests/docker/cmd/main.go +++ b/integration-tests/docker/cmd/main.go @@ -10,7 +10,7 @@ import ( "github.com/spf13/cobra" "github.com/testcontainers/testcontainers-go" - "github.com/smartcontractkit/ccip/integration-tests/docker/cmd/internal" + "github.com/smartcontractkit/chainlink/integration-tests/docker/cmd/internal" ) var rootCmd = &cobra.Command{ diff --git a/integration-tests/go.mod b/integration-tests/go.mod index f11f609258..1e949b536e 100644 --- a/integration-tests/go.mod +++ b/integration-tests/go.mod @@ -1,4 +1,4 @@ -module github.com/smartcontractkit/ccip/integration-tests +module github.com/smartcontractkit/chainlink/integration-tests go 1.22.5 @@ -40,7 +40,6 @@ require ( github.com/smartcontractkit/chainlink-testing-framework/lib/grafana v1.50.0 github.com/smartcontractkit/chainlink-testing-framework/seth v1.50.2 github.com/smartcontractkit/chainlink-testing-framework/wasp v1.50.0 - github.com/smartcontractkit/chainlink/integration-tests v0.0.0-00010101000000-000000000000 github.com/smartcontractkit/chainlink/v2 v2.0.0-00010101000000-000000000000 github.com/smartcontractkit/libocr v0.0.0-20240717100443-f6226e09bee7 github.com/spf13/cobra v1.8.1 @@ -528,7 +527,6 @@ replace ( // type func(a Label, b Label) bool of func(a, b Label) bool {…} does not match inferred type func(a Label, b Label) int for func(a E, b E) int github.com/prometheus/prometheus => github.com/prometheus/prometheus v0.47.2-0.20231010075449-4b9c19fe5510 - github.com/smartcontractkit/chainlink/integration-tests => ../integration-tests ) exclude github.com/sourcegraph/sourcegraph/lib v0.0.0-20221216004406-749998a2ac74 diff --git a/integration-tests/web/sdk/client/client.go b/integration-tests/web/sdk/client/client.go index e13a02aa5a..454e18a234 100644 --- a/integration-tests/web/sdk/client/client.go +++ b/integration-tests/web/sdk/client/client.go @@ -9,8 +9,8 @@ import ( "github.com/Khan/genqlient/graphql" - "github.com/smartcontractkit/ccip/integration-tests/web/sdk/client/internal/doer" - "github.com/smartcontractkit/ccip/integration-tests/web/sdk/internal/generated" + "github.com/smartcontractkit/chainlink/integration-tests/web/sdk/client/internal/doer" + "github.com/smartcontractkit/chainlink/integration-tests/web/sdk/internal/generated" ) type Client interface {