Skip to content

Commit

Permalink
fixed bug related to differences in cursor structure (#14579)
Browse files Browse the repository at this point in the history
* fixed bug related to differences in cursor structure

* Update core/chains/evm/logpoller/parser.go

Co-authored-by: Jordan Krage <jmank88@gmail.com>

* reference new func

---------

Co-authored-by: Jordan Krage <jmank88@gmail.com>
  • Loading branch information
EasterTheBunny and jmank88 authored Sep 27, 2024
1 parent 133e347 commit f9fe452
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 6 additions & 0 deletions core/chains/evm/logpoller/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,12 @@ func orderToString(dir query.SortDirection) (string, error) {
}
}

// MakeContractReaderCursor is exported to ensure cursor structure remains consistent.
func FormatContractReaderCursor(log Log) string {
return fmt.Sprintf("%d-%d-%s", log.BlockNumber, log.LogIndex, log.TxHash)
}

// ensure valuesFromCursor remains consistent with the function above that creates a cursor
func valuesFromCursor(cursor string) (int64, int, []byte, error) {
partCount := 3

Expand Down
2 changes: 1 addition & 1 deletion core/services/relay/evm/read/event.go
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ func (b *EventBinding) decodeLogsIntoSequences(ctx context.Context, logs []logpo

for idx := range logs {
sequences[idx] = commontypes.Sequence{
Cursor: fmt.Sprintf("%s-%s-%d", logs[idx].BlockHash, logs[idx].TxHash, logs[idx].LogIndex),
Cursor: logpoller.FormatContractReaderCursor(logs[idx]),
Head: commontypes.Head{
Height: fmt.Sprint(logs[idx].BlockNumber),
Hash: logs[idx].BlockHash.Bytes(),
Expand Down

0 comments on commit f9fe452

Please sign in to comment.