@@ -224,77 +224,61 @@ describe("AggregatedAttestationPool - Electra", () => {
224
224
225
225
it ( "Multiple attestations with same attestation data different committee" , ( ) => {
226
226
// Attestation from committtee 0
227
- const committeeBits0 = BitArray . fromSingleBit ( MAX_COMMITTEES_PER_SLOT , 0 )
227
+ const committeeBits0 = BitArray . fromSingleBit ( MAX_COMMITTEES_PER_SLOT , 0 ) ;
228
228
229
229
const attestation0 : Attestation < ForkPostElectra > = {
230
- ...attestation ,
230
+ ...attestation ,
231
231
aggregationBits : new BitArray ( new Uint8Array ( committeeLength / 8 ) . fill ( 1 ) , committeeLength ) ,
232
232
committeeBits : committeeBits0 ,
233
- }
233
+ } ;
234
234
235
235
// Attestation from committtee 1
236
- const committeeBits1 = BitArray . fromSingleBit ( MAX_COMMITTEES_PER_SLOT , 1 )
236
+ const committeeBits1 = BitArray . fromSingleBit ( MAX_COMMITTEES_PER_SLOT , 1 ) ;
237
237
238
238
const attestation1 : Attestation < ForkPostElectra > = {
239
- ...attestation ,
239
+ ...attestation ,
240
240
aggregationBits : new BitArray ( new Uint8Array ( committeeLength / 8 ) . fill ( 1 ) , committeeLength ) ,
241
241
committeeBits : committeeBits1 ,
242
- }
242
+ } ;
243
243
// Attestation from committtee 2
244
- const committeeBits2 = BitArray . fromSingleBit ( MAX_COMMITTEES_PER_SLOT , 2 )
244
+ const committeeBits2 = BitArray . fromSingleBit ( MAX_COMMITTEES_PER_SLOT , 2 ) ;
245
245
246
246
const attestation2 : Attestation < ForkPostElectra > = {
247
- ...attestation ,
247
+ ...attestation ,
248
248
aggregationBits : new BitArray ( new Uint8Array ( committeeLength / 8 ) . fill ( 1 ) , committeeLength ) ,
249
249
committeeBits : committeeBits2 ,
250
- }
250
+ } ;
251
251
252
252
// Attestation from committtee 3
253
- const committeeBits3 = BitArray . fromSingleBit ( MAX_COMMITTEES_PER_SLOT , 3 )
253
+ const committeeBits3 = BitArray . fromSingleBit ( MAX_COMMITTEES_PER_SLOT , 3 ) ;
254
254
255
255
const attestation3 : Attestation < ForkPostElectra > = {
256
- ...attestation ,
256
+ ...attestation ,
257
257
aggregationBits : new BitArray ( new Uint8Array ( committeeLength / 8 ) . fill ( 1 ) , committeeLength ) ,
258
258
committeeBits : committeeBits3 ,
259
- }
259
+ } ;
260
260
261
- pool . add (
262
- attestation0 ,
263
- attDataRootHex ,
264
- attestation0 . aggregationBits . getTrueBitIndexes ( ) . length ,
265
- committees [ 0 ] ,
266
- ) ;
261
+ pool . add ( attestation0 , attDataRootHex , attestation0 . aggregationBits . getTrueBitIndexes ( ) . length , committees [ 0 ] ) ;
267
262
268
- pool . add (
269
- attestation1 ,
270
- attDataRootHex ,
271
- attestation0 . aggregationBits . getTrueBitIndexes ( ) . length ,
272
- committees [ 1 ] ,
273
- ) ;
263
+ pool . add ( attestation1 , attDataRootHex , attestation0 . aggregationBits . getTrueBitIndexes ( ) . length , committees [ 1 ] ) ;
274
264
275
- pool . add (
276
- attestation2 ,
277
- attDataRootHex ,
278
- attestation0 . aggregationBits . getTrueBitIndexes ( ) . length ,
279
- committees [ 2 ] ,
280
- ) ;
265
+ pool . add ( attestation2 , attDataRootHex , attestation0 . aggregationBits . getTrueBitIndexes ( ) . length , committees [ 2 ] ) ;
281
266
282
- pool . add (
283
- attestation3 ,
284
- attDataRootHex ,
285
- attestation0 . aggregationBits . getTrueBitIndexes ( ) . length ,
286
- committees [ 3 ] ,
287
- ) ;
267
+ pool . add ( attestation3 , attDataRootHex , attestation0 . aggregationBits . getTrueBitIndexes ( ) . length , committees [ 3 ] ) ;
288
268
289
269
forkchoiceStub . getBlockHex . mockReturnValue ( generateProtoBlock ( ) ) ;
290
270
forkchoiceStub . getDependentRoot . mockReturnValue ( ZERO_HASH_HEX ) ;
291
-
271
+
292
272
const blockAttestations = pool . getAttestationsForBlock ( fork , forkchoiceStub , electraState ) ;
293
273
294
274
expect ( blockAttestations . length ) . toBe ( 1 ) ; // Expect attestations from committee 0, 1, 2 and 3 to be aggregated into one
295
- expect ( ( blockAttestations [ 0 ] as Attestation < ForkPostElectra > ) . committeeBits . getTrueBitIndexes ( ) ) . toStrictEqual ( committeeIndices ) ;
296
-
297
- } )
275
+ expect ( ( blockAttestations [ 0 ] as Attestation < ForkPostElectra > ) . committeeBits . getTrueBitIndexes ( ) ) . toStrictEqual (
276
+ committeeIndices
277
+ ) ;
278
+ expect ( ( blockAttestations [ 0 ] as Attestation < ForkPostElectra > ) . aggregationBits . bitLen ) . toStrictEqual (
279
+ committeeLength * 4
280
+ ) ;
281
+ } ) ;
298
282
} ) ;
299
283
300
284
describe ( "MatchingDataAttestationGroup.add()" , ( ) => {
0 commit comments