diff --git a/core/chains/evm/gas/rollups/custom_calldata_da_oracle.go b/core/chains/evm/gas/rollups/custom_calldata_da_oracle.go index d9097e5cf74..9992391db2b 100644 --- a/core/chains/evm/gas/rollups/custom_calldata_da_oracle.go +++ b/core/chains/evm/gas/rollups/custom_calldata_da_oracle.go @@ -3,6 +3,7 @@ package rollups import ( "context" "encoding/hex" + "errors" "fmt" "math/big" "strings" @@ -44,7 +45,7 @@ func NewCustomCalldataDAOracle(lggr logger.Logger, ethClient l1OracleClient, cha return nil, fmt.Errorf("expected %s oracle type, got %s", toml.DAOracleCustomCalldata, daOracleConfig.OracleType()) } if daOracleConfig.CustomGasPriceCalldata() == "" { - return nil, fmt.Errorf("CustomGasPriceCalldata is required") + return nil, errors.New("CustomGasPriceCalldata is required") } return &customCalldataDAOracle{ client: ethClient, @@ -137,15 +138,15 @@ func (o *customCalldataDAOracle) GasPrice(_ context.Context) (daGasPrice *assets o.daGasPriceMu.RUnlock() }) if !ok { - return daGasPrice, fmt.Errorf("DAGasOracle is not started; cannot estimate gas") + return daGasPrice, errors.New("DAGasOracle is not started; cannot estimate gas") } if daGasPrice == nil { - return daGasPrice, fmt.Errorf("failed to get DA gas price; gas price not set") + return daGasPrice, errors.New("failed to get DA gas price; gas price not set") } // Validate the price has been updated within the pollPeriod * 2 // Allowing double the poll period before declaring the price stale to give ample time for the refresh to process if time.Since(timestamp) > o.pollPeriod*2 { - return daGasPrice, fmt.Errorf("gas price is stale") + return daGasPrice, errors.New("gas price is stale") } return } @@ -155,14 +156,14 @@ func (o *customCalldataDAOracle) getCustomCalldataGasPrice(ctx context.Context) calldata := strings.TrimPrefix(o.daOracleConfig.CustomGasPriceCalldata(), "0x") calldataBytes, err := hex.DecodeString(calldata) if err != nil { - return nil, fmt.Errorf("failed to decode custom fee method calldata: %w", err) + return nil, fmt.Errorf("failed to decode custom fee method calldata: %v", err) } b, err := o.client.CallContract(ctx, ethereum.CallMsg{ To: &daOracleAddress, Data: calldataBytes, }, nil) if err != nil { - return nil, fmt.Errorf("custom fee method call failed: %w", err) + return nil, fmt.Errorf("custom fee method call failed: %v", err) } return new(big.Int).SetBytes(b), nil } diff --git a/core/chains/evm/gas/rollups/custom_calldata_da_oracle_test.go b/core/chains/evm/gas/rollups/custom_calldata_da_oracle_test.go index a8b79167131..3dcb08d9aeb 100644 --- a/core/chains/evm/gas/rollups/custom_calldata_da_oracle_test.go +++ b/core/chains/evm/gas/rollups/custom_calldata_da_oracle_test.go @@ -1,7 +1,7 @@ package rollups import ( - "fmt" + "errors" "math/big" "testing" @@ -94,7 +94,7 @@ func TestCustomCalldataDAOracle_getCustomCalldataGasPrice(t *testing.T) { oracle, err := NewCustomCalldataDAOracle(logger.Test(t), ethClient, chaintype.ChainCelo, daOracleConfig) require.NoError(t, err) - ethClient.On("CallContract", mock.Anything, mock.Anything, mock.Anything).Return(nil, fmt.Errorf("RPC failure")).Once() + ethClient.On("CallContract", mock.Anything, mock.Anything, mock.Anything).Return(nil, errors.New("RPC failure")).Once() _, err = oracle.getCustomCalldataGasPrice(tests.Context(t)) require.Error(t, err)