Skip to content

Commit 89474c3

Browse files
committed
Update unit test. Lint
1 parent 5e52471 commit 89474c3

File tree

1 file changed

+24
-40
lines changed

1 file changed

+24
-40
lines changed

packages/beacon-node/test/unit/chain/opPools/aggregatedAttestationPool.test.ts

+24-40
Original file line numberDiff line numberDiff line change
@@ -224,77 +224,61 @@ describe("AggregatedAttestationPool - Electra", () => {
224224

225225
it("Multiple attestations with same attestation data different committee", () => {
226226
// Attestation from committtee 0
227-
const committeeBits0 = BitArray.fromSingleBit(MAX_COMMITTEES_PER_SLOT, 0)
227+
const committeeBits0 = BitArray.fromSingleBit(MAX_COMMITTEES_PER_SLOT, 0);
228228

229229
const attestation0: Attestation<ForkPostElectra> = {
230-
...attestation,
230+
...attestation,
231231
aggregationBits: new BitArray(new Uint8Array(committeeLength / 8).fill(1), committeeLength),
232232
committeeBits: committeeBits0,
233-
}
233+
};
234234

235235
// Attestation from committtee 1
236-
const committeeBits1 = BitArray.fromSingleBit(MAX_COMMITTEES_PER_SLOT, 1)
236+
const committeeBits1 = BitArray.fromSingleBit(MAX_COMMITTEES_PER_SLOT, 1);
237237

238238
const attestation1: Attestation<ForkPostElectra> = {
239-
...attestation,
239+
...attestation,
240240
aggregationBits: new BitArray(new Uint8Array(committeeLength / 8).fill(1), committeeLength),
241241
committeeBits: committeeBits1,
242-
}
242+
};
243243
// Attestation from committtee 2
244-
const committeeBits2 = BitArray.fromSingleBit(MAX_COMMITTEES_PER_SLOT, 2)
244+
const committeeBits2 = BitArray.fromSingleBit(MAX_COMMITTEES_PER_SLOT, 2);
245245

246246
const attestation2: Attestation<ForkPostElectra> = {
247-
...attestation,
247+
...attestation,
248248
aggregationBits: new BitArray(new Uint8Array(committeeLength / 8).fill(1), committeeLength),
249249
committeeBits: committeeBits2,
250-
}
250+
};
251251

252252
// Attestation from committtee 3
253-
const committeeBits3 = BitArray.fromSingleBit(MAX_COMMITTEES_PER_SLOT, 3)
253+
const committeeBits3 = BitArray.fromSingleBit(MAX_COMMITTEES_PER_SLOT, 3);
254254

255255
const attestation3: Attestation<ForkPostElectra> = {
256-
...attestation,
256+
...attestation,
257257
aggregationBits: new BitArray(new Uint8Array(committeeLength / 8).fill(1), committeeLength),
258258
committeeBits: committeeBits3,
259-
}
259+
};
260260

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]);
267262

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]);
274264

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]);
281266

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]);
288268

289269
forkchoiceStub.getBlockHex.mockReturnValue(generateProtoBlock());
290270
forkchoiceStub.getDependentRoot.mockReturnValue(ZERO_HASH_HEX);
291-
271+
292272
const blockAttestations = pool.getAttestationsForBlock(fork, forkchoiceStub, electraState);
293273

294274
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+
});
298282
});
299283

300284
describe("MatchingDataAttestationGroup.add()", () => {

0 commit comments

Comments
 (0)