Skip to content

Commit

Permalink
check requests type validity (#8175)
Browse files Browse the repository at this point in the history
  • Loading branch information
rjnrohit authored Feb 6, 2025
1 parent 78e38db commit f692ff1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ public static int GetRequestsByteSize(this IEnumerable<ExecutionRequest> request
public static Hash256 CalculateHashFromFlatEncodedRequests(byte[][]? flatEncodedRequests)
{
// make sure that length is 3 or less elements
if (flatEncodedRequests is null || flatEncodedRequests.Length > MaxRequestsCount)
if (flatEncodedRequests is null)
{
throw new ArgumentException("Flat encoded requests must be an array of 3 or less elements");
throw new ArgumentException("Flat encoded requests must be an array");
}

using SHA256 sha256 = SHA256.Create();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// SPDX-FileCopyrightText: 2023 Demerzel Solutions Limited
// SPDX-License-Identifier: LGPL-3.0-only

using System;
using System.Collections.Generic;
using System.Linq;
using Nethermind.Core;
Expand Down Expand Up @@ -48,12 +49,6 @@ public ValidationResult ValidateParams(IReleaseSpec spec, int version, out strin
return ValidationResult.Fail;
}

if (ExecutionRequests.Length > ExecutionRequestExtensions.MaxRequestsCount)
{
error = $"Execution requests must have less than {ExecutionRequestExtensions.MaxRequestsCount} items";
return ValidationResult.Fail;
}

// verification of the requests
for (int i = 0; i < ExecutionRequests.Length; i++)
{
Expand Down

0 comments on commit f692ff1

Please sign in to comment.