mirror of
https://github.com/sigp/lighthouse.git
synced 2026-05-02 04:03:35 +00:00
BeaconBlockBody updates per eip-7732
This commit is contained in:
@@ -5727,15 +5727,12 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
|
||||
)
|
||||
}
|
||||
BeaconState::Gloas(_) => {
|
||||
let (
|
||||
payload,
|
||||
kzg_commitments,
|
||||
maybe_blobs_and_proofs,
|
||||
maybe_requests,
|
||||
execution_payload_value,
|
||||
) = block_contents
|
||||
.ok_or(BlockProductionError::MissingExecutionPayload)?
|
||||
.deconstruct();
|
||||
// Gloas blocks contain execution bids, not execution payloads
|
||||
let block_proposal_contents =
|
||||
block_contents.ok_or(BlockProductionError::MissingExecutionBid)?;
|
||||
let (signed_execution_bid, payload_attestations) = block_proposal_contents
|
||||
.into_execution_bid()
|
||||
.map_err(|_| BlockProductionError::InvalidPayloadFork)?;
|
||||
|
||||
(
|
||||
BeaconBlock::Gloas(BeaconBlockGloas {
|
||||
@@ -5754,18 +5751,15 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
|
||||
voluntary_exits: voluntary_exits.into(),
|
||||
sync_aggregate: sync_aggregate
|
||||
.ok_or(BlockProductionError::MissingSyncAggregate)?,
|
||||
execution_payload: payload
|
||||
.try_into()
|
||||
.map_err(|_| BlockProductionError::InvalidPayloadFork)?,
|
||||
bls_to_execution_changes: bls_to_execution_changes.into(),
|
||||
blob_kzg_commitments: kzg_commitments
|
||||
.ok_or(BlockProductionError::InvalidPayloadFork)?,
|
||||
execution_requests: maybe_requests
|
||||
.ok_or(BlockProductionError::MissingExecutionRequests)?,
|
||||
// EIP-7732: Use actual execution bid data
|
||||
signed_execution_payload_header: signed_execution_bid.clone(),
|
||||
payload_attestations,
|
||||
_phantom: PhantomData,
|
||||
},
|
||||
}),
|
||||
maybe_blobs_and_proofs,
|
||||
execution_payload_value,
|
||||
None, // blob commitments moved to `ExecutionPayloadEnvelope`
|
||||
Uint256::ZERO, // No execution payload value for Gloas blocks, just bids value
|
||||
)
|
||||
}
|
||||
};
|
||||
|
||||
@@ -292,6 +292,7 @@ pub enum BlockProductionError {
|
||||
MissingBlobs,
|
||||
MissingSyncAggregate,
|
||||
MissingExecutionPayload,
|
||||
MissingExecutionBid,
|
||||
MissingKzgCommitment(String),
|
||||
TokioJoin(JoinError),
|
||||
BeaconChain(Box<BeaconChainError>),
|
||||
|
||||
@@ -3252,25 +3252,6 @@ pub fn generate_rand_block_and_blobs<E: EthSpec>(
|
||||
message.body.blob_kzg_commitments = bundle.commitments.clone();
|
||||
bundle
|
||||
}
|
||||
SignedBeaconBlock::Gloas(SignedBeaconBlockGloas {
|
||||
ref mut message, ..
|
||||
}) => {
|
||||
// Get either zero blobs or a random number of blobs between 1 and Max Blobs.
|
||||
let payload: &mut FullPayloadGloas<E> = &mut message.body.execution_payload;
|
||||
let num_blobs = match num_blobs {
|
||||
NumBlobs::Random => rng.random_range(1..=max_blobs),
|
||||
NumBlobs::Number(n) => n,
|
||||
NumBlobs::None => 0,
|
||||
};
|
||||
let (bundle, transactions) =
|
||||
execution_layer::test_utils::generate_blobs::<E>(num_blobs, fork_name).unwrap();
|
||||
payload.execution_payload.transactions = <_>::default();
|
||||
for tx in Vec::from(transactions) {
|
||||
payload.execution_payload.transactions.push(tx).unwrap();
|
||||
}
|
||||
message.body.blob_kzg_commitments = bundle.commitments.clone();
|
||||
bundle
|
||||
}
|
||||
_ => return (block, blob_sidecars),
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user