mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-17 11:52:42 +00:00
Make max_blobs_per_block a config parameter (#6329)
* First pass
* Add restrictions to RuntimeVariableList api
* Use empty_uninitialized and fix warnings
* Fix some todos
* Merge branch 'unstable' into max-blobs-preset
* Fix take impl on RuntimeFixedList
* cleanup
* Fix test compilations
* Fix some more tests
* Fix test from unstable
* Merge branch 'unstable' into max-blobs-preset
* Merge remote-tracking branch 'origin/unstable' into max-blobs-preset
* Remove footgun function
* Minor simplifications
* Move from preset to config
* Fix typo
* Revert "Remove footgun function"
This reverts commit de01f923c7.
* Try fixing tests
* Thread through ChainSpec
* Fix release tests
* Move RuntimeFixedVector into module and rename
* Add test
* Remove empty RuntimeVarList awefullness
* Fix tests
* Simplify BlobSidecarListFromRoot
* Merge remote-tracking branch 'origin/unstable' into max-blobs-preset
* Bump quota to account for new target (6)
* Remove clone
* Fix issue from review
* Try to remove ugliness
* Merge branch 'unstable' into max-blobs-preset
* Fix max value
* Fix doctest
* Fix formatting
* Fix max check
* Delete hardcoded max_blobs_per_block in RPC limits
* Merge remote-tracking branch 'origin/unstable' into max-blobs-preset
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
use std::{
|
||||
collections::{hash_map::Entry, HashMap, VecDeque},
|
||||
sync::Arc,
|
||||
task::{Context, Poll},
|
||||
time::Duration,
|
||||
};
|
||||
@@ -9,7 +10,7 @@ use libp2p::{swarm::NotifyHandler, PeerId};
|
||||
use slog::{crit, debug, Logger};
|
||||
use smallvec::SmallVec;
|
||||
use tokio_util::time::DelayQueue;
|
||||
use types::EthSpec;
|
||||
use types::{EthSpec, ForkContext};
|
||||
|
||||
use super::{
|
||||
config::OutboundRateLimiterConfig,
|
||||
@@ -50,9 +51,13 @@ pub enum Error {
|
||||
|
||||
impl<Id: ReqId, E: EthSpec> SelfRateLimiter<Id, E> {
|
||||
/// Creates a new [`SelfRateLimiter`] based on configration values.
|
||||
pub fn new(config: OutboundRateLimiterConfig, log: Logger) -> Result<Self, &'static str> {
|
||||
pub fn new(
|
||||
config: OutboundRateLimiterConfig,
|
||||
fork_context: Arc<ForkContext>,
|
||||
log: Logger,
|
||||
) -> Result<Self, &'static str> {
|
||||
debug!(log, "Using self rate limiting params"; "config" => ?config);
|
||||
let limiter = RateLimiter::new_with_config(config.0)?;
|
||||
let limiter = RateLimiter::new_with_config(config.0, fork_context)?;
|
||||
|
||||
Ok(SelfRateLimiter {
|
||||
delayed_requests: Default::default(),
|
||||
@@ -215,7 +220,7 @@ mod tests {
|
||||
use crate::service::api_types::{AppRequestId, RequestId, SyncRequestId};
|
||||
use libp2p::PeerId;
|
||||
use std::time::Duration;
|
||||
use types::MainnetEthSpec;
|
||||
use types::{EthSpec, ForkContext, Hash256, MainnetEthSpec, Slot};
|
||||
|
||||
/// Test that `next_peer_request_ready` correctly maintains the queue.
|
||||
#[tokio::test]
|
||||
@@ -225,8 +230,13 @@ mod tests {
|
||||
ping_quota: Quota::n_every(1, 2),
|
||||
..Default::default()
|
||||
});
|
||||
let fork_context = std::sync::Arc::new(ForkContext::new::<MainnetEthSpec>(
|
||||
Slot::new(0),
|
||||
Hash256::ZERO,
|
||||
&MainnetEthSpec::default_spec(),
|
||||
));
|
||||
let mut limiter: SelfRateLimiter<RequestId, MainnetEthSpec> =
|
||||
SelfRateLimiter::new(config, log).unwrap();
|
||||
SelfRateLimiter::new(config, fork_context, log).unwrap();
|
||||
let peer_id = PeerId::random();
|
||||
|
||||
for i in 1..=5u32 {
|
||||
|
||||
Reference in New Issue
Block a user