@@ -20,7 +20,7 @@ import {
2020 makeExecutablePrivateFunctionWithMembershipProof ,
2121 makeUnconstrainedFunctionWithMembershipProof ,
2222} from '@aztec/circuits.js/testing' ;
23- import { times } from '@aztec/foundation/collection' ;
23+ import { times , timesParallel } from '@aztec/foundation/collection' ;
2424import { randomInt } from '@aztec/foundation/crypto' ;
2525
2626import { type ArchiverDataStore , type ArchiverL1SynchPoint } from './archiver_store.js' ;
@@ -51,9 +51,9 @@ export function describeArchiverDataStore(testName: string, getStore: () => Arch
5151 } ,
5252 } ) ;
5353
54- beforeEach ( ( ) => {
54+ beforeEach ( async ( ) => {
5555 store = getStore ( ) ;
56- blocks = times ( 10 , i => makeL1Published ( L2Block . random ( i + 1 ) , i + 10 ) ) ;
56+ blocks = await timesParallel ( 10 , async i => makeL1Published ( await L2Block . random ( i + 1 ) , i + 10 ) ) ;
5757 } ) ;
5858
5959 describe ( 'addBlocks' , ( ) => {
@@ -81,7 +81,7 @@ export function describeArchiverDataStore(testName: string, getStore: () => Arch
8181 } ) ;
8282
8383 it ( 'can unwind multiple empty blocks' , async ( ) => {
84- const emptyBlocks = times ( 10 , i => makeL1Published ( L2Block . random ( i + 1 , 0 ) , i + 10 ) ) ;
84+ const emptyBlocks = await timesParallel ( 10 , async i => makeL1Published ( await L2Block . random ( i + 1 , 0 ) , i + 10 ) ) ;
8585 await store . addBlocks ( emptyBlocks ) ;
8686 expect ( await store . getSynchedL2BlockNumber ( ) ) . toBe ( 10 ) ;
8787
@@ -276,7 +276,8 @@ export function describeArchiverDataStore(testName: string, getStore: () => Arch
276276 const blockNum = 10 ;
277277
278278 beforeEach ( async ( ) => {
279- contractInstance = { ...SerializableContractInstance . random ( ) , address : AztecAddress . random ( ) } ;
279+ const randomInstance = await SerializableContractInstance . random ( ) ;
280+ contractInstance = { ...randomInstance , address : await AztecAddress . random ( ) } ;
280281 await store . addContractInstances ( [ contractInstance ] , blockNum ) ;
281282 } ) ;
282283
@@ -285,7 +286,7 @@ export function describeArchiverDataStore(testName: string, getStore: () => Arch
285286 } ) ;
286287
287288 it ( 'returns undefined if contract instance is not found' , async ( ) => {
288- await expect ( store . getContractInstance ( AztecAddress . random ( ) ) ) . resolves . toBeUndefined ( ) ;
289+ await expect ( store . getContractInstance ( await AztecAddress . random ( ) ) ) . resolves . toBeUndefined ( ) ;
289290 } ) ;
290291
291292 it ( 'returns undefined if previously stored contract instances was deleted' , async ( ) => {
@@ -408,12 +409,12 @@ export function describeArchiverDataStore(testName: string, getStore: () => Arch
408409 } ) ;
409410 } ;
410411
411- const mockBlockWithLogs = ( blockNumber : number ) : L1Published < L2Block > => {
412- const block = L2Block . random ( blockNumber ) ;
412+ const mockBlockWithLogs = async ( blockNumber : number ) : Promise < L1Published < L2Block > > => {
413+ const block = await L2Block . random ( blockNumber ) ;
413414 block . header . globalVariables . blockNumber = new Fr ( blockNumber ) ;
414415
415- block . body . txEffects = times ( numTxsPerBlock , ( txIndex : number ) => {
416- const txEffect = TxEffect . random ( ) ;
416+ block . body . txEffects = await timesParallel ( numTxsPerBlock , async ( txIndex : number ) => {
417+ const txEffect = await TxEffect . random ( ) ;
417418 txEffect . privateLogs = mockPrivateLogs ( blockNumber , txIndex ) ;
418419 txEffect . publicLogs = mockPublicLogs ( blockNumber , txIndex ) ;
419420 return txEffect ;
@@ -426,7 +427,7 @@ export function describeArchiverDataStore(testName: string, getStore: () => Arch
426427 } ;
427428
428429 beforeEach ( async ( ) => {
429- blocks = times ( numBlocks , ( index : number ) => mockBlockWithLogs ( index ) ) ;
430+ blocks = await timesParallel ( numBlocks , ( index : number ) => mockBlockWithLogs ( index ) ) ;
430431
431432 await store . addBlocks ( blocks ) ;
432433 await store . addLogs ( blocks . map ( b => b . data ) ) ;
@@ -482,7 +483,7 @@ export function describeArchiverDataStore(testName: string, getStore: () => Arch
482483
483484 // Create a block containing logs that have the same tag as the blocks before.
484485 const newBlockNumber = numBlocks ;
485- const newBlock = mockBlockWithLogs ( newBlockNumber ) ;
486+ const newBlock = await mockBlockWithLogs ( newBlockNumber ) ;
486487 const newLog = newBlock . data . body . txEffects [ 1 ] . privateLogs [ 1 ] ;
487488 newLog . fields [ 0 ] = tags [ 0 ] ;
488489 newBlock . data . body . txEffects [ 1 ] . privateLogs [ 1 ] = newLog ;
@@ -545,7 +546,7 @@ export function describeArchiverDataStore(testName: string, getStore: () => Arch
545546
546547 // Create a block containing these invalid logs
547548 const newBlockNumber = numBlocks ;
548- const newBlock = mockBlockWithLogs ( newBlockNumber ) ;
549+ const newBlock = await mockBlockWithLogs ( newBlockNumber ) ;
549550 newBlock . data . body . txEffects [ 0 ] . publicLogs = invalidLogs ;
550551 await store . addBlocks ( [ newBlock ] ) ;
551552 await store . addLogs ( [ newBlock . data ] ) ;
@@ -565,8 +566,8 @@ export function describeArchiverDataStore(testName: string, getStore: () => Arch
565566 let blocks : L1Published < L2Block > [ ] ;
566567
567568 beforeEach ( async ( ) => {
568- blocks = times ( numBlocks , ( index : number ) => ( {
569- data : L2Block . random ( index + 1 , txsPerBlock , numPublicFunctionCalls , numPublicLogs ) ,
569+ blocks = await timesParallel ( numBlocks , async ( index : number ) => ( {
570+ data : await L2Block . random ( index + 1 , txsPerBlock , numPublicFunctionCalls , numPublicLogs ) ,
570571 l1 : { blockNumber : BigInt ( index ) , blockHash : `0x${ index } ` , timestamp : BigInt ( index ) } ,
571572 } ) ) ;
572573
@@ -748,8 +749,8 @@ export function describeArchiverDataStore(testName: string, getStore: () => Arch
748749 const numBlocks = 10 ;
749750 const nullifiersPerBlock = new Map < number , Fr [ ] > ( ) ;
750751
751- beforeEach ( ( ) => {
752- blocks = times ( numBlocks , ( index : number ) => L2Block . random ( index + 1 , 1 ) ) ;
752+ beforeEach ( async ( ) => {
753+ blocks = await timesParallel ( numBlocks , ( index : number ) => L2Block . random ( index + 1 , 1 ) ) ;
753754
754755 blocks . forEach ( ( block , blockIndex ) => {
755756 nullifiersPerBlock . set (
0 commit comments