Core Benchmarking Infra (#175)

* Implement a solution for the pre-fund account limit

* Update the account pre-funding handling

* Fix the lighthouse node tracing issue

* refactor existing dt infra

* Implement the platform driver

* Wire up the cleaned up driver implementation

* Implement the core benchmarking components

* Remove some debug logging

* Fix issues in the benchmarks driver

* Implement a global concurrency limit on provider requests

* Update the concurrency limit

* Update the concurrency limit

* Cleanups

* Update the lighthouse ports

* Ignore certain tests

* Update the new geth test
This commit is contained in:
Omar
2025-10-05 18:09:01 +03:00
committed by GitHub
parent f9dc362c03
commit 74fdeb4a2e
51 changed files with 4308 additions and 1990 deletions
+2
View File
@@ -1,9 +1,11 @@
mod identifiers;
mod mode;
mod private_key_allocator;
mod round_robin_pool;
mod version_or_requirement;
pub use identifiers::*;
pub use mode::*;
pub use private_key_allocator::*;
pub use round_robin_pool::*;
pub use version_or_requirement::*;
@@ -1,6 +1,6 @@
use alloy::primitives::U256;
use alloy::signers::local::PrivateKeySigner;
use alloy_primitives::U256;
use anyhow::{Result, bail};
use anyhow::{Context, Result, bail};
/// This is a sequential private key allocator. When instantiated, it allocated private keys in
/// sequentially and in order until the maximum private key specified is reached.
@@ -10,25 +10,26 @@ pub struct PrivateKeyAllocator {
next_private_key: U256,
/// The highest private key (exclusive) that can be returned by this allocator.
highest_private_key_exclusive: U256,
highest_private_key_inclusive: U256,
}
impl PrivateKeyAllocator {
/// Creates a new instance of the private key allocator.
pub fn new(highest_private_key_exclusive: U256) -> Self {
pub fn new(highest_private_key_inclusive: U256) -> Self {
Self {
next_private_key: U256::ZERO,
highest_private_key_exclusive,
next_private_key: U256::ONE,
highest_private_key_inclusive,
}
}
/// Allocates a new private key and errors out if the maximum private key has been reached.
pub fn allocate(&mut self) -> Result<PrivateKeySigner> {
if self.next_private_key >= self.highest_private_key_exclusive {
if self.next_private_key > self.highest_private_key_inclusive {
bail!("Attempted to allocate a private key but failed since all have been allocated");
};
let private_key =
PrivateKeySigner::from_slice(self.next_private_key.to_be_bytes::<32>().as_slice())?;
PrivateKeySigner::from_slice(self.next_private_key.to_be_bytes::<32>().as_slice())
.context("Failed to convert the private key digits into a private key")?;
self.next_private_key += U256::ONE;
Ok(private_key)
}
@@ -0,0 +1,24 @@
use std::sync::atomic::{AtomicUsize, Ordering};
pub struct RoundRobinPool<T> {
next_index: AtomicUsize,
items: Vec<T>,
}
impl<T> RoundRobinPool<T> {
pub fn new(items: Vec<T>) -> Self {
Self {
next_index: Default::default(),
items,
}
}
pub fn round_robin(&self) -> &T {
let current = self.next_index.fetch_add(1, Ordering::SeqCst) % self.items.len();
self.items.get(current).unwrap()
}
pub fn iter(&self) -> impl Iterator<Item = &T> {
self.items.iter()
}
}