Skip to content

Commit c87ffa2

Browse files
committed
Change builder api to return blocks and blobs
1 parent 44505a3 commit c87ffa2

File tree

2 files changed

+17
-8
lines changed

2 files changed

+17
-8
lines changed

builder-server/src/builder.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
use async_trait::async_trait;
22
use builder_api_types::{
3-
builder_bid::SignedBuilderBid, eth_spec::EthSpec, ExecutionBlockHash, ExecutionPayload,
4-
ForkName, PublicKeyBytes, SignedBlindedBeaconBlock, SignedValidatorRegistrationData, Slot,
3+
builder_bid::SignedBuilderBid, eth_spec::EthSpec, ExecutionBlockHash, ForkName,
4+
FullPayloadContents, PublicKeyBytes, SignedBlindedBeaconBlock, SignedValidatorRegistrationData,
5+
Slot,
56
};
67
use ethereum_apis_common::ErrorResponse;
78

@@ -15,7 +16,7 @@ pub trait Builder<E: EthSpec> {
1516
async fn submit_blinded_block(
1617
&self,
1718
block: SignedBlindedBeaconBlock<E>,
18-
) -> Result<ExecutionPayload<E>, ErrorResponse>;
19+
) -> Result<FullPayloadContents<E>, ErrorResponse>;
1920

2021
async fn get_header(
2122
&self,

builder-server/src/server.rs

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use axum::{
88
};
99
use builder_api_types::{
1010
eth_spec::EthSpec, fork_versioned_response::EmptyMetadata, ExecutionBlockHash,
11-
ForkVersionedResponse, PublicKeyBytes, SignedBlindedBeaconBlock,
11+
ForkVersionedResponse, FullPayloadContents, PublicKeyBytes, SignedBlindedBeaconBlock,
1212
SignedValidatorRegistrationData, Slot,
1313
};
1414
use ethereum_apis_common::build_response;
@@ -64,10 +64,18 @@ where
6464
.as_ref()
6565
.submit_blinded_block(block)
6666
.await
67-
.map(|payload| ForkVersionedResponse {
68-
version: Some(payload.fork_name()),
69-
metadata: EmptyMetadata {},
70-
data: payload,
67+
.map(|payload| {
68+
let fork_name = match &payload {
69+
FullPayloadContents::Payload(payload) => payload.fork_name(),
70+
FullPayloadContents::PayloadAndBlobs(payload_and_blobs) => {
71+
payload_and_blobs.execution_payload.fork_name()
72+
}
73+
};
74+
ForkVersionedResponse {
75+
version: Some(fork_name),
76+
metadata: EmptyMetadata {},
77+
data: payload,
78+
}
7179
});
7280
build_response(res).await
7381
}

0 commit comments

Comments
 (0)