Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion common/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
reExceededBlockRange = regexp.MustCompile(`exceeded maximum block range:\s*(\d+)`)
// Matches "eth_getLogs is limited to a 10,000 range" (number may contain comma thousands separators)
reEthGetLogsLimited = regexp.MustCompile(`eth_getLogs is limited to a\s+([\d,]+)\s+range`)
// Matches "query exceeds max block range 100000"
reQueryExceedsMaxBlockRange = regexp.MustCompile(`query exceeds max block range\s+(\d+)`)
)

// ParseMaxRangeFromError extracts the max range value from error message
Expand All @@ -23,7 +25,7 @@
// - "eth_getLogs is limited to a 10,000 range"
func ParseMaxRangeFromError(errMsg string) (uint64, bool) {
var matches []string
for _, re := range []*regexp.Regexp{reMaxRange, reExceededBlockRange, reEthGetLogsLimited} {
for _, re := range []*regexp.Regexp{reMaxRange, reExceededBlockRange, reEthGetLogsLimited, reQueryExceedsMaxBlockRange} {

Check failure on line 28 in common/errors.go

View workflow job for this annotation

GitHub Actions / lint

The line is 122 characters long, which exceeds the maximum of 120 characters. (lll)
matches = re.FindStringSubmatch(errMsg)
if len(matches) >= maxRangeMatchGroups {
break
Expand Down
12 changes: 12 additions & 0 deletions common/errors_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,18 @@ func TestParseMaxRangeFromError(t *testing.T) {
expectedMaxBlock: 100000,
expectedIsMaxRange: true,
},
{
name: "query exceeds max block range",
errorMsg: "query exceeds max block range 100000",
expectedMaxBlock: 100000,
expectedIsMaxRange: true,
},
{
name: "query exceeds max block range embedded in longer message",
errorMsg: "claimsync: FilterLogs error: query exceeds max block range 100000",
expectedMaxBlock: 100000,
expectedIsMaxRange: true,
},
}

for _, tt := range tests {
Expand Down
Loading