@@ -15,14 +15,14 @@ import type { KeyStore } from '@aztec/key-store';
1515import {
1616 AddressStore ,
1717 CapsuleStore ,
18+ ContractSyncService ,
1819 NoteStore ,
1920 ORACLE_VERSION ,
2021 PrivateEventStore ,
2122 RecipientTaggingStore ,
2223 SenderAddressBookStore ,
2324 SenderTaggingStore ,
2425 enrichPublicSimulationError ,
25- syncState ,
2626} from '@aztec/pxe/server' ;
2727import {
2828 ExecutionNoteCache ,
@@ -83,7 +83,6 @@ import { ForkCheckpoint } from '@aztec/world-state';
8383
8484import { DEFAULT_ADDRESS } from '../constants.js' ;
8585import type { TXEStateMachine } from '../state_machine/index.js' ;
86- import { NoopContractSyncService } from '../util/noop_contract_sync_service.js' ;
8786import type { TXEAccountStore } from '../util/txe_account_store.js' ;
8887import type { TXEContractStore } from '../util/txe_contract_store.js' ;
8988import { TXEPublicContractDataSource } from '../util/txe_public_contract_data_source.js' ;
@@ -108,6 +107,7 @@ export class TXEOracleTopLevelContext implements IMiscOracle, ITxeExecutionOracl
108107 private senderAddressBookStore : SenderAddressBookStore ,
109108 private capsuleStore : CapsuleStore ,
110109 private privateEventStore : PrivateEventStore ,
110+ private contractSyncService : ContractSyncService ,
111111 private jobId : string ,
112112 private nextBlockTimestamp : bigint ,
113113 private version : Fr ,
@@ -303,7 +303,13 @@ export class TXEOracleTopLevelContext implements IMiscOracle, ITxeExecutionOracl
303303 await this . executeUtilityCall ( call ) ;
304304 } ;
305305
306- await syncState ( targetContractAddress , this . contractStore , functionSelector , utilityExecutor ) ;
306+ const blockHeader = await this . stateMachine . anchorBlockStore . getBlockHeader ( ) ;
307+ await this . contractSyncService . ensureContractSynced (
308+ targetContractAddress ,
309+ functionSelector ,
310+ utilityExecutor ,
311+ blockHeader ,
312+ ) ;
307313
308314 const blockNumber = await this . txeGetNextBlockNumber ( ) ;
309315
@@ -315,8 +321,6 @@ export class TXEOracleTopLevelContext implements IMiscOracle, ITxeExecutionOracl
315321
316322 const txContext = new TxContext ( this . chainId , this . version , gasSettings ) ;
317323
318- const blockHeader = await this . stateMachine . anchorBlockStore . getBlockHeader ( ) ;
319-
320324 const protocolNullifier = await computeProtocolNullifier ( getSingleTxBlockRequestHash ( blockNumber ) ) ;
321325 const noteCache = new ExecutionNoteCache ( protocolNullifier ) ;
322326 // In production, the account contract sets the min revertible counter before calling the app function.
@@ -352,7 +356,7 @@ export class TXEOracleTopLevelContext implements IMiscOracle, ITxeExecutionOracl
352356 this . senderAddressBookStore ,
353357 this . capsuleStore ,
354358 this . privateEventStore ,
355- new NoopContractSyncService ( ) ,
359+ this . contractSyncService ,
356360 this . jobId ,
357361 0 , // totalPublicArgsCount
358362 minRevertibleSideEffectCounter , // (start) sideEffectCounter
@@ -665,9 +669,15 @@ export class TXEOracleTopLevelContext implements IMiscOracle, ITxeExecutionOracl
665669 }
666670
667671 // Sync notes before executing utility function to discover notes from previous transactions
668- await syncState ( targetContractAddress , this . contractStore , functionSelector , async call => {
669- await this . executeUtilityCall ( call ) ;
670- } ) ;
672+ const blockHeader = await this . stateMachine . anchorBlockStore . getBlockHeader ( ) ;
673+ await this . contractSyncService . ensureContractSynced (
674+ targetContractAddress ,
675+ functionSelector ,
676+ async call => {
677+ await this . executeUtilityCall ( call ) ;
678+ } ,
679+ blockHeader ,
680+ ) ;
671681
672682 const call = new FunctionCall (
673683 artifact . name ,
0 commit comments