eth/filters: return -32602 for block range limit exceeded error

The eth_getLogs endpoint was returning -32000 (server error) when the
requested block range exceeded the configured limit. This was inconsistent
with other parameter validation errors in the same package which return
-32602 (invalid params), and also inconsistent with Reth which returns
-32602 for the same condition.

This change makes the block range limit error return -32602, aligning it
with the rest of the parameter validation errors in eth/filters and with
other client implementations.

Fixes #34646
This commit is contained in:
Kubudak90 2026-04-05 02:52:06 +03:00
parent d8cb8a962b
commit 5596261772

View file

@ -147,7 +147,7 @@ func (f *Filter) Logs(ctx context.Context) ([]*types.Log, error) {
return nil, err
}
if f.rangeLimit != 0 && (end-begin) > f.rangeLimit {
return nil, fmt.Errorf("exceed maximum block range: %d", f.rangeLimit)
return nil, invalidParamsErr("exceed maximum block range: %d", f.rangeLimit)
}
return f.rangeLogs(ctx, begin, end)
}