@@ -19,19 +19,25 @@ var (
19
19
20
20
// read chunkedFilterLogs comment for additional information.
21
21
//
22
- // NOTE: There is no standard reply among providers, add as needed. This
23
- // function assumes that any server side error codes represent block range that
24
- // is too large.
25
- // ┌────────────────────────────┬───────┬────────┬────────────┐
26
- // │ provider │ limit │ code │ checked at │
27
- // ├────────────────────────────┼───────┼────────┼────────────┤
28
- // │ https://cloudflare-eth.com │ 800 │ -32047 │ 2025-01-24 │
29
- // └────────────────────────────┴───────┴────────┴────────────┘
22
+ // NOTE: There is no standard reply among providers, add as needed. To handle a
23
+ // new provider add it to the table below and make queryBlockRangeTooLarge
24
+ // return true when encountering its RPC error code.
25
+ // ┌───────────────────────────────────────────────────┬───────┬────────┬────────────┐
26
+ // │ provider │ limit │ code │ checked at │
27
+ // ├───────────────────────────────────────────────────┼───────┼────────┼────────────┤
28
+ // │ https://cloudflare-eth.com/ │ 800 │ -32047 │ 2025-01-24 │
29
+ // │ https://eth-mainnet.g.alchemy.com/v2/{key} (free) │ 500 │ -32600 │ 2025-05-13 │
30
+ // │ https://mainnet.infura.io/v3/{key} (free) │ 10000 │ -32005 │ 2025-05-15 │
31
+ // │ https://site1.moralis-nodes.com/eth/{key} (free) │ 100 │ 400 │ 2025-05-15 │
32
+ // └───────────────────────────────────────────────────┴───────┴────────┴────────────┘
30
33
func queryBlockRangeTooLarge (err error ) bool {
31
34
if err != nil {
32
35
switch e := err .(type ) {
33
36
case rpc.Error :
34
- return - 32099 <= e .ErrorCode () && e .ErrorCode () <= - 32000
37
+ return (e .ErrorCode () == - 32047 ) || // cloudflare (free)
38
+ (e .ErrorCode () == - 32600 ) || // alchemy (free)
39
+ (e .ErrorCode () == - 32005 ) || // infura (free)
40
+ (e .ErrorCode () == 400 ) // moralis (free)
35
41
}
36
42
}
37
43
return false
0 commit comments