mirror of
https://github.com/sigp/lighthouse.git
synced 2026-05-30 12:47:05 +00:00
update
This commit is contained in:
@@ -29,13 +29,13 @@ use types::{
|
|||||||
Address, Attestation, AttestationElectra, AttesterSlashing, AttesterSlashingElectra,
|
Address, Attestation, AttestationElectra, AttesterSlashing, AttesterSlashingElectra,
|
||||||
BeaconBlock, BeaconBlockBodyGloas, BeaconBlockBodyHeze, BeaconBlockGloas, BeaconBlockHeze,
|
BeaconBlock, BeaconBlockBodyGloas, BeaconBlockBodyHeze, BeaconBlockGloas, BeaconBlockHeze,
|
||||||
BeaconState, BeaconStateError, BuilderIndex, ChainSpec, Deposit, Eth1Data, EthSpec,
|
BeaconState, BeaconStateError, BuilderIndex, ChainSpec, Deposit, Eth1Data, EthSpec,
|
||||||
ExecutionBlockHash, ExecutionPayloadBidGloas, ExecutionPayloadBidHeze,
|
ExecutionBlockHash, ExecutionPayload, ExecutionPayloadBidGloas, ExecutionPayloadBidHeze,
|
||||||
ExecutionPayloadEnvelope, ExecutionPayloadEnvelopeGloas, ExecutionPayloadGloas,
|
ExecutionPayloadEnvelope, ExecutionPayloadEnvelopeGloas, ExecutionPayloadEnvelopeHeze,
|
||||||
ExecutionRequests, FullPayload, Graffiti, Hash256, PayloadAttestation, ProposerSlashing,
|
ExecutionRequests, FullPayload, Graffiti, Hash256, PayloadAttestation, ProposerSlashing,
|
||||||
RelativeEpoch, SignedBeaconBlock, SignedBlsToExecutionChange, SignedExecutionPayloadBid,
|
RelativeEpoch, SignedBeaconBlock, SignedBlsToExecutionChange, SignedExecutionPayloadBid,
|
||||||
SignedExecutionPayloadBidGloas, SignedExecutionPayloadBidHeze, SignedExecutionPayloadEnvelope,
|
SignedExecutionPayloadBidGloas, SignedExecutionPayloadBidHeze, SignedExecutionPayloadEnvelope,
|
||||||
SignedExecutionPayloadEnvelopeGloas, SignedVoluntaryExit, Slot, SyncAggregate, Withdrawal,
|
SignedExecutionPayloadEnvelopeGloas, SignedExecutionPayloadEnvelopeHeze, SignedVoluntaryExit,
|
||||||
Withdrawals,
|
Slot, SyncAggregate, Withdrawal, Withdrawals,
|
||||||
};
|
};
|
||||||
|
|
||||||
use crate::pending_payload_envelopes::PendingEnvelopeData;
|
use crate::pending_payload_envelopes::PendingEnvelopeData;
|
||||||
@@ -73,8 +73,8 @@ pub struct PartialBeaconBlock<E: EthSpec> {
|
|||||||
|
|
||||||
/// Data needed to construct an ExecutionPayloadEnvelope.
|
/// Data needed to construct an ExecutionPayloadEnvelope.
|
||||||
/// The envelope requires the beacon_block_root which can only be computed after the block exists.
|
/// The envelope requires the beacon_block_root which can only be computed after the block exists.
|
||||||
pub struct ExecutionPayloadData<E: types::EthSpec> {
|
pub struct ExecutionPayloadData<E: EthSpec> {
|
||||||
pub payload: ExecutionPayloadGloas<E>,
|
pub payload: ExecutionPayload<E>,
|
||||||
pub execution_requests: ExecutionRequests<E>,
|
pub execution_requests: ExecutionRequests<E>,
|
||||||
pub builder_index: BuilderIndex,
|
pub builder_index: BuilderIndex,
|
||||||
pub slot: Slot,
|
pub slot: Slot,
|
||||||
@@ -720,19 +720,45 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
|
|||||||
if let Some(payload_data) = payload_data {
|
if let Some(payload_data) = payload_data {
|
||||||
let beacon_block_root = block.tree_hash_root();
|
let beacon_block_root = block.tree_hash_root();
|
||||||
let parent_beacon_block_root = block.parent_root();
|
let parent_beacon_block_root = block.parent_root();
|
||||||
let execution_payload_envelope = ExecutionPayloadEnvelopeGloas {
|
|
||||||
payload: payload_data.payload,
|
let envelope = match payload_data.payload {
|
||||||
|
ExecutionPayload::Gloas(payload) => {
|
||||||
|
ExecutionPayloadEnvelope::Gloas(ExecutionPayloadEnvelopeGloas {
|
||||||
|
payload,
|
||||||
execution_requests: payload_data.execution_requests,
|
execution_requests: payload_data.execution_requests,
|
||||||
builder_index: payload_data.builder_index,
|
builder_index: payload_data.builder_index,
|
||||||
beacon_block_root,
|
beacon_block_root,
|
||||||
parent_beacon_block_root,
|
parent_beacon_block_root,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
ExecutionPayload::Heze(payload) => {
|
||||||
|
ExecutionPayloadEnvelope::Heze(ExecutionPayloadEnvelopeHeze {
|
||||||
|
payload,
|
||||||
|
execution_requests: payload_data.execution_requests,
|
||||||
|
builder_index: payload_data.builder_index,
|
||||||
|
beacon_block_root,
|
||||||
|
parent_beacon_block_root,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
_ => {
|
||||||
|
return Err(BlockProductionError::InvalidPayloadFork);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
let signed_envelope =
|
let signed_envelope = match &envelope {
|
||||||
|
ExecutionPayloadEnvelope::Gloas(msg) => {
|
||||||
SignedExecutionPayloadEnvelope::Gloas(SignedExecutionPayloadEnvelopeGloas {
|
SignedExecutionPayloadEnvelope::Gloas(SignedExecutionPayloadEnvelopeGloas {
|
||||||
message: execution_payload_envelope.clone(),
|
message: msg.clone(),
|
||||||
signature: Signature::empty(),
|
signature: Signature::empty(),
|
||||||
});
|
})
|
||||||
|
}
|
||||||
|
ExecutionPayloadEnvelope::Heze(msg) => {
|
||||||
|
SignedExecutionPayloadEnvelope::Heze(SignedExecutionPayloadEnvelopeHeze {
|
||||||
|
message: msg.clone(),
|
||||||
|
signature: Signature::empty(),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
// Verify the envelope against the state. This performs no state mutation.
|
// Verify the envelope against the state. This performs no state mutation.
|
||||||
verify_execution_payload_envelope(
|
verify_execution_payload_envelope(
|
||||||
@@ -752,7 +778,7 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
|
|||||||
self.pending_payload_envelopes.write().insert(
|
self.pending_payload_envelopes.write().insert(
|
||||||
envelope_slot,
|
envelope_slot,
|
||||||
PendingEnvelopeData {
|
PendingEnvelopeData {
|
||||||
envelope: ExecutionPayloadEnvelope::Gloas(execution_payload_envelope),
|
envelope,
|
||||||
blobs: Some(blobs),
|
blobs: Some(blobs),
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
@@ -895,7 +921,7 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
|
|||||||
|
|
||||||
// Store payload data for envelope construction after block is created
|
// Store payload data for envelope construction after block is created
|
||||||
let payload_data = ExecutionPayloadData {
|
let payload_data = ExecutionPayloadData {
|
||||||
payload,
|
payload: ExecutionPayload::Gloas(payload),
|
||||||
execution_requests,
|
execution_requests,
|
||||||
builder_index,
|
builder_index,
|
||||||
slot: produce_at_slot,
|
slot: produce_at_slot,
|
||||||
@@ -1233,7 +1259,10 @@ fn filter_voluntary_exits_for_parent_execution_requests<E: EthSpec>(
|
|||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
use ssz_types::VariableList;
|
use ssz_types::VariableList;
|
||||||
use types::{ConsolidationRequest, Epoch, MainnetEthSpec, VoluntaryExit, WithdrawalRequest};
|
use types::{
|
||||||
|
ConsolidationRequest, Epoch, ExecutionPayloadGloas, MainnetEthSpec, VoluntaryExit,
|
||||||
|
WithdrawalRequest,
|
||||||
|
};
|
||||||
|
|
||||||
type TestSpec = MainnetEthSpec;
|
type TestSpec = MainnetEthSpec;
|
||||||
|
|
||||||
@@ -1401,7 +1430,7 @@ mod tests {
|
|||||||
fn local_build(payload_gwei: u64, should_override_builder: bool) -> LocalBuildResult<TestSpec> {
|
fn local_build(payload_gwei: u64, should_override_builder: bool) -> LocalBuildResult<TestSpec> {
|
||||||
LocalBuildResult {
|
LocalBuildResult {
|
||||||
payload_data: ExecutionPayloadData {
|
payload_data: ExecutionPayloadData {
|
||||||
payload: types::ExecutionPayloadGloas::default(),
|
payload: ExecutionPayload::Gloas(ExecutionPayloadGloas::default()),
|
||||||
execution_requests: ExecutionRequests::default(),
|
execution_requests: ExecutionRequests::default(),
|
||||||
builder_index: BUILDER_INDEX_SELF_BUILD,
|
builder_index: BUILDER_INDEX_SELF_BUILD,
|
||||||
slot: Slot::new(0),
|
slot: Slot::new(0),
|
||||||
|
|||||||
Reference in New Issue
Block a user