diff --git a/beacon_node/execution_layer/src/lib.rs b/beacon_node/execution_layer/src/lib.rs index 5a1c2571b62..c4fa7c76771 100644 --- a/beacon_node/execution_layer/src/lib.rs +++ b/beacon_node/execution_layer/src/lib.rs @@ -796,18 +796,28 @@ impl ExecutionLayer { self.inner.builder_profit_threshold, spec, ) { - Ok(()) => Ok(ProvenancedPayload::Builder( - match relay.version.unwrap() { - ForkName::Base | ForkName::Altair | ForkName::Merge | ForkName::Capella => { + Ok(()) => { + Ok(ProvenancedPayload::Builder(match relay.version.unwrap() { + ForkName::Base + | ForkName::Altair + | ForkName::Merge + | ForkName::Capella => { BlockProposalContents::Payload(header) } - ForkName::Eip4844 => BlockProposalContents::PayloadAndBlobs { - payload: header, - blobs: VariableList::default(), - kzg_commitments: relay.data.message.blob_kzg_commitments().unwrap().clone() - }, - } - )), + ForkName::Eip4844 => { + BlockProposalContents::PayloadAndBlobs { + payload: header, + blobs: VariableList::default(), + kzg_commitments: relay + .data + .message + .blob_kzg_commitments() + .unwrap() + .clone(), + } + } + })) + } Err(reason) if !reason.payload_invalid() => { info!( self.log(), @@ -857,32 +867,52 @@ impl ExecutionLayer { self.inner.builder_profit_threshold, spec, ) { - Ok(()) => Ok(ProvenancedPayload::Builder( - match relay.version.unwrap() { - ForkName::Base | ForkName::Altair | ForkName::Merge | ForkName::Capella => { + Ok(()) => { + Ok(ProvenancedPayload::Builder(match relay.version.unwrap() { + ForkName::Base + | ForkName::Altair + | ForkName::Merge + | ForkName::Capella => { BlockProposalContents::Payload(header) } - ForkName::Eip4844 => BlockProposalContents::PayloadAndBlobs { - payload: header, - blobs: VariableList::default(), - kzg_commitments: relay.data.message.blob_kzg_commitments().unwrap().clone(), - }, - } - )), + ForkName::Eip4844 => { + BlockProposalContents::PayloadAndBlobs { + payload: header, + blobs: VariableList::default(), + kzg_commitments: relay + .data + .message + .blob_kzg_commitments() + .unwrap() + .clone(), + } + } + })) + } // If the payload is valid then use it. The local EE failed // to produce a payload so we have no alternative. - Err(e) if !e.payload_invalid() => Ok(ProvenancedPayload::Builder( - match relay.version.unwrap() { - ForkName::Base | ForkName::Altair | ForkName::Merge | ForkName::Capella => { + Err(e) if !e.payload_invalid() => { + Ok(ProvenancedPayload::Builder(match relay.version.unwrap() { + ForkName::Base + | ForkName::Altair + | ForkName::Merge + | ForkName::Capella => { BlockProposalContents::Payload(header) } - ForkName::Eip4844 => BlockProposalContents::PayloadAndBlobs { - payload: header, - blobs: VariableList::default(), - kzg_commitments: relay.data.message.blob_kzg_commitments().unwrap().clone(), - }, - } - )), + ForkName::Eip4844 => { + BlockProposalContents::PayloadAndBlobs { + payload: header, + blobs: VariableList::default(), + kzg_commitments: relay + .data + .message + .blob_kzg_commitments() + .unwrap() + .clone(), + } + } + })) + } Err(reason) => { metrics::inc_counter_vec( &metrics::EXECUTION_LAYER_GET_PAYLOAD_BUILDER_REJECTIONS, diff --git a/consensus/types/src/builder_bid.rs b/consensus/types/src/builder_bid.rs index 985797da37a..b0aa4e9c751 100644 --- a/consensus/types/src/builder_bid.rs +++ b/consensus/types/src/builder_bid.rs @@ -1,7 +1,7 @@ use super::KzgCommitment; use crate::{ AbstractExecPayload, ChainSpec, EthSpec, ExecPayload, ExecutionPayloadHeader, SignedRoot, - Uint256 + Uint256, }; use bls::PublicKeyBytes; use bls::Signature; @@ -17,14 +17,16 @@ use tree_hash_derive::TreeHash; #[superstruct( variants(Merge, Capella, Eip4844), variant_attributes( - derive( - PartialEq, Debug, Serialize, Deserialize, TreeHash, Clone - ), + derive(PartialEq, Debug, Serialize, Deserialize, TreeHash, Clone), serde(bound = "E: EthSpec, Payload: ExecPayload", deny_unknown_fields) ) )] #[derive(PartialEq, Debug, Serialize, Deserialize, TreeHash, Clone)] -#[serde(bound = "E: EthSpec, Payload: ExecPayload", deny_unknown_fields, untagged)] +#[serde( + bound = "E: EthSpec, Payload: ExecPayload", + deny_unknown_fields, + untagged +)] #[tree_hash(enum_behaviour = "transparent")] pub struct BuilderBid> { #[superstruct(only(Merge), partial_getter(rename = "payload_merge"))] @@ -106,17 +108,18 @@ impl> SignedBuilderBid { } } - #[cfg(test)] mod tests { - use crate::{BlindedPayload, MainnetEthSpec}; use super::*; + use crate::{BlindedPayload, MainnetEthSpec}; - pub fn deserialize_bid>(str: &str) -> Result, Error> { + pub fn deserialize_bid>( + str: &str, + ) -> Result, Error> { let bid = serde_json::from_str(str)?; Ok(bid) } - + #[test] fn test_deserialize_builder_bid_merge() { let str = r#"{ @@ -143,7 +146,6 @@ mod tests { assert!(result.is_ok()); } - #[test] #[cfg(feature = "withdrawals")] fn test_deserialize_builder_bid_capella() { @@ -203,4 +205,4 @@ mod tests { let result = deserialize_bid::>(str); assert!(result.is_ok()); } -} \ No newline at end of file +}