Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixed linting by changing to
Browse files Browse the repository at this point in the history
EasterTheBunny committed Nov 15, 2024
1 parent 9eb2c1f commit aaa773c
Showing 3 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions core/services/relay/evm/read/batch.go
Original file line number Diff line number Diff line change
@@ -128,7 +128,7 @@ func newDefaultEvmBatchCaller(
}

// batchCall formats a batch, calls the rpc client, and unpacks results.
// this function only returns errors of type ReadError which should wrap lower errors.
// this function only returns errors of type Error which should wrap lower errors.
func (c *defaultEvmBatchCaller) batchCall(ctx context.Context, blockNumber uint64, batchCall BatchCall) ([]dataAndErr, error) {
if len(batchCall) == 0 {
return nil, nil
@@ -147,7 +147,7 @@ func (c *defaultEvmBatchCaller) batchCall(ctx context.Context, blockNumber uint6
if err = c.evmClient.BatchCallContext(ctx, rpcBatchCalls); err != nil {
// return a basic read error with no detail or result since this is a general client
// error instead of an error for a specific batch call.
return nil, ReadError{
return nil, Error{
Err: fmt.Errorf("%w: batch call context: %s", types.ErrInternal, err.Error()),
Type: batchReadType,
}
@@ -290,7 +290,7 @@ func (c *defaultEvmBatchCaller) batchCallDynamicLimitRetries(ctx context.Context
}

if lim <= 1 {
return nil, ReadError{
return nil, Error{
Err: fmt.Errorf("%w: limited call: call data: %+v", err, calls),
Type: batchReadType,
}
10 changes: 5 additions & 5 deletions core/services/relay/evm/read/errors.go
Original file line number Diff line number Diff line change
@@ -18,7 +18,7 @@ const (
eventReadType readType = "QueryKey"
)

type ReadError struct {
type Error struct {
Err error
Type readType
Detail *readDetail
@@ -33,8 +33,8 @@ type readDetail struct {
Block string
}

func newErrorFromCall(err error, call Call, block string, tp readType) ReadError {
return ReadError{
func newErrorFromCall(err error, call Call, block string, tp readType) Error {
return Error{
Err: err,
Type: tp,
Detail: &readDetail{
@@ -48,7 +48,7 @@ func newErrorFromCall(err error, call Call, block string, tp readType) ReadError
}
}

func (e ReadError) Error() string {
func (e Error) Error() string {
var builder strings.Builder

builder.WriteString("[read error]")
@@ -71,7 +71,7 @@ func (e ReadError) Error() string {
return builder.String()
}

func (e ReadError) Unwrap() error {
func (e Error) Unwrap() error {
return e.Err
}

2 changes: 1 addition & 1 deletion core/services/relay/evm/read/method.go
Original file line number Diff line number Diff line change
@@ -68,7 +68,7 @@ func (b *MethodBinding) Bind(ctx context.Context, bindings ...common.Address) er
// check for contract byte code at the latest block and provided address
byteCode, err := b.client.CodeAt(ctx, binding, nil)
if err != nil {
return ReadError{
return Error{
Err: fmt.Errorf("%w: code at call failure: %s", commontypes.ErrInternal, err.Error()),
Type: singleReadType,
Detail: &readDetail{

0 comments on commit aaa773c

Please sign in to comment.