Skip to content

Commit f9fe452

Browse files
fixed bug related to differences in cursor structure (#14579)
* 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>
1 parent 133e347 commit f9fe452

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

core/chains/evm/logpoller/parser.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -432,6 +432,12 @@ func orderToString(dir query.SortDirection) (string, error) {
432432
}
433433
}
434434

435+
// MakeContractReaderCursor is exported to ensure cursor structure remains consistent.
436+
func FormatContractReaderCursor(log Log) string {
437+
return fmt.Sprintf("%d-%d-%s", log.BlockNumber, log.LogIndex, log.TxHash)
438+
}
439+
440+
// ensure valuesFromCursor remains consistent with the function above that creates a cursor
435441
func valuesFromCursor(cursor string) (int64, int, []byte, error) {
436442
partCount := 3
437443

core/services/relay/evm/read/event.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ func (b *EventBinding) decodeLogsIntoSequences(ctx context.Context, logs []logpo
338338

339339
for idx := range logs {
340340
sequences[idx] = commontypes.Sequence{
341-
Cursor: fmt.Sprintf("%s-%s-%d", logs[idx].BlockHash, logs[idx].TxHash, logs[idx].LogIndex),
341+
Cursor: logpoller.FormatContractReaderCursor(logs[idx]),
342342
Head: commontypes.Head{
343343
Height: fmt.Sprint(logs[idx].BlockNumber),
344344
Hash: logs[idx].BlockHash.Bytes(),

0 commit comments

Comments
 (0)