diff --git a/core/services/relay/evm/read/batch.go b/core/services/relay/evm/read/batch.go index fabb293db95..16333149f11 100644 --- a/core/services/relay/evm/read/batch.go +++ b/core/services/relay/evm/read/batch.go @@ -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, } diff --git a/core/services/relay/evm/read/errors.go b/core/services/relay/evm/read/errors.go index d8bd484a6da..422b7ded1d8 100644 --- a/core/services/relay/evm/read/errors.go +++ b/core/services/relay/evm/read/errors.go @@ -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 } diff --git a/core/services/relay/evm/read/method.go b/core/services/relay/evm/read/method.go index b1642023ec4..e988e4352f7 100644 --- a/core/services/relay/evm/read/method.go +++ b/core/services/relay/evm/read/method.go @@ -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{