Skip to content
This repository has been archived by the owner on Apr 4, 2024. It is now read-only.

Commit

Permalink
fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
thomas-nguy committed Jul 26, 2021
1 parent baaae15 commit 3bbfcce
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
5 changes: 3 additions & 2 deletions ethereum/rpc/namespaces/eth/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@ import (
"context"
"encoding/json"
"fmt"
"math/big"
"strings"

"github.com/ethereum/go-ethereum/core/vm"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
"math/big"
"strings"

"github.com/pkg/errors"
"github.com/spf13/viper"
Expand Down
2 changes: 1 addition & 1 deletion x/evm/keeper/grpc_query.go
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@ func (k Keeper) EstimateGas(c context.Context, req *types.EthCallRequest) (*type

// Binary search the gas requirement, as it may be higher than the amount used
var (
lo uint64 = ethparams.TxGas - 1
lo = ethparams.TxGas - 1
hi uint64
cap uint64
)
Expand Down
13 changes: 7 additions & 6 deletions x/evm/types/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package types
import (
"errors"
"fmt"

sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
"github.com/ethereum/go-ethereum/common"

Expand Down Expand Up @@ -78,33 +79,33 @@ var (

// NewExecErrorWithReason unpacks the revert return bytes and returns a wrapped error
// with the return reason.
func NewExecErrorWithReason(revertReason []byte) *revertError {
func NewExecErrorWithReason(revertReason []byte) *RevertError {
var result = common.CopyBytes(revertReason)
reason, errUnpack := abi.UnpackRevert(result)
err := errors.New("execution reverted")
if errUnpack == nil {
err = fmt.Errorf("execution reverted: %v", reason)
}
return &revertError{
return &RevertError{
error: err,
reason: hexutil.Encode(result),
}
}

// revertError is an API error that encompass an EVM revert with JSON error
// RevertError is an API error that encompass an EVM revert with JSON error
// code and a binary data blob.
type revertError struct {
type RevertError struct {
error
reason string // revert reason hex encoded
}

// ErrorCode returns the JSON error code for a revert.
// See: https://github.com/ethereum/wiki/wiki/JSON-RPC-Error-Codes-Improvement-Proposal
func (e *revertError) ErrorCode() int {
func (e *RevertError) ErrorCode() int {
return 3
}

// ErrorData returns the hex encoded revert reason.
func (e *revertError) ErrorData() interface{} {
func (e *RevertError) ErrorData() interface{} {
return e.reason
}

0 comments on commit 3bbfcce

Please sign in to comment.