Skip to content

Commit

Permalink
Added nil err check
Browse files Browse the repository at this point in the history
  • Loading branch information
silaslenihan committed Oct 3, 2024
1 parent 65e58b0 commit 2dd8974
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 15 deletions.
2 changes: 1 addition & 1 deletion core/services/relay/evm/evmtesting/run_tests.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ func RunContractReaderEvmTests[T TestingT[T]](t T, it *EVMChainComponentsInterfa

func RunContractReaderInLoopTests[T TestingT[T]](t T, it ChainComponentsInterfaceTester[T]) {
RunContractReaderInterfaceTests[T](t, it, false)

it.Setup(t)
ctx := tests.Context(t)
cr := it.GetContractReader(t)
Expand Down
32 changes: 18 additions & 14 deletions core/services/relay/evm/read/event.go
Original file line number Diff line number Diff line change
Expand Up @@ -240,17 +240,19 @@ func (b *EventBinding) GetLatestValue(ctx context.Context, address common.Addres
)

defer func() {
callErr := newErrorFromCall(err, Call{
ContractAddress: address,
ContractName: b.contractName,
MethodName: b.eventName,
Params: params,
ReturnVal: into,
}, strconv.Itoa(int(confs)), false)
if err != nil {
callErr := newErrorFromCall(err, Call{
ContractAddress: address,
ContractName: b.contractName,
MethodName: b.eventName,
Params: params,
ReturnVal: into,
}, strconv.Itoa(int(confs)), false)

callErr.Result = result
callErr.Result = result

err = callErr
err = callErr
}
}()

if err = b.validateBound(address); err != nil {
Expand Down Expand Up @@ -303,11 +305,13 @@ func (b *EventBinding) GetLatestValue(ctx context.Context, address common.Addres

func (b *EventBinding) QueryKey(ctx context.Context, address common.Address, filter query.KeyFilter, limitAndSort query.LimitAndSort, sequenceDataType any) (sequences []commontypes.Sequence, err error) {
defer func() {
err = newErrorFromCall(err, Call{
ContractAddress: address,
ContractName: b.contractName,
MethodName: b.eventName,
}, "", false)
if err != nil {
err = newErrorFromCall(err, Call{
ContractAddress: address,
ContractName: b.contractName,
MethodName: b.eventName,
}, "", false)
}
}()

if err = b.validateBound(address); err != nil {
Expand Down

0 comments on commit 2dd8974

Please sign in to comment.