ContextDeserialize and Beacon API Improvements (#7372)

* #7286
* BeaconAPI is not returning a versioned response when it should for some V1 endpoints
* these [strange functions with vX in the name that still accept `endpoint_version` arguments](https://github.com/sigp/lighthouse/blob/stable/beacon_node/http_api/src/produce_block.rs#L192)

This refactor is a prerequisite to get the fulu EF tests running.
This commit is contained in:
ethDreamer
2025-05-19 00:05:16 -05:00
committed by GitHub
parent fcfcbf9a11
commit 7684d1f866
92 changed files with 1863 additions and 827 deletions

View File

@@ -3,8 +3,7 @@ use decode::ssz_decode_light_client_update;
use serde::Deserialize;
use types::{LightClientUpdate, Slot};
#[derive(Debug, Clone, Deserialize)]
#[serde(deny_unknown_fields)]
#[derive(Debug, Clone)]
pub struct LightClientVerifyIsBetterUpdate<E: EthSpec> {
light_client_updates: Vec<LightClientUpdate<E>>,
}

View File

@@ -97,7 +97,7 @@ async fn verify_validator_count<E: EthSpec>(
let vc = remote_node
.get_debug_beacon_states::<E>(StateId::Head)
.await
.map(|body| body.unwrap().data)
.map(|body| body.unwrap().into_data())
.map_err(|e| format!("Get state root via http failed: {:?}", e))?
.validators()
.len();
@@ -197,7 +197,7 @@ pub async fn verify_full_sync_aggregates_up_to<E: EthSpec>(
slot
)
})
.data
.data()
.message()
.body()
.sync_aggregate()
@@ -235,7 +235,7 @@ pub async fn verify_transition_block_finalized<E: EthSpec>(
let execution_block_hash: ExecutionBlockHash = remote_node
.get_beacon_blocks::<E>(BlockId::Finalized)
.await
.map(|body| body.unwrap().data)
.map(|body| body.unwrap().into_data())
.map_err(|e| format!("Get state root via http failed: {:?}", e))?
.message()
.execution_payload()
@@ -308,7 +308,7 @@ pub(crate) async fn verify_light_client_updates<E: EthSpec>(
.await
.map_err(|e| format!("Error while getting light client updates: {:?}", e))?
.ok_or(format!("Light client optimistic update not found {slot:?}"))?
.data
.data()
.signature_slot();
let signature_slot_distance = slot - signature_slot;
if signature_slot_distance > light_client_update_slot_tolerance {
@@ -337,7 +337,7 @@ pub(crate) async fn verify_light_client_updates<E: EthSpec>(
.await
.map_err(|e| format!("Error while getting light client updates: {:?}", e))?
.ok_or(format!("Light client finality update not found {slot:?}"))?
.data
.data()
.signature_slot();
let signature_slot_distance = slot - signature_slot;
if signature_slot_distance > light_client_update_slot_tolerance {
@@ -385,7 +385,7 @@ pub async fn ensure_node_synced_up_to_slot<E: EthSpec>(
.ok()
.flatten()
.ok_or(format!("No head block exists on node {node_index}"))?
.data;
.into_data();
// Check the head block is synced with the rest of the network.
if head.slot() >= upto_slot {
@@ -422,7 +422,7 @@ pub async fn verify_full_blob_production_up_to<E: EthSpec>(
// the `verify_full_block_production_up_to` function.
if block.is_some() {
remote_node
.get_blobs::<E>(BlockId::Slot(Slot::new(slot)), None)
.get_blobs::<E>(BlockId::Slot(Slot::new(slot)), None, &E::default_spec())
.await
.map_err(|e| format!("Failed to get blobs at slot {slot:?}: {e:?}"))?
.ok_or_else(|| format!("No blobs available at slot {slot:?}"))?;