Skip to content

Commit

Permalink
Handle geth abi panic when encoding data word value comparators
Browse files Browse the repository at this point in the history
  • Loading branch information
ilija42 committed Sep 25, 2024
1 parent 024d87d commit c4ebced
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions core/services/relay/evm/read/event.go
Original file line number Diff line number Diff line change
Expand Up @@ -548,6 +548,12 @@ func (b *EventBinding) encodeComparator(comparator *primitives.Comparator) (quer
}

func (b *EventBinding) encodeValComparatorDataWord(dwTypeID string, value any) (hash common.Hash, err error) {
defer func() {
if r := recover(); r != nil {
err = fmt.Errorf("%w: cannot encode %s data word comparator", dwTypeID, commontypes.ErrInvalidType)

Check failure on line 553 in core/services/relay/evm/read/event.go

View workflow job for this annotation

GitHub Actions / Core Tests (go_core_tests)

fmt.Errorf format %w has arg dwTypeID of wrong type string

Check failure on line 553 in core/services/relay/evm/read/event.go

View workflow job for this annotation

GitHub Actions / Core Tests (go_core_race_tests)

fmt.Errorf format %w has arg dwTypeID of wrong type string
}
}()

dwTypes, exists := b.eventTypes[dwTypeID]
if !exists {
return common.Hash{}, fmt.Errorf("cannot find data word type for %s", dwTypeID)
Expand Down

0 comments on commit c4ebced

Please sign in to comment.