@aztec/txe 0.0.1-commit.d1cd2107c → 0.0.1-commit.d1da697d6

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 (43) hide show
  1. package/dest/oracle/txe_oracle_top_level_context.d.ts +4 -3
  2. package/dest/oracle/txe_oracle_top_level_context.d.ts.map +1 -1
  3. package/dest/oracle/txe_oracle_top_level_context.js +21 -15
  4. package/dest/rpc_translator.d.ts +24 -19
  5. package/dest/rpc_translator.d.ts.map +1 -1
  6. package/dest/rpc_translator.js +78 -38
  7. package/dest/state_machine/archiver.d.ts +3 -3
  8. package/dest/state_machine/archiver.d.ts.map +1 -1
  9. package/dest/state_machine/archiver.js +7 -8
  10. package/dest/state_machine/dummy_p2p_client.d.ts +3 -2
  11. package/dest/state_machine/dummy_p2p_client.d.ts.map +1 -1
  12. package/dest/state_machine/dummy_p2p_client.js +5 -2
  13. package/dest/state_machine/global_variable_builder.d.ts +3 -3
  14. package/dest/state_machine/global_variable_builder.d.ts.map +1 -1
  15. package/dest/state_machine/global_variable_builder.js +1 -1
  16. package/dest/state_machine/index.d.ts +4 -2
  17. package/dest/state_machine/index.d.ts.map +1 -1
  18. package/dest/state_machine/index.js +7 -3
  19. package/dest/state_machine/mock_epoch_cache.d.ts +17 -3
  20. package/dest/state_machine/mock_epoch_cache.d.ts.map +1 -1
  21. package/dest/state_machine/mock_epoch_cache.js +32 -2
  22. package/dest/state_machine/synchronizer.d.ts +5 -5
  23. package/dest/state_machine/synchronizer.d.ts.map +1 -1
  24. package/dest/state_machine/synchronizer.js +3 -3
  25. package/dest/txe_session.d.ts +4 -3
  26. package/dest/txe_session.d.ts.map +1 -1
  27. package/dest/txe_session.js +21 -12
  28. package/dest/util/encoding.d.ts +69 -1
  29. package/dest/util/encoding.d.ts.map +1 -1
  30. package/dest/util/txe_public_contract_data_source.d.ts +1 -1
  31. package/dest/util/txe_public_contract_data_source.d.ts.map +1 -1
  32. package/dest/util/txe_public_contract_data_source.js +1 -3
  33. package/package.json +15 -15
  34. package/src/oracle/txe_oracle_top_level_context.ts +31 -18
  35. package/src/rpc_translator.ts +108 -48
  36. package/src/state_machine/archiver.ts +6 -5
  37. package/src/state_machine/dummy_p2p_client.ts +6 -2
  38. package/src/state_machine/global_variable_builder.ts +7 -1
  39. package/src/state_machine/index.ts +6 -1
  40. package/src/state_machine/mock_epoch_cache.ts +42 -3
  41. package/src/state_machine/synchronizer.ts +4 -4
  42. package/src/txe_session.ts +23 -10
  43. package/src/util/txe_public_contract_data_source.ts +0 -2
@@ -339,20 +339,20 @@ export class RPCTranslator {
339
339
  }
340
340
 
341
341
  // eslint-disable-next-line camelcase
342
- aztec_prv_storeInExecutionCache(foreignValues: ForeignCallArray, foreignHash: ForeignCallSingle) {
342
+ aztec_prv_setHashPreimage(foreignValues: ForeignCallArray, foreignHash: ForeignCallSingle) {
343
343
  const values = fromArray(foreignValues);
344
344
  const hash = fromSingle(foreignHash);
345
345
 
346
- this.handlerAsPrivate().storeInExecutionCache(values, hash);
346
+ this.handlerAsPrivate().setHashPreimage(values, hash);
347
347
 
348
348
  return toForeignCallResult([]);
349
349
  }
350
350
 
351
351
  // eslint-disable-next-line camelcase
352
- async aztec_prv_loadFromExecutionCache(foreignHash: ForeignCallSingle) {
352
+ async aztec_prv_getHashPreimage(foreignHash: ForeignCallSingle) {
353
353
  const hash = fromSingle(foreignHash);
354
354
 
355
- const returns = await this.handlerAsPrivate().loadFromExecutionCache(hash);
355
+ const returns = await this.handlerAsPrivate().getHashPreimage(hash);
356
356
 
357
357
  return toForeignCallResult([toArray(returns)]);
358
358
  }
@@ -378,7 +378,7 @@ export class RPCTranslator {
378
378
  }
379
379
 
380
380
  // eslint-disable-next-line camelcase
381
- async aztec_utl_storageRead(
381
+ async aztec_utl_getFromPublicStorage(
382
382
  foreignBlockHash: ForeignCallSingle,
383
383
  foreignContractAddress: ForeignCallSingle,
384
384
  foreignStartStorageSlot: ForeignCallSingle,
@@ -389,7 +389,7 @@ export class RPCTranslator {
389
389
  const startStorageSlot = fromSingle(foreignStartStorageSlot);
390
390
  const numberOfElements = fromSingle(foreignNumberOfElements).toNumber();
391
391
 
392
- const values = await this.handlerAsUtility().storageRead(
392
+ const values = await this.handlerAsUtility().getFromPublicStorage(
393
393
  blockHash,
394
394
  contractAddress,
395
395
  startStorageSlot,
@@ -556,10 +556,10 @@ export class RPCTranslator {
556
556
  }
557
557
 
558
558
  // eslint-disable-next-line camelcase
559
- async aztec_utl_checkNullifierExists(foreignInnerNullifier: ForeignCallSingle) {
559
+ async aztec_utl_doesNullifierExist(foreignInnerNullifier: ForeignCallSingle) {
560
560
  const innerNullifier = fromSingle(foreignInnerNullifier);
561
561
 
562
- const exists = await this.handlerAsUtility().checkNullifierExists(innerNullifier);
562
+ const exists = await this.handlerAsUtility().doesNullifierExist(innerNullifier);
563
563
 
564
564
  return toForeignCallResult([toSingle(new Fr(exists))]);
565
565
  }
@@ -582,10 +582,10 @@ export class RPCTranslator {
582
582
  }
583
583
 
584
584
  // eslint-disable-next-line camelcase
585
- async aztec_utl_tryGetPublicKeysAndPartialAddress(foreignAddress: ForeignCallSingle) {
585
+ async aztec_utl_getPublicKeysAndPartialAddress(foreignAddress: ForeignCallSingle) {
586
586
  const address = addressFromSingle(foreignAddress);
587
587
 
588
- const result = await this.handlerAsUtility().tryGetPublicKeysAndPartialAddress(address);
588
+ const result = await this.handlerAsUtility().getPublicKeysAndPartialAddress(address);
589
589
 
590
590
  // We are going to return a Noir Option struct to represent the possibility of null values. Options are a struct
591
591
  // with two fields: `some` (a boolean) and `value` (a field array in this case).
@@ -652,34 +652,19 @@ export class RPCTranslator {
652
652
  }
653
653
 
654
654
  // eslint-disable-next-line camelcase
655
- public aztec_prv_notifyEnqueuedPublicFunctionCall(
656
- _foreignTargetContractAddress: ForeignCallSingle,
657
- _foreignCalldataHash: ForeignCallSingle,
658
- _foreignSideEffectCounter: ForeignCallSingle,
659
- _foreignIsStaticCall: ForeignCallSingle,
660
- ) {
655
+ public aztec_prv_assertValidPublicCalldata(_foreignCalldataHash: ForeignCallSingle) {
661
656
  throw new Error('Enqueueing public calls is not supported in TestEnvironment::private_context');
662
657
  }
663
658
 
664
659
  // eslint-disable-next-line camelcase
665
- public aztec_prv_notifySetPublicTeardownFunctionCall(
666
- _foreignTargetContractAddress: ForeignCallSingle,
667
- _foreignCalldataHash: ForeignCallSingle,
668
- _foreignSideEffectCounter: ForeignCallSingle,
669
- _foreignIsStaticCall: ForeignCallSingle,
670
- ) {
671
- throw new Error('Enqueueing public calls is not supported in TestEnvironment::private_context');
672
- }
673
-
674
- // eslint-disable-next-line camelcase
675
- public aztec_prv_notifySetMinRevertibleSideEffectCounter(_foreignMinRevertibleSideEffectCounter: ForeignCallSingle) {
660
+ public aztec_prv_notifyRevertiblePhaseStart(_foreignMinRevertibleSideEffectCounter: ForeignCallSingle) {
676
661
  throw new Error('Enqueueing public calls is not supported in TestEnvironment::private_context');
677
662
  }
678
663
 
679
664
  // eslint-disable-next-line camelcase
680
- public async aztec_prv_isSideEffectCounterRevertible(foreignSideEffectCounter: ForeignCallSingle) {
665
+ public async aztec_prv_isExecutionInRevertiblePhase(foreignSideEffectCounter: ForeignCallSingle) {
681
666
  const sideEffectCounter = fromSingle(foreignSideEffectCounter).toNumber();
682
- const isRevertible = await this.handlerAsPrivate().isSideEffectCounterRevertible(sideEffectCounter);
667
+ const isRevertible = await this.handlerAsPrivate().isExecutionInRevertiblePhase(sideEffectCounter);
683
668
  return toForeignCallResult([toSingle(new Fr(isRevertible))]);
684
669
  }
685
670
 
@@ -753,10 +738,14 @@ export class RPCTranslator {
753
738
  }
754
739
 
755
740
  // eslint-disable-next-line camelcase
756
- async aztec_utl_fetchTaggedLogs(foreignPendingTaggedLogArrayBaseSlot: ForeignCallSingle) {
741
+ async aztec_utl_getPendingTaggedLogs(
742
+ foreignPendingTaggedLogArrayBaseSlot: ForeignCallSingle,
743
+ foreignScope: ForeignCallSingle,
744
+ ) {
757
745
  const pendingTaggedLogArrayBaseSlot = fromSingle(foreignPendingTaggedLogArrayBaseSlot);
746
+ const scope = AztecAddress.fromField(fromSingle(foreignScope));
758
747
 
759
- await this.handlerAsUtility().fetchTaggedLogs(pendingTaggedLogArrayBaseSlot);
748
+ await this.handlerAsUtility().getPendingTaggedLogs(pendingTaggedLogArrayBaseSlot, scope);
760
749
 
761
750
  return toForeignCallResult([]);
762
751
  }
@@ -766,65 +755,103 @@ export class RPCTranslator {
766
755
  foreignContractAddress: ForeignCallSingle,
767
756
  foreignNoteValidationRequestsArrayBaseSlot: ForeignCallSingle,
768
757
  foreignEventValidationRequestsArrayBaseSlot: ForeignCallSingle,
758
+ foreignMaxNotePackedLen: ForeignCallSingle,
759
+ foreignMaxEventSerializedLen: ForeignCallSingle,
760
+ foreignScope: ForeignCallSingle,
769
761
  ) {
770
762
  const contractAddress = AztecAddress.fromField(fromSingle(foreignContractAddress));
771
763
  const noteValidationRequestsArrayBaseSlot = fromSingle(foreignNoteValidationRequestsArrayBaseSlot);
772
764
  const eventValidationRequestsArrayBaseSlot = fromSingle(foreignEventValidationRequestsArrayBaseSlot);
765
+ const maxNotePackedLen = fromSingle(foreignMaxNotePackedLen).toNumber();
766
+ const maxEventSerializedLen = fromSingle(foreignMaxEventSerializedLen).toNumber();
767
+ const scope = AztecAddress.fromField(fromSingle(foreignScope));
773
768
 
774
769
  await this.handlerAsUtility().validateAndStoreEnqueuedNotesAndEvents(
775
770
  contractAddress,
776
771
  noteValidationRequestsArrayBaseSlot,
777
772
  eventValidationRequestsArrayBaseSlot,
773
+ maxNotePackedLen,
774
+ maxEventSerializedLen,
775
+ scope,
778
776
  );
779
777
 
780
778
  return toForeignCallResult([]);
781
779
  }
782
780
 
783
781
  // eslint-disable-next-line camelcase
784
- public async aztec_utl_bulkRetrieveLogs(
782
+ public async aztec_utl_getLogsByTag(
785
783
  foreignContractAddress: ForeignCallSingle,
786
784
  foreignLogRetrievalRequestsArrayBaseSlot: ForeignCallSingle,
787
785
  foreignLogRetrievalResponsesArrayBaseSlot: ForeignCallSingle,
786
+ foreignScope: ForeignCallSingle,
788
787
  ) {
789
788
  const contractAddress = AztecAddress.fromField(fromSingle(foreignContractAddress));
790
789
  const logRetrievalRequestsArrayBaseSlot = fromSingle(foreignLogRetrievalRequestsArrayBaseSlot);
791
790
  const logRetrievalResponsesArrayBaseSlot = fromSingle(foreignLogRetrievalResponsesArrayBaseSlot);
791
+ const scope = AztecAddress.fromField(fromSingle(foreignScope));
792
792
 
793
- await this.handlerAsUtility().bulkRetrieveLogs(
793
+ await this.handlerAsUtility().getLogsByTag(
794
794
  contractAddress,
795
795
  logRetrievalRequestsArrayBaseSlot,
796
796
  logRetrievalResponsesArrayBaseSlot,
797
+ scope,
798
+ );
799
+
800
+ return toForeignCallResult([]);
801
+ }
802
+
803
+ // eslint-disable-next-line camelcase
804
+ public async aztec_utl_getMessageContextsByTxHash(
805
+ foreignContractAddress: ForeignCallSingle,
806
+ foreignMessageContextRequestsArrayBaseSlot: ForeignCallSingle,
807
+ foreignMessageContextResponsesArrayBaseSlot: ForeignCallSingle,
808
+ foreignScope: ForeignCallSingle,
809
+ ) {
810
+ const contractAddress = AztecAddress.fromField(fromSingle(foreignContractAddress));
811
+ const messageContextRequestsArrayBaseSlot = fromSingle(foreignMessageContextRequestsArrayBaseSlot);
812
+ const messageContextResponsesArrayBaseSlot = fromSingle(foreignMessageContextResponsesArrayBaseSlot);
813
+ const scope = AztecAddress.fromField(fromSingle(foreignScope));
814
+
815
+ await this.handlerAsUtility().getMessageContextsByTxHash(
816
+ contractAddress,
817
+ messageContextRequestsArrayBaseSlot,
818
+ messageContextResponsesArrayBaseSlot,
819
+ scope,
797
820
  );
798
821
 
799
822
  return toForeignCallResult([]);
800
823
  }
801
824
 
802
825
  // eslint-disable-next-line camelcase
803
- async aztec_utl_storeCapsule(
826
+ aztec_utl_setCapsule(
804
827
  foreignContractAddress: ForeignCallSingle,
805
828
  foreignSlot: ForeignCallSingle,
806
829
  foreignCapsule: ForeignCallArray,
830
+ foreignScope: ForeignCallSingle,
807
831
  ) {
808
832
  const contractAddress = AztecAddress.fromField(fromSingle(foreignContractAddress));
809
833
  const slot = fromSingle(foreignSlot);
810
834
  const capsule = fromArray(foreignCapsule);
835
+ const scope = AztecAddress.fromField(fromSingle(foreignScope));
811
836
 
812
- await this.handlerAsUtility().storeCapsule(contractAddress, slot, capsule);
837
+ this.handlerAsUtility().setCapsule(contractAddress, slot, capsule, scope);
813
838
 
814
839
  return toForeignCallResult([]);
815
840
  }
816
841
 
817
842
  // eslint-disable-next-line camelcase
818
- async aztec_utl_loadCapsule(
843
+ async aztec_utl_getCapsule(
819
844
  foreignContractAddress: ForeignCallSingle,
820
845
  foreignSlot: ForeignCallSingle,
821
846
  foreignTSize: ForeignCallSingle,
847
+ foreignScope: ForeignCallSingle,
822
848
  ) {
823
849
  const contractAddress = AztecAddress.fromField(fromSingle(foreignContractAddress));
824
850
  const slot = fromSingle(foreignSlot);
825
851
  const tSize = fromSingle(foreignTSize).toNumber();
852
+ const scope = AztecAddress.fromField(fromSingle(foreignScope));
826
853
 
827
- const values = await this.handlerAsUtility().loadCapsule(contractAddress, slot);
854
+ const values = await this.handlerAsUtility().getCapsule(contractAddress, slot, scope);
828
855
 
829
856
  // We are going to return a Noir Option struct to represent the possibility of null values. Options are a struct
830
857
  // with two fields: `some` (a boolean) and `value` (a field array in this case).
@@ -838,11 +865,16 @@ export class RPCTranslator {
838
865
  }
839
866
 
840
867
  // eslint-disable-next-line camelcase
841
- async aztec_utl_deleteCapsule(foreignContractAddress: ForeignCallSingle, foreignSlot: ForeignCallSingle) {
868
+ aztec_utl_deleteCapsule(
869
+ foreignContractAddress: ForeignCallSingle,
870
+ foreignSlot: ForeignCallSingle,
871
+ foreignScope: ForeignCallSingle,
872
+ ) {
842
873
  const contractAddress = AztecAddress.fromField(fromSingle(foreignContractAddress));
843
874
  const slot = fromSingle(foreignSlot);
875
+ const scope = AztecAddress.fromField(fromSingle(foreignScope));
844
876
 
845
- await this.handlerAsUtility().deleteCapsule(contractAddress, slot);
877
+ this.handlerAsUtility().deleteCapsule(contractAddress, slot, scope);
846
878
 
847
879
  return toForeignCallResult([]);
848
880
  }
@@ -853,13 +885,15 @@ export class RPCTranslator {
853
885
  foreignSrcSlot: ForeignCallSingle,
854
886
  foreignDstSlot: ForeignCallSingle,
855
887
  foreignNumEntries: ForeignCallSingle,
888
+ foreignScope: ForeignCallSingle,
856
889
  ) {
857
890
  const contractAddress = AztecAddress.fromField(fromSingle(foreignContractAddress));
858
891
  const srcSlot = fromSingle(foreignSrcSlot);
859
892
  const dstSlot = fromSingle(foreignDstSlot);
860
893
  const numEntries = fromSingle(foreignNumEntries).toNumber();
894
+ const scope = AztecAddress.fromField(fromSingle(foreignScope));
861
895
 
862
- await this.handlerAsUtility().copyCapsule(contractAddress, srcSlot, dstSlot, numEntries);
896
+ await this.handlerAsUtility().copyCapsule(contractAddress, srcSlot, dstSlot, numEntries, scope);
863
897
 
864
898
  return toForeignCallResult([]);
865
899
  }
@@ -869,7 +903,7 @@ export class RPCTranslator {
869
903
  // to implement this function here. Isn't there a way to programmatically identify that this is missing, given the
870
904
  // existence of a txe_oracle method?
871
905
  // eslint-disable-next-line camelcase
872
- async aztec_utl_aes128Decrypt(
906
+ async aztec_utl_decryptAes128(
873
907
  foreignCiphertextBVecStorage: ForeignCallArray,
874
908
  foreignCiphertextLength: ForeignCallSingle,
875
909
  foreignIv: ForeignCallArray,
@@ -879,11 +913,18 @@ export class RPCTranslator {
879
913
  const iv = fromUintArray(foreignIv, 8);
880
914
  const symKey = fromUintArray(foreignSymKey, 8);
881
915
 
882
- const plaintextBuffer = await this.handlerAsUtility().aes128Decrypt(ciphertext, iv, symKey);
883
-
884
- return toForeignCallResult(
885
- arrayToBoundedVec(bufferToU8Array(plaintextBuffer), foreignCiphertextBVecStorage.length),
886
- );
916
+ // Noir Option<BoundedVec> is encoded as [is_some: Field, storage: Field[], length: Field].
917
+ try {
918
+ const plaintextBuffer = await this.handlerAsUtility().decryptAes128(ciphertext, iv, symKey);
919
+ const [storage, length] = arrayToBoundedVec(
920
+ bufferToU8Array(plaintextBuffer),
921
+ foreignCiphertextBVecStorage.length,
922
+ );
923
+ return toForeignCallResult([toSingle(new Fr(1)), storage, length]);
924
+ } catch {
925
+ const zeroStorage = toArray(Array(foreignCiphertextBVecStorage.length).fill(new Fr(0)));
926
+ return toForeignCallResult([toSingle(new Fr(0)), zeroStorage, toSingle(new Fr(0))]);
927
+ }
887
928
  }
888
929
 
889
930
  // eslint-disable-next-line camelcase
@@ -892,6 +933,7 @@ export class RPCTranslator {
892
933
  foreignEphPKField0: ForeignCallSingle,
893
934
  foreignEphPKField1: ForeignCallSingle,
894
935
  foreignEphPKField2: ForeignCallSingle,
936
+ foreignContractAddress: ForeignCallSingle,
895
937
  ) {
896
938
  const address = AztecAddress.fromField(fromSingle(foreignAddress));
897
939
  const ephPK = Point.fromFields([
@@ -899,10 +941,28 @@ export class RPCTranslator {
899
941
  fromSingle(foreignEphPKField1),
900
942
  fromSingle(foreignEphPKField2),
901
943
  ]);
944
+ const contractAddress = AztecAddress.fromField(fromSingle(foreignContractAddress));
945
+
946
+ const secret = await this.handlerAsUtility().getSharedSecret(address, ephPK, contractAddress);
947
+
948
+ return toForeignCallResult([toSingle(secret)]);
949
+ }
950
+
951
+ // eslint-disable-next-line camelcase
952
+ aztec_utl_setContractSyncCacheInvalid(
953
+ foreignContractAddress: ForeignCallSingle,
954
+ foreignScopes: ForeignCallArray,
955
+ foreignScopeCount: ForeignCallSingle,
956
+ ) {
957
+ const contractAddress = addressFromSingle(foreignContractAddress);
958
+ const count = fromSingle(foreignScopeCount).toNumber();
959
+ const scopes = fromArray(foreignScopes)
960
+ .slice(0, count)
961
+ .map(f => new AztecAddress(f));
902
962
 
903
- const secret = await this.handlerAsUtility().getSharedSecret(address, ephPK);
963
+ this.handlerAsUtility().setContractSyncCacheInvalid(contractAddress, scopes);
904
964
 
905
- return toForeignCallResult(secret.toFields().map(toSingle));
965
+ return Promise.resolve(toForeignCallResult([]));
906
966
  }
907
967
 
908
968
  // eslint-disable-next-line camelcase
@@ -17,7 +17,7 @@ export class TXEArchiver extends ArchiverDataSourceBase {
17
17
  private readonly updater = new ArchiverDataStoreUpdater(this.store);
18
18
 
19
19
  constructor(db: AztecAsyncKVStore) {
20
- const store = new KVArchiverDataStore(db, 9999, { epochDuration: 32 });
20
+ const store = new KVArchiverDataStore(db, 9999);
21
21
  super(store);
22
22
  }
23
23
 
@@ -76,15 +76,16 @@ export class TXEArchiver extends ArchiverDataSourceBase {
76
76
  proven: tipId,
77
77
  finalized: tipId,
78
78
  checkpointed: tipId,
79
+ proposedCheckpoint: tipId,
79
80
  };
80
81
  }
81
82
 
82
- public getL2SlotNumber(): Promise<SlotNumber | undefined> {
83
- throw new Error('TXE Archiver does not implement "getL2SlotNumber"');
83
+ public getSyncedL2SlotNumber(): Promise<SlotNumber | undefined> {
84
+ throw new Error('TXE Archiver does not implement "getSyncedL2SlotNumber"');
84
85
  }
85
86
 
86
- public getL2EpochNumber(): Promise<EpochNumber | undefined> {
87
- throw new Error('TXE Archiver does not implement "getL2EpochNumber"');
87
+ public getSyncedL2EpochNumber(): Promise<EpochNumber | undefined> {
88
+ throw new Error('TXE Archiver does not implement "getSyncedL2EpochNumber"');
88
89
  }
89
90
 
90
91
  public isEpochComplete(_epochNumber: EpochNumber): Promise<boolean> {
@@ -61,8 +61,12 @@ export class DummyP2P implements P2P {
61
61
  throw new Error('DummyP2P does not implement "registerBlockProposalHandler"');
62
62
  }
63
63
 
64
- public registerCheckpointProposalHandler(_handler: P2PCheckpointReceivedCallback): void {
65
- throw new Error('DummyP2P does not implement "registerCheckpointProposalHandler"');
64
+ public registerValidatorCheckpointProposalHandler(_handler: P2PCheckpointReceivedCallback): void {
65
+ throw new Error('DummyP2P does not implement "registerValidatorCheckpointProposalHandler"');
66
+ }
67
+
68
+ public registerAllNodesCheckpointProposalHandler(_handler: P2PCheckpointReceivedCallback): void {
69
+ throw new Error('DummyP2P does not implement "registerAllNodesCheckpointProposalHandler"');
66
70
  }
67
71
 
68
72
  public requestTxs(_txHashes: TxHash[]): Promise<(Tx | undefined)[]> {
@@ -3,7 +3,12 @@ import type { EthAddress } from '@aztec/foundation/eth-address';
3
3
  import type { AztecAddress } from '@aztec/stdlib/aztec-address';
4
4
  import { GasFees } from '@aztec/stdlib/gas';
5
5
  import { makeGlobalVariables } from '@aztec/stdlib/testing';
6
- import { type CheckpointGlobalVariables, type GlobalVariableBuilder, GlobalVariables } from '@aztec/stdlib/tx';
6
+ import {
7
+ type BuildCheckpointGlobalVariablesOpts,
8
+ type CheckpointGlobalVariables,
9
+ type GlobalVariableBuilder,
10
+ GlobalVariables,
11
+ } from '@aztec/stdlib/tx';
7
12
 
8
13
  export class TXEGlobalVariablesBuilder implements GlobalVariableBuilder {
9
14
  public getCurrentMinFees(): Promise<GasFees> {
@@ -23,6 +28,7 @@ export class TXEGlobalVariablesBuilder implements GlobalVariableBuilder {
23
28
  _coinbase: EthAddress,
24
29
  _feeRecipient: AztecAddress,
25
30
  _slotNumber: SlotNumber,
31
+ _opts?: BuildCheckpointGlobalVariablesOpts,
26
32
  ): Promise<CheckpointGlobalVariables> {
27
33
  const vars = makeGlobalVariables();
28
34
  return Promise.resolve({
@@ -4,6 +4,7 @@ import { CheckpointNumber } from '@aztec/foundation/branded-types';
4
4
  import { Fr } from '@aztec/foundation/curves/bn254';
5
5
  import { createLogger } from '@aztec/foundation/log';
6
6
  import { type AnchorBlockStore, type ContractStore, ContractSyncService, type NoteStore } from '@aztec/pxe/server';
7
+ import { MessageContextService } from '@aztec/pxe/simulator';
7
8
  import { L2Block } from '@aztec/stdlib/block';
8
9
  import { Checkpoint, L1PublishedData, PublishedCheckpoint } from '@aztec/stdlib/checkpoint';
9
10
  import type { AztecNode } from '@aztec/stdlib/interfaces/client';
@@ -26,6 +27,7 @@ export class TXEStateMachine {
26
27
  public archiver: TXEArchiver,
27
28
  public anchorBlockStore: AnchorBlockStore,
28
29
  public contractSyncService: ContractSyncService,
30
+ public messageContextService: MessageContextService,
29
31
  ) {}
30
32
 
31
33
  public static async create(
@@ -57,6 +59,7 @@ export class TXEStateMachine {
57
59
  new MockEpochCache(),
58
60
  getPackageVersion() ?? '',
59
61
  new TestCircuitVerifier(),
62
+ new TestCircuitVerifier(),
60
63
  undefined,
61
64
  log,
62
65
  );
@@ -68,7 +71,9 @@ export class TXEStateMachine {
68
71
  createLogger('txe:contract_sync'),
69
72
  );
70
73
 
71
- return new this(node, synchronizer, archiver, anchorBlockStore, contractSyncService);
74
+ const messageContextService = new MessageContextService(node);
75
+
76
+ return new this(node, synchronizer, archiver, anchorBlockStore, contractSyncService, messageContextService);
72
77
  }
73
78
 
74
79
  public async handleL2Block(block: L2Block) {
@@ -8,7 +8,7 @@ import { EmptyL1RollupConstants, type L1RollupConstants } from '@aztec/stdlib/ep
8
8
  * Since in TXE we don't validate transactions, mock suffices here.
9
9
  */
10
10
  export class MockEpochCache implements EpochCacheInterface {
11
- getCommittee(): Promise<EpochCommitteeInfo> {
11
+ getCommittee(_slot: SlotTag = 'now'): Promise<EpochCommitteeInfo> {
12
12
  return Promise.resolve({
13
13
  committee: undefined,
14
14
  seed: 0n,
@@ -17,6 +17,22 @@ export class MockEpochCache implements EpochCacheInterface {
17
17
  });
18
18
  }
19
19
 
20
+ getSlotNow(): SlotNumber {
21
+ return SlotNumber(0);
22
+ }
23
+
24
+ getTargetSlot(): SlotNumber {
25
+ return SlotNumber(0);
26
+ }
27
+
28
+ getEpochNow(): EpochNumber {
29
+ return EpochNumber.ZERO;
30
+ }
31
+
32
+ getTargetEpoch(): EpochNumber {
33
+ return EpochNumber.ZERO;
34
+ }
35
+
20
36
  getEpochAndSlotNow(): EpochAndSlot & { nowMs: bigint } {
21
37
  return {
22
38
  epoch: EpochNumber.ZERO,
@@ -26,15 +42,23 @@ export class MockEpochCache implements EpochCacheInterface {
26
42
  };
27
43
  }
28
44
 
29
- getEpochAndSlotInNextL1Slot(): EpochAndSlot & { now: bigint } {
45
+ getEpochAndSlotInNextL1Slot(): EpochAndSlot & { nowSeconds: bigint } {
30
46
  return {
31
47
  epoch: EpochNumber.ZERO,
32
48
  slot: SlotNumber(0),
33
49
  ts: 0n,
34
- now: 0n,
50
+ nowSeconds: 0n,
35
51
  };
36
52
  }
37
53
 
54
+ getTargetEpochAndSlotInNextL1Slot(): EpochAndSlot & { nowSeconds: bigint } {
55
+ return this.getEpochAndSlotInNextL1Slot();
56
+ }
57
+
58
+ isProposerPipeliningEnabled(): boolean {
59
+ return false;
60
+ }
61
+
38
62
  getProposerIndexEncoding(_epoch: EpochNumber, _slot: SlotNumber, _seed: bigint): `0x${string}` {
39
63
  return '0x00';
40
64
  }
@@ -50,6 +74,13 @@ export class MockEpochCache implements EpochCacheInterface {
50
74
  };
51
75
  }
52
76
 
77
+ getTargetAndNextSlot(): { targetSlot: SlotNumber; nextSlot: SlotNumber } {
78
+ return {
79
+ targetSlot: SlotNumber(0),
80
+ nextSlot: SlotNumber(0),
81
+ };
82
+ }
83
+
53
84
  getProposerAttesterAddressInSlot(_slot: SlotNumber): Promise<EthAddress | undefined> {
54
85
  return Promise.resolve(undefined);
55
86
  }
@@ -66,6 +97,14 @@ export class MockEpochCache implements EpochCacheInterface {
66
97
  return Promise.resolve([]);
67
98
  }
68
99
 
100
+ isEscapeHatchOpen(_epoch: EpochNumber): Promise<boolean> {
101
+ return Promise.resolve(false);
102
+ }
103
+
104
+ isEscapeHatchOpenAtSlot(_slot: SlotTag): Promise<boolean> {
105
+ return Promise.resolve(false);
106
+ }
107
+
69
108
  getL1Constants(): L1RollupConstants {
70
109
  return EmptyL1RollupConstants;
71
110
  }
@@ -1,7 +1,7 @@
1
1
  import { NUMBER_OF_L1_L2_MESSAGES_PER_ROLLUP } from '@aztec/constants';
2
2
  import { BlockNumber } from '@aztec/foundation/branded-types';
3
3
  import { Fr } from '@aztec/foundation/curves/bn254';
4
- import type { L2Block } from '@aztec/stdlib/block';
4
+ import type { BlockHash, L2Block } from '@aztec/stdlib/block';
5
5
  import type {
6
6
  MerkleTreeReadOperations,
7
7
  MerkleTreeWriteOperations,
@@ -33,12 +33,12 @@ export class TXESynchronizer implements WorldStateSynchronizer {
33
33
  }
34
34
 
35
35
  /**
36
- * Forces an immediate sync to an optionally provided minimum block number
36
+ * Forces an immediate sync to an optionally provided minimum block number.
37
37
  * @param targetBlockNumber - The target block number that we must sync to. Will download unproven blocks if needed to reach it.
38
- * @param skipThrowIfTargetNotReached - Whether to skip throwing if the target block number is not reached.
38
+ * @param blockHash - If provided, verifies the block at targetBlockNumber matches this hash.
39
39
  * @returns A promise that resolves with the block number the world state was synced to
40
40
  */
41
- public syncImmediate(_minBlockNumber?: BlockNumber, _skipThrowIfTargetNotReached?: boolean): Promise<BlockNumber> {
41
+ public syncImmediate(_minBlockNumber?: BlockNumber, _blockHash?: BlockHash): Promise<BlockNumber> {
42
42
  return Promise.resolve(this.blockNumber);
43
43
  }
44
44