@aztec/simulator 0.87.7 → 1.0.0-nightly.20250605

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 (105) hide show
  1. package/dest/public/avm/avm_gas.d.ts +4 -5
  2. package/dest/public/avm/avm_gas.d.ts.map +1 -1
  3. package/dest/public/avm/avm_gas.js +29 -19
  4. package/dest/public/avm/fixtures/utils.js +1 -1
  5. package/dest/public/avm/opcodes/accrued_substate.d.ts.map +1 -1
  6. package/dest/public/avm/opcodes/accrued_substate.js +8 -7
  7. package/dest/public/avm/opcodes/addressing_mode.d.ts +2 -0
  8. package/dest/public/avm/opcodes/addressing_mode.d.ts.map +1 -1
  9. package/dest/public/avm/opcodes/addressing_mode.js +6 -0
  10. package/dest/public/avm/opcodes/arithmetic.d.ts.map +1 -1
  11. package/dest/public/avm/opcodes/arithmetic.js +1 -1
  12. package/dest/public/avm/opcodes/bitwise.d.ts +5 -1
  13. package/dest/public/avm/opcodes/bitwise.d.ts.map +1 -1
  14. package/dest/public/avm/opcodes/bitwise.js +17 -2
  15. package/dest/public/avm/opcodes/comparators.d.ts.map +1 -1
  16. package/dest/public/avm/opcodes/comparators.js +1 -1
  17. package/dest/public/avm/opcodes/contract.d.ts.map +1 -1
  18. package/dest/public/avm/opcodes/contract.js +1 -1
  19. package/dest/public/avm/opcodes/control_flow.d.ts.map +1 -1
  20. package/dest/public/avm/opcodes/control_flow.js +4 -4
  21. package/dest/public/avm/opcodes/conversion.d.ts +1 -0
  22. package/dest/public/avm/opcodes/conversion.d.ts.map +1 -1
  23. package/dest/public/avm/opcodes/conversion.js +263 -2
  24. package/dest/public/avm/opcodes/ec_add.d.ts.map +1 -1
  25. package/dest/public/avm/opcodes/ec_add.js +1 -1
  26. package/dest/public/avm/opcodes/environment_getters.d.ts.map +1 -1
  27. package/dest/public/avm/opcodes/environment_getters.js +1 -1
  28. package/dest/public/avm/opcodes/external_calls.d.ts.map +1 -1
  29. package/dest/public/avm/opcodes/external_calls.js +6 -8
  30. package/dest/public/avm/opcodes/hashing.d.ts.map +1 -1
  31. package/dest/public/avm/opcodes/hashing.js +3 -3
  32. package/dest/public/avm/opcodes/instruction.d.ts +9 -3
  33. package/dest/public/avm/opcodes/instruction.d.ts.map +1 -1
  34. package/dest/public/avm/opcodes/instruction.js +12 -7
  35. package/dest/public/avm/opcodes/memory.d.ts.map +1 -1
  36. package/dest/public/avm/opcodes/memory.js +8 -6
  37. package/dest/public/avm/opcodes/misc.js +1 -3
  38. package/dest/public/avm/opcodes/storage.d.ts.map +1 -1
  39. package/dest/public/avm/opcodes/storage.js +5 -3
  40. package/dest/public/fixtures/index.d.ts +1 -0
  41. package/dest/public/fixtures/index.d.ts.map +1 -1
  42. package/dest/public/fixtures/index.js +1 -0
  43. package/dest/public/fixtures/minimal_public_tx.d.ts +9 -0
  44. package/dest/public/fixtures/minimal_public_tx.d.ts.map +1 -0
  45. package/dest/public/fixtures/minimal_public_tx.js +43 -0
  46. package/dest/public/fixtures/utils.js +3 -3
  47. package/dest/public/hinting_db_sources.d.ts +3 -0
  48. package/dest/public/hinting_db_sources.d.ts.map +1 -1
  49. package/dest/public/hinting_db_sources.js +9 -0
  50. package/dest/public/index.d.ts +2 -1
  51. package/dest/public/index.d.ts.map +1 -1
  52. package/dest/public/index.js +2 -1
  53. package/dest/public/public_db_sources.d.ts.map +1 -1
  54. package/dest/public/public_db_sources.js +2 -2
  55. package/dest/public/public_processor/guarded_merkle_tree.d.ts +44 -0
  56. package/dest/public/public_processor/guarded_merkle_tree.d.ts.map +1 -0
  57. package/dest/public/public_processor/guarded_merkle_tree.js +105 -0
  58. package/dest/public/public_processor/public_processor.d.ts +6 -16
  59. package/dest/public/public_processor/public_processor.d.ts.map +1 -1
  60. package/dest/public/public_processor/public_processor.js +32 -16
  61. package/dest/public/public_tx_simulator/public_tx_context.d.ts +3 -1
  62. package/dest/public/public_tx_simulator/public_tx_context.d.ts.map +1 -1
  63. package/dest/public/public_tx_simulator/public_tx_context.js +18 -15
  64. package/dest/public/public_tx_simulator/public_tx_simulator.d.ts.map +1 -1
  65. package/dest/public/public_tx_simulator/public_tx_simulator.js +0 -3
  66. package/dest/public/side_effect_trace.d.ts +4 -1
  67. package/dest/public/side_effect_trace.d.ts.map +1 -1
  68. package/dest/public/side_effect_trace.js +13 -2
  69. package/dest/public/side_effect_trace_interface.d.ts +1 -0
  70. package/dest/public/side_effect_trace_interface.d.ts.map +1 -1
  71. package/dest/public/state_manager/state_manager.d.ts +1 -0
  72. package/dest/public/state_manager/state_manager.d.ts.map +1 -1
  73. package/dest/public/state_manager/state_manager.js +3 -0
  74. package/package.json +15 -15
  75. package/src/public/avm/avm_gas.ts +21 -15
  76. package/src/public/avm/fixtures/utils.ts +1 -1
  77. package/src/public/avm/opcodes/accrued_substate.ts +23 -7
  78. package/src/public/avm/opcodes/addressing_mode.ts +8 -0
  79. package/src/public/avm/opcodes/arithmetic.ts +3 -1
  80. package/src/public/avm/opcodes/bitwise.ts +26 -2
  81. package/src/public/avm/opcodes/comparators.ts +3 -1
  82. package/src/public/avm/opcodes/contract.ts +3 -1
  83. package/src/public/avm/opcodes/control_flow.ts +6 -4
  84. package/src/public/avm/opcodes/conversion.ts +21 -2
  85. package/src/public/avm/opcodes/ec_add.ts +3 -1
  86. package/src/public/avm/opcodes/environment_getters.ts +3 -1
  87. package/src/public/avm/opcodes/external_calls.ts +16 -8
  88. package/src/public/avm/opcodes/hashing.ts +11 -3
  89. package/src/public/avm/opcodes/instruction.ts +14 -7
  90. package/src/public/avm/opcodes/memory.ts +23 -6
  91. package/src/public/avm/opcodes/misc.ts +4 -4
  92. package/src/public/avm/opcodes/storage.ts +13 -3
  93. package/src/public/fixtures/index.ts +1 -0
  94. package/src/public/fixtures/minimal_public_tx.ts +57 -0
  95. package/src/public/fixtures/utils.ts +3 -3
  96. package/src/public/hinting_db_sources.ts +15 -0
  97. package/src/public/index.ts +2 -1
  98. package/src/public/public_db_sources.ts +3 -13
  99. package/src/public/public_processor/guarded_merkle_tree.ts +148 -0
  100. package/src/public/public_processor/public_processor.ts +47 -34
  101. package/src/public/public_tx_simulator/public_tx_context.ts +39 -20
  102. package/src/public/public_tx_simulator/public_tx_simulator.ts +0 -3
  103. package/src/public/side_effect_trace.ts +13 -0
  104. package/src/public/side_effect_trace_interface.ts +1 -0
  105. package/src/public/state_manager/state_manager.ts +4 -0
@@ -0,0 +1,9 @@
1
+ import { AvmCircuitInputs } from '@aztec/stdlib/avm';
2
+ import type { PublicTxResult } from '../public_tx_simulator/public_tx_simulator.js';
3
+ export declare function createAvmMinimalPublicTx(): Promise<PublicTxResult>;
4
+ /**
5
+ * Reads the AVM circuit inputs for the minimal public tx from a pre-generated JSON file.
6
+ * @returns The AvmCircuitInputs for the minimal public tx.
7
+ */
8
+ export declare function readAvmMinimalPublicTxInputsFromFile(): AvmCircuitInputs;
9
+ //# sourceMappingURL=minimal_public_tx.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"minimal_public_tx.d.ts","sourceRoot":"","sources":["../../../src/public/fixtures/minimal_public_tx.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAQrD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,+CAA+C,CAAC;AAGpF,wBAAsB,wBAAwB,IAAI,OAAO,CAAC,cAAc,CAAC,CAoCxE;AAED;;;GAGG;AACH,wBAAgB,oCAAoC,IAAI,gBAAgB,CAEvE"}
@@ -0,0 +1,43 @@
1
+ import { FunctionType, emptyContractArtifact, emptyFunctionArtifact } from '@aztec/stdlib/abi';
2
+ import { AvmCircuitInputs } from '@aztec/stdlib/avm';
3
+ import { AztecAddress } from '@aztec/stdlib/aztec-address';
4
+ import avmMinimalCircuitInputsJson from '../../../artifacts/avm_minimal_inputs.json' with {
5
+ type: 'json'
6
+ };
7
+ import { TypeTag } from '../avm/avm_memory_types.js';
8
+ import { Add, Return, Set } from '../avm/opcodes/index.js';
9
+ import { encodeToBytecode } from '../avm/serialization/bytecode_serialization.js';
10
+ import { Opcode } from '../avm/serialization/instruction_serialization.js';
11
+ import { PublicTxSimulationTester } from './public_tx_simulation_tester.js';
12
+ export async function createAvmMinimalPublicTx() {
13
+ const deployer = AztecAddress.fromNumber(42);
14
+ const simTester = await PublicTxSimulationTester.create();
15
+ const minimalBytecode = encodeToBytecode([
16
+ new Set(/*indirect*/ 0, /*dstOffset*/ 0, TypeTag.UINT32, /*value*/ 1).as(Opcode.SET_8, Set.wireFormat8),
17
+ new Set(/*indirect*/ 0, /*dstOffset*/ 1, TypeTag.UINT32, /*value*/ 2).as(Opcode.SET_8, Set.wireFormat8),
18
+ new Add(/*indirect=*/ 0, /*aOffset=*/ 0, /*bOffset=*/ 1, /*dstOffset=*/ 2).as(Opcode.ADD_8, Add.wireFormat8),
19
+ new Return(/*indirect=*/ 0, /*copySizeOffset=*/ 0, /*returnOffset=*/ 2)
20
+ ]);
21
+ const minimalContractArtifact = emptyContractArtifact();
22
+ minimalContractArtifact.name = 'MinimalContract';
23
+ minimalContractArtifact.functions = [
24
+ emptyFunctionArtifact()
25
+ ];
26
+ minimalContractArtifact.functions[0].name = 'public_dispatch';
27
+ minimalContractArtifact.functions[0].functionType = FunctionType.PUBLIC;
28
+ minimalContractArtifact.functions[0].bytecode = minimalBytecode;
29
+ const minimalTestContract = await simTester.registerAndDeployContract(/*constructorArgs=*/ [], deployer, /*contractArtifact=*/ minimalContractArtifact);
30
+ return await simTester.simulateTx(/*sender=*/ deployer, /*setupCalls=*/ [], /*appCalls=*/ [
31
+ {
32
+ address: minimalTestContract.address,
33
+ fnName: 'public_dispatch',
34
+ args: []
35
+ }
36
+ ]);
37
+ }
38
+ /**
39
+ * Reads the AVM circuit inputs for the minimal public tx from a pre-generated JSON file.
40
+ * @returns The AvmCircuitInputs for the minimal public tx.
41
+ */ export function readAvmMinimalPublicTxInputsFromFile() {
42
+ return AvmCircuitInputs.schema.parse(avmMinimalCircuitInputsJson);
43
+ }
@@ -66,9 +66,9 @@ export async function addNewContractClassToTx(tx, contractClass, skipNullifierIn
66
66
  ];
67
67
  const contractAddress = new AztecAddress(new Fr(REGISTERER_CONTRACT_ADDRESS));
68
68
  const emittedLength = contractClassLogFields.length;
69
- const log = ContractClassLogFields.fromEmittedFields(contractClassLogFields);
69
+ const logFields = ContractClassLogFields.fromEmittedFields(contractClassLogFields);
70
70
  const contractClassLogHash = LogHash.from({
71
- value: await log.hash(),
71
+ value: await logFields.hash(),
72
72
  length: emittedLength
73
73
  }).scope(contractAddress);
74
74
  const accumulatedData = tx.data.forPublic ? tx.data.forPublic.revertibleAccumulatedData : tx.data.forRollup.end;
@@ -78,7 +78,7 @@ export async function addNewContractClassToTx(tx, contractClass, skipNullifierIn
78
78
  }
79
79
  const nextLogIndex = countAccumulatedItems(accumulatedData.contractClassLogsHashes);
80
80
  accumulatedData.contractClassLogsHashes[nextLogIndex] = contractClassLogHash;
81
- tx.contractClassLogs.push(log);
81
+ tx.contractClassLogFields.push(logFields);
82
82
  }
83
83
  export async function addNewContractInstanceToTx(tx, contractInstance, skipNullifierInsertion = false) {
84
84
  // can't use publicKeys.toFields() because it includes isInfinite which
@@ -40,6 +40,8 @@ export declare class HintingMerkleWriteOperations implements MerkleTreeWriteOper
40
40
  sequentialInsert<TreeHeight extends number, ID extends IndexedTreeId>(treeId: ID, leaves: Buffer[]): Promise<SequentialInsertionResult<TreeHeight>>;
41
41
  appendLeaves<ID extends MerkleTreeId>(treeId: ID, leaves: MerkleTreeLeafType<ID>[]): Promise<void>;
42
42
  createCheckpoint(): Promise<void>;
43
+ commitAllCheckpoints(): Promise<void>;
44
+ revertAllCheckpoints(): Promise<void>;
43
45
  commitCheckpoint(): Promise<void>;
44
46
  revertCheckpoint(): Promise<void>;
45
47
  private getHintKey;
@@ -54,6 +56,7 @@ export declare class HintingMerkleWriteOperations implements MerkleTreeWriteOper
54
56
  batchInsert<TreeHeight extends number, SubtreeSiblingPathHeight extends number, ID extends IndexedTreeId>(treeId: ID, leaves: Buffer[], subtreeHeight: number): Promise<BatchInsertionResult<TreeHeight, SubtreeSiblingPathHeight>>;
55
57
  close(): Promise<void>;
56
58
  findLeafIndices<ID extends MerkleTreeId>(treeId: ID, values: MerkleTreeLeafType<ID>[]): Promise<(bigint | undefined)[]>;
59
+ findSiblingPaths<ID extends MerkleTreeId, N extends number>(treeId: ID, values: MerkleTreeLeafType<ID>[]): Promise<(SiblingPath<N> | undefined)[]>;
57
60
  findLeafIndicesAfter<ID extends MerkleTreeId>(treeId: ID, values: MerkleTreeLeafType<ID>[], startIndex: bigint): Promise<(bigint | undefined)[]>;
58
61
  getBlockNumbersForLeafIndices<ID extends MerkleTreeId>(treeId: ID, leafIndices: bigint[]): Promise<(bigint | undefined)[]>;
59
62
  }
@@ -1 +1 @@
1
- {"version":3,"file":"hinting_db_sources.d.ts","sourceRoot":"","sources":["../../src/public/hinting_db_sources.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAE9C,OAAO,KAAK,EAAE,uBAAuB,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACpF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,EAOL,KAAK,iBAAiB,EASvB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,mBAAmB,EAAE,2BAA2B,EAAE,MAAM,wBAAwB,CAAC;AAC/F,OAAO,EAEL,KAAK,oBAAoB,EACzB,KAAK,aAAa,EAClB,YAAY,EACZ,KAAK,kBAAkB,EACvB,KAAK,yBAAyB,EAK9B,KAAK,yBAAyB,EAG/B,MAAM,qBAAqB,CAAC;AAK7B,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,oBAAoB,CAAC;AAErE;;GAEG;AACH,qBAAa,wBAAyB,YAAW,0BAA0B;IAEvE,OAAO,CA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AC,EAAE,SAAS,YAAY,EAClD,MAAM,EAAE,EAAE,EACV,MAAM,EAAE,kBAAkB,CAAC,EAAE,CAAC,EAAE,GAC/B,OAAO,CAAC,CAAC,MAAM,GAAG,SAAS,CAAC,EAAE,CAAC;IAIrB,gBAAgB,CAAC,EAAE,SAAS,YAAY,EAAE,CAAC,SAAS,MAAM,EACrE,MAAM,EAAE,EAAE,EACV,MAAM,EAAE,kBAAkB,CAAC,EAAE,CAAC,EAAE,GAC/B,OAAO,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC,EAAE,CAAC;IAI7B,oBAAoB,CAAC,EAAE,SAAS,YAAY,EACvD,MAAM,EAAE,EAAE,EACV,MAAM,EAAE,kBAAkB,CAAC,EAAE,CAAC,EAAE,EAChC,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,CAAC,MAAM,GAAG,SAAS,CAAC,EAAE,CAAC;IAIrB,6BAA6B,CAAC,EAAE,SAAS,YAAY,EAChE,MAAM,EAAE,EAAE,EACV,WAAW,EAAE,MAAM,EAAE,GACpB,OAAO,CAAC,CAAC,MAAM,GAAG,SAAS,CAAC,EAAE,CAAC;CAGnC"}
@@ -182,6 +182,12 @@ import { strict as assert } from 'assert';
182
182
  this.hints.createCheckpointHints.push(new AvmCreateCheckpointHint(actionCounter, oldCheckpointId, newCheckpointId));
183
183
  HintingMerkleWriteOperations.log.trace(`[createCheckpoint:${actionCounter}] Checkpoint evolved ${oldCheckpointId} -> ${newCheckpointId} at trees state ${treesStateHash}.`);
184
184
  }
185
+ commitAllCheckpoints() {
186
+ throw new Error('commitAllCheckpoints is not supported in HintingMerkleWriteOperations.');
187
+ }
188
+ revertAllCheckpoints() {
189
+ throw new Error('revertAllCheckpoints is not supported in HintingMerkleWriteOperations.');
190
+ }
185
191
  async commitCheckpoint() {
186
192
  const actionCounter = this.checkpointActionCounter++;
187
193
  const oldCheckpointId = this.getCurrentCheckpointId();
@@ -272,6 +278,9 @@ import { strict as assert } from 'assert';
272
278
  async findLeafIndices(treeId, values) {
273
279
  return await this.db.findLeafIndices(treeId, values);
274
280
  }
281
+ async findSiblingPaths(treeId, values) {
282
+ return await this.db.findSiblingPaths(treeId, values);
283
+ }
275
284
  async findLeafIndicesAfter(treeId, values, startIndex) {
276
285
  return await this.db.findLeafIndicesAfter(treeId, values, startIndex);
277
286
  }
@@ -1,5 +1,6 @@
1
1
  export { PublicContractsDB } from './public_db_sources.js';
2
- export { type PublicTxResult, PublicTxSimulator, TelemetryPublicTxSimulator } from './public_tx_simulator/index.js';
2
+ export { GuardedMerkleTreeOperations } from './public_processor/guarded_merkle_tree.js';
3
3
  export { PublicProcessor, PublicProcessorFactory } from './public_processor/public_processor.js';
4
+ export { PublicTxSimulator, TelemetryPublicTxSimulator, type PublicTxResult } from './public_tx_simulator/index.js';
4
5
  export { getCallRequestsWithCalldataByPhase } from './utils.js';
5
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/public/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,KAAK,cAAc,EAAE,iBAAiB,EAAE,0BAA0B,EAAE,MAAM,gCAAgC,CAAC;AACpH,OAAO,EAAE,eAAe,EAAE,sBAAsB,EAAE,MAAM,wCAAwC,CAAC;AACjG,OAAO,EAAE,kCAAkC,EAAE,MAAM,YAAY,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/public/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,2BAA2B,EAAE,MAAM,2CAA2C,CAAC;AACxF,OAAO,EAAE,eAAe,EAAE,sBAAsB,EAAE,MAAM,wCAAwC,CAAC;AACjG,OAAO,EAAE,iBAAiB,EAAE,0BAA0B,EAAE,KAAK,cAAc,EAAE,MAAM,gCAAgC,CAAC;AACpH,OAAO,EAAE,kCAAkC,EAAE,MAAM,YAAY,CAAC"}
@@ -1,4 +1,5 @@
1
1
  export { PublicContractsDB } from './public_db_sources.js';
2
- export { PublicTxSimulator, TelemetryPublicTxSimulator } from './public_tx_simulator/index.js';
2
+ export { GuardedMerkleTreeOperations } from './public_processor/guarded_merkle_tree.js';
3
3
  export { PublicProcessor, PublicProcessorFactory } from './public_processor/public_processor.js';
4
+ export { PublicTxSimulator, TelemetryPublicTxSimulator } from './public_tx_simulator/index.js';
4
5
  export { getCallRequestsWithCalldataByPhase } from './utils.js';
@@ -1 +1 @@
1
- {"version":3,"file":"public_db_sources.d.ts","sourceRoot":"","sources":["../../src/public/public_db_sources.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAK9C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAE1D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EACL,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,EACvB,KAAK,2BAA2B,EAEjC,MAAM,wBAAwB,CAAC;AAEhC,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,iCAAiC,CAAC;AAGjF,OAAO,EACL,YAAY,EAKb,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,EAAE,MAAM,kBAAkB,CAAC;AAE1D,OAAO,KAAK,EAAE,0BAA0B,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAG7F;;;;;GAKG;AACH,qBAAa,iBAAkB,YAAW,0BAA0B;IAgBtD,OAAO,CAAC,UAAU;IAR9B,OAAO,CAAC,2BAA2B,CAAyB;IAC5D,OAAO,CAAC,wBAAwB,CAAyB;IACzD,OAAO,CAAC,UAAU,CAAyB;IAE3C,OAAO,CAAC,uBAAuB,CAAyB;IAExD,OAAO,CAAC,GAAG,CAA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AAED;;;;;;;;;;;GAWG;AACH,qBAAa,aAAc,YAAW,sBAAsB;IAG9C,OAAO,CAAC,QAAQ,CAAC,EAAE;IAF/B,OAAO,CAAC,MAAM,CAA6C;gBAE9B,EAAE,EAAE,yBAAyB;IAE7C,WAAW,CAAC,QAAQ,EAAE,YAAY,EAAE,IAAI,EAAE,EAAE,GAAG,OAAO,CAAC,EAAE,CAAC;IA2B1D,YAAY,CAAC,QAAQ,EAAE,YAAY,EAAE,IAAI,EAAE,EAAE,EAAE,QAAQ,EAAE,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAa3E,kBAAkB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,EAAE,GAAG,SAAS,CAAC;IAc9D,WAAW,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,EAAE,GAAG,SAAS,CAAC;IAcvD,aAAa,CAAC,QAAQ,EAAE,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAW1C,oBAAoB,CAAC,SAAS,EAAE,EAAE,GAAG,OAAO,CAAC,OAAO,CAAC;IAoBrD,cAAc,CAAC,eAAe,EAAE,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAWlD,OAAO,CAAC,MAAM,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAmCpE,gBAAgB,IAAI,OAAO,CAAC,IAAI,CAAC;IAIjC,gBAAgB,IAAI,OAAO,CAAC,IAAI,CAAC;IAIjC,gBAAgB,IAAI,OAAO,CAAC,IAAI,CAAC;IAIjC,gBAAgB,IAAI,OAAO,CAAC,aAAa,CAAC;CASxD"}
@@ -66,7 +66,7 @@ import { TxContractCache } from './tx_contract_cache.js';
66
66
  * For private-only txs, this will be all contract classes (found in tx.data.forPublic)
67
67
  * @param tx - The transaction to add non-revertible contract classes from.
68
68
  */ async addNonRevertibleContractClasses(tx) {
69
- const siloedContractClassLogs = tx.data.forPublic ? await tx.filterContractClassLogs(tx.data.forPublic.nonRevertibleAccumulatedData.contractClassLogsHashes, /*siloed=*/ true) : await tx.filterContractClassLogs(tx.data.forRollup.end.contractClassLogsHashes, /*siloed=*/ true);
69
+ const siloedContractClassLogs = tx.data.forPublic ? tx.getSplitContractClassLogs(false) : tx.getContractClassLogs();
70
70
  await this.addContractClassesFromLogs(siloedContractClassLogs, this.currentTxNonRevertibleCache, 'non-revertible');
71
71
  }
72
72
  /**
@@ -74,7 +74,7 @@ import { TxContractCache } from './tx_contract_cache.js';
74
74
  * None for private-only txs.
75
75
  * @param tx - The transaction to add revertible contract classes from.
76
76
  */ async addRevertibleContractClasses(tx) {
77
- const siloedContractClassLogs = tx.data.forPublic ? await tx.filterContractClassLogs(tx.data.forPublic.revertibleAccumulatedData.contractClassLogsHashes, /*siloed=*/ true) : [];
77
+ const siloedContractClassLogs = tx.data.forPublic ? tx.getSplitContractClassLogs(true) : [];
78
78
  await this.addContractClassesFromLogs(siloedContractClassLogs, this.currentTxRevertibleCache, 'revertible');
79
79
  }
80
80
  /**
@@ -0,0 +1,44 @@
1
+ import type { IndexedTreeLeafPreimage, SiblingPath } from '@aztec/foundation/trees';
2
+ import type { BatchInsertionResult, IndexedTreeId, MerkleTreeId, MerkleTreeLeafType, MerkleTreeWriteOperations, SequentialInsertionResult, TreeInfo } from '@aztec/stdlib/trees';
3
+ import type { BlockHeader, StateReference } from '@aztec/stdlib/tx';
4
+ /**
5
+ * Wraps an instance of `MerkleTreeWriteOperations` to allow the sequencer to gate access.
6
+ * If transactions execution goes past the deadline, the simulator will continue to execute and update the world state
7
+ * The public processor however requires that the world state remain constant after the deadline in order to finalise the block
8
+ * The public processor provides this implementation of MerkleTreeWriteOperations to the simulator
9
+ */
10
+ export declare class GuardedMerkleTreeOperations implements MerkleTreeWriteOperations {
11
+ private target;
12
+ private isStopped;
13
+ private serialQueue;
14
+ constructor(target: MerkleTreeWriteOperations);
15
+ private guard;
16
+ private guardAndPush;
17
+ getUnderlyingFork(): MerkleTreeWriteOperations;
18
+ stop(): Promise<void>;
19
+ appendLeaves<ID extends MerkleTreeId>(treeId: ID, leaves: MerkleTreeLeafType<ID>[]): Promise<void>;
20
+ updateArchive(header: BlockHeader): Promise<void>;
21
+ batchInsert<TreeHeight extends number, SubtreeSiblingPathHeight extends number, ID extends IndexedTreeId>(treeId: ID, leaves: Buffer[], subtreeHeight: number): Promise<BatchInsertionResult<TreeHeight, SubtreeSiblingPathHeight>>;
22
+ sequentialInsert<TreeHeight extends number, ID extends IndexedTreeId>(treeId: ID, leaves: Buffer[]): Promise<SequentialInsertionResult<TreeHeight>>;
23
+ close(): Promise<void>;
24
+ getTreeInfo(treeId: MerkleTreeId): Promise<TreeInfo>;
25
+ getStateReference(): Promise<StateReference>;
26
+ getInitialHeader(): BlockHeader;
27
+ getSiblingPath<N extends number>(treeId: MerkleTreeId, index: bigint): Promise<SiblingPath<N>>;
28
+ getPreviousValueIndex<ID extends IndexedTreeId>(treeId: ID, value: bigint): Promise<{
29
+ index: bigint;
30
+ alreadyPresent: boolean;
31
+ } | undefined>;
32
+ getLeafPreimage<ID extends IndexedTreeId>(treeId: ID, index: bigint): Promise<IndexedTreeLeafPreimage | undefined>;
33
+ findLeafIndices<ID extends MerkleTreeId>(treeId: ID, values: MerkleTreeLeafType<ID>[]): Promise<(bigint | undefined)[]>;
34
+ findLeafIndicesAfter<ID extends MerkleTreeId>(treeId: ID, values: MerkleTreeLeafType<ID>[], startIndex: bigint): Promise<(bigint | undefined)[]>;
35
+ getLeafValue<ID extends MerkleTreeId>(treeId: ID, index: bigint): Promise<MerkleTreeLeafType<typeof treeId> | undefined>;
36
+ getBlockNumbersForLeafIndices<ID extends MerkleTreeId>(treeId: ID, leafIndices: bigint[]): Promise<(bigint | undefined)[]>;
37
+ createCheckpoint(): Promise<void>;
38
+ commitCheckpoint(): Promise<void>;
39
+ revertCheckpoint(): Promise<void>;
40
+ commitAllCheckpoints(): Promise<void>;
41
+ revertAllCheckpoints(): Promise<void>;
42
+ findSiblingPaths<ID extends MerkleTreeId, N extends number>(treeId: ID, values: MerkleTreeLeafType<ID>[]): Promise<(SiblingPath<N> | undefined)[]>;
43
+ }
44
+ //# sourceMappingURL=guarded_merkle_tree.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"guarded_merkle_tree.d.ts","sourceRoot":"","sources":["../../../src/public/public_processor/guarded_merkle_tree.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,uBAAuB,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACpF,OAAO,KAAK,EACV,oBAAoB,EACpB,aAAa,EACb,YAAY,EACZ,kBAAkB,EAClB,yBAAyB,EACzB,yBAAyB,EACzB,QAAQ,EACT,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAEpE;;;;;GAKG;AAEH,qBAAa,2BAA4B,YAAW,yBAAyB;IAI/D,OAAO,CAAC,MAAM;IAH1B,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,WAAW,CAAqB;gBAEpB,MAAM,EAAE,yBAAyB;IAIrD,OAAO,CAAC,KAAK;IAOb,OAAO,CAAC,YAAY;IAQb,iBAAiB,IAAI,yBAAyB;IAK/C,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAS3B,YAAY,CAAC,EAAE,SAAS,YAAY,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,kBAAkB,CAAC,EAAE,CAAC,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAIlG,aAAa,CAAC,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;IAGjD,WAAW,CAAC,UAAU,SAAS,MAAM,EAAE,wBAAwB,SAAS,MAAM,EAAE,EAAE,SAAS,aAAa,EACtG,MAAM,EAAE,EAAE,EACV,MAAM,EAAE,MAAM,EAAE,EAChB,aAAa,EAAE,MAAM,GACpB,OAAO,CAAC,oBAAoB,CAAC,UAAU,EAAE,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,EAClC,MAAM,EAAE,EAAE,EACV,KAAK,EAAE,MAAM,GACZ,OAAO,CAAC,kBAAkB,CAAC,OAAO,MAAM,CAAC,GAAG,SAAS,CAAC;IAGzD,6BAA6B,CAAC,EAAE,SAAS,YAAY,EACnD,MAAM,EAAE,EAAE,EACV,WAAW,EAAE,MAAM,EAAE,GACpB,OAAO,CAAC,CAAC,MAAM,GAAG,SAAS,CAAC,EAAE,CAAC;IAGlC,gBAAgB,IAAI,OAAO,CAAC,IAAI,CAAC;IAGjC,gBAAgB,IAAI,OAAO,CAAC,IAAI,CAAC;IAGjC,gBAAgB,IAAI,OAAO,CAAC,IAAI,CAAC;IAGjC,oBAAoB,IAAI,OAAO,CAAC,IAAI,CAAC;IAGrC,oBAAoB,IAAI,OAAO,CAAC,IAAI,CAAC;IAGrC,gBAAgB,CAAC,EAAE,SAAS,YAAY,EAAE,CAAC,SAAS,MAAM,EACxD,MAAM,EAAE,EAAE,EACV,MAAM,EAAE,kBAAkB,CAAC,EAAE,CAAC,EAAE,GAC/B,OAAO,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC,EAAE,CAAC;CAG3C"}
@@ -0,0 +1,105 @@
1
+ import { SerialQueue } from '@aztec/foundation/queue';
2
+ /**
3
+ * Wraps an instance of `MerkleTreeWriteOperations` to allow the sequencer to gate access.
4
+ * If transactions execution goes past the deadline, the simulator will continue to execute and update the world state
5
+ * The public processor however requires that the world state remain constant after the deadline in order to finalise the block
6
+ * The public processor provides this implementation of MerkleTreeWriteOperations to the simulator
7
+ */ export class GuardedMerkleTreeOperations {
8
+ target;
9
+ isStopped;
10
+ serialQueue;
11
+ constructor(target){
12
+ this.target = target;
13
+ this.isStopped = false;
14
+ this.serialQueue = new SerialQueue();
15
+ this.serialQueue.start();
16
+ }
17
+ guard() {
18
+ if (this.isStopped) {
19
+ throw new Error('Merkle tree access has been stopped');
20
+ }
21
+ }
22
+ // Executes the provided function only if the guard is not stopped.
23
+ guardAndPush(fn) {
24
+ this.guard();
25
+ return this.serialQueue.put(()=>{
26
+ this.guard();
27
+ return fn();
28
+ });
29
+ }
30
+ getUnderlyingFork() {
31
+ return this.target;
32
+ }
33
+ // Stops all further access to the merkle trees via this object
34
+ async stop() {
35
+ await this.serialQueue.put(()=>{
36
+ this.isStopped = true;
37
+ return Promise.resolve();
38
+ });
39
+ return this.serialQueue.end();
40
+ }
41
+ // Proxy all methods to the target
42
+ appendLeaves(treeId, leaves) {
43
+ return this.guardAndPush(()=>this.target.appendLeaves(treeId, leaves));
44
+ }
45
+ updateArchive(header) {
46
+ return this.guardAndPush(()=>this.target.updateArchive(header));
47
+ }
48
+ batchInsert(treeId, leaves, subtreeHeight) {
49
+ return this.guardAndPush(()=>this.target.batchInsert(treeId, leaves, subtreeHeight));
50
+ }
51
+ sequentialInsert(treeId, leaves) {
52
+ return this.guardAndPush(()=>this.target.sequentialInsert(treeId, leaves));
53
+ }
54
+ close() {
55
+ return this.guardAndPush(()=>this.target.close());
56
+ }
57
+ getTreeInfo(treeId) {
58
+ return this.guardAndPush(()=>this.target.getTreeInfo(treeId));
59
+ }
60
+ getStateReference() {
61
+ return this.guardAndPush(()=>this.target.getStateReference());
62
+ }
63
+ getInitialHeader() {
64
+ return this.target.getInitialHeader();
65
+ }
66
+ getSiblingPath(treeId, index) {
67
+ return this.guardAndPush(()=>this.target.getSiblingPath(treeId, index));
68
+ }
69
+ getPreviousValueIndex(treeId, value) {
70
+ return this.guardAndPush(()=>this.target.getPreviousValueIndex(treeId, value));
71
+ }
72
+ getLeafPreimage(treeId, index) {
73
+ return this.guardAndPush(()=>this.target.getLeafPreimage(treeId, index));
74
+ }
75
+ findLeafIndices(treeId, values) {
76
+ return this.guardAndPush(()=>this.target.findLeafIndices(treeId, values));
77
+ }
78
+ findLeafIndicesAfter(treeId, values, startIndex) {
79
+ return this.guardAndPush(()=>this.target.findLeafIndicesAfter(treeId, values, startIndex));
80
+ }
81
+ getLeafValue(treeId, index) {
82
+ return this.guardAndPush(()=>this.target.getLeafValue(treeId, index));
83
+ }
84
+ getBlockNumbersForLeafIndices(treeId, leafIndices) {
85
+ return this.guardAndPush(()=>this.target.getBlockNumbersForLeafIndices(treeId, leafIndices));
86
+ }
87
+ createCheckpoint() {
88
+ return this.guardAndPush(()=>this.target.createCheckpoint());
89
+ }
90
+ commitCheckpoint() {
91
+ return this.guardAndPush(()=>this.target.commitCheckpoint());
92
+ }
93
+ revertCheckpoint() {
94
+ return this.guardAndPush(()=>this.target.revertCheckpoint());
95
+ }
96
+ commitAllCheckpoints() {
97
+ return this.guardAndPush(()=>this.target.commitAllCheckpoints());
98
+ }
99
+ revertAllCheckpoints() {
100
+ return this.guardAndPush(()=>this.target.revertAllCheckpoints());
101
+ }
102
+ findSiblingPaths(treeId, values) {
103
+ return this.guardAndPush(()=>this.target.findSiblingPaths(treeId, values));
104
+ }
105
+ }
@@ -1,11 +1,11 @@
1
1
  import { DateProvider } from '@aztec/foundation/timer';
2
2
  import type { ContractDataSource } from '@aztec/stdlib/contract';
3
- import { Gas } from '@aztec/stdlib/gas';
4
- import type { MerkleTreeWriteOperations } from '@aztec/stdlib/interfaces/server';
5
- import { type FailedTx, GlobalVariables, NestedProcessReturnValues, type ProcessedTx, Tx, type TxValidator } from '@aztec/stdlib/tx';
3
+ import type { MerkleTreeWriteOperations, PublicProcessorLimits, PublicProcessorValidator } from '@aztec/stdlib/interfaces/server';
4
+ import { type FailedTx, GlobalVariables, NestedProcessReturnValues, type ProcessedTx, Tx } from '@aztec/stdlib/tx';
6
5
  import { type TelemetryClient, type Traceable, type Tracer } from '@aztec/telemetry-client';
7
6
  import { PublicContractsDB } from '../public_db_sources.js';
8
7
  import { type PublicTxSimulator } from '../public_tx_simulator/index.js';
8
+ import { GuardedMerkleTreeOperations } from './guarded_merkle_tree.js';
9
9
  /**
10
10
  * Creates new instances of PublicProcessor given the provided merkle tree db and contract data source.
11
11
  */
@@ -30,13 +30,13 @@ export declare class PublicProcessorFactory {
30
30
  */
31
31
  export declare class PublicProcessor implements Traceable {
32
32
  protected globalVariables: GlobalVariables;
33
- private merkleTree;
33
+ private guardedMerkleTree;
34
34
  protected contractsDB: PublicContractsDB;
35
35
  protected publicTxSimulator: PublicTxSimulator;
36
36
  private dateProvider;
37
37
  private log;
38
38
  private metrics;
39
- constructor(globalVariables: GlobalVariables, merkleTree: MerkleTreeWriteOperations, contractsDB: PublicContractsDB, publicTxSimulator: PublicTxSimulator, dateProvider: DateProvider, telemetryClient?: TelemetryClient, log?: import("@aztec/foundation/log").Logger);
39
+ constructor(globalVariables: GlobalVariables, guardedMerkleTree: GuardedMerkleTreeOperations, contractsDB: PublicContractsDB, publicTxSimulator: PublicTxSimulator, dateProvider: DateProvider, telemetryClient?: TelemetryClient, log?: import("@aztec/foundation/log").Logger);
40
40
  get tracer(): Tracer;
41
41
  /**
42
42
  * Run each tx through the public circuit and the public kernel circuit if needed.
@@ -45,17 +45,7 @@ export declare class PublicProcessor implements Traceable {
45
45
  * @param validator - Pre-process validator and nullifier cache to use for processing the txs.
46
46
  * @returns The list of processed txs with their circuit simulation outputs.
47
47
  */
48
- process(txs: Iterable<Tx> | AsyncIterable<Tx>, limits?: {
49
- maxTransactions?: number;
50
- maxBlockSize?: number;
51
- maxBlockGas?: Gas;
52
- deadline?: Date;
53
- }, validator?: {
54
- preprocessValidator?: TxValidator<Tx>;
55
- nullifierCache?: {
56
- addNullifiers: (nullifiers: Buffer[]) => void;
57
- };
58
- }): Promise<[ProcessedTx[], FailedTx[], Tx[], NestedProcessReturnValues[]]>;
48
+ process(txs: Iterable<Tx> | AsyncIterable<Tx>, limits?: PublicProcessorLimits, validator?: PublicProcessorValidator): Promise<[ProcessedTx[], FailedTx[], Tx[], NestedProcessReturnValues[]]>;
59
49
  private processTx;
60
50
  private doTreeInsertionsForPrivateOnlyTx;
61
51
  /** Processes the given tx within deadline. Returns timeout if deadline is hit. */
@@ -1 +1 @@
1
- {"version":3,"file":"public_processor.d.ts","sourceRoot":"","sources":["../../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,EAAE,eAAe;IAC1C,OAAO,CAAC,UAAU;IAClB,SAAS,CAAC,WAAW,EAAE,iBAAiB;IACxC,SAAS,CAAC,iBAAiB,EAAE,iBAAiB;IAC9C,OAAO,CAAC,YAAY;IAEpB,OAAO,CAAC,GAAG;IATb,OAAO,CAAC,OAAO,CAAyB;gBAG5B,eAAe,EAAE,eAAe,EAClC,UAAU,EAAE,yBAAyB,EACnC,WAAW,EAAE,iBAAiB,EAC9B,iBAAiB,EAAE,iBAAiB,EACtC,YAAY,EAAE,YAAY,EAClC,eAAe,GAAE,eAAsC,EAC/C,GAAG,yCAA6C;IAK1D,IAAI,MAAM,IAAI,MAAM,CAEnB;IAED;;;;;;OAMG;IACU,OAAO,CAClB,GAAG,EAAE,QAAQ,CAAC,EAAE,CAAC,GAAG,aAAa,CAAC,EAAE,CAAC,EACrC,MAAM,GAAE;QACN,eAAe,CAAC,EAAE,MAAM,CAAC;QACzB,YAAY,CAAC,EAAE,MAAM,CAAC;QACtB,WAAW,CAAC,EAAE,GAAG,CAAC;QAClB,QAAQ,CAAC,EAAE,IAAI,CAAC;KACZ,EACN,SAAS,GAAE;QACT,mBAAmB,CAAC,EAAE,WAAW,CAAC,EAAE,CAAC,CAAC;QACtC,cAAc,CAAC,EAAE;YAAE,aAAa,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,KAAK,IAAI,CAAA;SAAE,CAAC;KAC/D,GACL,OAAO,CAAC,CAAC,WAAW,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,EAAE,EAAE,yBAAyB,EAAE,CAAC,CAAC;YA8I5D,SAAS;YA2BT,gCAAgC;IAoC9C,kFAAkF;YACpE,uBAAuB;IA+BrC;;;;OAIG;YACW,gCAAgC;YA0BhC,oBAAoB;YAsCpB,wBAAwB;CA8CvC"}
1
+ {"version":3,"file":"public_processor.d.ts","sourceRoot":"","sources":["../../../src/public/public_processor/public_processor.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,YAAY,EAAkC,MAAM,y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W,EAAE,iBAAiB;IACxC,SAAS,CAAC,iBAAiB,EAAE,iBAAiB;IAC9C,OAAO,CAAC,YAAY;IAEpB,OAAO,CAAC,GAAG;IATb,OAAO,CAAC,OAAO,CAAyB;gBAG5B,eAAe,EAAE,eAAe,EAClC,iBAAiB,EAAE,2BAA2B,EAC5C,WAAW,EAAE,iBAAiB,EAC9B,iBAAiB,EAAE,iBAAiB,EACtC,YAAY,EAAE,YAAY,EAClC,eAAe,GAAE,eAAsC,EAC/C,GAAG,yCAA6C;IAK1D,IAAI,MAAM,IAAI,MAAM,CAEnB;IAED;;;;;;OAMG;IACU,OAAO,CAClB,GAAG,EAAE,QAAQ,CAAC,EAAE,CAAC,GAAG,aAAa,CAAC,EAAE,CAAC,EACrC,MAAM,GAAE,qBAA0B,EAClC,SAAS,GAAE,wBAA6B,GACvC,OAAO,CAAC,CAAC,WAAW,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,EAAE,EAAE,yBAAyB,EAAE,CAAC,CAAC;YAkK5D,SAAS;YA2BT,gCAAgC;IAoC9C,kFAAkF;YACpE,uBAAuB;IA+BrC;;;;OAIG;YACW,gCAAgC;YA0BhC,oBAAoB;YAkCpB,wBAAwB;CA4CvC"}
@@ -20,6 +20,7 @@ import { Attributes, getTelemetryClient, trackSpan } from '@aztec/telemetry-clie
20
20
  import { ForkCheckpoint } from '@aztec/world-state/native';
21
21
  import { PublicContractsDB, PublicTreesDB } from '../public_db_sources.js';
22
22
  import { TelemetryPublicTxSimulator } from '../public_tx_simulator/index.js';
23
+ import { GuardedMerkleTreeOperations } from './guarded_merkle_tree.js';
23
24
  import { PublicProcessorMetrics } from './public_processor_metrics.js';
24
25
  /**
25
26
  * Creates new instances of PublicProcessor given the provided merkle tree db and contract data source.
@@ -40,8 +41,9 @@ import { PublicProcessorMetrics } from './public_processor_metrics.js';
40
41
  * @returns A new instance of a PublicProcessor.
41
42
  */ create(merkleTree, globalVariables, skipFeeEnforcement, clientInitiatedSimulation = false) {
42
43
  const contractsDB = new PublicContractsDB(this.contractDataSource);
43
- const publicTxSimulator = this.createPublicTxSimulator(merkleTree, contractsDB, globalVariables, /*doMerkleOperations=*/ true, skipFeeEnforcement, clientInitiatedSimulation);
44
- return new PublicProcessor(globalVariables, merkleTree, contractsDB, publicTxSimulator, this.dateProvider, this.telemetryClient);
44
+ const guardedFork = new GuardedMerkleTreeOperations(merkleTree);
45
+ const publicTxSimulator = this.createPublicTxSimulator(guardedFork, contractsDB, globalVariables, /*doMerkleOperations=*/ true, skipFeeEnforcement, clientInitiatedSimulation);
46
+ return new PublicProcessor(globalVariables, guardedFork, contractsDB, publicTxSimulator, this.dateProvider, this.telemetryClient);
45
47
  }
46
48
  createPublicTxSimulator(merkleTree, contractsDB, globalVariables, doMerkleOperations, skipFeeEnforcement, clientInitiatedSimulation) {
47
49
  return new TelemetryPublicTxSimulator(merkleTree, contractsDB, globalVariables, doMerkleOperations, skipFeeEnforcement, clientInitiatedSimulation, this.telemetryClient);
@@ -58,15 +60,15 @@ class PublicProcessorTimeoutError extends Error {
58
60
  * any public function calls in them. Txs with private calls only are unaffected.
59
61
  */ export class PublicProcessor {
60
62
  globalVariables;
61
- merkleTree;
63
+ guardedMerkleTree;
62
64
  contractsDB;
63
65
  publicTxSimulator;
64
66
  dateProvider;
65
67
  log;
66
68
  metrics;
67
- constructor(globalVariables, merkleTree, contractsDB, publicTxSimulator, dateProvider, telemetryClient = getTelemetryClient(), log = createLogger('simulator:public-processor')){
69
+ constructor(globalVariables, guardedMerkleTree, contractsDB, publicTxSimulator, dateProvider, telemetryClient = getTelemetryClient(), log = createLogger('simulator:public-processor')){
68
70
  this.globalVariables = globalVariables;
69
- this.merkleTree = merkleTree;
71
+ this.guardedMerkleTree = guardedMerkleTree;
70
72
  this.contractsDB = contractsDB;
71
73
  this.publicTxSimulator = publicTxSimulator;
72
74
  this.dateProvider = dateProvider;
@@ -154,7 +156,9 @@ class PublicProcessorTimeoutError extends Error {
154
156
  // We checkpoint the transaction here, then within the try/catch we
155
157
  // 1. Revert the checkpoint if the tx fails or needs to be discarded for any reason
156
158
  // 2. Commit the transaction in the finally block. Note that by using the ForkCheckpoint lifecycle only the first commit/revert takes effect
157
- const checkpoint = await ForkCheckpoint.new(this.merkleTree);
159
+ // By doing this, every transaction starts on a fresh checkpoint and it's state updates only make it to the fork if this checkpoint is committed.
160
+ // Note: We use the underlying fork here not the guarded one, this ensures that it's not impacted by stopping the guarded version
161
+ const checkpoint = await ForkCheckpoint.new(this.guardedMerkleTree.getUnderlyingFork());
158
162
  try {
159
163
  const [processedTx, returnValues] = await this.processTx(tx, deadline);
160
164
  // If the actual size of this tx would exceed block size, skip it
@@ -180,12 +184,25 @@ class PublicProcessorTimeoutError extends Error {
180
184
  totalBlockGas = totalBlockGas.add(processedTx.gasUsed.totalGas);
181
185
  totalSizeInBytes += txSize;
182
186
  } catch (err) {
183
- // Roll back state to start of TX before proceeding to next TX
184
- await checkpoint.revert();
185
187
  if (err?.name === 'PublicProcessorTimeoutError') {
186
188
  this.log.warn(`Stopping tx processing due to timeout.`);
189
+ // We hit the transaction execution deadline.
190
+ // There may still be a transaction executing. We stop the guarded fork to prevent any further access to the world state.
191
+ await this.guardedMerkleTree.stop();
192
+ // We now know there can't be any further access to world state. The fork is in a state where there is:
193
+ // 1. At least one outstanding checkpoint that has not been committed (the one created before we processed the tx).
194
+ // 2. Possible state updates on that checkpoint or any others created during execution.
195
+ // First we revert a checkpoint as managed by the ForkCheckpoint. This will revert whatever is the current checkpoint
196
+ // which may not be the one originally created by this object. But that is ok, we do this to fulfil the ForkCheckpoint
197
+ // lifecycle expectations and ensure it doesn't attempt to commit later on.
198
+ await checkpoint.revert();
199
+ // Now we want to revert any/all remaining checkpoints, destroying any outstanding state updates.
200
+ // This needs to be done directly on the underlying fork as the guarded fork has been stopped.
201
+ await this.guardedMerkleTree.getUnderlyingFork().revertAllCheckpoints();
187
202
  break;
188
203
  }
204
+ // Roll back state to start of TX before proceeding to next TX
205
+ await checkpoint.revert();
189
206
  const errorMessage = err instanceof Error ? err.message : 'Unknown error';
190
207
  this.log.warn(`Failed to process tx ${txHash.toString()}: ${errorMessage} ${err?.stack}`);
191
208
  failed.push({
@@ -194,7 +211,7 @@ class PublicProcessorTimeoutError extends Error {
194
211
  });
195
212
  returns.push(new NestedProcessReturnValues([]));
196
213
  } finally{
197
- // Base case is we always commit the checkpoint. Using the ForkCheckpoint means this has no effect if the tx was reverted
214
+ // Base case is we always commit the checkpoint. Using the ForkCheckpoint means this has no effect if the tx was previously reverted
198
215
  await checkpoint.commit();
199
216
  // The tx-level contracts cache should not live on to the next tx
200
217
  this.contractsDB.clearContractsForTx();
@@ -247,9 +264,9 @@ class PublicProcessorTimeoutError extends Error {
247
264
  // b) always had a txHandler with the same db passed to it as this.db, which updated the db in buildBaseRollupHints in this loop
248
265
  // To see how this ^ happens, move back to one shared db in test_context and run orchestrator_multi_public_functions.test.ts
249
266
  // The below is taken from buildBaseRollupHints:
250
- await this.merkleTree.appendLeaves(MerkleTreeId.NOTE_HASH_TREE, padArrayEnd(processedTx.txEffect.noteHashes, Fr.ZERO, MAX_NOTE_HASHES_PER_TX));
267
+ await this.guardedMerkleTree.appendLeaves(MerkleTreeId.NOTE_HASH_TREE, padArrayEnd(processedTx.txEffect.noteHashes, Fr.ZERO, MAX_NOTE_HASHES_PER_TX));
251
268
  try {
252
- await this.merkleTree.batchInsert(MerkleTreeId.NULLIFIER_TREE, padArrayEnd(processedTx.txEffect.nullifiers, Fr.ZERO, MAX_NULLIFIERS_PER_TX).map((n)=>n.toBuffer()), NULLIFIER_SUBTREE_HEIGHT);
269
+ await this.guardedMerkleTree.batchInsert(MerkleTreeId.NULLIFIER_TREE, padArrayEnd(processedTx.txEffect.nullifiers, Fr.ZERO, MAX_NULLIFIERS_PER_TX).map((n)=>n.toBuffer()), NULLIFIER_SUBTREE_HEIGHT);
253
270
  } catch {
254
271
  if (txValidator) {
255
272
  // Ideally the validator has already caught this above, but just in case:
@@ -288,7 +305,7 @@ class PublicProcessorTimeoutError extends Error {
288
305
  const balanceSlot = await computeFeePayerBalanceStorageSlot(feePayer);
289
306
  const leafSlot = await computeFeePayerBalanceLeafSlot(feePayer);
290
307
  // This high-level db is used as a convenient helper. It could be done with the merkleTree directly.
291
- const treesDB = new PublicTreesDB(this.merkleTree);
308
+ const treesDB = new PublicTreesDB(this.guardedMerkleTree);
292
309
  this.log.debug(`Deducting ${txFee.toBigInt()} balance in Fee Juice for ${feePayer}`);
293
310
  const balance = await treesDB.storageRead(feeJuiceAddress, balanceSlot);
294
311
  if (balance.lt(txFee)) {
@@ -303,8 +320,7 @@ class PublicProcessorTimeoutError extends Error {
303
320
  const transactionFee = tx.data.gasUsed.computeFee(gasFees);
304
321
  const feePaymentPublicDataWrite = await this.performFeePaymentPublicDataWrite(transactionFee, tx.data.feePayer);
305
322
  const processedTx = await makeProcessedTxFromPrivateOnlyTx(tx, transactionFee, feePaymentPublicDataWrite, this.globalVariables);
306
- const siloedContractClassLogs = await tx.filterContractClassLogs(tx.data.getNonEmptyContractClassLogsHashes(), true);
307
- this.metrics.recordClassRegistration(...siloedContractClassLogs.filter((log)=>ContractClassRegisteredEvent.isContractClassRegisteredEvent(log)).map((log)=>ContractClassRegisteredEvent.fromLog(log)));
323
+ this.metrics.recordClassRegistration(...tx.getContractClassLogs().filter((log)=>ContractClassRegisteredEvent.isContractClassRegisteredEvent(log)).map((log)=>ContractClassRegisteredEvent.fromLog(log)));
308
324
  // Fee payment insertion has already been done. Do the rest.
309
325
  await this.doTreeInsertionsForPrivateOnlyTx(processedTx);
310
326
  // Add any contracts registered/deployed in this private-only tx to the block-level cache
@@ -330,8 +346,8 @@ class PublicProcessorTimeoutError extends Error {
330
346
  this.metrics.recordPhaseDuration(phase.phase, phase.durationMs ?? 0);
331
347
  }
332
348
  });
333
- const siloedContractClassLogs = await tx.filterContractClassLogs(tx.data.getNonEmptyContractClassLogsHashes(), true);
334
- this.metrics.recordClassRegistration(...siloedContractClassLogs.filter((log)=>ContractClassRegisteredEvent.isContractClassRegisteredEvent(log)).map((log)=>ContractClassRegisteredEvent.fromLog(log)));
349
+ const contractClassLogs = revertCode.isOK() ? tx.getContractClassLogs() : tx.getSplitContractClassLogs(false);
350
+ this.metrics.recordClassRegistration(...contractClassLogs.filter((log)=>ContractClassRegisteredEvent.isContractClassRegisteredEvent(log)).map((log)=>ContractClassRegisteredEvent.fromLog(log)));
335
351
  const phaseCount = processedPhases.length;
336
352
  const durationMs = timer.ms();
337
353
  this.metrics.recordTx(phaseCount, durationMs, gasUsed.publicGas);
@@ -3,7 +3,7 @@ import { AvmCircuitPublicInputs, RevertCode } from '@aztec/stdlib/avm';
3
3
  import type { AztecAddress } from '@aztec/stdlib/aztec-address';
4
4
  import type { SimulationError } from '@aztec/stdlib/errors';
5
5
  import { Gas } from '@aztec/stdlib/gas';
6
- import { type PrivateToPublicAccumulatedData } from '@aztec/stdlib/kernel';
6
+ import { PrivateToPublicAccumulatedData } from '@aztec/stdlib/kernel';
7
7
  import { type GlobalVariables, PublicCallRequestWithCalldata, type Tx, TxExecutionPhase, type TxHash } from '@aztec/stdlib/tx';
8
8
  import type { PublicContractsDBInterface } from '../db_interfaces.js';
9
9
  import type { PublicTreesDB } from '../public_db_sources.js';
@@ -17,8 +17,10 @@ export declare class PublicTxContext {
17
17
  private readonly startTreeSnapshots;
18
18
  private readonly globalVariables;
19
19
  private readonly gasSettings;
20
+ private readonly clampedGasSettings;
20
21
  private readonly gasUsedByPrivate;
21
22
  private readonly gasAllocatedToPublic;
23
+ private readonly gasAllocatedToPublicTeardown;
22
24
  private readonly setupCallRequests;
23
25
  private readonly appLogicCallRequests;
24
26
  private readonly teardownCallRequests;
@@ -1 +1 @@
1
- {"version":3,"file":"public_tx_context.d.ts","sourceRoot":"","sources":["../../../src/public/public_tx_simulator/public_tx_context.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAE9C,OAAO,EAAsB,sBAAsB,EAA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