Remove /lighthouse/analysis/block_rewards APIs (#8935)

Mark pointed out that these APIs will require updates for Gloas, so I figured we may as well get rid of them. As far as I know, blockprint was the only use case and it is now defunct. The consensus block value is included in getBlock API responses, so there's no reason for VCs to use the `POST` API, and there is now a standard API for the rewards of canonical blocks. The SSE event was non-standard, and likely only used by blockprint as well.


Co-Authored-By: Michael Sproul <michael@sigmaprime.io>
This commit is contained in:
Michael Sproul
2026-03-09 11:35:52 +11:00
committed by GitHub
parent efe43f7699
commit 537c2ba8b3
11 changed files with 4 additions and 541 deletions

View File

@@ -2,12 +2,11 @@
mod attestation_performance;
mod block_packing_efficiency;
mod block_rewards;
mod custody;
pub mod sync_state;
use crate::{
BeaconNodeHttpClient, DepositData, Error, Hash256, Slot,
BeaconNodeHttpClient, DepositData, Error, Hash256,
lighthouse::sync_state::SyncState,
types::{AdminPeer, Epoch, GenericResponse, ValidatorId},
};
@@ -22,7 +21,6 @@ pub use attestation_performance::{
pub use block_packing_efficiency::{
BlockPackingEfficiency, BlockPackingEfficiencyQuery, ProposerInfo, UniqueAttestation,
};
pub use block_rewards::{AttestationRewards, BlockReward, BlockRewardMeta, BlockRewardsQuery};
pub use custody::CustodyInfo;
// Define "legacy" implementations of `Option<T>` which use four bytes for encoding the union
@@ -317,27 +315,6 @@ impl BeaconNodeHttpClient {
Analysis endpoints.
*/
/// `GET` lighthouse/analysis/block_rewards?start_slot,end_slot
pub async fn get_lighthouse_analysis_block_rewards(
&self,
start_slot: Slot,
end_slot: Slot,
) -> Result<Vec<BlockReward>, 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_rewards");
path.query_pairs_mut()
.append_pair("start_slot", &start_slot.to_string())
.append_pair("end_slot", &end_slot.to_string());
self.get(path).await
}
/// `GET` lighthouse/analysis/block_packing?start_epoch,end_epoch
pub async fn get_lighthouse_analysis_block_packing(
&self,

View File

@@ -1,60 +0,0 @@
use serde::{Deserialize, Serialize};
use std::collections::HashMap;
use types::{AttestationData, Hash256, Slot};
/// Details about the rewards paid to a block proposer for proposing a block.
///
/// All rewards in GWei.
///
/// Presently this only counts attestation rewards, but in future should be expanded
/// to include information on slashings and sync committee aggregates too.
#[derive(Debug, PartialEq, Clone, Serialize, Deserialize)]
pub struct BlockReward {
/// Sum of all reward components.
pub total: u64,
/// Block root of the block that these rewards are for.
pub block_root: Hash256,
/// Metadata about the block, particularly reward-relevant metadata.
pub meta: BlockRewardMeta,
/// Rewards due to attestations.
pub attestation_rewards: AttestationRewards,
/// Sum of rewards due to sync committee signatures.
pub sync_committee_rewards: u64,
}
#[derive(Debug, PartialEq, Clone, Serialize, Deserialize)]
pub struct BlockRewardMeta {
pub slot: Slot,
pub parent_slot: Slot,
pub proposer_index: u64,
pub graffiti: String,
}
#[derive(Debug, PartialEq, Clone, Serialize, Deserialize)]
pub struct AttestationRewards {
/// Total block reward from attestations included.
pub total: u64,
/// Total rewards from previous epoch attestations.
pub prev_epoch_total: u64,
/// Total rewards from current epoch attestations.
pub curr_epoch_total: u64,
/// Vec of attestation rewards for each attestation included.
///
/// Each element of the vec is a map from validator index to reward.
pub per_attestation_rewards: Vec<HashMap<u64, u64>>,
/// The attestations themselves (optional).
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub attestations: Vec<AttestationData>,
}
/// Query parameters for the `/lighthouse/block_rewards` endpoint.
#[derive(Debug, PartialEq, Clone, Serialize, Deserialize)]
pub struct BlockRewardsQuery {
/// Lower slot limit for block rewards returned (inclusive).
pub start_slot: Slot,
/// Upper slot limit for block rewards returned (inclusive).
pub end_slot: Slot,
/// Include the full attestations themselves?
#[serde(default)]
pub include_attestations: bool,
}

View File

@@ -37,9 +37,6 @@ pub mod beacon_response {
pub use crate::beacon_response::*;
}
#[cfg(feature = "lighthouse")]
use crate::lighthouse::BlockReward;
// Re-export error types from the unified error module
pub use crate::error::{ErrorMessage, Failure, IndexedErrorMessage, ResponseError as Error};
@@ -1199,8 +1196,6 @@ pub enum EventKind<E: EthSpec> {
LateHead(SseLateHead),
LightClientFinalityUpdate(Box<BeaconResponse<LightClientFinalityUpdate<E>>>),
LightClientOptimisticUpdate(Box<BeaconResponse<LightClientOptimisticUpdate<E>>>),
#[cfg(feature = "lighthouse")]
BlockReward(BlockReward),
PayloadAttributes(VersionedSsePayloadAttributes),
ProposerSlashing(Box<ProposerSlashing>),
AttesterSlashing(Box<AttesterSlashing<E>>),
@@ -1225,8 +1220,6 @@ impl<E: EthSpec> EventKind<E> {
EventKind::LateHead(_) => "late_head",
EventKind::LightClientFinalityUpdate(_) => "light_client_finality_update",
EventKind::LightClientOptimisticUpdate(_) => "light_client_optimistic_update",
#[cfg(feature = "lighthouse")]
EventKind::BlockReward(_) => "block_reward",
EventKind::ProposerSlashing(_) => "proposer_slashing",
EventKind::AttesterSlashing(_) => "attester_slashing",
EventKind::BlsToExecutionChange(_) => "bls_to_execution_change",
@@ -1302,10 +1295,6 @@ impl<E: EthSpec> EventKind<E> {
})?),
)))
}
#[cfg(feature = "lighthouse")]
"block_reward" => Ok(EventKind::BlockReward(serde_json::from_str(data).map_err(
|e| ServerError::InvalidServerSentEvent(format!("Block Reward: {:?}", e)),
)?)),
"attester_slashing" => Ok(EventKind::AttesterSlashing(
serde_json::from_str(data).map_err(|e| {
ServerError::InvalidServerSentEvent(format!("Attester Slashing: {:?}", e))
@@ -1355,8 +1344,6 @@ pub enum EventTopic {
PayloadAttributes,
LightClientFinalityUpdate,
LightClientOptimisticUpdate,
#[cfg(feature = "lighthouse")]
BlockReward,
AttesterSlashing,
ProposerSlashing,
BlsToExecutionChange,
@@ -1382,8 +1369,6 @@ impl FromStr for EventTopic {
"late_head" => Ok(EventTopic::LateHead),
"light_client_finality_update" => Ok(EventTopic::LightClientFinalityUpdate),
"light_client_optimistic_update" => Ok(EventTopic::LightClientOptimisticUpdate),
#[cfg(feature = "lighthouse")]
"block_reward" => Ok(EventTopic::BlockReward),
"attester_slashing" => Ok(EventTopic::AttesterSlashing),
"proposer_slashing" => Ok(EventTopic::ProposerSlashing),
"bls_to_execution_change" => Ok(EventTopic::BlsToExecutionChange),
@@ -1410,8 +1395,6 @@ impl fmt::Display for EventTopic {
EventTopic::LateHead => write!(f, "late_head"),
EventTopic::LightClientFinalityUpdate => write!(f, "light_client_finality_update"),
EventTopic::LightClientOptimisticUpdate => write!(f, "light_client_optimistic_update"),
#[cfg(feature = "lighthouse")]
EventTopic::BlockReward => write!(f, "block_reward"),
EventTopic::AttesterSlashing => write!(f, "attester_slashing"),
EventTopic::ProposerSlashing => write!(f, "proposer_slashing"),
EventTopic::BlsToExecutionChange => write!(f, "bls_to_execution_change"),