diff --git a/src/rpc/methods/eth.rs b/src/rpc/methods/eth.rs index d978338e4e59..8d1ede8b72b4 100644 --- a/src/rpc/methods/eth.rs +++ b/src/rpc/methods/eth.rs @@ -3872,7 +3872,7 @@ impl RpcMethod<1> for EthTraceFilter { let range = i64::try_from(to_block.0.saturating_sub(from_block.0)) .context("block range overflow")?; if range > max_block_range { - return Err(EthErrors::limit_exceeded(max_block_range as u64, range as u64).into()); + return Err(EthErrors::limit_exceeded(max_block_range, range).into()); } } Ok(trace_filter(ctx, filter, from_block, to_block, ext).await?) diff --git a/src/rpc/methods/eth/errors.rs b/src/rpc/methods/eth/errors.rs index fe0d725f060f..79d724e3124f 100644 --- a/src/rpc/methods/eth/errors.rs +++ b/src/rpc/methods/eth/errors.rs @@ -20,8 +20,8 @@ pub enum EthErrors { ExecutionReverted { message: String, data: String }, #[error("{message}")] BlockRangeExceeded { - max: u64, - given: u64, + max: i64, + given: i64, message: String, }, } @@ -43,7 +43,7 @@ impl EthErrors { } } - pub fn limit_exceeded(max_block_range: u64, given: u64) -> Self { + pub fn limit_exceeded(max_block_range: i64, given: i64) -> Self { Self::BlockRangeExceeded { max: max_block_range, given, diff --git a/src/rpc/methods/eth/filter/mod.rs b/src/rpc/methods/eth/filter/mod.rs index a06922f649b7..40e5d12a78c7 100644 --- a/src/rpc/methods/eth/filter/mod.rs +++ b/src/rpc/methods/eth/filter/mod.rs @@ -553,12 +553,12 @@ fn parse_block_range( if min_height == -1 && max_height > 0 { ensure!( max_height - heaviest <= max_range, - EthErrors::limit_exceeded(max_range as u64, (max_height - heaviest) as u64), + EthErrors::limit_exceeded(max_range, max_height - heaviest), ); } else if min_height >= 0 && max_height == -1 { ensure!( heaviest - min_height <= max_range, - EthErrors::limit_exceeded(max_range as u64, (heaviest - min_height) as u64) + EthErrors::limit_exceeded(max_range, heaviest - min_height) ); } else if min_height >= 0 && max_height >= 0 { ensure!( @@ -569,7 +569,7 @@ fn parse_block_range( ); ensure!( max_height - min_height <= max_range, - EthErrors::limit_exceeded(max_range as u64, (max_height - min_height) as u64) + EthErrors::limit_exceeded(max_range, max_height - min_height) ); }