Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
ogtownsend committed Oct 21, 2024
1 parent 3014ee4 commit 22a3d53
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
9 changes: 5 additions & 4 deletions core/chains/evm/gas/rollups/custom_calldata_da_oracle.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package rollups
import (
"context"
"encoding/hex"
"errors"
"fmt"
"math/big"
"strings"
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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
}
Expand Down
4 changes: 2 additions & 2 deletions core/chains/evm/gas/rollups/custom_calldata_da_oracle_test.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package rollups

import (
"fmt"
"errors"
"math/big"
"testing"

Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 22a3d53

Please sign in to comment.