mirror of
https://github.com/sigp/lighthouse.git
synced 2026-05-08 01:05:47 +00:00
Yeet
This commit is contained in:
@@ -15,11 +15,8 @@ use tree_hash_derive::TreeHash;
|
|||||||
use typenum::Unsigned;
|
use typenum::Unsigned;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
Address, SignedBlsToExecutionChange, SignedExecutionPayloadBid,
|
SignedExecutionPayloadBid,
|
||||||
attestation::{
|
attestation::{AttestationBase, AttestationData, IndexedAttestationBase},
|
||||||
AttestationBase, AttestationData, AttestationElectra, IndexedAttestationBase,
|
|
||||||
IndexedAttestationElectra, PayloadAttestation, PayloadAttestationData,
|
|
||||||
},
|
|
||||||
block::{
|
block::{
|
||||||
BeaconBlockBodyAltair, BeaconBlockBodyBase, BeaconBlockBodyBellatrix,
|
BeaconBlockBodyAltair, BeaconBlockBodyBase, BeaconBlockBodyBellatrix,
|
||||||
BeaconBlockBodyCapella, BeaconBlockBodyDeneb, BeaconBlockBodyElectra, BeaconBlockBodyFulu,
|
BeaconBlockBodyCapella, BeaconBlockBodyDeneb, BeaconBlockBodyElectra, BeaconBlockBodyFulu,
|
||||||
@@ -29,12 +26,12 @@ use crate::{
|
|||||||
core::{ChainSpec, Domain, Epoch, EthSpec, Graffiti, Hash256, SignedRoot, Slot},
|
core::{ChainSpec, Domain, Epoch, EthSpec, Graffiti, Hash256, SignedRoot, Slot},
|
||||||
deposit::{Deposit, DepositData},
|
deposit::{Deposit, DepositData},
|
||||||
execution::{
|
execution::{
|
||||||
AbstractExecPayload, BlindedPayload, BlsToExecutionChange, Eth1Data, ExecutionPayload,
|
AbstractExecPayload, BlindedPayload, Eth1Data, ExecutionPayload, ExecutionRequests,
|
||||||
ExecutionRequests, FullPayload,
|
FullPayload,
|
||||||
},
|
},
|
||||||
exit::{SignedVoluntaryExit, VoluntaryExit},
|
exit::{SignedVoluntaryExit, VoluntaryExit},
|
||||||
fork::{Fork, ForkName, InconsistentFork, map_fork_name},
|
fork::{Fork, ForkName, InconsistentFork, map_fork_name},
|
||||||
slashing::{AttesterSlashingBase, AttesterSlashingElectra, ProposerSlashing},
|
slashing::{AttesterSlashingBase, ProposerSlashing},
|
||||||
state::BeaconStateError,
|
state::BeaconStateError,
|
||||||
sync_committee::SyncAggregate,
|
sync_committee::SyncAggregate,
|
||||||
test_utils::TestRandom,
|
test_utils::TestRandom,
|
||||||
@@ -727,135 +724,6 @@ impl<E: EthSpec, Payload: AbstractExecPayload<E>> EmptyBlock for BeaconBlockGloa
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<E: EthSpec, Payload: AbstractExecPayload<E>> BeaconBlockGloas<E, Payload> {
|
|
||||||
/// Returns a full Gloas block with all variable-length fields at max capacity.
|
|
||||||
/// Used for computing the maximum SSZ-encoded size.
|
|
||||||
pub fn full(spec: &ChainSpec) -> Self {
|
|
||||||
let header = BeaconBlockHeader {
|
|
||||||
slot: Slot::new(1),
|
|
||||||
proposer_index: 0,
|
|
||||||
parent_root: Hash256::zero(),
|
|
||||||
state_root: Hash256::zero(),
|
|
||||||
body_root: Hash256::zero(),
|
|
||||||
};
|
|
||||||
|
|
||||||
let signed_header = SignedBeaconBlockHeader {
|
|
||||||
message: header,
|
|
||||||
signature: Signature::empty(),
|
|
||||||
};
|
|
||||||
|
|
||||||
let indexed_attestation = IndexedAttestationElectra {
|
|
||||||
attesting_indices: VariableList::new(vec![0_u64; E::MaxValidatorsPerSlot::to_usize()])
|
|
||||||
.unwrap(),
|
|
||||||
data: AttestationData::default(),
|
|
||||||
signature: AggregateSignature::empty(),
|
|
||||||
};
|
|
||||||
|
|
||||||
let proposer_slashing = ProposerSlashing {
|
|
||||||
signed_header_1: signed_header.clone(),
|
|
||||||
signed_header_2: signed_header,
|
|
||||||
};
|
|
||||||
|
|
||||||
let attester_slashing = AttesterSlashingElectra {
|
|
||||||
attestation_1: indexed_attestation.clone(),
|
|
||||||
attestation_2: indexed_attestation,
|
|
||||||
};
|
|
||||||
|
|
||||||
let attestation = AttestationElectra {
|
|
||||||
aggregation_bits: BitList::with_capacity(E::MaxValidatorsPerSlot::to_usize()).unwrap(),
|
|
||||||
data: AttestationData::default(),
|
|
||||||
signature: AggregateSignature::empty(),
|
|
||||||
committee_bits: BitVector::default(),
|
|
||||||
};
|
|
||||||
|
|
||||||
let deposit_data = DepositData {
|
|
||||||
pubkey: PublicKeyBytes::empty(),
|
|
||||||
withdrawal_credentials: Hash256::zero(),
|
|
||||||
amount: 0,
|
|
||||||
signature: SignatureBytes::empty(),
|
|
||||||
};
|
|
||||||
|
|
||||||
let deposit = Deposit {
|
|
||||||
proof: FixedVector::from_elem(Hash256::zero()),
|
|
||||||
data: deposit_data,
|
|
||||||
};
|
|
||||||
|
|
||||||
let signed_voluntary_exit = SignedVoluntaryExit {
|
|
||||||
message: VoluntaryExit {
|
|
||||||
epoch: Epoch::new(1),
|
|
||||||
validator_index: 1,
|
|
||||||
},
|
|
||||||
signature: Signature::empty(),
|
|
||||||
};
|
|
||||||
|
|
||||||
let signed_bls_to_execution_change = SignedBlsToExecutionChange {
|
|
||||||
message: BlsToExecutionChange {
|
|
||||||
validator_index: 0,
|
|
||||||
from_bls_pubkey: PublicKeyBytes::empty(),
|
|
||||||
to_execution_address: Address::zero(),
|
|
||||||
},
|
|
||||||
signature: Signature::empty(),
|
|
||||||
};
|
|
||||||
|
|
||||||
let payload_attestation = PayloadAttestation {
|
|
||||||
aggregation_bits: BitVector::default(),
|
|
||||||
data: PayloadAttestationData {
|
|
||||||
beacon_block_root: Hash256::zero(),
|
|
||||||
slot: Slot::new(0),
|
|
||||||
payload_present: false,
|
|
||||||
blob_data_available: false,
|
|
||||||
},
|
|
||||||
signature: AggregateSignature::empty(),
|
|
||||||
};
|
|
||||||
|
|
||||||
let mut block = BeaconBlockGloas::<E, Payload>::empty(spec);
|
|
||||||
|
|
||||||
for _ in 0..E::MaxProposerSlashings::to_usize() {
|
|
||||||
block
|
|
||||||
.body
|
|
||||||
.proposer_slashings
|
|
||||||
.push(proposer_slashing.clone())
|
|
||||||
.unwrap();
|
|
||||||
}
|
|
||||||
for _ in 0..E::max_attester_slashings_electra() {
|
|
||||||
block
|
|
||||||
.body
|
|
||||||
.attester_slashings
|
|
||||||
.push(attester_slashing.clone())
|
|
||||||
.unwrap();
|
|
||||||
}
|
|
||||||
for _ in 0..E::max_attestations_electra() {
|
|
||||||
block.body.attestations.push(attestation.clone()).unwrap();
|
|
||||||
}
|
|
||||||
for _ in 0..E::MaxDeposits::to_usize() {
|
|
||||||
block.body.deposits.push(deposit.clone()).unwrap();
|
|
||||||
}
|
|
||||||
for _ in 0..E::MaxVoluntaryExits::to_usize() {
|
|
||||||
block
|
|
||||||
.body
|
|
||||||
.voluntary_exits
|
|
||||||
.push(signed_voluntary_exit.clone())
|
|
||||||
.unwrap();
|
|
||||||
}
|
|
||||||
for _ in 0..E::MaxBlsToExecutionChanges::to_usize() {
|
|
||||||
block
|
|
||||||
.body
|
|
||||||
.bls_to_execution_changes
|
|
||||||
.push(signed_bls_to_execution_change.clone())
|
|
||||||
.unwrap();
|
|
||||||
}
|
|
||||||
for _ in 0..E::MaxPayloadAttestations::to_usize() {
|
|
||||||
block
|
|
||||||
.body
|
|
||||||
.payload_attestations
|
|
||||||
.push(payload_attestation.clone())
|
|
||||||
.unwrap();
|
|
||||||
}
|
|
||||||
|
|
||||||
block
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO(EIP-7732) Mark's branch had the following implementation but not sure if it's needed so will just add header below for reference
|
// TODO(EIP-7732) Mark's branch had the following implementation but not sure if it's needed so will just add header below for reference
|
||||||
// impl<E: EthSpec, Payload: AbstractExecPayload<E>> BeaconBlockEIP7732<E, Payload> {
|
// impl<E: EthSpec, Payload: AbstractExecPayload<E>> BeaconBlockEIP7732<E, Payload> {
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user