mirror of
https://github.com/sigp/lighthouse.git
synced 2026-05-30 20:57:10 +00:00
Merge branch 'unstable' of https://github.com/sigp/lighthouse into gloas-data-availability-checker
This commit is contained in:
@@ -1,7 +1,5 @@
|
||||
//! This module contains endpoints that are non-standard and only available on Lighthouse servers.
|
||||
|
||||
mod attestation_performance;
|
||||
mod block_packing_efficiency;
|
||||
mod custody;
|
||||
pub mod sync_state;
|
||||
|
||||
@@ -15,12 +13,6 @@ use serde::{Deserialize, Serialize};
|
||||
use ssz::four_byte_option_impl;
|
||||
use ssz_derive::{Decode, Encode};
|
||||
|
||||
pub use attestation_performance::{
|
||||
AttestationPerformance, AttestationPerformanceQuery, AttestationPerformanceStatistics,
|
||||
};
|
||||
pub use block_packing_efficiency::{
|
||||
BlockPackingEfficiency, BlockPackingEfficiencyQuery, ProposerInfo, UniqueAttestation,
|
||||
};
|
||||
pub use custody::CustodyInfo;
|
||||
|
||||
// Define "legacy" implementations of `Option<T>` which use four bytes for encoding the union
|
||||
@@ -310,52 +302,4 @@ impl BeaconNodeHttpClient {
|
||||
|
||||
self.post_with_response(path, &req).await
|
||||
}
|
||||
|
||||
/*
|
||||
Analysis endpoints.
|
||||
*/
|
||||
|
||||
/// `GET` lighthouse/analysis/block_packing?start_epoch,end_epoch
|
||||
pub async fn get_lighthouse_analysis_block_packing(
|
||||
&self,
|
||||
start_epoch: Epoch,
|
||||
end_epoch: Epoch,
|
||||
) -> Result<Vec<BlockPackingEfficiency>, Error> {
|
||||
let mut path = self.server.expose_full().clone();
|
||||
|
||||
path.path_segments_mut()
|
||||
.map_err(|()| Error::InvalidUrl(self.server.clone()))?
|
||||
.push("lighthouse")
|
||||
.push("analysis")
|
||||
.push("block_packing_efficiency");
|
||||
|
||||
path.query_pairs_mut()
|
||||
.append_pair("start_epoch", &start_epoch.to_string())
|
||||
.append_pair("end_epoch", &end_epoch.to_string());
|
||||
|
||||
self.get(path).await
|
||||
}
|
||||
|
||||
/// `GET` lighthouse/analysis/attestation_performance/{index}?start_epoch,end_epoch
|
||||
pub async fn get_lighthouse_analysis_attestation_performance(
|
||||
&self,
|
||||
start_epoch: Epoch,
|
||||
end_epoch: Epoch,
|
||||
target: String,
|
||||
) -> Result<Vec<AttestationPerformance>, Error> {
|
||||
let mut path = self.server.expose_full().clone();
|
||||
|
||||
path.path_segments_mut()
|
||||
.map_err(|()| Error::InvalidUrl(self.server.clone()))?
|
||||
.push("lighthouse")
|
||||
.push("analysis")
|
||||
.push("attestation_performance")
|
||||
.push(&target);
|
||||
|
||||
path.query_pairs_mut()
|
||||
.append_pair("start_epoch", &start_epoch.to_string())
|
||||
.append_pair("end_epoch", &end_epoch.to_string());
|
||||
|
||||
self.get(path).await
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,39 +0,0 @@
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::collections::HashMap;
|
||||
use types::Epoch;
|
||||
|
||||
#[derive(Debug, Default, PartialEq, Clone, Serialize, Deserialize)]
|
||||
pub struct AttestationPerformanceStatistics {
|
||||
pub active: bool,
|
||||
pub head: bool,
|
||||
pub target: bool,
|
||||
pub source: bool,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub delay: Option<u64>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Default, PartialEq, Clone, Serialize, Deserialize)]
|
||||
pub struct AttestationPerformance {
|
||||
pub index: u64,
|
||||
pub epochs: HashMap<u64, AttestationPerformanceStatistics>,
|
||||
}
|
||||
|
||||
impl AttestationPerformance {
|
||||
pub fn initialize(indices: Vec<u64>) -> Vec<Self> {
|
||||
let mut vec = Vec::with_capacity(indices.len());
|
||||
for index in indices {
|
||||
vec.push(Self {
|
||||
index,
|
||||
..Default::default()
|
||||
})
|
||||
}
|
||||
vec
|
||||
}
|
||||
}
|
||||
|
||||
/// Query parameters for the `/lighthouse/analysis/attestation_performance` endpoint.
|
||||
#[derive(Debug, PartialEq, Clone, Serialize, Deserialize)]
|
||||
pub struct AttestationPerformanceQuery {
|
||||
pub start_epoch: Epoch,
|
||||
pub end_epoch: Epoch,
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
use serde::{Deserialize, Serialize};
|
||||
use types::{Epoch, Hash256, Slot};
|
||||
|
||||
type CommitteePosition = usize;
|
||||
type Committee = u64;
|
||||
type ValidatorIndex = u64;
|
||||
|
||||
#[derive(Debug, Default, PartialEq, Eq, Hash, Clone, Serialize, Deserialize)]
|
||||
pub struct UniqueAttestation {
|
||||
pub slot: Slot,
|
||||
pub committee_index: Committee,
|
||||
pub committee_position: CommitteePosition,
|
||||
}
|
||||
#[derive(Debug, Default, PartialEq, Clone, Serialize, Deserialize)]
|
||||
pub struct ProposerInfo {
|
||||
pub validator_index: ValidatorIndex,
|
||||
pub graffiti: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Default, PartialEq, Clone, Serialize, Deserialize)]
|
||||
pub struct BlockPackingEfficiency {
|
||||
pub slot: Slot,
|
||||
pub block_hash: Hash256,
|
||||
pub proposer_info: ProposerInfo,
|
||||
pub available_attestations: usize,
|
||||
pub included_attestations: usize,
|
||||
pub prior_skip_slots: u64,
|
||||
}
|
||||
|
||||
#[derive(Debug, Default, PartialEq, Clone, Serialize, Deserialize)]
|
||||
pub struct BlockPackingEfficiencyQuery {
|
||||
pub start_epoch: Epoch,
|
||||
pub end_epoch: Epoch,
|
||||
}
|
||||
Reference in New Issue
Block a user