eth/filters: rangeLogs should error on invalid block range (#33763)
Some checks are pending
/ Keeper Build (push) Waiting to run
/ Linux Build (push) Waiting to run
/ Linux Build (arm) (push) Waiting to run
/ Windows Build (push) Waiting to run
/ Docker Image (push) Waiting to run

Fixes log filter to reject out of order block ranges.
This commit is contained in:
vickkkkkyy 2026-03-19 06:31:40 +08:00 committed by GitHub
parent b35645bdf7
commit 3341d8ace0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 3 additions and 2 deletions

View file

@ -390,7 +390,7 @@ func (f *Filter) rangeLogs(ctx context.Context, firstBlock, lastBlock uint64) ([
} }
if firstBlock > lastBlock { if firstBlock > lastBlock {
return nil, nil return nil, errInvalidBlockRange
} }
mb := f.sys.backend.NewMatcherBackend() mb := f.sys.backend.NewMatcherBackend()
defer mb.Close() defer mb.Close()

View file

@ -358,6 +358,7 @@ func testFilters(t *testing.T, history uint64, noHistory bool) {
}, },
{ {
f: sys.NewRangeFilter(int64(rpc.LatestBlockNumber), int64(rpc.FinalizedBlockNumber), nil, nil, 0), f: sys.NewRangeFilter(int64(rpc.LatestBlockNumber), int64(rpc.FinalizedBlockNumber), nil, nil, 0),
err: errInvalidBlockRange.Error(),
}, },
{ {
f: sys.NewRangeFilter(int64(rpc.SafeBlockNumber), int64(rpc.LatestBlockNumber), nil, nil, 0), f: sys.NewRangeFilter(int64(rpc.SafeBlockNumber), int64(rpc.LatestBlockNumber), nil, nil, 0),