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)