Skip to content

Commit 0b859c0

Browse files
fix(rpc): validate fee history reward percentiles (#20198)
1 parent a8e0606 commit 0b859c0

File tree

1 file changed

+2
-1
lines changed
  • crates/rpc/rpc-eth-api/src/helpers

1 file changed

+2
-1
lines changed

crates/rpc/rpc-eth-api/src/helpers/fee.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,8 @@ pub trait EthFees:
110110
// increasing and 0 <= p <= 100
111111
// Note: The types used ensure that the percentiles are never < 0
112112
if let Some(percentiles) = &reward_percentiles &&
113-
percentiles.windows(2).any(|w| w[0] > w[1] || w[0] > 100.)
113+
(percentiles.iter().any(|p| *p < 0.0 || *p > 100.0) ||
114+
percentiles.windows(2).any(|w| w[0] > w[1]))
114115
{
115116
return Err(EthApiError::InvalidRewardPercentiles.into())
116117
}

0 commit comments

Comments
 (0)