mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-19 21:04:41 +00:00
Update events and types
This commit is contained in:
@@ -1082,6 +1082,7 @@ pub enum EventKind<E: EthSpec> {
|
||||
PayloadAttributes(VersionedSsePayloadAttributes),
|
||||
ProposerSlashing(Box<ProposerSlashing>),
|
||||
AttesterSlashing(Box<AttesterSlashing<E>>),
|
||||
BlsToExecutionChange(Box<BlsToExecutionChange>),
|
||||
}
|
||||
|
||||
impl<E: EthSpec> EventKind<E> {
|
||||
@@ -1103,6 +1104,7 @@ impl<E: EthSpec> EventKind<E> {
|
||||
EventKind::BlockReward(_) => "block_reward",
|
||||
EventKind::ProposerSlashing(_) => "proposer_slashing",
|
||||
EventKind::AttesterSlashing(_) => "attester_slashing",
|
||||
EventKind::BlsToExecutionChange(_) => "bls_to_execution_change",
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1193,6 +1195,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(),
|
||||
)),
|
||||
@@ -1226,6 +1233,7 @@ pub enum EventTopic {
|
||||
BlockReward,
|
||||
AttesterSlashing,
|
||||
ProposerSlashing,
|
||||
BlsToExecutionChange,
|
||||
}
|
||||
|
||||
impl FromStr for EventTopic {
|
||||
@@ -1249,6 +1257,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()),
|
||||
}
|
||||
}
|
||||
@@ -1273,6 +1282,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"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user