@aztec/simulator 0.0.1-commit.9b94fc1 → 0.0.1-commit.d3ec352c

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 (81) hide show
  1. package/dest/public/avm/avm_simulator.d.ts +1 -1
  2. package/dest/public/avm/avm_simulator.d.ts.map +1 -1
  3. package/dest/public/avm/avm_simulator.js +5 -4
  4. package/dest/public/avm/errors.d.ts +7 -1
  5. package/dest/public/avm/errors.d.ts.map +1 -1
  6. package/dest/public/avm/errors.js +14 -2
  7. package/dest/public/avm/fixtures/initializers.js +2 -2
  8. package/dest/public/avm/fixtures/utils.d.ts +3 -2
  9. package/dest/public/avm/fixtures/utils.d.ts.map +1 -1
  10. package/dest/public/avm/fixtures/utils.js +2 -1
  11. package/dest/public/avm/opcodes/addressing_mode.js +2 -2
  12. package/dest/public/avm/opcodes/misc.js +2 -2
  13. package/dest/public/avm/revert_reason.d.ts +1 -1
  14. package/dest/public/avm/revert_reason.d.ts.map +1 -1
  15. package/dest/public/avm/revert_reason.js +3 -2
  16. package/dest/public/avm/serialization/bytecode_serialization.d.ts +1 -1
  17. package/dest/public/avm/serialization/bytecode_serialization.d.ts.map +1 -1
  18. package/dest/public/avm/serialization/bytecode_serialization.js +9 -6
  19. package/dest/public/debug_fn_name.d.ts +14 -1
  20. package/dest/public/debug_fn_name.d.ts.map +1 -1
  21. package/dest/public/debug_fn_name.js +19 -0
  22. package/dest/public/fixtures/public_tx_simulation_tester.d.ts +8 -2
  23. package/dest/public/fixtures/public_tx_simulation_tester.d.ts.map +1 -1
  24. package/dest/public/fixtures/public_tx_simulation_tester.js +14 -5
  25. package/dest/public/fixtures/simple_contract_data_source.d.ts +4 -3
  26. package/dest/public/fixtures/simple_contract_data_source.d.ts.map +1 -1
  27. package/dest/public/fixtures/simple_contract_data_source.js +4 -4
  28. package/dest/public/fixtures/token_test.d.ts +6 -2
  29. package/dest/public/fixtures/token_test.d.ts.map +1 -1
  30. package/dest/public/fixtures/token_test.js +12 -10
  31. package/dest/public/hinting_db_sources.d.ts +3 -2
  32. package/dest/public/hinting_db_sources.d.ts.map +1 -1
  33. package/dest/public/index.d.ts +2 -2
  34. package/dest/public/index.d.ts.map +1 -1
  35. package/dest/public/index.js +1 -1
  36. package/dest/public/public_processor/guarded_merkle_tree.d.ts +3 -2
  37. package/dest/public/public_processor/guarded_merkle_tree.d.ts.map +1 -1
  38. package/dest/public/public_processor/public_processor.d.ts +5 -5
  39. package/dest/public/public_processor/public_processor.d.ts.map +1 -1
  40. package/dest/public/public_processor/public_processor.js +13 -12
  41. package/dest/public/public_tx_simulator/cpp_public_tx_simulator.d.ts +6 -34
  42. package/dest/public/public_tx_simulator/cpp_public_tx_simulator.d.ts.map +1 -1
  43. package/dest/public/public_tx_simulator/cpp_public_tx_simulator.js +22 -139
  44. package/dest/public/public_tx_simulator/cpp_public_tx_simulator_with_hinted_dbs.d.ts +42 -0
  45. package/dest/public/public_tx_simulator/cpp_public_tx_simulator_with_hinted_dbs.d.ts.map +1 -0
  46. package/dest/public/public_tx_simulator/cpp_public_tx_simulator_with_hinted_dbs.js +86 -0
  47. package/dest/public/public_tx_simulator/cpp_vs_ts_public_tx_simulator.d.ts +30 -0
  48. package/dest/public/public_tx_simulator/cpp_vs_ts_public_tx_simulator.d.ts.map +1 -0
  49. package/dest/public/public_tx_simulator/cpp_vs_ts_public_tx_simulator.js +170 -0
  50. package/dest/public/public_tx_simulator/index.d.ts +2 -1
  51. package/dest/public/public_tx_simulator/index.d.ts.map +1 -1
  52. package/dest/public/public_tx_simulator/index.js +1 -0
  53. package/dest/public/public_tx_simulator/public_tx_simulator.d.ts +2 -2
  54. package/dest/public/public_tx_simulator/public_tx_simulator.d.ts.map +1 -1
  55. package/dest/public/public_tx_simulator/public_tx_simulator.js +7 -3
  56. package/dest/public/state_manager/state_manager.d.ts +6 -1
  57. package/dest/public/state_manager/state_manager.d.ts.map +1 -1
  58. package/dest/public/state_manager/state_manager.js +4 -1
  59. package/package.json +18 -18
  60. package/src/public/avm/avm_simulator.ts +7 -4
  61. package/src/public/avm/errors.ts +16 -2
  62. package/src/public/avm/fixtures/initializers.ts +2 -2
  63. package/src/public/avm/fixtures/utils.ts +2 -1
  64. package/src/public/avm/opcodes/addressing_mode.ts +2 -2
  65. package/src/public/avm/opcodes/misc.ts +2 -2
  66. package/src/public/avm/revert_reason.ts +5 -2
  67. package/src/public/avm/serialization/bytecode_serialization.ts +17 -6
  68. package/src/public/debug_fn_name.ts +25 -0
  69. package/src/public/fixtures/public_tx_simulation_tester.ts +29 -7
  70. package/src/public/fixtures/simple_contract_data_source.ts +7 -8
  71. package/src/public/fixtures/token_test.ts +17 -8
  72. package/src/public/hinting_db_sources.ts +2 -1
  73. package/src/public/index.ts +5 -1
  74. package/src/public/public_processor/guarded_merkle_tree.ts +2 -1
  75. package/src/public/public_processor/public_processor.ts +16 -16
  76. package/src/public/public_tx_simulator/cpp_public_tx_simulator.ts +23 -174
  77. package/src/public/public_tx_simulator/cpp_public_tx_simulator_with_hinted_dbs.ts +132 -0
  78. package/src/public/public_tx_simulator/cpp_vs_ts_public_tx_simulator.ts +240 -0
  79. package/src/public/public_tx_simulator/index.ts +1 -0
  80. package/src/public/public_tx_simulator/public_tx_simulator.ts +10 -6
  81. package/src/public/state_manager/state_manager.ts +8 -1
@@ -1,20 +1,18 @@
1
- import { createLogger } from '@aztec/foundation/log';
2
- import { writeTestData } from '@aztec/foundation/testing/files';
3
- import { avmSimulate, avmSimulateWithHintedDbs } from '@aztec/native';
1
+ import { createLogger, logLevel } from '@aztec/foundation/log';
2
+ import { avmSimulate } from '@aztec/native';
4
3
  import { ProtocolContractsList } from '@aztec/protocol-contracts';
5
- import { AvmCircuitInputs, AvmFastSimulationInputs, AvmTxHint, PublicTxResult, deserializeFromMessagePack } from '@aztec/stdlib/avm';
4
+ import { AvmFastSimulationInputs, AvmTxHint, PublicTxResult, deserializeFromMessagePack } from '@aztec/stdlib/avm';
6
5
  import { SimulationError } from '@aztec/stdlib/errors';
7
6
  import { WorldStateRevisionWithHandle } from '@aztec/stdlib/world-state';
7
+ import { getTelemetryClient } from '@aztec/telemetry-client';
8
8
  import { strict as assert } from 'assert';
9
+ import { ExecutorMetrics } from '../executor_metrics.js';
9
10
  import { ContractProviderForCpp } from './contract_provider_for_cpp.js';
10
11
  import { PublicTxSimulator } from './public_tx_simulator.js';
11
12
  /**
12
13
  * C++ implementation of PublicTxSimulator using the C++ simulator.
13
14
  * The C++ simulator accesses the world state directly/natively within C++.
14
15
  * For contract DB accesses, it makes callbacks through NAPI back to the TS PublicContractsDB cache.
15
- *
16
- * TODO(dbanks12): for now this still simulates first in TS to generate hints and public inputs,
17
- * since the C++ simulator doesn't have hinting & PI generation logic yet.
18
16
  */ export class CppPublicTxSimulator extends PublicTxSimulator {
19
17
  log;
20
18
  constructor(merkleTree, contractsDB, globalVariables, config){
@@ -31,35 +29,12 @@ import { PublicTxSimulator } from './public_tx_simulator.js';
31
29
  this.log.debug(`C++ simulation of ${tx.publicFunctionCalldata.length} public calls for tx ${txHash}`, {
32
30
  txHash
33
31
  });
34
- // TODO(dbanks12): remove the first run with TS that hints!
35
- // Run TS simulation to generate hints and public inputs
36
- this.log.debug(`Running TS simulation for tx ${txHash}`);
37
- // create checkpoint for ws
38
- let tsResult;
39
- let tsStateRef;
40
- await this.merkleTree.createCheckpoint();
41
- this.contractsDB.createCheckpoint();
42
- try {
43
- // Run the full TypeScript simulation using the parent class
44
- // This will modify the merkle tree with the transaction's state changes
45
- tsResult = await super.simulate(tx);
46
- this.log.debug(`TS simulation completed for tx ${txHash}`);
47
- tsStateRef = await this.merkleTree.getStateReference(); // capture tree roots for later comparsion
48
- } catch (error) {
49
- this.log.warn(`TS simulation failed, but still continuing with C++ simulation: ${error.message} ${error.stack}`);
50
- } finally{
51
- // revert checkpoint for ws and clear contract db changes
52
- // (cpp should reapply exactly the same changes if there are no bugs)
53
- await this.merkleTree.revertCheckpoint();
54
- this.contractsDB.revertCheckpoint();
55
- }
56
- this.log.debug(`Running C++ simulation for tx ${txHash}`);
57
32
  // Using the "as WorldStateRevisionWithHandle" is a bit of a "trust me bro", hence the assert.
58
33
  let wsRevision = this.merkleTree.getRevision();
59
34
  assert(wsRevision instanceof WorldStateRevisionWithHandle, 'CppPublicTxSimulator a real NativeWorldStateInstance with a handle to the C++ WorldState object');
60
35
  const wsCppHandle = wsRevision.handle;
61
36
  wsRevision = wsRevision.toWorldStateRevision(); // for msgpack serialization, we don't include the handle in the type
62
- this.log.debug(`Running C++ simulation with world state revision ${JSON.stringify(wsRevision)}`);
37
+ this.log.trace(`Running C++ simulation with world state revision ${JSON.stringify(wsRevision)}`);
63
38
  // Create the fast simulation inputs
64
39
  const txHint = AvmTxHint.fromTx(tx, this.globalVariables.gasFees);
65
40
  const protocolContracts = ProtocolContractsList;
@@ -67,49 +42,27 @@ import { PublicTxSimulator } from './public_tx_simulator.js';
67
42
  // Create contract provider for callbacks to TypeScript PublicContractsDB from C++
68
43
  const contractProvider = new ContractProviderForCpp(this.contractsDB, this.globalVariables);
69
44
  // Serialize to msgpack and call the C++ simulator
70
- this.log.verbose(`Serializing fast simulation inputs to msgpack...`);
45
+ this.log.trace(`Serializing fast simulation inputs to msgpack...`);
71
46
  const inputBuffer = fastSimInputs.serializeWithMessagePack();
72
47
  let resultBuffer;
73
48
  try {
74
- this.log.verbose(`Calling C++ simulator for tx ${txHash}`);
75
- resultBuffer = await avmSimulate(inputBuffer, contractProvider, wsCppHandle);
49
+ this.log.debug(`Calling C++ simulator for tx ${txHash}`);
50
+ resultBuffer = await avmSimulate(inputBuffer, contractProvider, wsCppHandle, logLevel);
76
51
  } catch (error) {
77
52
  throw new SimulationError(`C++ simulation failed: ${error.message}`, []);
78
53
  }
79
54
  // If we've reached this point, C++ succeeded during simulation,
80
- // so we assert that TS also succeeded.
81
- assert(tsResult !== undefined, 'TS simulation should have succeeded if C++ succeeded');
82
- assert(tsStateRef !== undefined, 'TS state reference should have been captured if C++ succeeded');
83
55
  // Deserialize the msgpack result
84
- this.log.verbose(`Deserializing C++ from buffer (size: ${resultBuffer.length})...`);
56
+ this.log.trace(`Deserializing C++ from buffer (size: ${resultBuffer.length})...`);
85
57
  const cppResultJSON = deserializeFromMessagePack(resultBuffer);
86
- // Write testdata if AZTEC_WRITE_TESTDATA=1.
87
- writeTestData(`barretenberg/cpp/src/barretenberg/vm2/testing/tx_result_${txHash}.testdata.bin`, resultBuffer, /*raw=*/ true);
88
- this.log.verbose(`Deserializing C++ result to PublicTxResult...`);
58
+ this.log.trace(`Deserializing C++ result to PublicTxResult...`);
89
59
  const cppResult = PublicTxResult.fromPlainObject(cppResultJSON);
90
- this.log.verbose(`Done.`);
91
- // TODO(fcarreiro): complete this.
92
- assert(cppResult.revertCode.equals(tsResult.revertCode));
93
- assert(cppResult.gasUsed.totalGas.equals(tsResult.gasUsed.totalGas));
94
- assert(cppResult.gasUsed.publicGas.equals(tsResult.gasUsed.publicGas));
95
- assert(cppResult.gasUsed.teardownGas.equals(tsResult.gasUsed.teardownGas));
96
- assert(cppResult.gasUsed.billedGas.equals(tsResult.gasUsed.billedGas));
97
- assert(cppResult.publicInputs.toBuffer().equals(tsResult.publicInputs.toBuffer()));
98
- if (this.config?.collectCallMetadata) {
99
- assert(cppResult.appLogicReturnValues.length == tsResult.appLogicReturnValues.length);
100
- assert(cppResult.appLogicReturnValues.every((v, i)=>v.equals(tsResult.appLogicReturnValues[i])));
101
- }
102
- // Confirm that tree roots match
103
- const cppStateRef = await this.merkleTree.getStateReference();
104
- assert(cppStateRef.equals(tsStateRef), `Tree roots mismatch between TS and C++ public simulations for tx ${txHash}`);
105
- this.log.debug(`C++ simulation completed for tx ${txHash}`, {
60
+ this.log.trace(`C++ simulation completed for tx ${txHash}`, {
106
61
  txHash,
107
- reverted: !tsResult.revertCode.isOK(),
108
- tsGasUsed: tsResult.gasUsed.totalGas.l2Gas,
109
- cppGasUsed: tsResult.gasUsed.totalGas.l2Gas
62
+ reverted: !cppResult.revertCode.isOK(),
63
+ cppGasUsed: cppResult.gasUsed.totalGas.l2Gas
110
64
  });
111
- // TODO(dbanks12): C++ should return PublicTxResult (or something similar)
112
- return tsResult;
65
+ return cppResult;
113
66
  }
114
67
  }
115
68
  export class MeasuredCppPublicTxSimulator extends CppPublicTxSimulator {
@@ -129,82 +82,12 @@ export class MeasuredCppPublicTxSimulator extends CppPublicTxSimulator {
129
82
  }
130
83
  }
131
84
  /**
132
- * C++ implementation of PublicTxSimulator using pre-collected hints.
133
- * This implementation runs TS simulation first to collect all hints,
134
- * then passes the complete AvmCircuitInputs (hints + public inputs)
135
- * to C++ to run hinted simulation.
136
- */ export class CppPublicTxSimulatorHintedDbs extends PublicTxSimulator {
137
- log;
138
- constructor(merkleTree, contractsDB, globalVariables, config){
139
- super(merkleTree, contractsDB, globalVariables, config);
140
- this.log = createLogger(`simulator:cpp_public_tx_simulator_hinted_dbs`);
141
- }
142
- /**
143
- * Simulate a transaction's public portion using the C++ vm2 simulator with hinted DBs.
144
- *
145
- * This implementation:
146
- * 1. Runs the full TypeScript simulation to generate AvmCircuitInputs (hints + public inputs)
147
- * 2. Passes the complete AvmCircuitInputs to C++ to run hinted simulation
148
- *
149
- * @param tx - The transaction to simulate.
150
- * @returns The result of the transaction's public execution.
151
- */ async simulate(tx) {
152
- const txHash = this.computeTxHash(tx);
153
- this.log.debug(`C++ hinted DB simulation of ${tx.publicFunctionCalldata.length} public calls for tx ${txHash}`, {
154
- txHash
155
- });
156
- // First, run TS simulation to generate hints and public inputs
157
- this.log.debug(`Running TS simulation for tx ${txHash}`);
158
- // Run the full TypeScript simulation using the parent class
159
- // This will modify the merkle tree with the transaction's state changes
160
- const tsResult = await super.simulate(tx);
161
- this.log.debug(`TS simulation succeeded for tx ${txHash}`);
162
- // Extract the full AvmCircuitInputs from the TS result
163
- const avmCircuitInputs = new AvmCircuitInputs(tsResult.hints, tsResult.publicInputs);
164
- // Second, run C++ simulation with hinted DBs
165
- this.log.debug(`Running C++ simulation with hinted DBs for tx ${txHash}`);
166
- // Serialize to msgpack and call the C++ simulator
167
- const inputBuffer = avmCircuitInputs.serializeWithMessagePack();
168
- let resultBuffer;
169
- try {
170
- resultBuffer = await avmSimulateWithHintedDbs(inputBuffer);
171
- } catch (error) {
172
- throw new SimulationError(`C++ hinted simulation failed: ${error.message}`, []);
173
- }
174
- // Deserialize the msgpack result
175
- const cppResultJSON = deserializeFromMessagePack(resultBuffer);
176
- const cppResult = PublicTxResult.fromPlainObject(cppResultJSON);
177
- assert(cppResult.revertCode.equals(tsResult.revertCode));
178
- assert(cppResult.gasUsed.totalGas.equals(tsResult.gasUsed.totalGas));
179
- this.log.debug(`C++ hinted simulation completed for tx ${txHash}`, {
180
- txHash,
181
- reverted: !tsResult.revertCode.isOK(),
182
- tsGasUsed: tsResult.gasUsed.totalGas.l2Gas,
183
- cppGasUsed: tsResult.gasUsed.totalGas.l2Gas
184
- });
185
- // TODO(fcarreiro): complete this.
186
- return tsResult;
187
- }
188
- }
189
- /**
190
- * Class to record metrics for simulation.
191
- *
192
- * Note(dbanks12): We might not be able to collect all the same metrics in C++ as we do in TS!
193
- * Unless we move some of the metrics collection to C++, we don't have inner functions exposed
194
- * to TS for tracking.
195
- */ export class MeasuredCppPublicTxSimulatorHintedDbs extends CppPublicTxSimulatorHintedDbs {
196
- metrics;
197
- constructor(merkleTree, contractsDB, globalVariables, metrics, config){
198
- super(merkleTree, contractsDB, globalVariables, config), this.metrics = metrics;
199
- }
200
- async simulate(tx, txLabel = 'unlabeledTx') {
201
- this.metrics.startRecordingTxSimulation(txLabel);
202
- let result;
203
- try {
204
- result = await super.simulate(tx);
205
- } finally{
206
- this.metrics.stopRecordingTxSimulation(txLabel, result?.gasUsed, result?.revertCode);
207
- }
208
- return result;
85
+ * A C++ public tx simulator that tracks runtime/production metrics with telemetry.
86
+ */ export class TelemetryCppPublicTxSimulator extends MeasuredCppPublicTxSimulator {
87
+ /* tracer needed by trackSpans */ tracer;
88
+ constructor(merkleTree, contractsDB, globalVariables, telemetryClient = getTelemetryClient(), config){
89
+ const metrics = new ExecutorMetrics(telemetryClient, 'CppPublicTxSimulator');
90
+ super(merkleTree, contractsDB, globalVariables, metrics, config);
91
+ this.tracer = metrics.tracer;
209
92
  }
210
93
  }
@@ -0,0 +1,42 @@
1
+ import { type Logger } from '@aztec/foundation/log';
2
+ import { type PublicSimulatorConfig, PublicTxResult } from '@aztec/stdlib/avm';
3
+ import type { MerkleTreeWriteOperations } from '@aztec/stdlib/trees';
4
+ import type { GlobalVariables, Tx } from '@aztec/stdlib/tx';
5
+ import type { ExecutorMetricsInterface } from '../executor_metrics_interface.js';
6
+ import type { PublicContractsDB } from '../public_db_sources.js';
7
+ import { PublicTxSimulator } from './public_tx_simulator.js';
8
+ import type { MeasuredPublicTxSimulatorInterface, PublicTxSimulatorInterface } from './public_tx_simulator_interface.js';
9
+ /**
10
+ * C++ implementation of PublicTxSimulator using pre-collected hints.
11
+ * This implementation runs TS simulation first to collect all hints,
12
+ * then passes the complete AvmCircuitInputs (hints + public inputs)
13
+ * to C++ to run hinted simulation.
14
+ */
15
+ export declare class CppPublicTxSimulatorHintedDbs extends PublicTxSimulator implements PublicTxSimulatorInterface {
16
+ protected log: Logger;
17
+ constructor(merkleTree: MerkleTreeWriteOperations, contractsDB: PublicContractsDB, globalVariables: GlobalVariables, config?: Partial<PublicSimulatorConfig>);
18
+ /**
19
+ * Simulate a transaction's public portion using the C++ vm2 simulator with hinted DBs.
20
+ *
21
+ * This implementation:
22
+ * 1. Runs the full TypeScript simulation to generate AvmCircuitInputs (hints + public inputs)
23
+ * 2. Passes the complete AvmCircuitInputs to C++ to run hinted simulation
24
+ *
25
+ * @param tx - The transaction to simulate.
26
+ * @returns The result of the transaction's public execution.
27
+ */
28
+ simulate(tx: Tx): Promise<PublicTxResult>;
29
+ }
30
+ /**
31
+ * Class to record metrics for simulation.
32
+ *
33
+ * Note(dbanks12): We might not be able to collect all the same metrics in C++ as we do in TS!
34
+ * Unless we move some of the metrics collection to C++, we don't have inner functions exposed
35
+ * to TS for tracking.
36
+ */
37
+ export declare class MeasuredCppPublicTxSimulatorHintedDbs extends CppPublicTxSimulatorHintedDbs implements MeasuredPublicTxSimulatorInterface {
38
+ protected readonly metrics: ExecutorMetricsInterface;
39
+ constructor(merkleTree: MerkleTreeWriteOperations, contractsDB: PublicContractsDB, globalVariables: GlobalVariables, metrics: ExecutorMetricsInterface, config?: Partial<PublicSimulatorConfig>);
40
+ simulate(tx: Tx, txLabel?: string): Promise<PublicTxResult>;
41
+ }
42
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY3BwX3B1YmxpY190eF9zaW11bGF0b3Jfd2l0aF9oaW50ZWRfZGJzLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvcHVibGljL3B1YmxpY190eF9zaW11bGF0b3IvY3BwX3B1YmxpY190eF9zaW11bGF0b3Jfd2l0aF9oaW50ZWRfZGJzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxLQUFLLE1BQU0sRUFBMEIsTUFBTSx1QkFBdUIsQ0FBQztBQUU1RSxPQUFPLEVBRUwsS0FBSyxxQkFBcUIsRUFDMUIsY0FBYyxFQUVmLE1BQU0sbUJBQW1CLENBQUM7QUFFM0IsT0FBTyxLQUFLLEVBQUUseUJBQXlCLEVBQUUsTUFBTSxxQkFBcUIsQ0FBQztBQUNyRSxPQUFPLEtBQUssRUFBRSxlQUFlLEVBQUUsRUFBRSxFQUFFLE1BQU0sa0JBQWtCLENBQUM7QUFJNUQsT0FBTyxLQUFLLEVBQUUsd0JBQXdCLEVBQUUsTUFBTSxrQ0FBa0MsQ0FBQztBQUNqRixPQUFPLEtBQUssRUFBRSxpQkFBaUIsRUFBRSxNQUFNLHlCQUF5QixDQUFDO0FBQ2pFLE9BQU8sRUFBRSxpQkFBaUIsRUFBRSxNQUFNLDBC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GAAG,OAAO,CAAC,cAAc,CAAC,CAS/F;CACF"}
@@ -0,0 +1,86 @@
1
+ import { createLogger, logLevel } from '@aztec/foundation/log';
2
+ import { avmSimulateWithHintedDbs } from '@aztec/native';
3
+ import { AvmCircuitInputs, PublicTxResult, deserializeFromMessagePack } from '@aztec/stdlib/avm';
4
+ import { SimulationError } from '@aztec/stdlib/errors';
5
+ import { strict as assert } from 'assert';
6
+ import { PublicTxSimulator } from './public_tx_simulator.js';
7
+ /**
8
+ * C++ implementation of PublicTxSimulator using pre-collected hints.
9
+ * This implementation runs TS simulation first to collect all hints,
10
+ * then passes the complete AvmCircuitInputs (hints + public inputs)
11
+ * to C++ to run hinted simulation.
12
+ */ export class CppPublicTxSimulatorHintedDbs extends PublicTxSimulator {
13
+ log;
14
+ constructor(merkleTree, contractsDB, globalVariables, config){
15
+ super(merkleTree, contractsDB, globalVariables, config);
16
+ this.log = createLogger(`simulator:cpp_public_tx_simulator_hinted_dbs`);
17
+ }
18
+ /**
19
+ * Simulate a transaction's public portion using the C++ vm2 simulator with hinted DBs.
20
+ *
21
+ * This implementation:
22
+ * 1. Runs the full TypeScript simulation to generate AvmCircuitInputs (hints + public inputs)
23
+ * 2. Passes the complete AvmCircuitInputs to C++ to run hinted simulation
24
+ *
25
+ * @param tx - The transaction to simulate.
26
+ * @returns The result of the transaction's public execution.
27
+ */ async simulate(tx) {
28
+ const txHash = this.computeTxHash(tx);
29
+ this.log.debug(`C++ hinted DB simulation of ${tx.publicFunctionCalldata.length} public calls for tx ${txHash}`, {
30
+ txHash
31
+ });
32
+ // First, run TS simulation to generate hints and public inputs
33
+ this.log.debug(`Running TS simulation for tx ${txHash}`);
34
+ // Run the full TypeScript simulation using the parent class
35
+ // This will modify the merkle tree with the transaction's state changes
36
+ const tsResult = await super.simulate(tx);
37
+ this.log.debug(`TS simulation succeeded for tx ${txHash}`);
38
+ // Extract the full AvmCircuitInputs from the TS result
39
+ const avmCircuitInputs = new AvmCircuitInputs(tsResult.hints, tsResult.publicInputs);
40
+ // Second, run C++ simulation with hinted DBs
41
+ this.log.debug(`Running C++ simulation with hinted DBs for tx ${txHash}`);
42
+ // Serialize to msgpack and call the C++ simulator
43
+ const inputBuffer = avmCircuitInputs.serializeWithMessagePack();
44
+ let resultBuffer;
45
+ try {
46
+ resultBuffer = await avmSimulateWithHintedDbs(inputBuffer, logLevel);
47
+ } catch (error) {
48
+ throw new SimulationError(`C++ hinted simulation failed: ${error.message}`, []);
49
+ }
50
+ // Deserialize the msgpack result
51
+ const cppResultJSON = deserializeFromMessagePack(resultBuffer);
52
+ const cppResult = PublicTxResult.fromPlainObject(cppResultJSON);
53
+ assert(cppResult.revertCode.equals(tsResult.revertCode));
54
+ assert(cppResult.gasUsed.totalGas.equals(tsResult.gasUsed.totalGas));
55
+ this.log.debug(`C++ hinted simulation completed for tx ${txHash}`, {
56
+ txHash,
57
+ reverted: !tsResult.revertCode.isOK(),
58
+ tsGasUsed: tsResult.gasUsed.totalGas.l2Gas,
59
+ cppGasUsed: tsResult.gasUsed.totalGas.l2Gas
60
+ });
61
+ // TODO(fcarreiro): complete this.
62
+ return tsResult;
63
+ }
64
+ }
65
+ /**
66
+ * Class to record metrics for simulation.
67
+ *
68
+ * Note(dbanks12): We might not be able to collect all the same metrics in C++ as we do in TS!
69
+ * Unless we move some of the metrics collection to C++, we don't have inner functions exposed
70
+ * to TS for tracking.
71
+ */ export class MeasuredCppPublicTxSimulatorHintedDbs extends CppPublicTxSimulatorHintedDbs {
72
+ metrics;
73
+ constructor(merkleTree, contractsDB, globalVariables, metrics, config){
74
+ super(merkleTree, contractsDB, globalVariables, config), this.metrics = metrics;
75
+ }
76
+ async simulate(tx, txLabel = 'unlabeledTx') {
77
+ this.metrics.startRecordingTxSimulation(txLabel);
78
+ let result;
79
+ try {
80
+ result = await super.simulate(tx);
81
+ } finally{
82
+ this.metrics.stopRecordingTxSimulation(txLabel, result?.gasUsed, result?.revertCode);
83
+ }
84
+ return result;
85
+ }
86
+ }
@@ -0,0 +1,30 @@
1
+ import { type Logger } from '@aztec/foundation/log';
2
+ import { type PublicSimulatorConfig, PublicTxResult } from '@aztec/stdlib/avm';
3
+ import type { MerkleTreeWriteOperations } from '@aztec/stdlib/trees';
4
+ import type { GlobalVariables, Tx } from '@aztec/stdlib/tx';
5
+ import type { ExecutorMetricsInterface } from '../executor_metrics_interface.js';
6
+ import type { PublicContractsDB } from '../public_db_sources.js';
7
+ import { PublicTxSimulator } from './public_tx_simulator.js';
8
+ import type { MeasuredPublicTxSimulatorInterface, PublicTxSimulatorInterface } from './public_tx_simulator_interface.js';
9
+ /**
10
+ * An implementation of PublicTxSimulator that first simulates in C++, then TS, an compares the results.
11
+ * The C++ simulator accesses the world state directly/natively within C++.
12
+ * For contract DB accesses, it makes callbacks through NAPI back to the TS PublicContractsDB cache.
13
+ */
14
+ export declare class CppVsTsPublicTxSimulator extends PublicTxSimulator implements PublicTxSimulatorInterface {
15
+ protected log: Logger;
16
+ constructor(merkleTree: MerkleTreeWriteOperations, contractsDB: PublicContractsDB, globalVariables: GlobalVariables, config?: Partial<PublicSimulatorConfig>);
17
+ /**
18
+ * Simulate a transaction's public portion using the C++ avvm simulator.
19
+ *
20
+ * @param tx - The transaction to simulate.
21
+ * @returns The result of the transaction's public execution.
22
+ */
23
+ simulate(tx: Tx): Promise<PublicTxResult>;
24
+ }
25
+ export declare class MeasuredCppVsTsPublicTxSimulator extends CppVsTsPublicTxSimulator implements MeasuredPublicTxSimulatorInterface {
26
+ protected readonly metrics: ExecutorMetricsInterface;
27
+ constructor(merkleTree: MerkleTreeWriteOperations, contractsDB: PublicContractsDB, globalVariables: GlobalVariables, metrics: ExecutorMetricsInterface, config?: Partial<PublicSimulatorConfig>);
28
+ simulate(tx: Tx, txLabel?: string): Promise<PublicTxResult>;
29
+ }
30
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY3BwX3ZzX3RzX3B1YmxpY190eF9zaW11bGF0b3IuZC50cy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AAE5C;;;;GAIG;AACH,qBAAa,wBAAyB,SAAQ,iBAAkB,YAAW,0BAA0B;IACnG,UAAmB,GAAG,EAAE,MAAM,CAAC;IAE/B,YACE,UAAU,EAAE,yBAAyB,EACrC,WAAW,EAAE,iBAAiB,EAC9B,eAAe,EAAE,eAAe,EAChC,MAAM,CAAC,EAAE,OAAO,CAAC,qBAAqB,CAAC,EAIxC;IAED;;;;;OAKG;IACmB,QAAQ,CAAC,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,cAAc,CAAC,CAiK9D;CACF;AAED,qBAAa,gCACX,SAAQ,wBACR,YAAW,kCAAkC;IAM3C,SAAS,CAAC,QAAQ,CAAC,OAAO,EAAE,wBAAwB;IAJtD,YACE,UAAU,EAAE,yBAAyB,EACrC,WAAW,EAAE,iBAAiB,EAC9B,eAAe,EAAE,eAAe,EACb,OAAO,EAAE,wBAAwB,EACpD,MAAM,CAAC,EAAE,OAAO,CAAC,qBAAqB,CAAC,EAGxC;IAEqB,QAAQ,CAAC,EAAE,EAAE,EAAE,EAAE,OAAO,GAAE,MAAsB,GAAG,OAAO,CAAC,cAAc,CAAC,CAS/F;CACF"}
@@ -0,0 +1,170 @@
1
+ import { createLogger, logLevel } from '@aztec/foundation/log';
2
+ import { writeTestData } from '@aztec/foundation/testing/files';
3
+ import { avmSimulate } from '@aztec/native';
4
+ import { ProtocolContractsList } from '@aztec/protocol-contracts';
5
+ import { AvmFastSimulationInputs, AvmTxHint, PublicTxResult, deserializeFromMessagePack } from '@aztec/stdlib/avm';
6
+ import { SimulationError } from '@aztec/stdlib/errors';
7
+ import { WorldStateRevisionWithHandle } from '@aztec/stdlib/world-state';
8
+ import { strict as assert } from 'assert';
9
+ import { ContractProviderForCpp } from './contract_provider_for_cpp.js';
10
+ import { PublicTxSimulator } from './public_tx_simulator.js';
11
+ /**
12
+ * An implementation of PublicTxSimulator that first simulates in C++, then TS, an compares the results.
13
+ * The C++ simulator accesses the world state directly/natively within C++.
14
+ * For contract DB accesses, it makes callbacks through NAPI back to the TS PublicContractsDB cache.
15
+ */ export class CppVsTsPublicTxSimulator extends PublicTxSimulator {
16
+ log;
17
+ constructor(merkleTree, contractsDB, globalVariables, config){
18
+ super(merkleTree, contractsDB, globalVariables, config);
19
+ this.log = createLogger(`simulator:cpp_public_tx_simulator`);
20
+ }
21
+ /**
22
+ * Simulate a transaction's public portion using the C++ avvm simulator.
23
+ *
24
+ * @param tx - The transaction to simulate.
25
+ * @returns The result of the transaction's public execution.
26
+ */ async simulate(tx) {
27
+ const txHash = this.computeTxHash(tx);
28
+ this.log.debug(`C++ simulation of ${tx.publicFunctionCalldata.length} public calls for tx ${txHash}`, {
29
+ txHash
30
+ });
31
+ // Run TS simulation to generate hints and public inputs
32
+ this.log.debug(`Running TS simulation for tx ${txHash}`);
33
+ // create checkpoint for ws
34
+ let tsResult;
35
+ let tsStateRef;
36
+ await this.merkleTree.createCheckpoint();
37
+ this.contractsDB.createCheckpoint();
38
+ try {
39
+ // Run the full TypeScript simulation using the parent class
40
+ // This will modify the merkle tree with the transaction's state changes
41
+ tsResult = await super.simulate(tx);
42
+ this.log.debug(`TS simulation completed for tx ${txHash}`);
43
+ tsStateRef = await this.merkleTree.getStateReference(); // capture tree roots for later comparsion
44
+ } catch (error) {
45
+ this.log.warn(`TS simulation failed, but still continuing with C++ simulation: ${error.message} ${error.stack}`);
46
+ } finally{
47
+ // revert checkpoint for ws and clear contract db changes
48
+ // (cpp should reapply exactly the same changes if there are no bugs)
49
+ await this.merkleTree.revertCheckpoint();
50
+ this.contractsDB.revertCheckpoint();
51
+ }
52
+ this.log.debug(`Running C++ simulation for tx ${txHash}`);
53
+ // Using the "as WorldStateRevisionWithHandle" is a bit of a "trust me bro", hence the assert.
54
+ let wsRevision = this.merkleTree.getRevision();
55
+ assert(wsRevision instanceof WorldStateRevisionWithHandle, 'CppPublicTxSimulator a real NativeWorldStateInstance with a handle to the C++ WorldState object');
56
+ const wsCppHandle = wsRevision.handle;
57
+ wsRevision = wsRevision.toWorldStateRevision(); // for msgpack serialization, we don't include the handle in the type
58
+ this.log.debug(`Running C++ simulation with world state revision ${JSON.stringify(wsRevision)}`);
59
+ // Create the fast simulation inputs
60
+ const txHint = AvmTxHint.fromTx(tx, this.globalVariables.gasFees);
61
+ const protocolContracts = ProtocolContractsList;
62
+ const fastSimInputs = new AvmFastSimulationInputs(wsRevision, this.config, txHint, this.globalVariables, protocolContracts);
63
+ // Create contract provider for callbacks to TypeScript PublicContractsDB from C++
64
+ const contractProvider = new ContractProviderForCpp(this.contractsDB, this.globalVariables);
65
+ // Serialize to msgpack and call the C++ simulator
66
+ this.log.debug(`Serializing fast simulation inputs to msgpack...`);
67
+ const inputBuffer = fastSimInputs.serializeWithMessagePack();
68
+ let resultBuffer;
69
+ try {
70
+ this.log.debug(`Calling C++ simulator for tx ${txHash}`);
71
+ resultBuffer = await avmSimulate(inputBuffer, contractProvider, wsCppHandle, logLevel);
72
+ } catch (error) {
73
+ throw new SimulationError(`C++ simulation failed: ${error.message}`, []);
74
+ }
75
+ // If we've reached this point, C++ succeeded during simulation,
76
+ // so we assert that TS also succeeded.
77
+ assert(tsResult !== undefined, 'TS simulation should have succeeded if C++ succeeded');
78
+ assert(tsStateRef !== undefined, 'TS state reference should have been captured if C++ succeeded');
79
+ // Deserialize the msgpack result
80
+ this.log.debug(`Deserializing C++ from buffer (size: ${resultBuffer.length})...`);
81
+ const cppResultJSON = deserializeFromMessagePack(resultBuffer);
82
+ // Write testdata if AZTEC_WRITE_TESTDATA=1.
83
+ writeTestData(`barretenberg/cpp/src/barretenberg/vm2/testing/tx_result_${txHash}.testdata.bin`, resultBuffer, /*raw=*/ true);
84
+ this.log.debug(`Deserializing C++ result to PublicTxResult...`);
85
+ const cppResult = PublicTxResult.fromPlainObject(cppResultJSON);
86
+ this.log.debug(`Done.`);
87
+ assert(cppResult.revertCode.equals(tsResult.revertCode));
88
+ assert(cppResult.gasUsed.totalGas.equals(tsResult.gasUsed.totalGas));
89
+ assert(cppResult.gasUsed.publicGas.equals(tsResult.gasUsed.publicGas));
90
+ assert(cppResult.gasUsed.teardownGas.equals(tsResult.gasUsed.teardownGas));
91
+ assert(cppResult.gasUsed.billedGas.equals(tsResult.gasUsed.billedGas));
92
+ assert(cppResult.publicInputs.toBuffer().equals(tsResult.publicInputs.toBuffer()));
93
+ // TODO(fcarreiro): complete this.
94
+ // Check that C++ hints are a strict subset of TS hints.
95
+ // Then enable for misc tests and validate hints.
96
+ //if (this.config?.collectHints) {
97
+ //}
98
+ if (this.config?.collectCallMetadata) {
99
+ assert(cppResult.getAppLogicReturnValues().length === tsResult.getAppLogicReturnValues().length);
100
+ for(let i = 0; i < cppResult.getAppLogicReturnValues().length; i++){
101
+ assert(cppResult.getAppLogicReturnValues()[i].equals(tsResult.getAppLogicReturnValues()[i]));
102
+ }
103
+ }
104
+ // Messages are still not ok for exceptional halts (they are not plumbed in C++).
105
+ const cppRevertReason = cppResult.findRevertReason() || {};
106
+ const tsRevertReason = tsResult.findRevertReason() || {};
107
+ const cppRevertReasonAsObject = JSON.parse(JSON.stringify(cppRevertReason));
108
+ const tsRevertReasonAsObject = JSON.parse(JSON.stringify(tsRevertReason));
109
+ if (JSON.stringify(cppRevertReasonAsObject) !== JSON.stringify(tsRevertReasonAsObject)) {
110
+ this.log.debug('cppResult.findRevertReason()', cppRevertReasonAsObject);
111
+ this.log.debug('tsResult.findRevertReason()', tsRevertReasonAsObject);
112
+ }
113
+ // TODO: dont compare the strings since this is not deterministic.
114
+ // Sometimes error messages are different between C++ and TS, so we omit in the default comparison
115
+ const cppRevertReasonWithoutMessage = {
116
+ ...cppRevertReasonAsObject,
117
+ originalMessage: undefined
118
+ };
119
+ const tsRevertReasonWithoutMessage = {
120
+ ...tsRevertReasonAsObject,
121
+ originalMessage: undefined
122
+ };
123
+ assert(JSON.stringify(cppRevertReasonWithoutMessage) === JSON.stringify(tsRevertReasonWithoutMessage));
124
+ const cppHasRevertMessage = cppRevertReasonAsObject.originalMessage && cppRevertReasonAsObject.originalMessage.length > 0;
125
+ const tsHasRevertMessage = tsRevertReasonAsObject.originalMessage && tsRevertReasonAsObject.originalMessage.length > 0;
126
+ // assert that if one of the error messages is non-empty, the other is
127
+ assert(cppHasRevertMessage === tsHasRevertMessage, 'One of the AVM simulators (C++ or TS) produced a revert message, but the other did not');
128
+ // Ideally, we'd love to be able to compare full error messages, but without a lot of work
129
+ // the two simulators will always be able to produce some differing errors.
130
+ // Commenting out the code below will enforce that the error messages are at least
131
+ // similar (one contains the other). Even this is not something we can guarantee.
132
+ //if (cppHasRevertMessage) {
133
+ // const cppRevertMessageContainsTs = cppRevertReasonAsObject.originalMessage.includes(
134
+ // tsRevertReasonAsObject.originalMessage,
135
+ // );
136
+ // const tsRevertMessageContainsCpp = tsRevertReasonAsObject.originalMessage.includes(
137
+ // cppRevertReasonAsObject.originalMessage,
138
+ // );
139
+ // assert(
140
+ // cppRevertMessageContainsTs || tsRevertMessageContainsCpp,
141
+ // 'The AVM simulators (C++ and TS) produced different revert messages (neither was a substring of the other)',
142
+ // );
143
+ //}
144
+ // Confirm that tree roots match
145
+ const cppStateRef = await this.merkleTree.getStateReference();
146
+ assert(cppStateRef.equals(tsStateRef), `Tree roots mismatch between TS and C++ public simulations for tx ${txHash}`);
147
+ this.log.debug(`C++ simulation completed for tx ${txHash}`, {
148
+ txHash,
149
+ reverted: !cppResult.revertCode.isOK(),
150
+ cppGasUsed: cppResult.gasUsed.totalGas.l2Gas
151
+ });
152
+ return tsResult;
153
+ }
154
+ }
155
+ export class MeasuredCppVsTsPublicTxSimulator extends CppVsTsPublicTxSimulator {
156
+ metrics;
157
+ constructor(merkleTree, contractsDB, globalVariables, metrics, config){
158
+ super(merkleTree, contractsDB, globalVariables, config), this.metrics = metrics;
159
+ }
160
+ async simulate(tx, txLabel = 'unlabeledTx') {
161
+ this.metrics.startRecordingTxSimulation(txLabel);
162
+ let result;
163
+ try {
164
+ result = await super.simulate(tx);
165
+ } finally{
166
+ this.metrics.stopRecordingTxSimulation(txLabel, result?.gasUsed, result?.revertCode);
167
+ }
168
+ return result;
169
+ }
170
+ }
@@ -1,5 +1,6 @@
1
1
  export * from './public_tx_simulator.js';
2
+ export { CppPublicTxSimulator, TelemetryCppPublicTxSimulator } from './cpp_public_tx_simulator.js';
2
3
  export type { PublicTxSimulatorInterface } from './public_tx_simulator_interface.js';
3
4
  export { TelemetryPublicTxSimulator } from './telemetry_public_tx_simulator.js';
4
5
  export type { PublicTxResult, PublicSimulatorConfig as PublicTxSimulatorConfig } from '@aztec/stdlib/avm';
5
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9wdWJsaWMvcHVibGljX3R4X3NpbXVsYXRvci9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxjQUFjLDBCQUEwQixDQUFDO0FBQ3pDLFlBQVksRUFBRSwwQkFBMEIsRUFBRSxNQUFNLG9DQUFvQyxDQUFDO0FBQ3JGLE9BQU8sRUFBRSwwQkFBMEIsRUFBRSxNQUFNLG9DQUFvQyxDQUFDO0FBQ2hGLFlBQVksRUFBRSxjQUFjLEVBQUUscUJBQXFCLElBQUksdUJBQXVCLEVBQUUsTUFBTSxtQkFBbUIsQ0FBQyJ9
6
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9wdWJsaWMvcHVibGljX3R4X3NpbXVsYXRvci9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxjQUFjLDBCQUEwQixDQUFDO0FBQ3pDLE9BQU8sRUFBRSxvQkFBb0IsRUFBRSw2QkFBNkIsRUFBRSxNQUFNLDhCQUE4QixDQUFDO0FBQ25HLFlBQVksRUFBRSwwQkFBMEIsRUFBRSxNQUFNLG9DQUFvQyxDQUFDO0FBQ3JGLE9BQU8sRUFBRSwwQkFBMEIsRUFBRSxNQUFNLG9DQUFvQyxDQUFDO0FBQ2hGLFlBQVksRUFBRSxjQUFjLEVBQUUscUJBQXFCLElBQUksdUJBQXVCLEVBQUUsTUFBTSxtQkFBbUIsQ0FBQyJ9
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/public/public_tx_simulator/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC;AACzC,YAAY,EAAE,0BAA0B,EAAE,MAAM,oCAAoC,CAAC;AACrF,OAAO,EAAE,0BAA0B,EAAE,MAAM,oCAAoC,CAAC;AAChF,YAAY,EAAE,cAAc,EAAE,qBAAqB,IAAI,uBAAuB,EAAE,MAAM,mBAAmB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/public/public_tx_simulator/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC;AACzC,OAAO,EAAE,oBAAoB,EAAE,6BAA6B,EAAE,MAAM,8BAA8B,CAAC;AACnG,YAAY,EAAE,0BAA0B,EAAE,MAAM,oCAAoC,CAAC;AACrF,OAAO,EAAE,0BAA0B,EAAE,MAAM,oCAAoC,CAAC;AAChF,YAAY,EAAE,cAAc,EAAE,qBAAqB,IAAI,uBAAuB,EAAE,MAAM,mBAAmB,CAAC"}
@@ -1,2 +1,3 @@
1
1
  export * from './public_tx_simulator.js';
2
+ export { CppPublicTxSimulator, TelemetryCppPublicTxSimulator } from './cpp_public_tx_simulator.js';
2
3
  export { TelemetryPublicTxSimulator } from './telemetry_public_tx_simulator.js';
@@ -2,7 +2,7 @@ import { Fr } from '@aztec/foundation/fields';
2
2
  import { type Logger } from '@aztec/foundation/log';
3
3
  import { PublicSimulatorConfig, PublicTxResult } from '@aztec/stdlib/avm';
4
4
  import { SimulationError } from '@aztec/stdlib/errors';
5
- import type { Gas } from '@aztec/stdlib/gas';
5
+ import { Gas } from '@aztec/stdlib/gas';
6
6
  import type { MerkleTreeWriteOperations } from '@aztec/stdlib/trees';
7
7
  import { type GlobalVariables, NestedProcessReturnValues, PublicCallRequestWithCalldata, Tx, TxExecutionPhase } from '@aztec/stdlib/tx';
8
8
  import type { AvmFinalizedCallResult } from '../avm/avm_contract_call_result.js';
@@ -77,4 +77,4 @@ export declare class PublicTxSimulator implements PublicTxSimulatorInterface {
77
77
  private payFee;
78
78
  }
79
79
  export {};
80
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHVibGljX3R4X3NpbXVsYXRvci5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL3B1YmxpYy9wdWJsaWNfdHhfc2ltdWxhdG9yL3B1YmxpY190eF9zaW11bGF0b3IudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQ0EsT0FBTyxFQUFFLEVBQUUsRUFBRSxNQUFNLDBCQUEwQixDQUFDO0FBQzlDLE9BQU8sRUFBRSxLQUFLLE1BQU0sRUFBZ0IsTUFBTSx1QkFBdUIsQ0FBQztBQUdsRSxPQUFPLEVBQWdDLHFCQUFxQixFQUFFLGNBQWMsRUFBRSxNQUFNLG1CQUFtQixDQUFDO0FBQ3hHLE9BQU8sRUFBRSxlQUFlLEVBQUUsTUFBTSxzQkFBc0IsQ0FBQztBQUN2RCxPQUFPLEtBQUssRUFBRSxHQUFHLEVBQUUsTUFBTSxtQkFBbUIsQ0FBQztBQUM3QyxPQUFPLEtBQUssRUFBRSx5QkFBeUIsRUFBRSxNQUFNLHFCQUFxQixDQUFDO0FBQ3JFLE9BQU8sRUFDTCxLQUFLLGVBQWUsRUFDcEIseUJBQXlCLEVBQ3pCLDZCQUE2QixFQUM3QixFQUFFLEVBQ0YsZ0JBQWdCLEVBQ2pCLE1BQU0sa0JBQWtCLENBQUM7QUF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,OAAO,EAAE,eAAe,EACxB,WAAW,EAAE,6BAA6B,GACzC,OAAO,CAAC,sBAAsB,CAAC,CA2BjC;IAED;;;;;;;;;;;;OAYG;IACH,UAAgB,4BAA4B,CAC1C,YAAY,EAAE,6BAA6B,EAC3C,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,6BAA6B,EACpD,YAAY,EAAE,GAAG,EACjB,cAAc,EAAE,EAAE,EAClB,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,sBAAsB,CAAC,CAqBjC;IAED;;OAEG;IACH,UAAgB,+BAA+B,CAAC,OAAO,EAAE,eAAe,iBAyBvE;IAED;;;;;;;;OAQG;IACH,UAAgB,4BAA4B,CAAC,OAAO,EAAE,eAAe,iBA0EpE;YAEa,MAAM;CAmCrB"}
1
+ {"version":3,"file":"public_tx_simulator.d.ts","sourceRoot":"","sources":["../../../src/public/public_tx_simulator/public_tx_simulator.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAC9C,OAAO,EAAE,KAAK,MAAM,EAAgB,MAAM,uBAAuB,CAAC;AAGlE,OAAO,EAAgC,qBAAqB,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACxG,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AACxC,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;AACrE,OAAO,EACL,KAAK,eAAe,EACpB,yBAAyB,EACzB,6BAA6B,EAC7B,EAAE,EACF,gBAAgB,EACjB,MAAM,kBAAkB,CAAC;AAI1B,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,oCAAoC,CAAC;AAIjF,OAAO,EAAE,KAAK,iBAAiB,EAAiB,MAAM,yBAAyB,CAAC;AAOhF,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,mCAAmC,CAAC;AACvF,OAAO,EAAE,eA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