@@ -35,7 +35,7 @@ import type { RecipientTaggingStore } from '../../storage/tagging_store/recipien
3535import type { SenderAddressBookStore } from '../../storage/tagging_store/sender_address_book_store.js' ;
3636import type { SenderTaggingStore } from '../../storage/tagging_store/sender_tagging_store.js' ;
3737import { ContractFunctionSimulator } from '../contract_function_simulator.js' ;
38- import { UtilityExecutionOracle } from './utility_execution_oracle.js' ;
38+ import { UtilityExecutionOracle , type UtilityExecutionOracleArgs } from './utility_execution_oracle.js' ;
3939
4040describe ( 'Utility Execution test suite' , ( ) => {
4141 const simulator = new WASMSimulator ( ) ;
@@ -328,27 +328,7 @@ describe('Utility Execution test suite', () => {
328328
329329 scope = await AztecAddress . random ( ) ;
330330
331- utilityExecutionOracle = new UtilityExecutionOracle ( {
332- contractAddress,
333- authWitnesses : [ ] ,
334- capsules : [ ] ,
335- anchorBlockHeader,
336- contractStore,
337- noteStore,
338- keyStore,
339- addressStore,
340- aztecNode,
341- recipientTaggingStore,
342- senderAddressBookStore,
343- capsuleService : new CapsuleService ( capsuleStore , [ scope ] ) ,
344- privateEventStore,
345- messageContextService,
346- contractSyncService,
347- jobId : 'test-job-id' ,
348- scopes : [ scope ] ,
349- l2TipsStore,
350- simulator,
351- } ) ;
331+ utilityExecutionOracle = makeOracle ( { contractAddress, scopes : [ scope ] } ) ;
352332 } ) ;
353333
354334 describe ( 'Respects synced block number' , ( ) => {
@@ -393,29 +373,13 @@ describe('Utility Execution test suite', () => {
393373 const transientScoped = [ Fr . random ( ) ] ;
394374 const persisted = [ Fr . random ( ) ] ;
395375
396- utilityExecutionOracle = new UtilityExecutionOracle ( {
376+ utilityExecutionOracle = makeOracle ( {
397377 contractAddress,
398- authWitnesses : [ ] ,
378+ scopes : [ scope ] ,
399379 capsules : [
400380 new Capsule ( contractAddress , slot , transientGlobal ) ,
401381 new Capsule ( contractAddress , slot , transientScoped , scope ) ,
402382 ] ,
403- anchorBlockHeader,
404- contractStore,
405- noteStore,
406- keyStore,
407- addressStore,
408- aztecNode,
409- recipientTaggingStore,
410- senderAddressBookStore,
411- capsuleService : new CapsuleService ( capsuleStore , [ scope ] ) ,
412- privateEventStore,
413- messageContextService,
414- contractSyncService,
415- jobId : 'test-job-id' ,
416- scopes : [ scope ] ,
417- l2TipsStore,
418- simulator,
419383 } ) ;
420384
421385 capsuleStore . getCapsule . mockResolvedValueOnce ( persisted ) ;
@@ -577,31 +541,8 @@ describe('Utility Execution test suite', () => {
577541 const contractAddressA = await AztecAddress . random ( ) ;
578542 const contractAddressB = await AztecAddress . random ( ) ;
579543
580- const makeOracle = ( addr : AztecAddress ) =>
581- new UtilityExecutionOracle ( {
582- contractAddress : addr ,
583- authWitnesses : [ ] ,
584- capsules : [ ] ,
585- anchorBlockHeader,
586- contractStore,
587- noteStore,
588- keyStore,
589- addressStore,
590- aztecNode,
591- recipientTaggingStore,
592- senderAddressBookStore,
593- capsuleService : new CapsuleService ( capsuleStore , [ ] ) ,
594- privateEventStore,
595- messageContextService,
596- contractSyncService,
597- jobId : 'test-job-id' ,
598- scopes : [ ] ,
599- l2TipsStore,
600- simulator,
601- } ) ;
602-
603- const oracleA = makeOracle ( contractAddressA ) ;
604- const oracleB = makeOracle ( contractAddressB ) ;
544+ const oracleA = makeOracle ( { contractAddress : contractAddressA } ) ;
545+ const oracleB = makeOracle ( { contractAddress : contractAddressB } ) ;
605546
606547 const secretA = await oracleA . getSharedSecret ( owner , ephPk , contractAddressA ) ;
607548 const secretB = await oracleB . getSharedSecret ( owner , ephPk , contractAddressB ) ;
@@ -622,5 +563,32 @@ describe('Utility Execution test suite', () => {
622563 await expect ( utilityExecutionOracle . getSharedSecret ( owner , ephPk , wrongAddress ) ) . rejects . toThrow ( / e x p e c t e d / ) ;
623564 } ) ;
624565 } ) ;
566+
567+ const makeOracle = ( overrides ?: Partial < UtilityExecutionOracleArgs > ) => {
568+ const scopes = overrides ?. scopes ?? [ ] ;
569+ return new UtilityExecutionOracle ( {
570+ contractAddress,
571+ authWitnesses : [ ] ,
572+ capsules : [ ] ,
573+ anchorBlockHeader,
574+ contractStore,
575+ noteStore,
576+ keyStore,
577+ addressStore,
578+ aztecNode,
579+ recipientTaggingStore,
580+ senderAddressBookStore,
581+ capsuleService : new CapsuleService ( capsuleStore , scopes ) ,
582+ privateEventStore,
583+ messageContextService,
584+ contractSyncService,
585+ jobId : 'test-job-id' ,
586+ scopes,
587+ l2TipsStore,
588+ simulator,
589+ utilityExecutor : ( ) => Promise . resolve ( ) ,
590+ ...overrides ,
591+ } ) ;
592+ } ;
625593 } ) ;
626594} ) ;
0 commit comments