Merge branch 'electra-engine-api' of https://github.com/sigp/lighthouse into beacon-api-electra

This commit is contained in:
realbigsean
2024-05-31 08:53:12 -04:00
194 changed files with 5822 additions and 3879 deletions

View File

@@ -1084,6 +1084,7 @@ pub enum EventKind<E: EthSpec> {
PayloadAttributes(VersionedSsePayloadAttributes),
ProposerSlashing(Box<ProposerSlashing>),
AttesterSlashing(Box<AttesterSlashing<E>>),
BlsToExecutionChange(Box<SignedBlsToExecutionChange>),
}
impl<E: EthSpec> EventKind<E> {
@@ -1105,6 +1106,7 @@ impl<E: EthSpec> EventKind<E> {
EventKind::BlockReward(_) => "block_reward",
EventKind::ProposerSlashing(_) => "proposer_slashing",
EventKind::AttesterSlashing(_) => "attester_slashing",
EventKind::BlsToExecutionChange(_) => "bls_to_execution_change",
}
}
@@ -1195,6 +1197,11 @@ impl<E: EthSpec> EventKind<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(),
)),
@@ -1228,6 +1235,7 @@ pub enum EventTopic {
BlockReward,
AttesterSlashing,
ProposerSlashing,
BlsToExecutionChange,
}
impl FromStr for EventTopic {
@@ -1251,6 +1259,7 @@ impl FromStr for EventTopic {
"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()),
}
}
@@ -1275,6 +1284,7 @@ impl fmt::Display for EventTopic {
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"),
}
}
}