mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-10 04:01:51 +00:00
BeaconState and BeaconBlockBody mods
This commit is contained in:
@@ -27,7 +27,7 @@ use tracing::{debug, error, info, warn};
|
||||
use tree_hash::TreeHash;
|
||||
use types::builder_bid::{
|
||||
BuilderBid, BuilderBidBellatrix, BuilderBidCapella, BuilderBidDeneb, BuilderBidElectra,
|
||||
BuilderBidFulu, BuilderBidGloas, SignedBuilderBid,
|
||||
BuilderBidFulu, SignedBuilderBid,
|
||||
};
|
||||
use types::{
|
||||
Address, BeaconState, ChainSpec, Epoch, EthSpec, ExecPayload, ExecutionPayload,
|
||||
@@ -115,9 +115,6 @@ impl<E: EthSpec> BidStuff<E> for BuilderBid<E> {
|
||||
ExecutionPayloadHeaderRefMut::Fulu(header) => {
|
||||
header.fee_recipient = fee_recipient;
|
||||
}
|
||||
ExecutionPayloadHeaderRefMut::Gloas(header) => {
|
||||
header.fee_recipient = fee_recipient;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -138,9 +135,6 @@ impl<E: EthSpec> BidStuff<E> for BuilderBid<E> {
|
||||
ExecutionPayloadHeaderRefMut::Fulu(header) => {
|
||||
header.gas_limit = gas_limit;
|
||||
}
|
||||
ExecutionPayloadHeaderRefMut::Gloas(header) => {
|
||||
header.gas_limit = gas_limit;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -165,9 +159,6 @@ impl<E: EthSpec> BidStuff<E> for BuilderBid<E> {
|
||||
ExecutionPayloadHeaderRefMut::Fulu(header) => {
|
||||
header.parent_hash = ExecutionBlockHash::from_root(parent_hash);
|
||||
}
|
||||
ExecutionPayloadHeaderRefMut::Gloas(header) => {
|
||||
header.parent_hash = ExecutionBlockHash::from_root(parent_hash);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -188,9 +179,6 @@ impl<E: EthSpec> BidStuff<E> for BuilderBid<E> {
|
||||
ExecutionPayloadHeaderRefMut::Fulu(header) => {
|
||||
header.prev_randao = prev_randao;
|
||||
}
|
||||
ExecutionPayloadHeaderRefMut::Gloas(header) => {
|
||||
header.prev_randao = prev_randao;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -211,9 +199,6 @@ impl<E: EthSpec> BidStuff<E> for BuilderBid<E> {
|
||||
ExecutionPayloadHeaderRefMut::Fulu(header) => {
|
||||
header.block_number = block_number;
|
||||
}
|
||||
ExecutionPayloadHeaderRefMut::Gloas(header) => {
|
||||
header.block_number = block_number;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -234,9 +219,6 @@ impl<E: EthSpec> BidStuff<E> for BuilderBid<E> {
|
||||
ExecutionPayloadHeaderRefMut::Fulu(header) => {
|
||||
header.timestamp = timestamp;
|
||||
}
|
||||
ExecutionPayloadHeaderRefMut::Gloas(header) => {
|
||||
header.timestamp = timestamp;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -257,9 +239,6 @@ impl<E: EthSpec> BidStuff<E> for BuilderBid<E> {
|
||||
ExecutionPayloadHeaderRefMut::Fulu(header) => {
|
||||
header.withdrawals_root = withdrawals_root;
|
||||
}
|
||||
ExecutionPayloadHeaderRefMut::Gloas(header) => {
|
||||
header.withdrawals_root = withdrawals_root;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -293,10 +272,6 @@ impl<E: EthSpec> BidStuff<E> for BuilderBid<E> {
|
||||
header.extra_data = extra_data;
|
||||
header.block_hash = ExecutionBlockHash::from_root(header.tree_hash_root());
|
||||
}
|
||||
ExecutionPayloadHeaderRefMut::Gloas(header) => {
|
||||
header.extra_data = extra_data;
|
||||
header.block_hash = ExecutionBlockHash::from_root(header.tree_hash_root());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -464,9 +439,7 @@ impl<E: EthSpec> MockBuilder<E> {
|
||||
block: SignedBlindedBeaconBlock<E>,
|
||||
) -> Result<FullPayloadContents<E>, String> {
|
||||
let root = match &block {
|
||||
SignedBlindedBeaconBlock::Base(_)
|
||||
| SignedBlindedBeaconBlock::Altair(_)
|
||||
| SignedBlindedBeaconBlock::Gloas(_) => {
|
||||
SignedBlindedBeaconBlock::Base(_) | SignedBlindedBeaconBlock::Altair(_) => {
|
||||
return Err("invalid fork".to_string());
|
||||
}
|
||||
SignedBlindedBeaconBlock::Bellatrix(block) => {
|
||||
@@ -484,6 +457,10 @@ impl<E: EthSpec> MockBuilder<E> {
|
||||
SignedBlindedBeaconBlock::Fulu(block) => {
|
||||
block.message.body.execution_payload.tree_hash_root()
|
||||
}
|
||||
SignedBlindedBeaconBlock::Gloas(_) => {
|
||||
// TODO(EIP7732) Check if this is how we want to do error handling for gloas
|
||||
return Err("invalid fork".to_string());
|
||||
}
|
||||
};
|
||||
info!(
|
||||
block_hash = %root,
|
||||
@@ -567,18 +544,10 @@ impl<E: EthSpec> MockBuilder<E> {
|
||||
) = payload_response.into();
|
||||
|
||||
match fork {
|
||||
ForkName::Gloas => BuilderBid::Gloas(BuilderBidGloas {
|
||||
header: payload
|
||||
.as_gloas()
|
||||
.map_err(|_| "incorrect payload variant".to_string())?
|
||||
.into(),
|
||||
blob_kzg_commitments: maybe_blobs_bundle
|
||||
.map(|b| b.commitments.clone())
|
||||
.unwrap_or_default(),
|
||||
value: self.get_bid_value(value),
|
||||
pubkey: self.builder_sk.public_key().compress(),
|
||||
execution_requests: maybe_requests.unwrap_or_default(),
|
||||
}),
|
||||
ForkName::Gloas => {
|
||||
// TODO(EIP7732) Check if this is how we want to do error handling for gloas
|
||||
return Err("invalid fork".to_string());
|
||||
}
|
||||
ForkName::Fulu => BuilderBid::Fulu(BuilderBidFulu {
|
||||
header: payload
|
||||
.as_fulu()
|
||||
@@ -877,6 +846,10 @@ impl<E: EthSpec> MockBuilder<E> {
|
||||
// first to avoid polluting the execution block generator with invalid payload attributes
|
||||
// NOTE: this was part of an effort to add payload attribute uniqueness checks,
|
||||
// which was abandoned because it broke too many tests in subtle ways.
|
||||
ForkName::Gloas => {
|
||||
// TODO(EIP7732) Check if this is how we want to do error handling for gloas
|
||||
return Err("invalid fork".to_string());
|
||||
}
|
||||
ForkName::Bellatrix | ForkName::Capella => PayloadAttributes::new(
|
||||
timestamp,
|
||||
*prev_randao,
|
||||
@@ -884,16 +857,11 @@ impl<E: EthSpec> MockBuilder<E> {
|
||||
expected_withdrawals,
|
||||
None,
|
||||
),
|
||||
ForkName::Deneb | ForkName::Electra | ForkName::Fulu | ForkName::Gloas => {
|
||||
PayloadAttributes::new(
|
||||
timestamp,
|
||||
*prev_randao,
|
||||
fee_recipient,
|
||||
expected_withdrawals,
|
||||
Some(head_block_root),
|
||||
)
|
||||
}
|
||||
ForkName::Base | ForkName::Altair => {
|
||||
ForkName::Deneb
|
||||
| ForkName::Electra
|
||||
| ForkName::Fulu
|
||||
| ForkName::Base
|
||||
| ForkName::Altair => {
|
||||
return Err("invalid fork".to_string());
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user