Skip to content

Commit

Permalink
Merge branch 'electra-alpha7' of https://github.com/pawanjay176/light…
Browse files Browse the repository at this point in the history
…house into single_attestation
  • Loading branch information
eserilev committed Dec 4, 2024
2 parents 5e28a01 + c5c9aca commit ba06501
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 15 deletions.
3 changes: 1 addition & 2 deletions beacon_node/execution_layer/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,7 @@ impl<E: EthSpec> TryFrom<BuilderBid<E>> for ProvenancedPayload<BlockProposalCont
block_value: builder_bid.value,
kzg_commitments: builder_bid.blob_kzg_commitments,
blobs_and_proofs: None,
// TODO(electra): update this with builder api returning the requests
requests: None,
requests: Some(builder_bid.execution_requests),
},
};
Ok(ProvenancedPayload::Builder(
Expand Down
24 changes: 13 additions & 11 deletions beacon_node/execution_layer/src/test_utils/mock_builder.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::test_utils::{DEFAULT_BUILDER_PAYLOAD_VALUE_WEI, DEFAULT_JWT_SECRET};
use crate::test_utils::DEFAULT_JWT_SECRET;
use crate::{Config, ExecutionLayer, PayloadAttributes};
use eth2::types::{BlobsBundle, BlockId, StateId, ValidatorId};
use eth2::{BeaconNodeHttpClient, Timeouts, CONSENSUS_VERSION_HEADER};
Expand Down Expand Up @@ -543,7 +543,7 @@ pub fn serve<E: EthSpec>(
let mut message = match payload_response_type {
crate::GetPayloadResponseType::Full(payload_response) => {
#[allow(clippy::type_complexity)]
let (payload, _block_value, maybe_blobs_bundle, _maybe_requests): (
let (payload, value, maybe_blobs_bundle, maybe_requests): (
ExecutionPayload<E>,
Uint256,
Option<BlobsBundle<E>>,
Expand All @@ -559,8 +559,9 @@ pub fn serve<E: EthSpec>(
blob_kzg_commitments: maybe_blobs_bundle
.map(|b| b.commitments)
.unwrap_or_default(),
value: Uint256::from(DEFAULT_BUILDER_PAYLOAD_VALUE_WEI),
value,
pubkey: builder.builder_sk.public_key().compress(),
execution_requests: maybe_requests.unwrap_or_default(),
}),
ForkName::Deneb => BuilderBid::Deneb(BuilderBidDeneb {
header: payload
Expand All @@ -570,23 +571,23 @@ pub fn serve<E: EthSpec>(
blob_kzg_commitments: maybe_blobs_bundle
.map(|b| b.commitments)
.unwrap_or_default(),
value: Uint256::from(DEFAULT_BUILDER_PAYLOAD_VALUE_WEI),
value,
pubkey: builder.builder_sk.public_key().compress(),
}),
ForkName::Capella => BuilderBid::Capella(BuilderBidCapella {
header: payload
.as_capella()
.map_err(|_| reject("incorrect payload variant"))?
.into(),
value: Uint256::from(DEFAULT_BUILDER_PAYLOAD_VALUE_WEI),
value,
pubkey: builder.builder_sk.public_key().compress(),
}),
ForkName::Bellatrix => BuilderBid::Bellatrix(BuilderBidBellatrix {
header: payload
.as_bellatrix()
.map_err(|_| reject("incorrect payload variant"))?
.into(),
value: Uint256::from(DEFAULT_BUILDER_PAYLOAD_VALUE_WEI),
value,
pubkey: builder.builder_sk.public_key().compress(),
}),
ForkName::Base | ForkName::Altair => {
Expand All @@ -596,7 +597,7 @@ pub fn serve<E: EthSpec>(
}
crate::GetPayloadResponseType::Blinded(payload_response) => {
#[allow(clippy::type_complexity)]
let (payload, _block_value, maybe_blobs_bundle, _maybe_requests): (
let (payload, value, maybe_blobs_bundle, maybe_requests): (
ExecutionPayload<E>,
Uint256,
Option<BlobsBundle<E>>,
Expand All @@ -611,8 +612,9 @@ pub fn serve<E: EthSpec>(
blob_kzg_commitments: maybe_blobs_bundle
.map(|b| b.commitments)
.unwrap_or_default(),
value: Uint256::from(DEFAULT_BUILDER_PAYLOAD_VALUE_WEI),
value,
pubkey: builder.builder_sk.public_key().compress(),
execution_requests: maybe_requests.unwrap_or_default(),
}),
ForkName::Deneb => BuilderBid::Deneb(BuilderBidDeneb {
header: payload
Expand All @@ -622,23 +624,23 @@ pub fn serve<E: EthSpec>(
blob_kzg_commitments: maybe_blobs_bundle
.map(|b| b.commitments)
.unwrap_or_default(),
value: Uint256::from(DEFAULT_BUILDER_PAYLOAD_VALUE_WEI),
value,
pubkey: builder.builder_sk.public_key().compress(),
}),
ForkName::Capella => BuilderBid::Capella(BuilderBidCapella {
header: payload
.as_capella()
.map_err(|_| reject("incorrect payload variant"))?
.into(),
value: Uint256::from(DEFAULT_BUILDER_PAYLOAD_VALUE_WEI),
value,
pubkey: builder.builder_sk.public_key().compress(),
}),
ForkName::Bellatrix => BuilderBid::Bellatrix(BuilderBidBellatrix {
header: payload
.as_bellatrix()
.map_err(|_| reject("incorrect payload variant"))?
.into(),
value: Uint256::from(DEFAULT_BUILDER_PAYLOAD_VALUE_WEI),
value,
pubkey: builder.builder_sk.public_key().compress(),
}),
ForkName::Base | ForkName::Altair => {
Expand Down
2 changes: 1 addition & 1 deletion beacon_node/execution_layer/src/test_utils/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ pub use execution_block_generator::{
static_valid_tx, Block, ExecutionBlockGenerator,
};
pub use hook::Hook;
pub use mock_builder::{MockBuilder, Operation};
pub use mock_builder::{MockBuilder, Operation, serve as serve_mock_builder};
pub use mock_execution_layer::MockExecutionLayer;

pub const DEFAULT_TERMINAL_DIFFICULTY: u64 = 6400;
Expand Down
5 changes: 4 additions & 1 deletion consensus/types/src/builder_bid.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ use crate::beacon_block_body::KzgCommitments;
use crate::{
ChainSpec, EthSpec, ExecutionPayloadHeaderBellatrix, ExecutionPayloadHeaderCapella,
ExecutionPayloadHeaderDeneb, ExecutionPayloadHeaderElectra, ExecutionPayloadHeaderRef,
ExecutionPayloadHeaderRefMut, ForkName, ForkVersionDeserialize, SignedRoot, Uint256,
ExecutionPayloadHeaderRefMut, ExecutionRequests, ForkName, ForkVersionDeserialize, SignedRoot,
Uint256,
};
use bls::PublicKeyBytes;
use bls::Signature;
Expand Down Expand Up @@ -33,6 +34,8 @@ pub struct BuilderBid<E: EthSpec> {
pub header: ExecutionPayloadHeaderElectra<E>,
#[superstruct(only(Deneb, Electra))]
pub blob_kzg_commitments: KzgCommitments<E>,
#[superstruct(only(Electra))]
pub execution_requests: ExecutionRequests<E>,
#[serde(with = "serde_utils::quoted_u256")]
pub value: Uint256,
pub pubkey: PublicKeyBytes,
Expand Down

0 comments on commit ba06501

Please sign in to comment.