Add bls_to_execution_change topic to eth1/v1/events (#5823)

* Add bls event

* Update events and types

* Add bls in event

* Event bls

* tests..rs

* change order

* another tests.rs

* Signed BLS

* Revert "another tests.rs"

This reverts commit 7f54e9c1ce.

* Revert "Signed BLS"

This reverts commit 1146bc734b.

* withdrawal_keyparis

* Fix genesis
This commit is contained in:
chonghe
2024-05-30 13:48:29 +08:00
committed by GitHub
parent 6daeec31e2
commit ffe29c087d
5 changed files with 58 additions and 0 deletions

View File

@@ -1082,6 +1082,7 @@ pub enum EventKind<E: EthSpec> {
PayloadAttributes(VersionedSsePayloadAttributes),
ProposerSlashing(Box<ProposerSlashing>),
AttesterSlashing(Box<AttesterSlashing<E>>),
BlsToExecutionChange(Box<SignedBlsToExecutionChange>),
}
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"),
}
}
}