Merge branch 'unstable' into into-anchor

This commit is contained in:
Daniel Knopik
2025-07-24 10:38:05 +02:00
206 changed files with 5394 additions and 4022 deletions

View File

@@ -26,6 +26,7 @@ use std::time::Duration;
use task_executor::test_utils::TestRuntime;
use tempfile::{tempdir, TempDir};
use tokio::sync::oneshot;
use types::ChainSpec;
use validator_services::block_service::BlockService;
use zeroize::Zeroizing;
@@ -61,6 +62,7 @@ pub struct ApiTester {
pub _server_shutdown: oneshot::Sender<()>,
pub validator_dir: TempDir,
pub secrets_dir: TempDir,
pub spec: Arc<ChainSpec>,
}
impl ApiTester {
@@ -69,6 +71,19 @@ impl ApiTester {
}
pub async fn new_with_http_config(http_config: HttpConfig) -> Self {
let slot_clock =
TestingSlotClock::new(Slot::new(0), Duration::from_secs(0), Duration::from_secs(1));
let genesis_validators_root = Hash256::repeat_byte(42);
let spec = Arc::new(E::default_spec());
Self::new_with_options(http_config, slot_clock, genesis_validators_root, spec).await
}
pub async fn new_with_options(
http_config: HttpConfig,
slot_clock: TestingSlotClock,
genesis_validators_root: Hash256,
spec: Arc<ChainSpec>,
) -> Self {
let validator_dir = tempdir().unwrap();
let secrets_dir = tempdir().unwrap();
let token_path = tempdir().unwrap().path().join(PK_FILENAME);
@@ -91,20 +106,15 @@ impl ApiTester {
..Default::default()
};
let spec = Arc::new(E::default_spec());
let slashing_db_path = validator_dir.path().join(SLASHING_PROTECTION_FILENAME);
let slashing_protection = SlashingDatabase::open_or_create(&slashing_db_path).unwrap();
let slot_clock =
TestingSlotClock::new(Slot::new(0), Duration::from_secs(0), Duration::from_secs(1));
let test_runtime = TestRuntime::default();
let validator_store = Arc::new(LighthouseValidatorStore::new(
initialized_validators,
slashing_protection,
Hash256::repeat_byte(42),
genesis_validators_root,
spec.clone(),
Some(Arc::new(DoppelgangerService::default())),
slot_clock.clone(),
@@ -127,7 +137,7 @@ impl ApiTester {
validator_store: Some(validator_store.clone()),
graffiti_file: None,
graffiti_flag: Some(Graffiti::default()),
spec,
spec: spec.clone(),
config: http_config,
sse_logging_components: None,
slot_clock,
@@ -161,6 +171,7 @@ impl ApiTester {
_server_shutdown: shutdown_tx,
validator_dir,
secrets_dir,
spec,
}
}

View File

@@ -55,8 +55,8 @@ const SLASHING_PROTECTION_HISTORY_EPOCHS: u64 = 512;
/// Currently used as the default gas limit in execution clients.
///
/// https://ethresear.ch/t/on-increasing-the-block-gas-limit-technical-considerations-path-forward/21225.
pub const DEFAULT_GAS_LIMIT: u64 = 36_000_000;
/// https://ethpandaops.io/posts/gaslimit-scaling/.
pub const DEFAULT_GAS_LIMIT: u64 = 45_000_000;
pub struct LighthouseValidatorStore<T, E> {
validators: Arc<RwLock<InitializedValidators>>,

View File

@@ -388,7 +388,7 @@ pub struct ValidatorClient {
#[clap(
long,
value_name = "INTEGER",
default_value_t = 36_000_000,
default_value_t = 45_000_000,
requires = "builder_proposals",
help = "The gas limit to be used in all builder proposals for all validators managed \
by this validator client. Note this will not necessarily be used if the gas limit \

View File

@@ -524,22 +524,44 @@ impl<S: ValidatorStore + 'static, T: SlotClock + 'static> BlockService<S, T> {
proposer_index: Option<u64>,
builder_boost_factor: Option<u64>,
) -> Result<UnsignedBlock<S::E>, BlockError> {
let (block_response, _) = beacon_node
.get_validator_blocks_v3::<S::E>(
let block_response = match beacon_node
.get_validator_blocks_v3_ssz::<S::E>(
slot,
randao_reveal_ref,
graffiti.as_ref(),
builder_boost_factor,
)
.await
.map_err(|e| {
BlockError::Recoverable(format!(
"Error from beacon node when producing block: {:?}",
e
))
})?;
{
Ok((ssz_block_response, _)) => ssz_block_response,
Err(e) => {
warn!(
slot = slot.as_u64(),
error = %e,
"Beacon node does not support SSZ in block production, falling back to JSON"
);
let (block_proposer, unsigned_block) = match block_response.data {
let (json_block_response, _) = beacon_node
.get_validator_blocks_v3::<S::E>(
slot,
randao_reveal_ref,
graffiti.as_ref(),
builder_boost_factor,
)
.await
.map_err(|e| {
BlockError::Recoverable(format!(
"Error from beacon node when producing block: {:?}",
e
))
})?;
// Extract ProduceBlockV3Response (data field of the struct ForkVersionedResponse)
json_block_response.data
}
};
let (block_proposer, unsigned_block) = match block_response {
eth2::types::ProduceBlockV3Response::Full(block) => {
(block.block().proposer_index(), UnsignedBlock::Full(block))
}