Skip to content

Commit

Permalink
add block limit error
Browse files Browse the repository at this point in the history
  • Loading branch information
rjnrohit committed Dec 16, 2024
1 parent b2b143a commit 7ae3d74
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/Nethermind/Nethermind.JsonRpc/ErrorCodes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -111,5 +111,10 @@ public static class ErrorCodes
/// Invalid RPC simulate call transaction
/// </summary>
public const int InvalidTransaction = -38014;

/// <summary>
/// Too many blocks for simulation
/// </summary>
public const int ClientLimitExceededError = -38026;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,11 @@ public override ResultWrapper<IReadOnlyList<SimulateBlockResult>> Execute(
return ResultWrapper<IReadOnlyList<SimulateBlockResult>>.Fail(
$"Block number out of order {givenNumber} is < than given base number of {header.Number}!", ErrorCodes.InvalidInputBlocksOutOfOrder);

// if the no. of filler blocks are greater than maximum simulate blocks cap
if (givenNumber - (ulong)lastBlockNumber > (ulong)_blocksLimit)
return ResultWrapper<IReadOnlyList<SimulateBlockResult>>.Fail(
$"too many blocks",
ErrorCodes.ClientLimitExceededError);

for (ulong fillBlockNumber = (ulong)lastBlockNumber + 1; fillBlockNumber < givenNumber; fillBlockNumber++)
{
Expand Down

0 comments on commit 7ae3d74

Please sign in to comment.