Skip to content

Commit

Permalink
check inputs
Browse files Browse the repository at this point in the history
  • Loading branch information
kajoseph committed Sep 20, 2024
1 parent f81ffb5 commit 1a871e2
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -551,10 +551,12 @@ export class BaseEVMStateProvider extends InternalStateProvider implements IChai
args.endBlock = Math.min(args.endBlock ?? tip, tip);
args.startBlock = Math.max(args.startBlock != null ? Number(args.startBlock) : args.endBlock - 10000, 0);

if (args.endBlock - args.startBlock > 10000) {
throw new Error('Cannot scan more than 10000 blocks at a time. Please limit your search with startBlock and endBlock');
if (isNaN(args.startBlock!) || isNaN(args.endBlock!)) {
throw new Error('startBlock and endBlock must be numbers');
} else if (args.endBlock < args.startBlock) {
throw new Error('startBlock cannot be greater than endBlock');
} else if (args.endBlock - args.startBlock > 10000) {
throw new Error('Cannot scan more than 10000 blocks at a time. Please limit your search with startBlock and endBlock');
}

windowSize = Math.min(windowSize, args.endBlock - args.startBlock);
Expand Down

0 comments on commit 1a871e2

Please sign in to comment.