@@ -960,6 +960,35 @@ impl SseBlobSidecar {
960960 }
961961}
962962
963+ #[ derive( PartialEq , Debug , Serialize , Deserialize , Clone ) ]
964+ pub struct SseDataColumnSidecar {
965+ pub block_root : Hash256 ,
966+ #[ serde( with = "serde_utils::quoted_u64" ) ]
967+ pub index : u64 ,
968+ pub slot : Slot ,
969+ pub kzg_commitments : Vec < KzgCommitment > ,
970+ pub versioned_hashes : Vec < VersionedHash > ,
971+ }
972+
973+ impl SseDataColumnSidecar {
974+ pub fn from_data_column_sidecar < E : EthSpec > (
975+ data_column_sidecar : & DataColumnSidecar < E > ,
976+ ) -> SseDataColumnSidecar {
977+ let kzg_commitments = data_column_sidecar. kzg_commitments . to_vec ( ) ;
978+ let versioned_hashes = kzg_commitments
979+ . iter ( )
980+ . map ( |c| c. calculate_versioned_hash ( ) )
981+ . collect ( ) ;
982+ SseDataColumnSidecar {
983+ block_root : data_column_sidecar. block_root ( ) ,
984+ index : data_column_sidecar. index ,
985+ slot : data_column_sidecar. slot ( ) ,
986+ kzg_commitments,
987+ versioned_hashes,
988+ }
989+ }
990+ }
991+
963992#[ derive( PartialEq , Debug , Serialize , Deserialize , Clone ) ]
964993pub struct SseFinalizedCheckpoint {
965994 pub block : Hash256 ,
@@ -1110,6 +1139,7 @@ pub enum EventKind<E: EthSpec> {
11101139 SingleAttestation ( Box < SingleAttestation > ) ,
11111140 Block ( SseBlock ) ,
11121141 BlobSidecar ( SseBlobSidecar ) ,
1142+ DataColumnSidecar ( SseDataColumnSidecar ) ,
11131143 FinalizedCheckpoint ( SseFinalizedCheckpoint ) ,
11141144 Head ( SseHead ) ,
11151145 VoluntaryExit ( SignedVoluntaryExit ) ,
@@ -1133,6 +1163,7 @@ impl<E: EthSpec> EventKind<E> {
11331163 EventKind :: Head ( _) => "head" ,
11341164 EventKind :: Block ( _) => "block" ,
11351165 EventKind :: BlobSidecar ( _) => "blob_sidecar" ,
1166+ EventKind :: DataColumnSidecar ( _) => "data_column_sidecar" ,
11361167 EventKind :: Attestation ( _) => "attestation" ,
11371168 EventKind :: SingleAttestation ( _) => "single_attestation" ,
11381169 EventKind :: VoluntaryExit ( _) => "voluntary_exit" ,
@@ -1168,6 +1199,11 @@ impl<E: EthSpec> EventKind<E> {
11681199 "blob_sidecar" => Ok ( EventKind :: BlobSidecar ( serde_json:: from_str ( data) . map_err (
11691200 |e| ServerError :: InvalidServerSentEvent ( format ! ( "Blob Sidecar: {:?}" , e) ) ,
11701201 ) ?) ) ,
1202+ "data_column_sidecar" => Ok ( EventKind :: DataColumnSidecar (
1203+ serde_json:: from_str ( data) . map_err ( |e| {
1204+ ServerError :: InvalidServerSentEvent ( format ! ( "Data Column Sidecar: {:?}" , e) )
1205+ } ) ?,
1206+ ) ) ,
11711207 "chain_reorg" => Ok ( EventKind :: ChainReorg ( serde_json:: from_str ( data) . map_err (
11721208 |e| ServerError :: InvalidServerSentEvent ( format ! ( "Chain Reorg: {:?}" , e) ) ,
11731209 ) ?) ) ,
@@ -1257,6 +1293,7 @@ pub enum EventTopic {
12571293 Head ,
12581294 Block ,
12591295 BlobSidecar ,
1296+ DataColumnSidecar ,
12601297 Attestation ,
12611298 SingleAttestation ,
12621299 VoluntaryExit ,
@@ -1283,6 +1320,7 @@ impl FromStr for EventTopic {
12831320 "head" => Ok ( EventTopic :: Head ) ,
12841321 "block" => Ok ( EventTopic :: Block ) ,
12851322 "blob_sidecar" => Ok ( EventTopic :: BlobSidecar ) ,
1323+ "data_column_sidecar" => Ok ( EventTopic :: DataColumnSidecar ) ,
12861324 "attestation" => Ok ( EventTopic :: Attestation ) ,
12871325 "single_attestation" => Ok ( EventTopic :: SingleAttestation ) ,
12881326 "voluntary_exit" => Ok ( EventTopic :: VoluntaryExit ) ,
@@ -1310,6 +1348,7 @@ impl fmt::Display for EventTopic {
13101348 EventTopic :: Head => write ! ( f, "head" ) ,
13111349 EventTopic :: Block => write ! ( f, "block" ) ,
13121350 EventTopic :: BlobSidecar => write ! ( f, "blob_sidecar" ) ,
1351+ EventTopic :: DataColumnSidecar => write ! ( f, "data_column_sidecar" ) ,
13131352 EventTopic :: Attestation => write ! ( f, "attestation" ) ,
13141353 EventTopic :: SingleAttestation => write ! ( f, "single_attestation" ) ,
13151354 EventTopic :: VoluntaryExit => write ! ( f, "voluntary_exit" ) ,
0 commit comments