Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: enhanced eth_getLogs with timestamp range validation and new error handling #3431

Merged
Prev Previous commit
Next Next commit
feat: added new predefined error TIMESTAMP_RANGE_TOO_LARGE
Signed-off-by: Logan Nguyen <logan.nguyen@swirldslabs.com>
quiet-node committed Jan 27, 2025
commit 12899c7ed7d4be5a30f25923f5cbd5b8bb8857fd
5 changes: 5 additions & 0 deletions packages/relay/src/lib/errors/JsonRpcError.ts
Original file line number Diff line number Diff line change
@@ -133,6 +133,11 @@ export const predefined = {
code: -32000,
message: `Exceeded maximum block range: ${blockRange}`,
}),
TIMESTAMP_RANGE_TOO_LARGE: (fromBlock: string, fromTimestamp: number, toBlock: string, toTimestamp: number) =>
new JsonRpcError({
code: -32000,
message: `The provided fromBlock and toBlock contain timestamps that exceed the maximum allowed duration of 7 days (604800 seconds): fromBlock: ${fromBlock} (${fromTimestamp}), toBlock: ${toBlock} (${toTimestamp})`,
}),
REQUEST_BEYOND_HEAD_BLOCK: (requested: number, latest: number) =>
new JsonRpcError({
code: -32000,