mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-17 20:02:43 +00:00
Enable arithmetic lint in rate-limiter (#7025)
https://github.com/sigp/lighthouse/issues/6875 - Enabled the linter in rate-limiter and fixed errors. - Changed the type of `Quota::max_tokens` from `u64` to `NonZeroU64` because `max_tokens` cannot be zero. - Added a test to ensure that a large value for `tokens`, which causes an overflow, is handled properly.
This commit is contained in:
@@ -316,6 +316,7 @@ mod tests {
|
||||
use crate::service::api_types::{AppRequestId, SingleLookupReqId, SyncRequestId};
|
||||
use libp2p::PeerId;
|
||||
use logging::create_test_tracing_subscriber;
|
||||
use std::num::NonZeroU64;
|
||||
use std::time::Duration;
|
||||
use types::{EthSpec, ForkContext, Hash256, MainnetEthSpec, Slot};
|
||||
|
||||
@@ -324,7 +325,7 @@ mod tests {
|
||||
async fn test_next_peer_request_ready() {
|
||||
create_test_tracing_subscriber();
|
||||
let config = OutboundRateLimiterConfig(RateLimiterConfig {
|
||||
ping_quota: Quota::n_every(1, 2),
|
||||
ping_quota: Quota::n_every(NonZeroU64::new(1).unwrap(), 2),
|
||||
..Default::default()
|
||||
});
|
||||
let fork_context = std::sync::Arc::new(ForkContext::new::<MainnetEthSpec>(
|
||||
|
||||
Reference in New Issue
Block a user