7
7
SYNC_COMMITTEE_SUBNET_COUNT ,
8
8
isForkLightClient ,
9
9
MAX_BLOBS_PER_BLOCK ,
10
+ DATA_COLUMN_SIDECAR_SUBNET_COUNT ,
10
11
} from "@lodestar/params" ;
11
12
12
13
import { GossipAction , GossipActionError , GossipErrorCode } from "../../chain/errors/gossipValidation.js" ;
@@ -75,6 +76,8 @@ function stringifyGossipTopicType(topic: GossipTopic): string {
75
76
return `${ topic . type } _${ topic . subnet } ` ;
76
77
case GossipType . blob_sidecar :
77
78
return `${ topic . type } _${ topic . index } ` ;
79
+ case GossipType . data_column_sidecar :
80
+ return `${ topic . type } _${ topic . index } ` ;
78
81
}
79
82
}
80
83
@@ -86,6 +89,8 @@ export function getGossipSSZType(topic: GossipTopic) {
86
89
return ssz [ topic . fork ] . SignedBeaconBlock ;
87
90
case GossipType . blob_sidecar :
88
91
return ssz . deneb . BlobSidecar ;
92
+ case GossipType . data_column_sidecar :
93
+ return ssz . electra . DataColumnSidecar ;
89
94
case GossipType . beacon_aggregate_and_proof :
90
95
return ssz . phase0 . SignedAggregateAndProof ;
91
96
case GossipType . beacon_attestation :
@@ -189,6 +194,13 @@ export function parseGossipTopic(forkDigestContext: ForkDigestContext, topicStr:
189
194
return { type : GossipType . blob_sidecar , index, fork, encoding} ;
190
195
}
191
196
197
+ if ( gossipTypeStr . startsWith ( GossipType . data_column_sidecar ) ) {
198
+ const indexStr = gossipTypeStr . slice ( GossipType . data_column_sidecar . length + 1 ) ; // +1 for '_' concatenating the topic name and the index
199
+ const index = parseInt ( indexStr , 10 ) ;
200
+ if ( Number . isNaN ( index ) ) throw Error ( `index ${ indexStr } is not a number` ) ;
201
+ return { type : GossipType . data_column_sidecar , index, fork, encoding} ;
202
+ }
203
+
192
204
throw Error ( `Unknown gossip type ${ gossipTypeStr } ` ) ;
193
205
} catch ( e ) {
194
206
( e as Error ) . message = `Invalid gossip topic ${ topicStr } : ${ ( e as Error ) . message } ` ;
@@ -212,6 +224,13 @@ export function getCoreTopicsAtFork(
212
224
{ type : GossipType . attester_slashing } ,
213
225
] ;
214
226
227
+ // After Electra also track data_column_sidecar_{index}
228
+ if ( ForkSeq [ fork ] >= ForkSeq . electra ) {
229
+ for ( let index = 0 ; index < DATA_COLUMN_SIDECAR_SUBNET_COUNT ; index ++ ) {
230
+ topics . push ( { type : GossipType . data_column_sidecar , index} ) ;
231
+ }
232
+ }
233
+
215
234
// After Deneb also track blob_sidecar_{index}
216
235
if ( ForkSeq [ fork ] >= ForkSeq . deneb ) {
217
236
for ( let index = 0 ; index < MAX_BLOBS_PER_BLOCK ; index ++ ) {
@@ -262,6 +281,7 @@ function parseEncodingStr(encodingStr: string): GossipEncoding {
262
281
export const gossipTopicIgnoreDuplicatePublishError : Record < GossipType , boolean > = {
263
282
[ GossipType . beacon_block ] : true ,
264
283
[ GossipType . blob_sidecar ] : true ,
284
+ [ GossipType . data_column_sidecar ] : true ,
265
285
[ GossipType . beacon_aggregate_and_proof ] : true ,
266
286
[ GossipType . beacon_attestation ] : true ,
267
287
[ GossipType . voluntary_exit ] : true ,
0 commit comments