Merge branch 'unstable' of https://github.com/sigp/lighthouse into gloas-range-sync

This commit is contained in:
Eitan Seri-Levi
2026-04-28 20:21:25 +02:00
9 changed files with 743 additions and 70 deletions

View File

@@ -1,8 +1,8 @@
use std::collections::HashMap;
use std::collections::{HashMap, HashSet};
use std::marker::PhantomData;
use std::sync::Arc;
use bls::Signature;
use bls::{PublicKeyBytes, Signature};
use execution_layer::{
BlockProposalContentsGloas, BuilderParams, PayloadAttributes, PayloadParameters,
};
@@ -28,13 +28,14 @@ use types::consts::gloas::BUILDER_INDEX_SELF_BUILD;
use types::{
Address, Attestation, AttestationElectra, AttesterSlashing, AttesterSlashingElectra,
BeaconBlock, BeaconBlockBodyGloas, BeaconBlockGloas, BeaconState, BeaconStateError,
BuilderIndex, Deposit, Eth1Data, EthSpec, ExecutionBlockHash, ExecutionPayloadBid,
BuilderIndex, ChainSpec, Deposit, Eth1Data, EthSpec, ExecutionBlockHash, ExecutionPayloadBid,
ExecutionPayloadEnvelope, ExecutionPayloadGloas, ExecutionRequests, FullPayload, Graffiti,
Hash256, PayloadAttestation, ProposerSlashing, RelativeEpoch, SignedBeaconBlock,
SignedBlsToExecutionChange, SignedExecutionPayloadBid, SignedExecutionPayloadEnvelope,
SignedVoluntaryExit, Slot, SyncAggregate, Withdrawal, Withdrawals,
};
use crate::pending_payload_envelopes::PendingEnvelopeData;
use crate::{
BeaconChain, BeaconChainError, BeaconChainTypes, BlockProductionError,
ProduceBlockVerification, block_production::BlockProductionState,
@@ -74,6 +75,7 @@ pub struct ExecutionPayloadData<E: types::EthSpec> {
pub execution_requests: ExecutionRequests<E>,
pub builder_index: BuilderIndex,
pub slot: Slot,
pub blobs_and_proofs: (types::BlobsList<E>, types::KzgProofs<E>),
}
impl<T: BeaconChainTypes> BeaconChain<T> {
@@ -137,6 +139,16 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
graffiti_settings: GraffitiSettings,
verification: ProduceBlockVerification,
) -> Result<BlockProductionResult<T::EthSpec>, BlockProductionError> {
// Extract the parent's execution requests from the envelope (if parent was full).
let parent_execution_requests = if parent_payload_status == PayloadStatus::Full {
parent_envelope
.as_ref()
.map(|env| env.message.execution_requests.clone())
.ok_or(BlockProductionError::MissingParentExecutionPayload)?
} else {
ExecutionRequests::default()
};
// Part 1/3 (blocking)
//
// Perform the state advance and block-packing functions.
@@ -145,6 +157,7 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
.graffiti_calculator
.get_graffiti(graffiti_settings)
.await;
let parent_execution_requests_ref = parent_execution_requests.clone();
let (partial_beacon_block, state) = self
.task_executor
.spawn_blocking_handle(
@@ -155,6 +168,7 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
produce_at_slot,
randao_reveal,
graffiti,
&parent_execution_requests_ref,
)
},
"produce_partial_beacon_block_gloas",
@@ -163,16 +177,6 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
.await
.map_err(BlockProductionError::TokioJoin)??;
// Extract the parent's execution requests from the envelope (if parent was full).
let parent_execution_requests = if parent_payload_status == PayloadStatus::Full {
parent_envelope
.as_ref()
.map(|env| env.message.execution_requests.clone())
.ok_or(BlockProductionError::MissingParentExecutionPayload)?
} else {
ExecutionRequests::default()
};
// Part 2/3 (async)
//
// Produce the execution payload bid.
@@ -223,6 +227,7 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
produce_at_slot: Slot,
randao_reveal: Signature,
graffiti: Graffiti,
parent_execution_requests: &ExecutionRequests<T::EthSpec>,
) -> Result<(PartialBeaconBlock<T::EthSpec>, BeaconState<T::EthSpec>), BlockProductionError>
{
// It is invalid to try to produce a block using a state from a future slot.
@@ -257,6 +262,13 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
let (mut proposer_slashings, mut attester_slashings, mut voluntary_exits) =
self.op_pool.get_slashings_and_exits(&state, &self.spec);
filter_voluntary_exits_for_parent_execution_requests(
&mut voluntary_exits,
parent_execution_requests,
|idx| state.validators().get(idx as usize).map(|v| v.pubkey),
&self.spec,
);
drop(slashings_and_exits_span);
let eth1_data = state.eth1_data().clone();
@@ -637,9 +649,14 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
let envelope_slot = payload_data.slot;
// TODO(gloas) might be safer to cache by root instead of by slot.
// We should revisit this once this code path + beacon api spec matures
self.pending_payload_envelopes
.write()
.insert(envelope_slot, signed_envelope.message);
let (blobs, _) = payload_data.blobs_and_proofs;
self.pending_payload_envelopes.write().insert(
envelope_slot,
PendingEnvelopeData {
envelope: signed_envelope.message,
blobs: Some(blobs),
},
);
debug!(
%beacon_block_root,
@@ -759,7 +776,7 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
payload_value: _,
execution_requests,
blob_kzg_commitments,
blobs_and_proofs: _,
blobs_and_proofs,
} = block_proposal_contents;
// TODO(gloas) since we are defaulting to local building, execution payment is 0
@@ -785,6 +802,7 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
execution_requests,
builder_index,
slot: produce_at_slot,
blobs_and_proofs,
};
// TODO(gloas) this is only local building
@@ -958,3 +976,178 @@ where
Ok(block_contents)
}
/// Drop voluntary exits whose target validators will be exited by the parent envelope's
/// execution requests.
///
/// In Gloas the parent execution payload is processed before voluntary exits during block
/// processing. EL-triggered withdrawal-full-exit requests (EIP-7002) and cross-pubkey
/// consolidation requests (EIP-7251) call `initiate_validator_exit`, setting the target's
/// `exit_epoch`. A voluntary exit for the same validator would then fail with `AlreadyExited`.
fn filter_voluntary_exits_for_parent_execution_requests<E: EthSpec>(
voluntary_exits: &mut Vec<SignedVoluntaryExit>,
parent_execution_requests: &ExecutionRequests<E>,
pubkey_at_index: impl Fn(u64) -> Option<PublicKeyBytes>,
spec: &ChainSpec,
) {
let mut exited_pubkeys = HashSet::with_capacity(
parent_execution_requests.withdrawals.len()
+ parent_execution_requests.consolidations.len(),
);
for req in &parent_execution_requests.withdrawals {
if req.amount == spec.full_exit_request_amount {
exited_pubkeys.insert(req.validator_pubkey);
}
}
for req in &parent_execution_requests.consolidations {
if req.source_pubkey != req.target_pubkey {
exited_pubkeys.insert(req.source_pubkey);
}
}
if !exited_pubkeys.is_empty() {
voluntary_exits.retain(|exit| {
pubkey_at_index(exit.message.validator_index)
.map(|pk| !exited_pubkeys.contains(&pk))
.unwrap_or(false)
});
}
}
#[cfg(test)]
mod tests {
use super::*;
use ssz_types::VariableList;
use types::{ConsolidationRequest, Epoch, MainnetEthSpec, VoluntaryExit, WithdrawalRequest};
type TestSpec = MainnetEthSpec;
fn pubkey(byte: u8) -> PublicKeyBytes {
PublicKeyBytes::deserialize(&[byte; 48]).expect("valid pubkey byte length")
}
fn exit(validator_index: u64) -> SignedVoluntaryExit {
SignedVoluntaryExit {
message: VoluntaryExit {
epoch: Epoch::new(0),
validator_index,
},
signature: Signature::empty(),
}
}
fn requests(
withdrawals: Vec<WithdrawalRequest>,
consolidations: Vec<ConsolidationRequest>,
) -> ExecutionRequests<TestSpec> {
ExecutionRequests {
deposits: VariableList::empty(),
withdrawals: VariableList::new(withdrawals).unwrap(),
consolidations: VariableList::new(consolidations).unwrap(),
}
}
fn run_filter(
exits: &mut Vec<SignedVoluntaryExit>,
requests: &ExecutionRequests<TestSpec>,
validator_pubkeys: &[PublicKeyBytes],
spec: &ChainSpec,
) {
filter_voluntary_exits_for_parent_execution_requests(
exits,
requests,
|idx| validator_pubkeys.get(idx as usize).copied(),
spec,
);
}
#[test]
fn full_exit_withdrawal_request_filters_matching_voluntary_exit() {
let spec = ChainSpec::mainnet();
let validators = vec![pubkey(1), pubkey(2)];
let mut exits = vec![exit(0), exit(1)];
let reqs = requests(
vec![WithdrawalRequest {
source_address: Address::repeat_byte(0xaa),
validator_pubkey: validators[0],
amount: spec.full_exit_request_amount,
}],
vec![],
);
run_filter(&mut exits, &reqs, &validators, &spec);
assert_eq!(exits.len(), 1);
assert_eq!(exits[0].message.validator_index, 1);
}
#[test]
fn partial_withdrawal_request_does_not_filter_voluntary_exit() {
let spec = ChainSpec::mainnet();
let validators = vec![pubkey(1)];
let mut exits = vec![exit(0)];
let reqs = requests(
vec![WithdrawalRequest {
source_address: Address::repeat_byte(0xaa),
validator_pubkey: validators[0],
amount: spec.full_exit_request_amount + 1,
}],
vec![],
);
run_filter(&mut exits, &reqs, &validators, &spec);
assert_eq!(exits.len(), 1);
}
#[test]
fn cross_pubkey_consolidation_filters_voluntary_exit_for_source_only() {
let spec = ChainSpec::mainnet();
let validators = vec![pubkey(1), pubkey(2), pubkey(3)];
let mut exits = vec![exit(0), exit(1), exit(2)];
let reqs = requests(
vec![],
vec![ConsolidationRequest {
source_address: Address::repeat_byte(0xaa),
source_pubkey: validators[1],
target_pubkey: validators[2],
}],
);
run_filter(&mut exits, &reqs, &validators, &spec);
// The source (validator 1) is exited; the target (validator 2) is not.
let remaining: Vec<u64> = exits.iter().map(|e| e.message.validator_index).collect();
assert_eq!(remaining, vec![0, 2]);
}
#[test]
fn self_consolidation_does_not_filter_voluntary_exit() {
let spec = ChainSpec::mainnet();
let validators = vec![pubkey(1)];
let mut exits = vec![exit(0)];
let reqs = requests(
vec![],
vec![ConsolidationRequest {
source_address: Address::repeat_byte(0xaa),
source_pubkey: validators[0],
target_pubkey: validators[0],
}],
);
run_filter(&mut exits, &reqs, &validators, &spec);
assert_eq!(exits.len(), 1);
}
#[test]
fn empty_parent_requests_preserve_voluntary_exits() {
let spec = ChainSpec::mainnet();
let validators = vec![pubkey(1), pubkey(2)];
let mut exits = vec![exit(0), exit(1)];
let reqs = requests(vec![], vec![]);
run_filter(&mut exits, &reqs, &validators, &spec);
assert_eq!(exits.len(), 2);
}
}

View File

@@ -296,6 +296,35 @@ pub fn blobs_to_data_column_sidecars<E: EthSpec>(
}
}
/// Build Gloas data column sidecars from blobs, computing cells and proofs locally.
pub fn blobs_to_data_column_sidecars_gloas<E: EthSpec>(
blobs: &[&Blob<E>],
beacon_block_root: Hash256,
slot: Slot,
kzg: &Kzg,
spec: &ChainSpec,
) -> Result<DataColumnSidecarList<E>, DataColumnSidecarError> {
if blobs.is_empty() {
return Ok(vec![]);
}
let blob_cells_and_proofs_vec = blobs
.into_par_iter()
.map(|blob| {
let blob = blob.as_ref().try_into().map_err(|e| {
KzgError::InconsistentArrayLength(format!(
"blob should have a guaranteed size due to FixedVector: {e:?}"
))
})?;
kzg.compute_cells_and_proofs(blob)
})
.collect::<Result<Vec<_>, KzgError>>()?;
build_data_column_sidecars_gloas(beacon_block_root, slot, blob_cells_and_proofs_vec, spec)
.map_err(DataColumnSidecarError::BuildSidecarFailed)
}
/// Build data column sidecars from a signed beacon block and its blobs.
#[instrument(skip_all, level = "debug", fields(blob_count = blobs_and_proofs.len()))]
pub fn blobs_to_partial_data_columns<E: EthSpec>(
@@ -728,8 +757,8 @@ pub fn reconstruct_data_columns<E: EthSpec>(
#[cfg(test)]
mod test {
use crate::kzg_utils::{
blobs_to_data_column_sidecars, reconstruct_blobs, reconstruct_data_columns,
validate_full_data_columns,
blobs_to_data_column_sidecars, blobs_to_data_column_sidecars_gloas, reconstruct_blobs,
reconstruct_data_columns, validate_full_data_columns,
};
use bls::Signature;
use eth2::types::BlobsBundle;
@@ -737,25 +766,30 @@ mod test {
use kzg::{Kzg, KzgCommitment, trusted_setup::get_trusted_setup};
use types::{
BeaconBlock, BeaconBlockFulu, BlobsList, ChainSpec, EmptyBlock, EthSpec, ForkName,
FullPayload, KzgProofs, MainnetEthSpec, SignedBeaconBlock, kzg_ext::KzgCommitments,
FullPayload, Hash256, KzgProofs, MainnetEthSpec, SignedBeaconBlock, Slot,
kzg_ext::KzgCommitments,
};
type E = MainnetEthSpec;
// Loading and initializing PeerDAS KZG is expensive and slow, so we group the tests together
// only load it once.
// TODO(Gloas) make this generic over fulu/gloas, or write a separate function for Gloas
#[test]
fn test_build_data_columns_sidecars() {
let spec = ForkName::Fulu.make_genesis_spec(E::default_spec());
let kzg = get_kzg();
test_build_data_columns_empty(&kzg, &spec);
test_build_data_columns_fulu(&kzg, &spec);
test_reconstruct_data_columns(&kzg, &spec);
test_reconstruct_data_columns_unordered(&kzg, &spec);
test_reconstruct_blobs_from_data_columns(&kzg, &spec);
test_reconstruct_blobs_from_data_columns_unordered(&kzg, &spec);
test_validate_data_columns(&kzg, &spec);
let fulu_spec = ForkName::Fulu.make_genesis_spec(E::default_spec());
test_build_data_columns_empty(&kzg, &fulu_spec);
test_build_data_columns_fulu(&kzg, &fulu_spec);
test_reconstruct_data_columns(&kzg, &fulu_spec);
test_reconstruct_data_columns_unordered(&kzg, &fulu_spec);
test_reconstruct_blobs_from_data_columns(&kzg, &fulu_spec);
test_reconstruct_blobs_from_data_columns_unordered(&kzg, &fulu_spec);
test_validate_data_columns(&kzg, &fulu_spec);
let gloas_spec = ForkName::Gloas.make_genesis_spec(E::default_spec());
test_build_data_columns_gloas(&kzg, &gloas_spec);
test_build_data_columns_gloas_empty(&kzg, &gloas_spec);
}
#[track_caller]
@@ -784,8 +818,49 @@ mod test {
assert!(column_sidecars.is_empty());
}
// TODO(gloas) create `test_build_data_columns_gloas` and make sure its called
// in the relevant places
#[track_caller]
fn test_build_data_columns_gloas(kzg: &Kzg, spec: &ChainSpec) {
let num_of_blobs = 2;
let (blobs, _proofs) = create_test_gloas_blobs::<E>(num_of_blobs);
let beacon_block_root = Hash256::random();
let slot = Slot::new(0);
let blob_refs: Vec<_> = blobs.iter().collect();
let column_sidecars = blobs_to_data_column_sidecars_gloas::<E>(
&blob_refs,
beacon_block_root,
slot,
kzg,
spec,
)
.unwrap();
assert_eq!(column_sidecars.len(), E::number_of_columns());
for (idx, col_sidecar) in column_sidecars.iter().enumerate() {
assert_eq!(*col_sidecar.index(), idx as u64);
assert_eq!(col_sidecar.column().len(), num_of_blobs);
assert_eq!(col_sidecar.kzg_proofs().len(), num_of_blobs);
let gloas_col = col_sidecar.as_gloas().expect("should be Gloas sidecar");
assert_eq!(gloas_col.beacon_block_root, beacon_block_root);
assert_eq!(gloas_col.slot, slot);
}
}
#[track_caller]
fn test_build_data_columns_gloas_empty(kzg: &Kzg, spec: &ChainSpec) {
let blob_refs: Vec<&types::Blob<E>> = vec![];
let column_sidecars = blobs_to_data_column_sidecars_gloas::<E>(
&blob_refs,
Hash256::random(),
Slot::new(0),
kzg,
spec,
)
.unwrap();
assert!(column_sidecars.is_empty());
}
#[track_caller]
fn test_build_data_columns_fulu(kzg: &Kzg, spec: &ChainSpec) {
// Using at least 2 blobs to make sure we're arranging the data columns correctly.
@@ -974,4 +1049,9 @@ mod test {
(signed_block, blobs, proofs)
}
fn create_test_gloas_blobs<E: EthSpec>(num_of_blobs: usize) -> (BlobsList<E>, KzgProofs<E>) {
let (blobs_bundle, _) = generate_blobs::<E>(num_of_blobs, ForkName::Gloas).unwrap();
(blobs_bundle.blobs, blobs_bundle.proofs)
}
}

View File

@@ -6,7 +6,12 @@
//! and publishes the payload.
use std::collections::HashMap;
use types::{EthSpec, ExecutionPayloadEnvelope, Slot};
use types::{BlobsList, EthSpec, ExecutionPayloadEnvelope, Slot};
pub struct PendingEnvelopeData<E: EthSpec> {
pub envelope: ExecutionPayloadEnvelope<E>,
pub blobs: Option<BlobsList<E>>,
}
/// Cache for pending execution payload envelopes awaiting publishing.
///
@@ -16,7 +21,7 @@ pub struct PendingPayloadEnvelopes<E: EthSpec> {
/// Maximum number of slots to keep envelopes before pruning.
max_slot_age: u64,
/// The envelopes, keyed by slot.
envelopes: HashMap<Slot, ExecutionPayloadEnvelope<E>>,
envelopes: HashMap<Slot, PendingEnvelopeData<E>>,
}
impl<E: EthSpec> Default for PendingPayloadEnvelopes<E> {
@@ -38,19 +43,24 @@ impl<E: EthSpec> PendingPayloadEnvelopes<E> {
}
/// Insert a pending envelope into the cache.
pub fn insert(&mut self, slot: Slot, envelope: ExecutionPayloadEnvelope<E>) {
pub fn insert(&mut self, slot: Slot, data: PendingEnvelopeData<E>) {
// TODO(gloas): we may want to check for duplicates here, which shouldn't be allowed
self.envelopes.insert(slot, envelope);
self.envelopes.insert(slot, data);
}
/// Get a pending envelope by slot.
pub fn get(&self, slot: Slot) -> Option<&ExecutionPayloadEnvelope<E>> {
self.envelopes.get(&slot)
self.envelopes.get(&slot).map(|d| &d.envelope)
}
/// Remove and return the blobs and proofs for a slot, leaving the envelope in place.
pub fn take_blobs(&mut self, slot: Slot) -> Option<BlobsList<E>> {
self.envelopes.get_mut(&slot).and_then(|d| d.blobs.take())
}
/// Remove and return a pending envelope by slot.
pub fn remove(&mut self, slot: Slot) -> Option<ExecutionPayloadEnvelope<E>> {
self.envelopes.remove(&slot)
self.envelopes.remove(&slot).map(|d| d.envelope)
}
/// Check if an envelope exists for the given slot.
@@ -85,15 +95,18 @@ mod tests {
type E = MainnetEthSpec;
fn make_envelope(slot: Slot) -> ExecutionPayloadEnvelope<E> {
ExecutionPayloadEnvelope {
payload: ExecutionPayloadGloas {
slot_number: slot,
..ExecutionPayloadGloas::default()
fn make_envelope(slot: Slot) -> PendingEnvelopeData<E> {
PendingEnvelopeData {
envelope: ExecutionPayloadEnvelope {
payload: ExecutionPayloadGloas {
slot_number: slot,
..ExecutionPayloadGloas::default()
},
execution_requests: ExecutionRequests::default(),
builder_index: 0,
beacon_block_root: Hash256::ZERO,
},
execution_requests: ExecutionRequests::default(),
builder_index: 0,
beacon_block_root: Hash256::ZERO,
blobs: None,
}
}
@@ -101,33 +114,73 @@ mod tests {
fn insert_and_get() {
let mut cache = PendingPayloadEnvelopes::<E>::default();
let slot = Slot::new(1);
let envelope = make_envelope(slot);
let data = make_envelope(slot);
let expected_envelope = data.envelope.clone();
assert!(!cache.contains(slot));
assert_eq!(cache.len(), 0);
cache.insert(slot, envelope.clone());
cache.insert(slot, data);
assert!(cache.contains(slot));
assert_eq!(cache.len(), 1);
assert_eq!(cache.get(slot), Some(&envelope));
assert_eq!(cache.get(slot), Some(&expected_envelope));
}
#[test]
fn remove() {
let mut cache = PendingPayloadEnvelopes::<E>::default();
let slot = Slot::new(1);
let envelope = make_envelope(slot);
let data = make_envelope(slot);
let expected_envelope = data.envelope.clone();
cache.insert(slot, envelope.clone());
cache.insert(slot, data);
assert!(cache.contains(slot));
let removed = cache.remove(slot);
assert_eq!(removed, Some(envelope));
assert_eq!(removed, Some(expected_envelope));
assert!(!cache.contains(slot));
assert_eq!(cache.len(), 0);
}
#[test]
fn take_blobs_returns_once() {
let mut cache = PendingPayloadEnvelopes::<E>::default();
let slot = Slot::new(1);
let blobs = BlobsList::<E>::default();
let data = PendingEnvelopeData {
envelope: make_envelope(slot).envelope,
blobs: Some(blobs),
};
cache.insert(slot, data);
// First take returns the blobs
let taken = cache.take_blobs(slot);
assert!(taken.is_some());
// Second take returns None — blobs are consumed
let taken_again = cache.take_blobs(slot);
assert!(taken_again.is_none());
// Envelope is still in the cache
assert!(cache.contains(slot));
assert!(cache.get(slot).is_some());
}
#[test]
fn take_blobs_returns_none_when_absent() {
let mut cache = PendingPayloadEnvelopes::<E>::default();
let slot = Slot::new(1);
// Insert with no blobs
cache.insert(slot, make_envelope(slot));
assert!(cache.take_blobs(slot).is_none());
// Non-existent slot
assert!(cache.take_blobs(Slot::new(99)).is_none());
}
#[test]
fn prune_old_envelopes() {
let mut cache = PendingPayloadEnvelopes::<E>::new(2);

View File

@@ -86,6 +86,8 @@ pub const FORK_NAME_ENV_VAR: &str = "FORK_NAME";
// `beacon_node/execution_layer/src/test_utils/fixtures/mainnet/test_blobs_bundle.ssz`
pub const TEST_DATA_COLUMN_SIDECARS_SSZ: &[u8] =
include_bytes!("test_utils/fixtures/test_data_column_sidecars.ssz");
pub const TEST_DATA_COLUMN_SIDECARS_GLOAS_SSZ: &[u8] =
include_bytes!("test_utils/fixtures/test_data_column_sidecars_gloas.ssz");
// Default target aggregators to set during testing, this ensures an aggregator at each slot.
//
@@ -3789,24 +3791,24 @@ pub fn generate_data_column_sidecars_from_block<E: EthSpec>(
block: &SignedBeaconBlock<E>,
spec: &ChainSpec,
) -> DataColumnSidecarList<E> {
let kzg_commitments = block.message().body().blob_kzg_commitments().unwrap();
if kzg_commitments.is_empty() {
return vec![];
}
let kzg_commitments_inclusion_proof = block
.message()
.body()
.kzg_commitments_merkle_proof()
.unwrap();
let signed_block_header = block.signed_block_header();
// Load the precomputed column sidecar to avoid computing them for every block in the tests.
// Then repeat the cells and proofs for every blob
if block.fork_name_unchecked().gloas_enabled() {
let kzg_commitments = &block
.message()
.body()
.signed_execution_payload_bid()
.expect("Gloas block should have a payload bid")
.message
.blob_kzg_commitments;
if kzg_commitments.is_empty() {
return vec![];
}
let num_blobs = kzg_commitments.len();
let signed_block_header = block.signed_block_header();
let template_data_columns =
RuntimeVariableList::<DataColumnSidecarGloas<E>>::from_ssz_bytes(
TEST_DATA_COLUMN_SIDECARS_SSZ,
TEST_DATA_COLUMN_SIDECARS_GLOAS_SSZ,
E::number_of_columns(),
)
.unwrap();
@@ -3826,7 +3828,7 @@ pub fn generate_data_column_sidecars_from_block<E: EthSpec>(
.collect::<(Vec<_>, Vec<_>)>();
let blob_cells_and_proofs_vec =
vec![(cells.try_into().unwrap(), proofs.try_into().unwrap()); kzg_commitments.len()];
vec![(cells.try_into().unwrap(), proofs.try_into().unwrap()); num_blobs];
build_data_column_sidecars_gloas(
signed_block_header.message.tree_hash_root(),
@@ -3836,6 +3838,18 @@ pub fn generate_data_column_sidecars_from_block<E: EthSpec>(
)
.unwrap()
} else {
let kzg_commitments = block.message().body().blob_kzg_commitments().unwrap();
if kzg_commitments.is_empty() {
return vec![];
}
let kzg_commitments_inclusion_proof = block
.message()
.body()
.kzg_commitments_merkle_proof()
.unwrap();
let signed_block_header = block.signed_block_header();
// load the precomputed column sidecar to avoid computing them for every block in the tests.
let template_data_columns =
RuntimeVariableList::<DataColumnSidecarFulu<E>>::from_ssz_bytes(