Merge branch 'unstable' into vc-fallback

This commit is contained in:
Mac L
2024-06-05 16:20:15 +10:00
309 changed files with 9719 additions and 11817 deletions

View File

@@ -1080,6 +1080,9 @@ pub enum EventKind<E: EthSpec> {
#[cfg(feature = "lighthouse")]
BlockReward(BlockReward),
PayloadAttributes(VersionedSsePayloadAttributes),
ProposerSlashing(Box<ProposerSlashing>),
AttesterSlashing(Box<AttesterSlashing<E>>),
BlsToExecutionChange(Box<SignedBlsToExecutionChange>),
}
impl<E: EthSpec> EventKind<E> {
@@ -1099,6 +1102,9 @@ impl<E: EthSpec> EventKind<E> {
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",
}
}
@@ -1179,6 +1185,21 @@ impl<E: EthSpec> EventKind<E> {
"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))
})?,
)),
"proposer_slashing" => Ok(EventKind::ProposerSlashing(
serde_json::from_str(data).map_err(|e| {
ServerError::InvalidServerSentEvent(format!("Proposer Slashing: {:?}", e))
})?,
)),
"bls_to_execution_change" => Ok(EventKind::BlsToExecutionChange(
serde_json::from_str(data).map_err(|e| {
ServerError::InvalidServerSentEvent(format!("Bls To Execution Change: {:?}", e))
})?,
)),
_ => Err(ServerError::InvalidServerSentEvent(
"Could not parse event tag".to_string(),
)),
@@ -1210,6 +1231,9 @@ pub enum EventTopic {
LightClientOptimisticUpdate,
#[cfg(feature = "lighthouse")]
BlockReward,
AttesterSlashing,
ProposerSlashing,
BlsToExecutionChange,
}
impl FromStr for EventTopic {
@@ -1231,6 +1255,9 @@ impl FromStr for EventTopic {
"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),
_ => Err("event topic cannot be parsed.".to_string()),
}
}
@@ -1253,6 +1280,9 @@ impl fmt::Display for EventTopic {
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"),
}
}
}