@aztec/txe 0.0.1-commit.6c91f13 → 0.0.1-commit.6d63667d

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 (52) hide show
  1. package/dest/oracle/interfaces.d.ts +3 -3
  2. package/dest/oracle/interfaces.d.ts.map +1 -1
  3. package/dest/oracle/txe_oracle_public_context.d.ts +3 -3
  4. package/dest/oracle/txe_oracle_public_context.d.ts.map +1 -1
  5. package/dest/oracle/txe_oracle_public_context.js +6 -6
  6. package/dest/oracle/txe_oracle_top_level_context.d.ts +3 -2
  7. package/dest/oracle/txe_oracle_top_level_context.d.ts.map +1 -1
  8. package/dest/oracle/txe_oracle_top_level_context.js +39 -24
  9. package/dest/rpc_translator.d.ts +17 -11
  10. package/dest/rpc_translator.d.ts.map +1 -1
  11. package/dest/rpc_translator.js +73 -48
  12. package/dest/state_machine/archiver.d.ts +20 -67
  13. package/dest/state_machine/archiver.d.ts.map +1 -1
  14. package/dest/state_machine/archiver.js +59 -178
  15. package/dest/state_machine/dummy_p2p_client.d.ts +8 -7
  16. package/dest/state_machine/dummy_p2p_client.d.ts.map +1 -1
  17. package/dest/state_machine/dummy_p2p_client.js +13 -10
  18. package/dest/state_machine/global_variable_builder.d.ts +2 -2
  19. package/dest/state_machine/global_variable_builder.d.ts.map +1 -1
  20. package/dest/state_machine/global_variable_builder.js +1 -1
  21. package/dest/state_machine/index.d.ts +5 -5
  22. package/dest/state_machine/index.d.ts.map +1 -1
  23. package/dest/state_machine/index.js +34 -11
  24. package/dest/state_machine/mock_epoch_cache.d.ts +7 -6
  25. package/dest/state_machine/mock_epoch_cache.d.ts.map +1 -1
  26. package/dest/state_machine/mock_epoch_cache.js +10 -7
  27. package/dest/state_machine/synchronizer.d.ts +3 -3
  28. package/dest/state_machine/synchronizer.d.ts.map +1 -1
  29. package/dest/txe_session.d.ts +5 -3
  30. package/dest/txe_session.d.ts.map +1 -1
  31. package/dest/txe_session.js +34 -15
  32. package/dest/util/encoding.d.ts +17 -17
  33. package/dest/utils/block_creation.d.ts +4 -4
  34. package/dest/utils/block_creation.d.ts.map +1 -1
  35. package/dest/utils/block_creation.js +18 -5
  36. package/dest/utils/tx_effect_creation.d.ts +2 -3
  37. package/dest/utils/tx_effect_creation.d.ts.map +1 -1
  38. package/dest/utils/tx_effect_creation.js +3 -6
  39. package/package.json +16 -16
  40. package/src/oracle/interfaces.ts +2 -2
  41. package/src/oracle/txe_oracle_public_context.ts +6 -8
  42. package/src/oracle/txe_oracle_top_level_context.ts +75 -28
  43. package/src/rpc_translator.ts +76 -50
  44. package/src/state_machine/archiver.ts +54 -220
  45. package/src/state_machine/dummy_p2p_client.ts +18 -13
  46. package/src/state_machine/global_variable_builder.ts +1 -1
  47. package/src/state_machine/index.ts +48 -11
  48. package/src/state_machine/mock_epoch_cache.ts +10 -11
  49. package/src/state_machine/synchronizer.ts +2 -2
  50. package/src/txe_session.ts +43 -21
  51. package/src/utils/block_creation.ts +19 -16
  52. package/src/utils/tx_effect_creation.ts +3 -11
@@ -3,7 +3,7 @@ import { Fr } from '@aztec/foundation/curves/bn254';
3
3
  import { createLogger } from '@aztec/foundation/log';
4
4
  import { KeyStore } from '@aztec/key-store';
5
5
  import { openTmpStore } from '@aztec/kv-store/lmdb-v2';
6
- import { AddressStore, CapsuleStore, NoteService, NoteStore, PrivateEventStore, RecipientTaggingStore, SenderAddressBookStore, SenderTaggingStore } from '@aztec/pxe/server';
6
+ import { AddressStore, AnchorBlockStore, CapsuleStore, JobCoordinator, NoteService, NoteStore, PrivateEventStore, RecipientTaggingStore, SenderAddressBookStore, SenderTaggingStore } from '@aztec/pxe/server';
7
7
  import { ExecutionNoteCache, ExecutionTaggingIndexCache, HashedValuesCache, Oracle, PrivateExecutionOracle, UtilityExecutionOracle } from '@aztec/pxe/simulator';
8
8
  import { ExecutionError, WASMSimulator, createSimulationError, extractCallStack, resolveAssertionMessageFromError, toACVMWitness } from '@aztec/simulator/client';
9
9
  import { FunctionSelector, FunctionType } from '@aztec/stdlib/abi';
@@ -17,6 +17,7 @@ import { DEFAULT_ADDRESS } from './constants.js';
17
17
  import { TXEOraclePublicContext } from './oracle/txe_oracle_public_context.js';
18
18
  import { TXEOracleTopLevelContext } from './oracle/txe_oracle_top_level_context.js';
19
19
  import { RPCTranslator } from './rpc_translator.js';
20
+ import { TXEArchiver } from './state_machine/archiver.js';
20
21
  import { TXEStateMachine } from './state_machine/index.js';
21
22
  import { TXEAccountStore } from './util/txe_account_store.js';
22
23
  import { TXEContractStore } from './util/txe_contract_store.js';
@@ -39,12 +40,14 @@ import { makeTxEffect } from './utils/tx_effect_creation.js';
39
40
  senderAddressBookStore;
40
41
  capsuleStore;
41
42
  privateEventStore;
43
+ jobCoordinator;
44
+ currentJobId;
42
45
  chainId;
43
46
  version;
44
47
  nextBlockTimestamp;
45
48
  state;
46
49
  authwits;
47
- constructor(logger, stateMachine, oracleHandler, contractStore, noteStore, keyStore, addressStore, accountStore, senderTaggingStore, recipientTaggingStore, senderAddressBookStore, capsuleStore, privateEventStore, chainId, version, nextBlockTimestamp){
50
+ constructor(logger, stateMachine, oracleHandler, contractStore, noteStore, keyStore, addressStore, accountStore, senderTaggingStore, recipientTaggingStore, senderAddressBookStore, capsuleStore, privateEventStore, jobCoordinator, currentJobId, chainId, version, nextBlockTimestamp){
48
51
  this.logger = logger;
49
52
  this.stateMachine = stateMachine;
50
53
  this.oracleHandler = oracleHandler;
@@ -58,6 +61,8 @@ import { makeTxEffect } from './utils/tx_effect_creation.js';
58
61
  this.senderAddressBookStore = senderAddressBookStore;
59
62
  this.capsuleStore = capsuleStore;
60
63
  this.privateEventStore = privateEventStore;
64
+ this.jobCoordinator = jobCoordinator;
65
+ this.currentJobId = currentJobId;
61
66
  this.chainId = chainId;
62
67
  this.version = version;
63
68
  this.nextBlockTimestamp = nextBlockTimestamp;
@@ -71,25 +76,37 @@ import { makeTxEffect } from './utils/tx_effect_creation.js';
71
76
  const addressStore = new AddressStore(store);
72
77
  const privateEventStore = new PrivateEventStore(store);
73
78
  const contractStore = new TXEContractStore(store);
74
- const noteStore = await NoteStore.create(store);
79
+ const noteStore = new NoteStore(store);
75
80
  const senderTaggingStore = new SenderTaggingStore(store);
76
81
  const recipientTaggingStore = new RecipientTaggingStore(store);
77
82
  const senderAddressBookStore = new SenderAddressBookStore(store);
78
83
  const capsuleStore = new CapsuleStore(store);
79
84
  const keyStore = new KeyStore(store);
80
85
  const accountStore = new TXEAccountStore(store);
86
+ // Create job coordinator and register staged stores
87
+ const jobCoordinator = new JobCoordinator(store);
88
+ jobCoordinator.registerStores([
89
+ capsuleStore,
90
+ senderTaggingStore,
91
+ recipientTaggingStore,
92
+ privateEventStore,
93
+ noteStore
94
+ ]);
81
95
  // Register protocol contracts.
82
96
  for (const { contractClass, instance, artifact } of protocolContracts){
83
97
  await contractStore.addContractArtifact(contractClass.id, artifact);
84
98
  await contractStore.addContractInstance(instance);
85
99
  }
86
- const stateMachine = await TXEStateMachine.create(store);
100
+ const archiver = new TXEArchiver(store);
101
+ const anchorBlockStore = new AnchorBlockStore(store);
102
+ const stateMachine = await TXEStateMachine.create(archiver, anchorBlockStore, contractStore, noteStore);
87
103
  const nextBlockTimestamp = BigInt(Math.floor(new Date().getTime() / 1000));
88
104
  const version = new Fr(await stateMachine.node.getVersion());
89
105
  const chainId = new Fr(await stateMachine.node.getChainId());
90
- const topLevelOracleHandler = new TXEOracleTopLevelContext(stateMachine, contractStore, noteStore, keyStore, addressStore, accountStore, senderTaggingStore, recipientTaggingStore, senderAddressBookStore, capsuleStore, privateEventStore, nextBlockTimestamp, version, chainId, new Map());
106
+ const initialJobId = jobCoordinator.beginJob();
107
+ const topLevelOracleHandler = new TXEOracleTopLevelContext(stateMachine, contractStore, noteStore, keyStore, addressStore, accountStore, senderTaggingStore, recipientTaggingStore, senderAddressBookStore, capsuleStore, privateEventStore, initialJobId, nextBlockTimestamp, version, chainId, new Map());
91
108
  await topLevelOracleHandler.txeAdvanceBlocksBy(1);
92
- return new TXESession(createLogger('txe:session'), stateMachine, topLevelOracleHandler, contractStore, noteStore, keyStore, addressStore, accountStore, senderTaggingStore, recipientTaggingStore, senderAddressBookStore, capsuleStore, privateEventStore, version, chainId, nextBlockTimestamp);
109
+ return new TXESession(createLogger('txe:session'), stateMachine, topLevelOracleHandler, contractStore, noteStore, keyStore, addressStore, accountStore, senderTaggingStore, recipientTaggingStore, senderAddressBookStore, capsuleStore, privateEventStore, jobCoordinator, initialJobId, version, chainId, nextBlockTimestamp);
93
110
  }
94
111
  /**
95
112
  * Processes an oracle function invoked by the Noir test associated to this session.
@@ -138,7 +155,10 @@ import { makeTxEffect } from './utils/tx_effect_creation.js';
138
155
  this.state;
139
156
  }
140
157
  }
141
- this.oracleHandler = new TXEOracleTopLevelContext(this.stateMachine, this.contractStore, this.noteStore, this.keyStore, this.addressStore, this.accountStore, this.senderTaggingStore, this.recipientTaggingStore, this.senderAddressBookStore, this.capsuleStore, this.privateEventStore, this.nextBlockTimestamp, this.version, this.chainId, this.authwits);
158
+ // Commit all staged stores from the job that was just completed, then begin a new job
159
+ await this.jobCoordinator.commitJob(this.currentJobId);
160
+ this.currentJobId = this.jobCoordinator.beginJob();
161
+ this.oracleHandler = new TXEOracleTopLevelContext(this.stateMachine, this.contractStore, this.noteStore, this.keyStore, this.addressStore, this.accountStore, this.senderTaggingStore, this.recipientTaggingStore, this.senderAddressBookStore, this.capsuleStore, this.privateEventStore, this.currentJobId, this.nextBlockTimestamp, this.version, this.chainId, this.authwits);
142
162
  this.state = {
143
163
  name: 'TOP_LEVEL'
144
164
  };
@@ -146,11 +166,11 @@ import { makeTxEffect } from './utils/tx_effect_creation.js';
146
166
  }
147
167
  async enterPrivateState(contractAddress = DEFAULT_ADDRESS, anchorBlockNumber) {
148
168
  this.exitTopLevelState();
149
- await new NoteService(this.noteStore, this.stateMachine.node, this.stateMachine.anchorBlockStore).syncNoteNullifiers(contractAddress);
150
169
  // Private execution has two associated block numbers: the anchor block (i.e. the historical block that is used to
151
170
  // build the proof), and the *next* block, i.e. the one we'll create once the execution ends, and which will contain
152
171
  // a single transaction with the effects of what was done in the test.
153
172
  const anchorBlock = await this.stateMachine.node.getBlockHeader(anchorBlockNumber ?? 'latest');
173
+ await new NoteService(this.noteStore, this.stateMachine.node, anchorBlock, this.currentJobId).syncNoteNullifiers(contractAddress);
154
174
  const latestBlock = await this.stateMachine.node.getBlockHeader('latest');
155
175
  const nextBlockGlobalVariables = makeGlobalVariables(undefined, {
156
176
  blockNumber: BlockNumber(latestBlock.globalVariables.blockNumber + 1),
@@ -163,7 +183,7 @@ import { makeTxEffect } from './utils/tx_effect_creation.js';
163
183
  const noteCache = new ExecutionNoteCache(protocolNullifier);
164
184
  const taggingIndexCache = new ExecutionTaggingIndexCache();
165
185
  const utilityExecutor = this.utilityExecutorForContractSync(anchorBlock);
166
- this.oracleHandler = new PrivateExecutionOracle(Fr.ZERO, new TxContext(this.chainId, this.version, GasSettings.empty()), new CallContext(AztecAddress.ZERO, contractAddress, FunctionSelector.empty(), false), anchorBlock, utilityExecutor, [], [], new HashedValuesCache(), noteCache, taggingIndexCache, this.contractStore, this.noteStore, this.keyStore, this.addressStore, this.stateMachine.node, this.stateMachine.anchorBlockStore, this.senderTaggingStore, this.recipientTaggingStore, this.senderAddressBookStore, this.capsuleStore, this.privateEventStore);
186
+ this.oracleHandler = new PrivateExecutionOracle(Fr.ZERO, new TxContext(this.chainId, this.version, GasSettings.empty()), new CallContext(AztecAddress.ZERO, contractAddress, FunctionSelector.empty(), false), anchorBlock, utilityExecutor, [], [], new HashedValuesCache(), noteCache, taggingIndexCache, this.contractStore, this.noteStore, this.keyStore, this.addressStore, this.stateMachine.node, this.senderTaggingStore, this.recipientTaggingStore, this.senderAddressBookStore, this.capsuleStore, this.privateEventStore, this.stateMachine.contractSyncService, this.currentJobId);
167
187
  // We store the note and tagging index caches fed into the PrivateExecutionOracle (along with some other auxiliary
168
188
  // data) in order to refer to it later, mimicking the way this object is used by the ContractFunctionSimulator. The
169
189
  // difference resides in that the simulator has all information needed in order to run the simulation, while ours
@@ -172,7 +192,6 @@ import { makeTxEffect } from './utils/tx_effect_creation.js';
172
192
  this.state = {
173
193
  name: 'PRIVATE',
174
194
  nextBlockGlobalVariables,
175
- protocolNullifier,
176
195
  noteCache,
177
196
  taggingIndexCache
178
197
  };
@@ -198,14 +217,14 @@ import { makeTxEffect } from './utils/tx_effect_creation.js';
198
217
  }
199
218
  async enterUtilityState(contractAddress = DEFAULT_ADDRESS) {
200
219
  this.exitTopLevelState();
220
+ const anchorBlockHeader = await this.stateMachine.anchorBlockStore.getBlockHeader();
201
221
  // There is no automatic message discovery and contract-driven syncing process in inlined private or utility
202
222
  // contexts, which means that known nullifiers are also not searched for, since it is during the tagging sync that
203
223
  // we perform this. We therefore search for known nullifiers now, as otherwise notes that were nullified would not
204
224
  // be removed from the database.
205
225
  // TODO(#12553): make the synchronizer sync here instead and remove this
206
- await new NoteService(this.noteStore, this.stateMachine.node, this.stateMachine.anchorBlockStore).syncNoteNullifiers(contractAddress);
207
- const anchorBlockHeader = await this.stateMachine.anchorBlockStore.getBlockHeader();
208
- this.oracleHandler = new UtilityExecutionOracle(contractAddress, [], [], anchorBlockHeader, this.contractStore, this.noteStore, this.keyStore, this.addressStore, this.stateMachine.node, this.stateMachine.anchorBlockStore, this.recipientTaggingStore, this.senderAddressBookStore, this.capsuleStore, this.privateEventStore);
226
+ await new NoteService(this.noteStore, this.stateMachine.node, anchorBlockHeader, this.currentJobId).syncNoteNullifiers(contractAddress);
227
+ this.oracleHandler = new UtilityExecutionOracle(contractAddress, [], [], anchorBlockHeader, this.contractStore, this.noteStore, this.keyStore, this.addressStore, this.stateMachine.node, this.recipientTaggingStore, this.senderAddressBookStore, this.capsuleStore, this.privateEventStore, this.currentJobId);
209
228
  this.state = {
210
229
  name: 'UTILITY'
211
230
  };
@@ -235,7 +254,7 @@ import { makeTxEffect } from './utils/tx_effect_creation.js';
235
254
  });
236
255
  // We rely on the note cache to determine the effects of the transaction. This is incomplete as it doesn't private
237
256
  // logs (other effects like enqueued public calls don't need to be considered since those are not allowed).
238
- const txEffect = await makeTxEffect(this.state.noteCache, this.state.protocolNullifier, this.state.nextBlockGlobalVariables.blockNumber);
257
+ const txEffect = await makeTxEffect(this.state.noteCache, this.state.nextBlockGlobalVariables.blockNumber);
239
258
  // We build a block holding just this transaction
240
259
  const forkedWorldTrees = await this.stateMachine.synchronizer.nativeWorldStateService.fork();
241
260
  await insertTxEffectIntoWorldTrees(txEffect, forkedWorldTrees);
@@ -268,7 +287,7 @@ import { makeTxEffect } from './utils/tx_effect_creation.js';
268
287
  throw new Error(`Cannot run ${entryPointArtifact.functionType} function as utility`);
269
288
  }
270
289
  try {
271
- const oracle = new UtilityExecutionOracle(call.to, [], [], anchorBlock, this.contractStore, this.noteStore, this.keyStore, this.addressStore, this.stateMachine.node, this.stateMachine.anchorBlockStore, this.recipientTaggingStore, this.senderAddressBookStore, this.capsuleStore, this.privateEventStore);
290
+ const oracle = new UtilityExecutionOracle(call.to, [], [], anchorBlock, this.contractStore, this.noteStore, this.keyStore, this.addressStore, this.stateMachine.node, this.recipientTaggingStore, this.senderAddressBookStore, this.capsuleStore, this.privateEventStore, this.currentJobId);
272
291
  await new WASMSimulator().executeUserCircuit(toACVMWitness(0, call.args), entryPointArtifact, new Oracle(oracle).toACIRCallback()).catch((err)=>{
273
292
  err.message = resolveAssertionMessageFromError(err, entryPointArtifact);
274
293
  throw new ExecutionError(err.message, {
@@ -150,7 +150,7 @@ export declare const ForeignCallArgsSchema: z.ZodArray<z.ZodUnion<[z.ZodString,
150
150
  error_kind: "custom";
151
151
  } & import("@aztec/stdlib/abi").AbiType) | undefined>;
152
152
  }>, z.ZodObject<{
153
- bytecode: import("../../../foundation/dest/schemas/types.js").ZodFor<Buffer<ArrayBufferLike>>;
153
+ bytecode: import("@aztec/foundation/schemas").ZodFor<Buffer<ArrayBufferLike>>;
154
154
  verificationKey: z.ZodOptional<z.ZodString>;
155
155
  debugSymbols: z.ZodString;
156
156
  debug: z.ZodOptional<z.ZodObject<{
@@ -656,27 +656,27 @@ export declare const ForeignCallArgsSchema: z.ZodArray<z.ZodUnion<[z.ZodString,
656
656
  }>;
657
657
  }>, z.ZodIntersection<z.ZodObject<{
658
658
  version: z.ZodLiteral<1>;
659
- salt: import("../../../foundation/dest/schemas/types.js").ZodFor<Fr>;
660
- deployer: import("../../../foundation/dest/schemas/types.js").ZodFor<AztecAddress>;
661
- currentContractClassId: import("../../../foundation/dest/schemas/types.js").ZodFor<Fr>;
662
- originalContractClassId: import("../../../foundation/dest/schemas/types.js").ZodFor<Fr>;
663
- initializationHash: import("../../../foundation/dest/schemas/types.js").ZodFor<Fr>;
659
+ salt: import("@aztec/foundation/schemas").ZodFor<Fr>;
660
+ deployer: import("@aztec/foundation/schemas").ZodFor<AztecAddress>;
661
+ currentContractClassId: import("@aztec/foundation/schemas").ZodFor<Fr>;
662
+ originalContractClassId: import("@aztec/foundation/schemas").ZodFor<Fr>;
663
+ initializationHash: import("@aztec/foundation/schemas").ZodFor<Fr>;
664
664
  publicKeys: z.ZodEffects<z.ZodObject<{
665
- masterNullifierPublicKey: z.ZodType<import("../../../foundation/dest/schemas/schemas.js").Point, any, string>;
666
- masterIncomingViewingPublicKey: z.ZodType<import("../../../foundation/dest/schemas/schemas.js").Point, any, string>;
667
- masterOutgoingViewingPublicKey: z.ZodType<import("../../../foundation/dest/schemas/schemas.js").Point, any, string>;
668
- masterTaggingPublicKey: z.ZodType<import("../../../foundation/dest/schemas/schemas.js").Point, any, string>;
665
+ masterNullifierPublicKey: z.ZodType<import("@aztec/foundation/schemas").Point, any, string>;
666
+ masterIncomingViewingPublicKey: z.ZodType<import("@aztec/foundation/schemas").Point, any, string>;
667
+ masterOutgoingViewingPublicKey: z.ZodType<import("@aztec/foundation/schemas").Point, any, string>;
668
+ masterTaggingPublicKey: z.ZodType<import("@aztec/foundation/schemas").Point, any, string>;
669
669
  }, "strip", z.ZodTypeAny, {
670
- masterNullifierPublicKey: import("../../../foundation/dest/schemas/schemas.js").Point;
671
- masterIncomingViewingPublicKey: import("../../../foundation/dest/schemas/schemas.js").Point;
672
- masterOutgoingViewingPublicKey: import("../../../foundation/dest/schemas/schemas.js").Point;
673
- masterTaggingPublicKey: import("../../../foundation/dest/schemas/schemas.js").Point;
670
+ masterNullifierPublicKey: import("@aztec/foundation/schemas").Point;
671
+ masterIncomingViewingPublicKey: import("@aztec/foundation/schemas").Point;
672
+ masterOutgoingViewingPublicKey: import("@aztec/foundation/schemas").Point;
673
+ masterTaggingPublicKey: import("@aztec/foundation/schemas").Point;
674
674
  }, {
675
675
  masterNullifierPublicKey: string;
676
676
  masterIncomingViewingPublicKey: string;
677
677
  masterOutgoingViewingPublicKey: string;
678
678
  masterTaggingPublicKey: string;
679
- }>, import("../../../stdlib/dest/keys/public_keys.js").PublicKeys, {
679
+ }>, import("@aztec/stdlib/keys").PublicKeys, {
680
680
  masterNullifierPublicKey: string;
681
681
  masterIncomingViewingPublicKey: string;
682
682
  masterOutgoingViewingPublicKey: string;
@@ -689,7 +689,7 @@ export declare const ForeignCallArgsSchema: z.ZodArray<z.ZodUnion<[z.ZodString,
689
689
  currentContractClassId: Fr;
690
690
  originalContractClassId: Fr;
691
691
  initializationHash: Fr;
692
- publicKeys: import("../../../stdlib/dest/keys/public_keys.js").PublicKeys;
692
+ publicKeys: import("@aztec/stdlib/keys").PublicKeys;
693
693
  }, {
694
694
  version: 1;
695
695
  salt?: any;
@@ -704,7 +704,7 @@ export declare const ForeignCallArgsSchema: z.ZodArray<z.ZodUnion<[z.ZodString,
704
704
  masterTaggingPublicKey: string;
705
705
  };
706
706
  }>, z.ZodObject<{
707
- address: import("../../../foundation/dest/schemas/types.js").ZodFor<AztecAddress>;
707
+ address: import("@aztec/foundation/schemas").ZodFor<AztecAddress>;
708
708
  }, "strip", z.ZodTypeAny, {
709
709
  address: AztecAddress;
710
710
  }, {
@@ -1,8 +1,8 @@
1
1
  import { BlockNumber } from '@aztec/foundation/branded-types';
2
2
  import { Fr } from '@aztec/foundation/curves/bn254';
3
- import { L2Block, L2BlockHeader } from '@aztec/stdlib/block';
3
+ import { L2Block } from '@aztec/stdlib/block';
4
4
  import { type MerkleTreeWriteOperations } from '@aztec/stdlib/trees';
5
- import { GlobalVariables, TxEffect } from '@aztec/stdlib/tx';
5
+ import { BlockHeader, GlobalVariables, TxEffect } from '@aztec/stdlib/tx';
6
6
  /**
7
7
  * Returns a transaction request hash that is valid for transactions that are the only ones in a block.
8
8
  * @param blockNumber The number for the block in which there is a single transaction.
@@ -10,7 +10,7 @@ import { GlobalVariables, TxEffect } from '@aztec/stdlib/tx';
10
10
  */
11
11
  export declare function getSingleTxBlockRequestHash(blockNumber: BlockNumber): Fr;
12
12
  export declare function insertTxEffectIntoWorldTrees(txEffect: TxEffect, worldTrees: MerkleTreeWriteOperations): Promise<void>;
13
- export declare function makeTXEBlockHeader(worldTrees: MerkleTreeWriteOperations, globalVariables: GlobalVariables): Promise<L2BlockHeader>;
13
+ export declare function makeTXEBlockHeader(worldTrees: MerkleTreeWriteOperations, globalVariables: GlobalVariables): Promise<BlockHeader>;
14
14
  /**
15
15
  * Creates an L2Block with proper archive chaining.
16
16
  * This function:
@@ -25,4 +25,4 @@ export declare function makeTXEBlockHeader(worldTrees: MerkleTreeWriteOperations
25
25
  * @returns The created L2Block with proper archive chaining
26
26
  */
27
27
  export declare function makeTXEBlock(worldTrees: MerkleTreeWriteOperations, globalVariables: GlobalVariables, txEffects: TxEffect[]): Promise<L2Block>;
28
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYmxvY2tfY3JlYXRpb24uZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy91dGlscy9ibG9ja19jcmVhdGlvbi50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFNQSxPQUFPLEVBQUUsV0FBVyxFQUFFLE1BQU0saUNBQWl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e,EAAE,eAAe,GAC/B,OAAO,CAAC,WAAW,CAAC,CAYtB;AAED;;;;;;;;;;;;GAYG;AACH,wBAAsB,YAAY,CAChC,UAAU,EAAE,yBAAyB,EACrC,eAAe,EAAE,eAAe,EAChC,SAAS,EAAE,QAAQ,EAAE,GACpB,OAAO,CAAC,OAAO,CAAC,CAiBlB"}
@@ -1,9 +1,10 @@
1
1
  import { MAX_NOTE_HASHES_PER_TX, MAX_NULLIFIERS_PER_TX, NULLIFIER_SUBTREE_HEIGHT, NUMBER_OF_L1_L2_MESSAGES_PER_ROLLUP } from '@aztec/constants';
2
+ import { CheckpointNumber, IndexWithinCheckpoint } from '@aztec/foundation/branded-types';
2
3
  import { padArrayEnd } from '@aztec/foundation/collection';
3
4
  import { Fr } from '@aztec/foundation/curves/bn254';
4
- import { Body, L2Block, L2BlockHeader } from '@aztec/stdlib/block';
5
- import { makeContentCommitment } from '@aztec/stdlib/testing';
5
+ import { Body, L2Block } from '@aztec/stdlib/block';
6
6
  import { AppendOnlyTreeSnapshot, MerkleTreeId } from '@aztec/stdlib/trees';
7
+ import { BlockHeader } from '@aztec/stdlib/tx';
7
8
  /**
8
9
  * Returns a transaction request hash that is valid for transactions that are the only ones in a block.
9
10
  * @param blockNumber The number for the block in which there is a single transaction.
@@ -20,7 +21,14 @@ export async function insertTxEffectIntoWorldTrees(txEffect, worldTrees) {
20
21
  export async function makeTXEBlockHeader(worldTrees, globalVariables) {
21
22
  const stateReference = await worldTrees.getStateReference();
22
23
  const archiveInfo = await worldTrees.getTreeInfo(MerkleTreeId.ARCHIVE);
23
- return new L2BlockHeader(new AppendOnlyTreeSnapshot(new Fr(archiveInfo.root), Number(archiveInfo.size)), makeContentCommitment(), stateReference, globalVariables, Fr.ZERO, Fr.ZERO, Fr.ZERO, Fr.ZERO);
24
+ return BlockHeader.from({
25
+ lastArchive: new AppendOnlyTreeSnapshot(new Fr(archiveInfo.root), Number(archiveInfo.size)),
26
+ spongeBlobHash: Fr.ZERO,
27
+ state: stateReference,
28
+ globalVariables,
29
+ totalFees: Fr.ZERO,
30
+ totalManaUsed: Fr.ZERO
31
+ });
24
32
  }
25
33
  /**
26
34
  * Creates an L2Block with proper archive chaining.
@@ -37,9 +45,14 @@ export async function makeTXEBlockHeader(worldTrees, globalVariables) {
37
45
  */ export async function makeTXEBlock(worldTrees, globalVariables, txEffects) {
38
46
  const header = await makeTXEBlockHeader(worldTrees, globalVariables);
39
47
  // Update the archive tree with this block's header hash
40
- await worldTrees.updateArchive(header.toBlockHeader());
48
+ await worldTrees.updateArchive(header);
41
49
  // Get the new archive state after updating
42
50
  const newArchiveInfo = await worldTrees.getTreeInfo(MerkleTreeId.ARCHIVE);
43
51
  const newArchive = new AppendOnlyTreeSnapshot(new Fr(newArchiveInfo.root), Number(newArchiveInfo.size));
44
- return new L2Block(newArchive, header, new Body(txEffects));
52
+ // L2Block requires checkpointNumber and indexWithinCheckpoint.
53
+ // TXE uses 1-block-per-checkpoint for testing simplicity, so we can use block number as checkpoint number.
54
+ // This uses the deprecated fromBlockNumber method intentionally for the TXE testing environment.
55
+ const checkpointNumber = CheckpointNumber.fromBlockNumber(globalVariables.blockNumber);
56
+ const indexWithinCheckpoint = IndexWithinCheckpoint(0);
57
+ return new L2Block(newArchive, header, new Body(txEffects), checkpointNumber, indexWithinCheckpoint);
45
58
  }
@@ -1,6 +1,5 @@
1
1
  import { BlockNumber } from '@aztec/foundation/branded-types';
2
- import { Fr } from '@aztec/foundation/curves/bn254';
3
2
  import type { ExecutionNoteCache } from '@aztec/pxe/simulator';
4
3
  import { TxEffect } from '@aztec/stdlib/tx';
5
- export declare function makeTxEffect(noteCache: ExecutionNoteCache, protocolNullifier: Fr, txBlockNumber: BlockNumber): Promise<TxEffect>;
6
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHhfZWZmZWN0X2NyZWF0aW9uLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcm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0F1Qi9HIn0=
@@ -1 +1 @@
1
- {"version":3,"file":"tx_effect_creation.d.ts","sourceRoot":"","sources":["../../src/utils/tx_effect_creation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAC9D,OAAO,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AACpD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE/D,OAAO,EAAE,QAAQ,EAAU,MAAM,kBAAkB,CAAC;AAEpD,wBAAsB,YAAY,CAChC,SAAS,EAAE,kBAAkB,EAC7B,iBAAiB,EAAE,EAAE,EACrB,aAAa,EAAE,WAAW,GACzB,OAAO,CAAC,QAAQ,CAAC,CA2BnB"}
1
+ {"version":3,"file":"tx_effect_creation.d.ts","sourceRoot":"","sources":["../../src/utils/tx_effect_creation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAE9D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE/D,OAAO,EAAE,QAAQ,EAAU,MAAM,kBAAkB,CAAC;AAEpD,wBAAsB,YAAY,CAAC,SAAS,EAAE,kBAAkB,EAAE,aAAa,EAAE,WAAW,GAAG,OAAO,CAAC,QAAQ,CAAC,CAuB/G"}
@@ -1,16 +1,13 @@
1
1
  import { Fr } from '@aztec/foundation/curves/bn254';
2
2
  import { computeNoteHashNonce, computeUniqueNoteHash, siloNoteHash } from '@aztec/stdlib/hash';
3
3
  import { TxEffect, TxHash } from '@aztec/stdlib/tx';
4
- export async function makeTxEffect(noteCache, protocolNullifier, txBlockNumber) {
4
+ export async function makeTxEffect(noteCache, txBlockNumber) {
5
5
  const txEffect = TxEffect.empty();
6
- const { usedProtocolNullifierForNonces } = noteCache.finish();
7
- const nonceGenerator = usedProtocolNullifierForNonces ? protocolNullifier : noteCache.getAllNullifiers()[0];
6
+ noteCache.finish();
7
+ const nonceGenerator = noteCache.getNonceGenerator();
8
8
  txEffect.noteHashes = await Promise.all(noteCache.getAllNotes().map(async (pendingNote, i)=>computeUniqueNoteHash(await computeNoteHashNonce(nonceGenerator, i), await siloNoteHash(pendingNote.note.contractAddress, pendingNote.noteHashForConsumption))));
9
9
  // Nullifiers are already siloed
10
10
  txEffect.nullifiers = noteCache.getAllNullifiers();
11
- if (usedProtocolNullifierForNonces) {
12
- txEffect.nullifiers.unshift(protocolNullifier);
13
- }
14
11
  txEffect.txHash = new TxHash(new Fr(txBlockNumber));
15
12
  return txEffect;
16
13
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aztec/txe",
3
- "version": "0.0.1-commit.6c91f13",
3
+ "version": "0.0.1-commit.6d63667d",
4
4
  "type": "module",
5
5
  "exports": "./dest/index.js",
6
6
  "bin": "./dest/bin/index.js",
@@ -61,27 +61,27 @@
61
61
  ]
62
62
  },
63
63
  "dependencies": {
64
- "@aztec/accounts": "0.0.1-commit.6c91f13",
65
- "@aztec/archiver": "0.0.1-commit.6c91f13",
66
- "@aztec/aztec-node": "0.0.1-commit.6c91f13",
67
- "@aztec/aztec.js": "0.0.1-commit.6c91f13",
68
- "@aztec/bb-prover": "0.0.1-commit.6c91f13",
69
- "@aztec/constants": "0.0.1-commit.6c91f13",
70
- "@aztec/foundation": "0.0.1-commit.6c91f13",
71
- "@aztec/key-store": "0.0.1-commit.6c91f13",
72
- "@aztec/kv-store": "0.0.1-commit.6c91f13",
73
- "@aztec/protocol-contracts": "0.0.1-commit.6c91f13",
74
- "@aztec/pxe": "0.0.1-commit.6c91f13",
75
- "@aztec/simulator": "0.0.1-commit.6c91f13",
76
- "@aztec/stdlib": "0.0.1-commit.6c91f13",
77
- "@aztec/world-state": "0.0.1-commit.6c91f13",
64
+ "@aztec/accounts": "0.0.1-commit.6d63667d",
65
+ "@aztec/archiver": "0.0.1-commit.6d63667d",
66
+ "@aztec/aztec-node": "0.0.1-commit.6d63667d",
67
+ "@aztec/aztec.js": "0.0.1-commit.6d63667d",
68
+ "@aztec/bb-prover": "0.0.1-commit.6d63667d",
69
+ "@aztec/constants": "0.0.1-commit.6d63667d",
70
+ "@aztec/foundation": "0.0.1-commit.6d63667d",
71
+ "@aztec/key-store": "0.0.1-commit.6d63667d",
72
+ "@aztec/kv-store": "0.0.1-commit.6d63667d",
73
+ "@aztec/protocol-contracts": "0.0.1-commit.6d63667d",
74
+ "@aztec/pxe": "0.0.1-commit.6d63667d",
75
+ "@aztec/simulator": "0.0.1-commit.6d63667d",
76
+ "@aztec/stdlib": "0.0.1-commit.6d63667d",
77
+ "@aztec/world-state": "0.0.1-commit.6d63667d",
78
78
  "zod": "^3.23.8"
79
79
  },
80
80
  "devDependencies": {
81
81
  "@jest/globals": "^30.0.0",
82
82
  "@types/jest": "^30.0.0",
83
83
  "@types/node": "^22.15.17",
84
- "@typescript/native-preview": "7.0.0-dev.20251126.1",
84
+ "@typescript/native-preview": "7.0.0-dev.20260113.1",
85
85
  "jest": "^30.0.0",
86
86
  "jest-mock-extended": "^4.0.0",
87
87
  "ts-node": "^10.9.1",
@@ -33,9 +33,9 @@ export interface IAvmExecutionOracle {
33
33
  avmOpcodeVersion(): Promise<Fr>;
34
34
  avmOpcodeEmitNullifier(nullifier: Fr): Promise<void>;
35
35
  avmOpcodeEmitNoteHash(noteHash: Fr): Promise<void>;
36
- avmOpcodeNullifierExists(innerNullifier: Fr, targetAddress: AztecAddress): Promise<boolean>;
36
+ avmOpcodeNullifierExists(siloedNullifier: Fr): Promise<boolean>;
37
37
  avmOpcodeStorageWrite(slot: Fr, value: Fr): Promise<void>;
38
- avmOpcodeStorageRead(slot: Fr): Promise<Fr>;
38
+ avmOpcodeStorageRead(slot: Fr, contractAddress: AztecAddress): Promise<Fr>;
39
39
  }
40
40
 
41
41
  /**
@@ -78,13 +78,11 @@ export class TXEOraclePublicContext implements IAvmExecutionOracle {
78
78
  this.transientUniqueNoteHashes.push(siloedNoteHash);
79
79
  }
80
80
 
81
- async avmOpcodeNullifierExists(innerNullifier: Fr, targetAddress: AztecAddress): Promise<boolean> {
82
- const nullifier = await siloNullifier(targetAddress, innerNullifier!);
83
-
81
+ async avmOpcodeNullifierExists(siloedNullifier: Fr): Promise<boolean> {
84
82
  const treeIndex = (
85
- await this.forkedWorldTrees.findLeafIndices(MerkleTreeId.NULLIFIER_TREE, [nullifier.toBuffer()])
83
+ await this.forkedWorldTrees.findLeafIndices(MerkleTreeId.NULLIFIER_TREE, [siloedNullifier.toBuffer()])
86
84
  )[0];
87
- const transientIndex = this.transientSiloedNullifiers.find(n => n.equals(nullifier));
85
+ const transientIndex = this.transientSiloedNullifiers.find(n => n.equals(siloedNullifier));
88
86
 
89
87
  return treeIndex !== undefined || transientIndex !== undefined;
90
88
  }
@@ -101,8 +99,8 @@ export class TXEOraclePublicContext implements IAvmExecutionOracle {
101
99
  ]);
102
100
  }
103
101
 
104
- async avmOpcodeStorageRead(slot: Fr): Promise<Fr> {
105
- const leafSlot = await computePublicDataTreeLeafSlot(this.contractAddress, slot);
102
+ async avmOpcodeStorageRead(slot: Fr, contractAddress: AztecAddress): Promise<Fr> {
103
+ const leafSlot = await computePublicDataTreeLeafSlot(contractAddress, slot);
106
104
 
107
105
  const lowLeafResult = await this.forkedWorldTrees.getPreviousValueIndex(
108
106
  MerkleTreeId.PUBLIC_DATA_TREE,
@@ -119,7 +117,7 @@ export class TXEOraclePublicContext implements IAvmExecutionOracle {
119
117
  )) as PublicDataTreeLeafPreimage
120
118
  ).leaf.value;
121
119
 
122
- this.logger.debug('AVM storage read', { slot, value });
120
+ this.logger.debug('AVM storage read', { slot, contractAddress, value });
123
121
 
124
122
  return value;
125
123
  }