mirror of
https://github.com/sigp/lighthouse.git
synced 2026-04-29 18:53:32 +00:00
Cell Dissemination (Partial messages) (#8314)
- https://github.com/ethereum/consensus-specs/pull/4558 - https://eips.ethereum.org/EIPS/eip-8136 Co-Authored-By: Daniel Knopik <daniel@dknopik.de> Co-Authored-By: Pawan Dhananjay <pawandhananjay@gmail.com> Co-Authored-By: Jimmy Chen <jchen.tc@gmail.com>
This commit is contained in:
@@ -596,6 +596,7 @@ pub struct EngineCapabilities {
|
||||
pub get_client_version_v1: bool,
|
||||
pub get_blobs_v1: bool,
|
||||
pub get_blobs_v2: bool,
|
||||
pub get_blobs_v3: bool,
|
||||
}
|
||||
|
||||
impl EngineCapabilities {
|
||||
|
||||
@@ -64,6 +64,7 @@ pub const ENGINE_GET_CLIENT_VERSION_TIMEOUT: Duration = Duration::from_secs(1);
|
||||
|
||||
pub const ENGINE_GET_BLOBS_V1: &str = "engine_getBlobsV1";
|
||||
pub const ENGINE_GET_BLOBS_V2: &str = "engine_getBlobsV2";
|
||||
pub const ENGINE_GET_BLOBS_V3: &str = "engine_getBlobsV3";
|
||||
pub const ENGINE_GET_BLOBS_TIMEOUT: Duration = Duration::from_secs(1);
|
||||
|
||||
/// This error is returned during a `chainId` call by Geth.
|
||||
@@ -743,6 +744,20 @@ impl HttpJsonRpc {
|
||||
.await
|
||||
}
|
||||
|
||||
pub async fn get_blobs_v3<E: EthSpec>(
|
||||
&self,
|
||||
versioned_hashes: Vec<Hash256>,
|
||||
) -> Result<Option<Vec<BlobAndProofV3<E>>>, Error> {
|
||||
let params = json!([versioned_hashes]);
|
||||
|
||||
self.rpc_request(
|
||||
ENGINE_GET_BLOBS_V3,
|
||||
params,
|
||||
ENGINE_GET_BLOBS_TIMEOUT * self.execution_timeout_multiplier,
|
||||
)
|
||||
.await
|
||||
}
|
||||
|
||||
pub async fn get_block_by_number(
|
||||
&self,
|
||||
query: BlockByNumberQuery<'_>,
|
||||
@@ -1258,6 +1273,7 @@ impl HttpJsonRpc {
|
||||
get_client_version_v1: capabilities.contains(ENGINE_GET_CLIENT_VERSION_V1),
|
||||
get_blobs_v1: capabilities.contains(ENGINE_GET_BLOBS_V1),
|
||||
get_blobs_v2: capabilities.contains(ENGINE_GET_BLOBS_V2),
|
||||
get_blobs_v3: capabilities.contains(ENGINE_GET_BLOBS_V3),
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -864,6 +864,9 @@ pub struct BlobAndProof<E: EthSpec> {
|
||||
pub proofs: KzgProofs<E>,
|
||||
}
|
||||
|
||||
/// A BlobAndProofV3 is just a BlobAndProofV2 that may also be `null` if unknown by the EL.
|
||||
pub type BlobAndProofV3<E> = Option<BlobAndProofV2<E>>;
|
||||
|
||||
#[derive(Debug, PartialEq, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct JsonForkchoiceStateV1 {
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
//! This crate only provides useful functionality for "The Merge", it does not provide any of the
|
||||
//! deposit-contract functionality that the `beacon_node/eth1` crate already provides.
|
||||
|
||||
use crate::json_structures::{BlobAndProofV1, BlobAndProofV2};
|
||||
use crate::json_structures::{BlobAndProofV1, BlobAndProofV2, BlobAndProofV3};
|
||||
use crate::payload_cache::PayloadCache;
|
||||
use arc_swap::ArcSwapOption;
|
||||
use auth::{Auth, JwtKey, strip_prefix};
|
||||
@@ -1741,6 +1741,23 @@ impl<E: EthSpec> ExecutionLayer<E> {
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn get_blobs_v3(
|
||||
&self,
|
||||
query: Vec<Hash256>,
|
||||
) -> Result<Option<Vec<BlobAndProofV3<E>>>, Error> {
|
||||
let capabilities = self.get_engine_capabilities(None).await?;
|
||||
|
||||
if capabilities.get_blobs_v3 {
|
||||
self.engine()
|
||||
.request(|engine| async move { engine.api.get_blobs_v3(query).await })
|
||||
.await
|
||||
.map_err(Box::new)
|
||||
.map_err(Error::EngineError)
|
||||
} else {
|
||||
Err(Error::GetBlobsNotSupported)
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn get_block_by_number(
|
||||
&self,
|
||||
query: BlockByNumberQuery<'_>,
|
||||
|
||||
@@ -59,6 +59,7 @@ pub const DEFAULT_ENGINE_CAPABILITIES: EngineCapabilities = EngineCapabilities {
|
||||
get_client_version_v1: true,
|
||||
get_blobs_v1: true,
|
||||
get_blobs_v2: true,
|
||||
get_blobs_v3: true,
|
||||
};
|
||||
|
||||
pub static DEFAULT_CLIENT_VERSION: LazyLock<JsonClientVersionV1> =
|
||||
|
||||
Reference in New Issue
Block a user