diff --git a/beacon_node/execution_layer/src/engine_api.rs b/beacon_node/execution_layer/src/engine_api.rs index ba0a37736..c82acea63 100644 --- a/beacon_node/execution_layer/src/engine_api.rs +++ b/beacon_node/execution_layer/src/engine_api.rs @@ -11,6 +11,10 @@ pub use types::{ }; pub mod auth; +use crate::engines::ForkChoiceState; +pub use types::{Address, EthSpec, ExecutionPayload, Hash256, Uint256}; +use types::{Blob, KZGCommitment}; + pub mod http; pub mod json_structures; @@ -166,3 +170,9 @@ pub struct ProposeBlindedBlockResponse { pub latest_valid_hash: Option, pub validation_error: Option, } + +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct BlobDetailsV1 { + kzg: KZGCommitment, + blob: Vec, +} diff --git a/beacon_node/execution_layer/src/engine_api/http.rs b/beacon_node/execution_layer/src/engine_api/http.rs index 0f848a771..093dad5f1 100644 --- a/beacon_node/execution_layer/src/engine_api/http.rs +++ b/beacon_node/execution_layer/src/engine_api/http.rs @@ -34,6 +34,9 @@ pub const ENGINE_NEW_PAYLOAD_TIMEOUT: Duration = Duration::from_secs(8); pub const ENGINE_GET_PAYLOAD_V1: &str = "engine_getPayloadV1"; pub const ENGINE_GET_PAYLOAD_TIMEOUT: Duration = Duration::from_secs(2); +pub const ENGINE_GET_BLOB_V1: &str = "engine_getBlobV1"; +pub const ENGINE_GET_BLOB_TIMEOUT: Duration = Duration::from_secs(2); + pub const ENGINE_FORKCHOICE_UPDATED_V1: &str = "engine_forkchoiceUpdatedV1"; pub const ENGINE_FORKCHOICE_UPDATED_TIMEOUT: Duration = Duration::from_secs(8); @@ -664,6 +667,20 @@ impl HttpJsonRpc { Ok(response.into()) } + async fn get_blob_v1( + &self, + payload_id: PayloadId, + versioned_hash: Hash256, + ) -> Result { + let params = json!([JsonPayloadIdRequest::from(payload_id), versioned_hash]); + + let response: BlobDetailsV1 = self + .rpc_request(ENGINE_GET_BLOB_V1, params, ENGINE_GET_BLOB_TIMEOUT) + .await?; + + Ok(response.into()) + } + pub async fn forkchoice_updated_v1( &self, forkchoice_state: ForkChoiceState, diff --git a/consensus/types/src/blob_wrapper.rs b/consensus/types/src/blob_wrapper.rs index a2d647556..7960403a7 100644 --- a/consensus/types/src/blob_wrapper.rs +++ b/consensus/types/src/blob_wrapper.rs @@ -1,6 +1,6 @@ -use crate::{Blob, EthSpec, Hash256, SignedBeaconBlock, Slot}; +use crate::{Blob, EthSpec, Hash256, Slot}; use serde_derive::{Deserialize, Serialize}; -use ssz::{Decode, Encode}; +use ssz::Encode; use ssz_derive::{Decode, Encode}; use ssz_types::VariableList; use tree_hash::TreeHash;