mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-11 18:04:18 +00:00
Add data columns sidecars debug beacon API (#7591)
Beacon API spec PR: https://github.com/ethereum/beacon-APIs/pull/537
This commit is contained in:
@@ -2883,6 +2883,55 @@ pub fn serve<T: BeaconChainTypes>(
|
||||
* debug
|
||||
*/
|
||||
|
||||
// GET debug/beacon/data_column_sidecars/{block_id}
|
||||
let get_debug_data_column_sidecars = eth_v1
|
||||
.and(warp::path("debug"))
|
||||
.and(warp::path("beacon"))
|
||||
.and(warp::path("data_column_sidecars"))
|
||||
.and(block_id_or_err)
|
||||
.and(warp::path::end())
|
||||
.and(multi_key_query::<api_types::DataColumnIndicesQuery>())
|
||||
.and(task_spawner_filter.clone())
|
||||
.and(chain_filter.clone())
|
||||
.and(warp::header::optional::<api_types::Accept>("accept"))
|
||||
.then(
|
||||
|block_id: BlockId,
|
||||
indices_res: Result<api_types::DataColumnIndicesQuery, warp::Rejection>,
|
||||
task_spawner: TaskSpawner<T::EthSpec>,
|
||||
chain: Arc<BeaconChain<T>>,
|
||||
accept_header: Option<api_types::Accept>| {
|
||||
task_spawner.blocking_response_task(Priority::P1, move || {
|
||||
let indices = indices_res?;
|
||||
let (data_columns, fork_name, execution_optimistic, finalized) =
|
||||
block_id.get_data_columns(indices, &chain)?;
|
||||
|
||||
match accept_header {
|
||||
Some(api_types::Accept::Ssz) => Response::builder()
|
||||
.status(200)
|
||||
.body(data_columns.as_ssz_bytes().into())
|
||||
.map(|res: Response<Body>| add_ssz_content_type_header(res))
|
||||
.map_err(|e| {
|
||||
warp_utils::reject::custom_server_error(format!(
|
||||
"failed to create response: {}",
|
||||
e
|
||||
))
|
||||
}),
|
||||
_ => {
|
||||
// Post as a V2 endpoint so we return the fork version.
|
||||
let res = execution_optimistic_finalized_beacon_response(
|
||||
ResponseIncludesVersion::Yes(fork_name),
|
||||
execution_optimistic,
|
||||
finalized,
|
||||
&data_columns,
|
||||
)?;
|
||||
Ok(warp::reply::json(&res).into_response())
|
||||
}
|
||||
}
|
||||
.map(|resp| add_consensus_version_header(resp, fork_name))
|
||||
})
|
||||
},
|
||||
);
|
||||
|
||||
// GET debug/beacon/states/{state_id}
|
||||
let get_debug_beacon_states = any_version
|
||||
.and(warp::path("debug"))
|
||||
@@ -4950,6 +4999,7 @@ pub fn serve<T: BeaconChainTypes>(
|
||||
.uor(get_config_spec)
|
||||
.uor(get_config_deposit_contract)
|
||||
.uor(get_debug_beacon_states)
|
||||
.uor(get_debug_data_column_sidecars)
|
||||
.uor(get_debug_beacon_heads)
|
||||
.uor(get_debug_fork_choice)
|
||||
.uor(get_node_identity)
|
||||
|
||||
Reference in New Issue
Block a user