@aztec/txe 5.0.0-rc.1 → 5.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (133) hide show
  1. package/dest/AuthRegistry-FSRZIMX6.js +3 -0
  2. package/dest/AuthRegistry-FSRZIMX6.js.map +7 -0
  3. package/dest/ContractClassRegistry-N6NA3SFA.js +3 -0
  4. package/dest/ContractClassRegistry-N6NA3SFA.js.map +7 -0
  5. package/dest/ContractInstanceRegistry-NADDSLGL.js +3 -0
  6. package/dest/ContractInstanceRegistry-NADDSLGL.js.map +7 -0
  7. package/dest/FeeJuice-QBH5JWJV.js +3 -0
  8. package/dest/FeeJuice-QBH5JWJV.js.map +7 -0
  9. package/dest/HandshakeRegistry-KKUEU7XW.js +3 -0
  10. package/dest/HandshakeRegistry-KKUEU7XW.js.map +7 -0
  11. package/dest/MultiCallEntrypoint-TGICA67H.js +3 -0
  12. package/dest/MultiCallEntrypoint-TGICA67H.js.map +7 -0
  13. package/dest/SchnorrAccount-J5T6OKR3.js +3 -0
  14. package/dest/SchnorrAccount-J5T6OKR3.js.map +7 -0
  15. package/dest/SchnorrInitializerlessAccount-OOES6Q4F.js +3 -0
  16. package/dest/SchnorrInitializerlessAccount-OOES6Q4F.js.map +7 -0
  17. package/dest/bin/index.js +1 -1
  18. package/dest/bin/oracle_test_server.js +2 -2
  19. package/dest/{chunk-UPW55EJX.js → chunk-PDOEF22H.js} +2 -2
  20. package/dest/{chunk-UPW55EJX.js.map → chunk-PDOEF22H.js.map} +3 -3
  21. package/dest/chunk-YP4ODNMQ.js +268 -0
  22. package/dest/chunk-YP4ODNMQ.js.map +7 -0
  23. package/dest/constants.d.ts +1 -1
  24. package/dest/constants.d.ts.map +1 -1
  25. package/dest/constants.js +1 -1
  26. package/dest/index.d.ts +1 -1
  27. package/dest/index.d.ts.map +1 -1
  28. package/dest/index.js +5 -3
  29. package/dest/metafile.json +9768 -8714
  30. package/dest/oracle/interfaces.d.ts +19 -10
  31. package/dest/oracle/interfaces.d.ts.map +1 -1
  32. package/dest/oracle/tagging_secret_strategy.d.ts +12 -0
  33. package/dest/oracle/tagging_secret_strategy.d.ts.map +1 -0
  34. package/dest/oracle/tagging_secret_strategy.js +12 -0
  35. package/dest/oracle/test-resolver/default_fixtures.d.ts +9 -0
  36. package/dest/oracle/test-resolver/default_fixtures.d.ts.map +1 -0
  37. package/dest/oracle/test-resolver/default_fixtures.js +207 -0
  38. package/dest/oracle/test-resolver/index.d.ts +1 -1
  39. package/dest/oracle/test-resolver/index.d.ts.map +1 -1
  40. package/dest/oracle/test-resolver/index.js +1 -2
  41. package/dest/oracle/test-resolver/resolver.d.ts +22 -8
  42. package/dest/oracle/test-resolver/resolver.d.ts.map +1 -1
  43. package/dest/oracle/test-resolver/resolver.js +100 -33
  44. package/dest/oracle/txe_oracle_public_context.d.ts +9 -9
  45. package/dest/oracle/txe_oracle_public_context.d.ts.map +1 -1
  46. package/dest/oracle/txe_oracle_public_context.js +15 -9
  47. package/dest/oracle/txe_oracle_registry.d.ts +159 -3
  48. package/dest/oracle/txe_oracle_registry.d.ts.map +1 -1
  49. package/dest/oracle/txe_oracle_registry.js +221 -34
  50. package/dest/oracle/txe_oracle_top_level_context.d.ts +22 -8
  51. package/dest/oracle/txe_oracle_top_level_context.d.ts.map +1 -1
  52. package/dest/oracle/txe_oracle_top_level_context.js +107 -49
  53. package/dest/oracle/txe_oracle_version.d.ts +3 -3
  54. package/dest/oracle/txe_oracle_version.js +3 -3
  55. package/dest/rpc_translator.d.ts +14 -4
  56. package/dest/rpc_translator.d.ts.map +1 -1
  57. package/dest/rpc_translator.js +91 -11
  58. package/dest/server.bundle.js +1 -1
  59. package/dest/state_machine/archiver.d.ts +1 -1
  60. package/dest/state_machine/archiver.d.ts.map +1 -1
  61. package/dest/state_machine/archiver.js +1 -2
  62. package/dest/state_machine/dummy_p2p_client.d.ts +4 -2
  63. package/dest/state_machine/dummy_p2p_client.d.ts.map +1 -1
  64. package/dest/state_machine/dummy_p2p_client.js +6 -0
  65. package/dest/state_machine/global_variable_builder.d.ts +3 -4
  66. package/dest/state_machine/global_variable_builder.d.ts.map +1 -1
  67. package/dest/state_machine/global_variable_builder.js +0 -3
  68. package/dest/state_machine/index.d.ts +8 -6
  69. package/dest/state_machine/index.d.ts.map +1 -1
  70. package/dest/state_machine/index.js +40 -12
  71. package/dest/state_machine/synchronizer.d.ts +5 -2
  72. package/dest/state_machine/synchronizer.d.ts.map +1 -1
  73. package/dest/state_machine/synchronizer.js +6 -2
  74. package/dest/txe_session.d.ts +8 -6
  75. package/dest/txe_session.d.ts.map +1 -1
  76. package/dest/txe_session.js +72 -32
  77. package/dest/utils/block_creation.d.ts +2 -2
  78. package/dest/utils/block_creation.d.ts.map +1 -1
  79. package/dest/utils/block_creation.js +2 -2
  80. package/dest/utils/encoding.d.ts +4 -3
  81. package/dest/utils/encoding.d.ts.map +1 -1
  82. package/dest/utils/tx_effect_creation.d.ts +1 -1
  83. package/dest/utils/tx_effect_creation.d.ts.map +1 -1
  84. package/dest/utils/tx_effect_creation.js +0 -1
  85. package/dest/utils/txe_public_contract_data_source.d.ts +1 -1
  86. package/dest/utils/txe_public_contract_data_source.d.ts.map +1 -1
  87. package/dest/utils/txe_public_contract_data_source.js +7 -4
  88. package/dest/worker.bundle.js +1 -1
  89. package/package.json +17 -17
  90. package/src/bin/oracle_test_server.ts +2 -2
  91. package/src/constants.ts +1 -1
  92. package/src/index.ts +5 -3
  93. package/src/oracle/interfaces.ts +21 -8
  94. package/src/oracle/tagging_secret_strategy.ts +25 -0
  95. package/src/oracle/test-resolver/default_fixtures.ts +282 -0
  96. package/src/oracle/test-resolver/index.ts +1 -2
  97. package/src/oracle/test-resolver/resolver.ts +122 -42
  98. package/src/oracle/txe_oracle_public_context.ts +16 -14
  99. package/src/oracle/txe_oracle_registry.ts +156 -18
  100. package/src/oracle/txe_oracle_top_level_context.ts +147 -50
  101. package/src/oracle/txe_oracle_version.ts +3 -3
  102. package/src/rpc_translator.ts +119 -11
  103. package/src/state_machine/archiver.ts +0 -1
  104. package/src/state_machine/dummy_p2p_client.ts +9 -0
  105. package/src/state_machine/global_variable_builder.ts +2 -16
  106. package/src/state_machine/index.ts +49 -30
  107. package/src/state_machine/synchronizer.ts +8 -2
  108. package/src/txe_session.ts +104 -27
  109. package/src/utils/block_creation.ts +2 -1
  110. package/src/utils/tx_effect_creation.ts +0 -2
  111. package/src/utils/txe_public_contract_data_source.ts +6 -4
  112. package/dest/AuthRegistry-CPGFQR26.js +0 -3
  113. package/dest/AuthRegistry-CPGFQR26.js.map +0 -7
  114. package/dest/ContractClassRegistry-EHVIHGEK.js +0 -3
  115. package/dest/ContractClassRegistry-EHVIHGEK.js.map +0 -7
  116. package/dest/ContractInstanceRegistry-DWZDXHRG.js +0 -3
  117. package/dest/ContractInstanceRegistry-DWZDXHRG.js.map +0 -7
  118. package/dest/FeeJuice-MI32ZO7B.js +0 -3
  119. package/dest/FeeJuice-MI32ZO7B.js.map +0 -7
  120. package/dest/HandshakeRegistry-3KSP3ITH.js +0 -3
  121. package/dest/HandshakeRegistry-3KSP3ITH.js.map +0 -7
  122. package/dest/MultiCallEntrypoint-IU7HYFYE.js +0 -3
  123. package/dest/MultiCallEntrypoint-IU7HYFYE.js.map +0 -7
  124. package/dest/SchnorrAccount-6TUE7JX4.js +0 -3
  125. package/dest/SchnorrAccount-6TUE7JX4.js.map +0 -7
  126. package/dest/SchnorrInitializerlessAccount-S3DU2DJK.js +0 -3
  127. package/dest/SchnorrInitializerlessAccount-S3DU2DJK.js.map +0 -7
  128. package/dest/chunk-5U25VAFR.js +0 -265
  129. package/dest/chunk-5U25VAFR.js.map +0 -7
  130. package/dest/oracle/test-resolver/fixtures.d.ts +0 -43
  131. package/dest/oracle/test-resolver/fixtures.d.ts.map +0 -1
  132. package/dest/oracle/test-resolver/fixtures.js +0 -39
  133. package/src/oracle/test-resolver/fixtures.ts +0 -84
@@ -7,16 +7,20 @@ import { openEphemeralStore } from '@aztec/kv-store/lmdb-v2';
7
7
  import {
8
8
  AddressStore,
9
9
  AnchorBlockStore,
10
+ AnchoredContractData,
10
11
  CapsuleService,
11
12
  CapsuleStore,
12
13
  ContractStore,
14
+ FactService,
15
+ FactStore,
13
16
  JobCoordinator,
14
17
  NoteService,
15
18
  NoteStore,
16
19
  PrivateEventStore,
17
20
  RecipientTaggingStore,
18
- SenderAddressBookStore,
19
21
  SenderTaggingStore,
22
+ TaggingSecretSourcesStore,
23
+ composeHooks,
20
24
  } from '@aztec/pxe/server';
21
25
  import {
22
26
  ExecutionNoteCache,
@@ -25,6 +29,7 @@ import {
25
29
  type IMiscOracle,
26
30
  type IPrivateExecutionOracle,
27
31
  type IUtilityExecutionOracle,
32
+ LEGACY_ORACLE_REGISTRY,
28
33
  Option,
29
34
  TransientArrayService,
30
35
  UtilityExecutionOracle,
@@ -52,7 +57,12 @@ import { z } from 'zod';
52
57
 
53
58
  import { DEFAULT_ADDRESS, MAX_OFFCHAIN_EFFECTS_PER_TXE_QUERY, MAX_OFFCHAIN_EFFECT_LEN } from './constants.js';
54
59
  import type { IAvmExecutionOracle, ITxeExecutionOracle } from './oracle/interfaces.js';
60
+ import {
61
+ type TXETaggingSecretStrategies,
62
+ makeResolveTaggingSecretStrategyHook,
63
+ } from './oracle/tagging_secret_strategy.js';
55
64
  import { TXEOraclePublicContext } from './oracle/txe_oracle_public_context.js';
65
+ import { callTxeLegacyHandler } from './oracle/txe_oracle_registry.js';
56
66
  import { TXEOracleTopLevelContext } from './oracle/txe_oracle_top_level_context.js';
57
67
  import { TXE_ORACLE_VERSION_MAJOR, TXE_ORACLE_VERSION_MINOR } from './oracle/txe_oracle_version.js';
58
68
  import { TXEPrivateExecutionOracle } from './oracle/txe_private_execution_oracle.js';
@@ -146,6 +156,7 @@ export interface TXESessionStateHandler {
146
156
 
147
157
  /** Executes a top-level utility function and commits the job. */
148
158
  executeUtilityFunction(
159
+ from: Option<AztecAddress>,
149
160
  targetContractAddress: AztecAddress,
150
161
  functionSelector: FunctionSelector,
151
162
  args: Fr[],
@@ -229,6 +240,7 @@ function emptyLastCallState(): LastCallState {
229
240
  export class TXESession implements TXESessionStateHandler {
230
241
  private state: SessionState = { name: 'TOP_LEVEL' };
231
242
  private authwits: Map<string, AuthWitness> = new Map();
243
+ private taggingSecretStrategies: TXETaggingSecretStrategies = new Map();
232
244
  private lastCallInfo: LastCallState = emptyLastCallState();
233
245
  private txeOracleVersion: { major: number; minor: number } | undefined;
234
246
 
@@ -251,8 +263,9 @@ export class TXESession implements TXESessionStateHandler {
251
263
  private accountStore: TXEAccountStore,
252
264
  private senderTaggingStore: SenderTaggingStore,
253
265
  private recipientTaggingStore: RecipientTaggingStore,
254
- private senderAddressBookStore: SenderAddressBookStore,
266
+ private taggingSecretSourcesStore: TaggingSecretSourcesStore,
255
267
  private capsuleStore: CapsuleStore,
268
+ private factStore: FactStore,
256
269
  private privateEventStore: PrivateEventStore,
257
270
  private jobCoordinator: JobCoordinator,
258
271
  private currentJobId: string,
@@ -302,14 +315,16 @@ export class TXESession implements TXESessionStateHandler {
302
315
  const noteStore = new NoteStore(store);
303
316
  const senderTaggingStore = new SenderTaggingStore(store);
304
317
  const recipientTaggingStore = new RecipientTaggingStore(store);
305
- const senderAddressBookStore = new SenderAddressBookStore(store);
318
+ const taggingSecretSourcesStore = new TaggingSecretSourcesStore(store);
306
319
  const capsuleStore = new CapsuleStore(store);
320
+ const factStore = new FactStore(store);
307
321
  const keyStore = new KeyStore(store);
308
322
  const accountStore = new TXEAccountStore(store);
309
323
 
310
324
  const jobCoordinator = new JobCoordinator(store);
311
325
  jobCoordinator.registerStores([
312
326
  capsuleStore,
327
+ factStore,
313
328
  senderTaggingStore,
314
329
  recipientTaggingStore,
315
330
  privateEventStore,
@@ -337,13 +352,15 @@ export class TXESession implements TXESessionStateHandler {
337
352
  accountStore,
338
353
  senderTaggingStore,
339
354
  recipientTaggingStore,
340
- senderAddressBookStore,
355
+ taggingSecretSourcesStore,
341
356
  capsuleStore,
357
+ factStore,
342
358
  privateEventStore,
343
359
  nextBlockTimestamp,
344
360
  version,
345
361
  chainId,
346
362
  new Map(),
363
+ new Map(),
347
364
  artifactResolver,
348
365
  rootPath,
349
366
  packageName,
@@ -363,8 +380,9 @@ export class TXESession implements TXESessionStateHandler {
363
380
  accountStore,
364
381
  senderTaggingStore,
365
382
  recipientTaggingStore,
366
- senderAddressBookStore,
383
+ taggingSecretSourcesStore,
367
384
  capsuleStore,
385
+ factStore,
368
386
  privateEventStore,
369
387
  jobCoordinator,
370
388
  initialJobId,
@@ -385,6 +403,18 @@ export class TXESession implements TXESessionStateHandler {
385
403
  */
386
404
  processFunction(functionName: TXEOracleFunctionName, inputs: ForeignCallArgs): Promise<ForeignCallResult> {
387
405
  try {
406
+ // Oracles retired into the PXE legacy registry have no translator method; dispatch them through the same
407
+ // buildACIRCallback legacy path that contract execution uses, keeping TXE's two oracle paths in sync.
408
+ // Use an own-property check: `in` would match inherited `Object.prototype` keys (e.g. `constructor`), routing
409
+ // them into the legacy path instead of letting them fall through to the unknown-oracle error.
410
+ if (Object.hasOwn(LEGACY_ORACLE_REGISTRY, functionName)) {
411
+ return callTxeLegacyHandler(
412
+ functionName,
413
+ inputs,
414
+ this.oracleHandler as Parameters<typeof buildACIRCallback>[0],
415
+ );
416
+ }
417
+
388
418
  const translator = new RPCTranslator(this, this.oracleHandler) as any;
389
419
  // We perform a runtime validation to check that the function name corresponds to a real oracle handler.
390
420
  const validatedFunctionName = z
@@ -537,6 +567,7 @@ export class TXESession implements TXESessionStateHandler {
537
567
  }
538
568
 
539
569
  async executeUtilityFunction(
570
+ from: Option<AztecAddress>,
540
571
  targetContractAddress: AztecAddress,
541
572
  functionSelector: FunctionSelector,
542
573
  args: Fr[],
@@ -545,6 +576,7 @@ export class TXESession implements TXESessionStateHandler {
545
576
  const handler = this.handlerAsTxe();
546
577
  return await this.withTopLevelCallTracking(async () => {
547
578
  const returnValues = await handler.executeUtilityFunction(
579
+ from?.value,
548
580
  targetContractAddress,
549
581
  functionSelector,
550
582
  args,
@@ -650,13 +682,15 @@ export class TXESession implements TXESessionStateHandler {
650
682
  this.accountStore,
651
683
  this.senderTaggingStore,
652
684
  this.recipientTaggingStore,
653
- this.senderAddressBookStore,
685
+ this.taggingSecretSourcesStore,
654
686
  this.capsuleStore,
687
+ this.factStore,
655
688
  this.privateEventStore,
656
689
  this.nextBlockTimestamp,
657
690
  this.version,
658
691
  this.chainId,
659
692
  this.authwits,
693
+ this.taggingSecretStrategies,
660
694
  this.artifactResolver,
661
695
  this.rootPath,
662
696
  this.packageName,
@@ -701,9 +735,15 @@ export class TXESession implements TXESessionStateHandler {
701
735
 
702
736
  const utilityExecutor = this.utilityExecutorForContractSync(anchorBlock);
703
737
  const transientArrayService = new TransientArrayService();
738
+ const anchoredContractData = new AnchoredContractData(
739
+ this.contractStore,
740
+ this.stateMachine.contractClassService,
741
+ anchorBlock!,
742
+ );
704
743
  this.oracleHandler = new TXEPrivateExecutionOracle({
705
744
  argsHash: Fr.ZERO,
706
745
  txContext: new TxContext(this.chainId, this.version, gasSettings),
746
+ txRequestSalt: Fr.ZERO,
707
747
  callContext: new CallContext(AztecAddress.ZERO, contractAddress, FunctionSelector.empty(), false),
708
748
  anchorBlockHeader: anchorBlock!,
709
749
  utilityExecutor,
@@ -712,22 +752,26 @@ export class TXESession implements TXESessionStateHandler {
712
752
  executionCache: new HashedValuesCache(),
713
753
  noteCache,
714
754
  taggingIndexCache,
715
- contractStore: this.contractStore,
755
+ anchoredContractData,
716
756
  noteStore: this.noteStore,
717
757
  keyStore: this.keyStore,
718
758
  addressStore: this.addressStore,
719
759
  aztecNode: this.stateMachine.node,
720
760
  senderTaggingStore: this.senderTaggingStore,
721
761
  recipientTaggingStore: this.recipientTaggingStore,
722
- senderAddressBookStore: this.senderAddressBookStore,
762
+ taggingSecretSourcesStore: this.taggingSecretSourcesStore,
723
763
  capsuleService: new CapsuleService(this.capsuleStore, await this.keyStore.getAccounts()),
764
+ factService: new FactService(this.factStore, await this.keyStore.getAccounts()),
724
765
  privateEventStore: this.privateEventStore,
725
766
  contractSyncService: this.stateMachine.contractSyncService,
726
767
  l2TipsStore: this.stateMachine.l2TipsProvider,
727
768
  jobId: this.currentJobId,
728
769
  scopes: await this.keyStore.getAccounts(),
729
- messageContextService: this.stateMachine.messageContextService,
770
+ txResolver: this.stateMachine.txResolver,
730
771
  simulator: new WASMSimulator(),
772
+ hooks: composeHooks({
773
+ resolveTaggingSecretStrategy: makeResolveTaggingSecretStrategyHook(this.taggingSecretStrategies),
774
+ }),
731
775
  transientArrayService,
732
776
  });
733
777
 
@@ -796,20 +840,31 @@ export class TXESession implements TXESessionStateHandler {
796
840
  ).syncNoteNullifiers(contractAddress, await this.keyStore.getAccounts());
797
841
 
798
842
  this.oracleHandler = new UtilityExecutionOracle({
799
- contractAddress,
843
+ callContext: CallContext.from({
844
+ msgSender: AztecAddress.NULL_MSG_SENDER,
845
+ contractAddress,
846
+ // No specific function is being executed in this inlined utility context, hence the empty selector.
847
+ functionSelector: FunctionSelector.empty(),
848
+ isStaticCall: true,
849
+ }),
800
850
  authWitnesses: [],
801
851
  capsules: [],
802
852
  anchorBlockHeader,
803
- contractStore: this.contractStore,
853
+ anchoredContractData: new AnchoredContractData(
854
+ this.contractStore,
855
+ this.stateMachine.contractClassService,
856
+ anchorBlockHeader,
857
+ ),
804
858
  noteStore: this.noteStore,
805
859
  keyStore: this.keyStore,
806
860
  addressStore: this.addressStore,
807
861
  aztecNode: this.stateMachine.node,
808
862
  recipientTaggingStore: this.recipientTaggingStore,
809
- senderAddressBookStore: this.senderAddressBookStore,
863
+ taggingSecretSourcesStore: this.taggingSecretSourcesStore,
810
864
  capsuleService: new CapsuleService(this.capsuleStore, await this.keyStore.getAccounts()),
865
+ factService: new FactService(this.factStore, await this.keyStore.getAccounts()),
811
866
  privateEventStore: this.privateEventStore,
812
- messageContextService: this.stateMachine.messageContextService,
867
+ txResolver: this.stateMachine.txResolver,
813
868
  contractSyncService: this.stateMachine.contractSyncService,
814
869
  l2TipsStore: this.stateMachine.l2TipsProvider,
815
870
  jobId: this.currentJobId,
@@ -833,15 +888,20 @@ export class TXESession implements TXESessionStateHandler {
833
888
  }
834
889
 
835
890
  // Note that while all public and private contexts do is build a single block that we then process when exiting
836
- // those, the top level context performs a large number of actions not captured in the following 'close' call. Among
837
- // others, it will create empty blocks (via `advanceBlocksBy` and `deploy`), create blocks with transactions via
838
- // `privateCallNewFlow` and `publicCallNewFlow`, add accounts to PXE via `addAccount`, etc. This is a
839
- // slight inconsistency in the working model of this class, but is not too bad.
840
- // TODO: it's quite unfortunate that we need to capture the authwits created to later pass them again when the top
841
- // level context is re-created. This is because authwits create a temporary utility context that'd otherwise reset
842
- // the authwits if not persisted, so we'd not be able to pass more than one per execution.
843
- // Ideally authwits would be passed alongside a contract call instead of pre-seeded.
844
- [this.nextBlockTimestamp, this.authwits] = (this.oracleHandler as TXEOracleTopLevelContext).close();
891
+ // them, the top level context does most of its work as it goes: it creates empty blocks (via `advanceBlocksBy`
892
+ // and `deploy`), creates blocks with transactions (via `privateCallNewFlow` and `publicCallNewFlow`), adds
893
+ // accounts to PXE (via `addAccount`), etc. This is a slight inconsistency in the working model of this class, but
894
+ // is not too bad. The `close` call below therefore only hands back the session-scoped values that a test
895
+ // sets directly at the top level, outside any contract execution (e.g. via `advanceTimestampBy`,
896
+ // `addAuthWitness`, `setTaggingSecretStrategies`). The oracle handler is discarded on every state transition,
897
+ // so the session must seed these values into the contexts it creates later.
898
+
899
+ // TODO: persisting authwits this way is quite unfortunate: they create a temporary utility context that would
900
+ // otherwise reset them, so we'd not be able to pass more than one per execution. Ideally authwits would be passed
901
+ // alongside a contract call instead of pre-seeded.
902
+ [this.nextBlockTimestamp, this.authwits, this.taggingSecretStrategies] = (
903
+ this.oracleHandler as TXEOracleTopLevelContext
904
+ ).close();
845
905
  }
846
906
 
847
907
  private async exitPrivateState() {
@@ -890,7 +950,18 @@ export class TXESession implements TXESessionStateHandler {
890
950
 
891
951
  private utilityExecutorForContractSync(anchorBlock: any) {
892
952
  return async (call: FunctionCall, scopes: AztecAddress[]) => {
893
- const entryPointArtifact = await this.contractStore.getFunctionArtifactWithDebugMetadata(call.to, call.selector);
953
+ const anchoredContractData = new AnchoredContractData(
954
+ this.contractStore,
955
+ this.stateMachine.contractClassService,
956
+ anchorBlock!,
957
+ );
958
+ const entryPointArtifact = await anchoredContractData.getFunctionArtifactWithDebugMetadata(
959
+ call.to,
960
+ call.selector,
961
+ );
962
+ if (!entryPointArtifact) {
963
+ throw new Error(`Cannot run function ${call.selector} on ${call.to}: the contract is not registered.`);
964
+ }
894
965
  if (entryPointArtifact.functionType !== FunctionType.UTILITY) {
895
966
  throw new Error(`Cannot run ${entryPointArtifact.functionType} function as utility`);
896
967
  }
@@ -898,20 +969,26 @@ export class TXESession implements TXESessionStateHandler {
898
969
  try {
899
970
  const simulator = new WASMSimulator();
900
971
  const oracle = new UtilityExecutionOracle({
901
- contractAddress: call.to,
972
+ callContext: CallContext.from({
973
+ msgSender: AztecAddress.NULL_MSG_SENDER,
974
+ contractAddress: call.to,
975
+ functionSelector: call.selector,
976
+ isStaticCall: true,
977
+ }),
902
978
  authWitnesses: [],
903
979
  capsules: [],
904
980
  anchorBlockHeader: anchorBlock!,
905
- contractStore: this.contractStore,
981
+ anchoredContractData,
906
982
  noteStore: this.noteStore,
907
983
  keyStore: this.keyStore,
908
984
  addressStore: this.addressStore,
909
985
  aztecNode: this.stateMachine.node,
910
986
  recipientTaggingStore: this.recipientTaggingStore,
911
- senderAddressBookStore: this.senderAddressBookStore,
987
+ taggingSecretSourcesStore: this.taggingSecretSourcesStore,
912
988
  capsuleService: new CapsuleService(this.capsuleStore, scopes),
989
+ factService: new FactService(this.factStore, scopes),
913
990
  privateEventStore: this.privateEventStore,
914
- messageContextService: this.stateMachine.messageContextService,
991
+ txResolver: this.stateMachine.txResolver,
915
992
  contractSyncService: this.stateMachine.contractSyncService,
916
993
  l2TipsStore: this.stateMachine.l2TipsProvider,
917
994
  jobId: this.currentJobId,
@@ -23,6 +23,7 @@ export function getSingleTxBlockRequestHash(blockNumber: BlockNumber): Fr {
23
23
  export async function insertTxEffectIntoWorldTrees(
24
24
  txEffect: TxEffect,
25
25
  worldTrees: MerkleTreeWriteOperations,
26
+ l1ToL2Messages: Fr[] = [],
26
27
  ): Promise<void> {
27
28
  await worldTrees.appendLeaves(
28
29
  MerkleTreeId.NOTE_HASH_TREE,
@@ -37,7 +38,7 @@ export async function insertTxEffectIntoWorldTrees(
37
38
 
38
39
  await worldTrees.appendLeaves(
39
40
  MerkleTreeId.L1_TO_L2_MESSAGE_TREE,
40
- padArrayEnd<Fr, number>(txEffect.l2ToL1Msgs, Fr.ZERO, NUMBER_OF_L1_L2_MESSAGES_PER_ROLLUP),
41
+ padArrayEnd<Fr, number>(l1ToL2Messages, Fr.ZERO, NUMBER_OF_L1_L2_MESSAGES_PER_ROLLUP),
41
42
  );
42
43
 
43
44
  // We do not need to add public data writes because we apply them as we go.
@@ -7,8 +7,6 @@ import { TxEffect, TxHash } from '@aztec/stdlib/tx';
7
7
  export async function makeTxEffect(noteCache: ExecutionNoteCache, txBlockNumber: BlockNumber): Promise<TxEffect> {
8
8
  const txEffect = TxEffect.empty();
9
9
 
10
- noteCache.finish();
11
-
12
10
  const nonceGenerator = noteCache.getNonceGenerator();
13
11
  txEffect.noteHashes = await Promise.all(
14
12
  noteCache
@@ -36,7 +36,8 @@ export class TXEPublicContractDataSource implements ContractDataSource {
36
36
 
37
37
  async getContract(address: AztecAddress): Promise<ContractInstanceWithAddress | undefined> {
38
38
  const instance = await this.contractStore.getContractInstance(address);
39
- return instance && { ...instance, address };
39
+ // TXE has no contract updates, so the current class always equals the original.
40
+ return instance && { ...instance, address, currentContractClassId: instance.originalContractClassId };
40
41
  }
41
42
 
42
43
  getContractClassIds(): Promise<Fr[]> {
@@ -44,12 +45,13 @@ export class TXEPublicContractDataSource implements ContractDataSource {
44
45
  }
45
46
 
46
47
  async getContractArtifact(address: AztecAddress): Promise<ContractArtifact | undefined> {
47
- const instance = await this.contractStore.getContractInstance(address);
48
- return instance && this.contractStore.getContractArtifact(instance.currentContractClassId);
48
+ const instance = await this.getContract(address);
49
+ return instance && this.contractStore.getContractArtifact(instance.originalContractClassId);
49
50
  }
50
51
 
51
52
  async getDebugFunctionName(address: AztecAddress, selector: FunctionSelector): Promise<string | undefined> {
52
- return await this.contractStore.getDebugFunctionName(address, selector);
53
+ const instance = await this.getContract(address);
54
+ return instance && this.contractStore.getDebugFunctionName(instance.originalContractClassId, selector);
53
55
  }
54
56
 
55
57
  registerContractFunctionSignatures(_signatures: []): Promise<void> {