Skip to content

Commit

Permalink
Maximum cursor uses int32 not uint32 so this overflows
Browse files Browse the repository at this point in the history
  • Loading branch information
Shaptic committed Nov 7, 2024
1 parent 7d5c6e5 commit 5d804ad
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
6 changes: 3 additions & 3 deletions cmd/soroban-rpc/internal/db/cursor.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,9 @@ var (
// MaxCursor is the largest possible cursor
//nolint:gochecknoglobals
MaxCursor = Cursor{
Ledger: math.MaxUint32,
Tx: math.MaxUint32,
Op: math.MaxUint32,
Ledger: math.MaxInt32,
Tx: math.MaxInt32,
Op: math.MaxInt32,
Event: math.MaxUint32,
}
)
2 changes: 0 additions & 2 deletions cmd/soroban-rpc/internal/methods/get_events.go
Original file line number Diff line number Diff line change
Expand Up @@ -446,10 +446,8 @@ func (h eventsRPCHandler) getEvents(ctx context.Context, request GetEventsReques
}
}
endLedger := start.Ledger + LedgerScanLimit

// endLedger should not exceed ledger retention window
endLedger = min(ledgerRange.LastLedger.Sequence+1, endLedger)

if request.EndLedger != 0 {
endLedger = min(request.EndLedger, endLedger)
}
Expand Down

0 comments on commit 5d804ad

Please sign in to comment.