@aztec/simulator 3.0.0-nightly.20251205 → 3.0.0-nightly.20251206
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.
- package/dest/public/avm/avm_simulator.d.ts +1 -1
- package/dest/public/avm/avm_simulator.d.ts.map +1 -1
- package/dest/public/avm/avm_simulator.js +5 -4
- package/dest/public/avm/errors.d.ts +7 -1
- package/dest/public/avm/errors.d.ts.map +1 -1
- package/dest/public/avm/errors.js +14 -2
- package/dest/public/avm/opcodes/addressing_mode.js +2 -2
- package/dest/public/avm/opcodes/misc.js +2 -2
- package/dest/public/avm/revert_reason.d.ts +1 -1
- package/dest/public/avm/revert_reason.d.ts.map +1 -1
- package/dest/public/avm/revert_reason.js +3 -2
- package/dest/public/avm/serialization/bytecode_serialization.d.ts +1 -1
- package/dest/public/avm/serialization/bytecode_serialization.d.ts.map +1 -1
- package/dest/public/avm/serialization/bytecode_serialization.js +9 -6
- package/dest/public/debug_fn_name.d.ts +14 -1
- package/dest/public/debug_fn_name.d.ts.map +1 -1
- package/dest/public/debug_fn_name.js +19 -0
- package/dest/public/fixtures/public_tx_simulation_tester.d.ts +8 -2
- package/dest/public/fixtures/public_tx_simulation_tester.d.ts.map +1 -1
- package/dest/public/fixtures/public_tx_simulation_tester.js +12 -4
- package/dest/public/fixtures/simple_contract_data_source.d.ts +2 -2
- package/dest/public/fixtures/simple_contract_data_source.d.ts.map +1 -1
- package/dest/public/fixtures/simple_contract_data_source.js +4 -4
- package/dest/public/fixtures/token_test.d.ts +6 -2
- package/dest/public/fixtures/token_test.d.ts.map +1 -1
- package/dest/public/fixtures/token_test.js +12 -10
- package/dest/public/index.d.ts +2 -2
- package/dest/public/index.d.ts.map +1 -1
- package/dest/public/index.js +1 -1
- package/dest/public/public_processor/public_processor.d.ts +5 -5
- package/dest/public/public_processor/public_processor.d.ts.map +1 -1
- package/dest/public/public_processor/public_processor.js +13 -12
- package/dest/public/public_tx_simulator/cpp_public_tx_simulator.d.ts +6 -34
- package/dest/public/public_tx_simulator/cpp_public_tx_simulator.d.ts.map +1 -1
- package/dest/public/public_tx_simulator/cpp_public_tx_simulator.js +22 -139
- package/dest/public/public_tx_simulator/cpp_public_tx_simulator_with_hinted_dbs.d.ts +42 -0
- package/dest/public/public_tx_simulator/cpp_public_tx_simulator_with_hinted_dbs.d.ts.map +1 -0
- package/dest/public/public_tx_simulator/cpp_public_tx_simulator_with_hinted_dbs.js +86 -0
- package/dest/public/public_tx_simulator/cpp_vs_ts_public_tx_simulator.d.ts +30 -0
- package/dest/public/public_tx_simulator/cpp_vs_ts_public_tx_simulator.d.ts.map +1 -0
- package/dest/public/public_tx_simulator/cpp_vs_ts_public_tx_simulator.js +170 -0
- package/dest/public/public_tx_simulator/index.d.ts +2 -1
- package/dest/public/public_tx_simulator/index.d.ts.map +1 -1
- package/dest/public/public_tx_simulator/index.js +1 -0
- package/dest/public/public_tx_simulator/public_tx_simulator.d.ts +2 -2
- package/dest/public/public_tx_simulator/public_tx_simulator.d.ts.map +1 -1
- package/dest/public/public_tx_simulator/public_tx_simulator.js +7 -3
- package/dest/public/state_manager/state_manager.d.ts +6 -1
- package/dest/public/state_manager/state_manager.d.ts.map +1 -1
- package/dest/public/state_manager/state_manager.js +4 -1
- package/package.json +16 -16
- package/src/public/avm/avm_simulator.ts +7 -4
- package/src/public/avm/errors.ts +16 -2
- package/src/public/avm/opcodes/addressing_mode.ts +2 -2
- package/src/public/avm/opcodes/misc.ts +2 -2
- package/src/public/avm/revert_reason.ts +5 -2
- package/src/public/avm/serialization/bytecode_serialization.ts +17 -6
- package/src/public/debug_fn_name.ts +25 -0
- package/src/public/fixtures/public_tx_simulation_tester.ts +27 -6
- package/src/public/fixtures/simple_contract_data_source.ts +5 -7
- package/src/public/fixtures/token_test.ts +17 -8
- package/src/public/index.ts +5 -1
- package/src/public/public_processor/public_processor.ts +16 -16
- package/src/public/public_tx_simulator/cpp_public_tx_simulator.ts +23 -174
- package/src/public/public_tx_simulator/cpp_public_tx_simulator_with_hinted_dbs.ts +132 -0
- package/src/public/public_tx_simulator/cpp_vs_ts_public_tx_simulator.ts +240 -0
- package/src/public/public_tx_simulator/index.ts +1 -0
- package/src/public/public_tx_simulator/public_tx_simulator.ts +10 -6
- package/src/public/state_manager/state_manager.ts +8 -1
|
@@ -5,7 +5,7 @@ import type { MerkleTreeWriteOperations, PublicProcessorLimits, PublicProcessorV
|
|
|
5
5
|
import { type FailedTx, GlobalVariables, NestedProcessReturnValues, type ProcessedTx, Tx } from '@aztec/stdlib/tx';
|
|
6
6
|
import { type TelemetryClient, type Traceable, type Tracer } from '@aztec/telemetry-client';
|
|
7
7
|
import { PublicContractsDB } from '../public_db_sources.js';
|
|
8
|
-
import { type
|
|
8
|
+
import { type PublicTxSimulatorConfig, type PublicTxSimulatorInterface } from '../public_tx_simulator/index.js';
|
|
9
9
|
import { GuardedMerkleTreeOperations } from './guarded_merkle_tree.js';
|
|
10
10
|
/**
|
|
11
11
|
* Creates new instances of PublicProcessor given the provided merkle tree db and contract data source.
|
|
@@ -22,7 +22,7 @@ export declare class PublicProcessorFactory {
|
|
|
22
22
|
* @returns A new instance of a PublicProcessor.
|
|
23
23
|
*/
|
|
24
24
|
create(merkleTree: MerkleTreeWriteOperations, globalVariables: GlobalVariables, config: PublicSimulatorConfig): PublicProcessor;
|
|
25
|
-
protected createPublicTxSimulator(merkleTree: MerkleTreeWriteOperations, contractsDB: PublicContractsDB, globalVariables: GlobalVariables, config?: Partial<PublicTxSimulatorConfig>):
|
|
25
|
+
protected createPublicTxSimulator(merkleTree: MerkleTreeWriteOperations, contractsDB: PublicContractsDB, globalVariables: GlobalVariables, config?: Partial<PublicTxSimulatorConfig>): PublicTxSimulatorInterface;
|
|
26
26
|
}
|
|
27
27
|
/**
|
|
28
28
|
* Converts Txs lifted from the P2P module into ProcessedTx objects by executing
|
|
@@ -32,12 +32,12 @@ export declare class PublicProcessor implements Traceable {
|
|
|
32
32
|
protected globalVariables: GlobalVariables;
|
|
33
33
|
private guardedMerkleTree;
|
|
34
34
|
protected contractsDB: PublicContractsDB;
|
|
35
|
-
protected publicTxSimulator:
|
|
35
|
+
protected publicTxSimulator: PublicTxSimulatorInterface;
|
|
36
36
|
private dateProvider;
|
|
37
37
|
private log;
|
|
38
38
|
private opts;
|
|
39
39
|
private metrics;
|
|
40
|
-
constructor(globalVariables: GlobalVariables, guardedMerkleTree: GuardedMerkleTreeOperations, contractsDB: PublicContractsDB, publicTxSimulator:
|
|
40
|
+
constructor(globalVariables: GlobalVariables, guardedMerkleTree: GuardedMerkleTreeOperations, contractsDB: PublicContractsDB, publicTxSimulator: PublicTxSimulatorInterface, dateProvider: DateProvider, telemetryClient?: TelemetryClient, log?: import("@aztec/foundation/log").Logger, opts?: Pick<SequencerConfig, 'fakeProcessingDelayPerTxMs'>);
|
|
41
41
|
get tracer(): Tracer;
|
|
42
42
|
/**
|
|
43
43
|
* Run each tx through the public circuit and the public kernel circuit if needed.
|
|
@@ -59,4 +59,4 @@ export declare class PublicProcessor implements Traceable {
|
|
|
59
59
|
*/
|
|
60
60
|
private static generateProvingRequest;
|
|
61
61
|
}
|
|
62
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
62
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHVibGljX3Byb2Nlc3Nvci5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL3B1YmxpYy9wdWJsaWNfcHJvY2Vzc29yL3B1YmxpY19wcm9jZXNzb3IudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBS0EsT0FBTyxFQUFFLFlBQVksRUFBa0MsTUFBTSx5QkFBeUIsQ0FBQztBQUl2RixPQUFPLEVBTUwscUJBQXFCLEVBQ3RCLE1BQU0sbUJBQW1CLENBQUM7QUFFM0IsT0FBTyxLQUFLLEVBQUUsa0JBQWtCLEVBQUUsTUFBTSx3QkFBd0IsQ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FQUFFLEVBQUUseUJBQXlCLEVBQUUsQ0FBQyxDQUFDLENBaU16RTtZQUVhLHdCQUF3QjtZQWlCeEIsU0FBUztZQTJCVCxnQ0FBZ0M7WUE0QmhDLHVCQUF1QjtZQWdEdkIsZ0NBQWdDO1lBMEJoQyxvQkFBb0I7WUErQnBCLHdCQUF3QjtJQW9DdEM7O09BRUc7SUFDSCxPQUFPLENBQUMsTUFBTSxDQUFDLHNCQUFzQjtDQVN0QyJ9
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"public_processor.d.ts","sourceRoot":"","sources":["../../../src/public/public_processor/public_processor.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,YAAY,EAAkC,MAAM,yBAAyB,CAAC;AAIvF,OAAO,EAML,qBAAqB,EACtB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAGjE,OAAO,KAAK,EACV,yBAAyB,EACzB,qBAAqB,EACrB,wBAAwB,EACxB,eAAe,EAChB,MAAM,iCAAiC,CAAC;AAGzC,OAAO,EACL,KAAK,QAAQ,EACb,eAAe,EACf,yBAAyB,EACzB,KAAK,WAAW,EAEhB,EAAE,EAGH,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAEL,KAAK,eAAe,EACpB,KAAK,SAAS,EACd,KAAK,MAAM,EAGZ,MAAM,yBAAyB,CAAC;AAKjC,OAAO,EAAE,iBAAiB,EAAiB,MAAM,yBAAyB,CAAC;AAC3E,OAAO,EACL,KAAK,
|
|
1
|
+
{"version":3,"file":"public_processor.d.ts","sourceRoot":"","sources":["../../../src/public/public_processor/public_processor.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,YAAY,EAAkC,MAAM,yBAAyB,CAAC;AAIvF,OAAO,EAML,qBAAqB,EACtB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAGjE,OAAO,KAAK,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C,GAAG;IACX,OAAO,CAAC,IAAI;IAVd,OAAO,CAAC,OAAO,CAAyB;IAExC,YACY,eAAe,EAAE,eAAe,EAClC,iBAAiB,EAAE,2BAA2B,EAC5C,WAAW,EAAE,iBAAiB,EAC9B,iBAAiB,EAAE,0BAA0B,EAC/C,YAAY,EAAE,YAAY,EAClC,eAAe,GAAE,eAAsC,EAC/C,GAAG,yCAA6C,EAChD,IAAI,GAAE,IAAI,CAAC,eAAe,EAAE,4BAA4B,CAAM,EAGvE;IAED,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,CAiMzE;YAEa,wBAAwB;YAiBxB,SAAS;YA2BT,gCAAgC;YA4BhC,uBAAuB;YAgDvB,gCAAgC;YA0BhC,oBAAoB;YA+BpB,wBAAwB;IAoCtC;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,sBAAsB;CAStC"}
|
|
@@ -13,7 +13,7 @@ import { DateProvider, Timer, elapsed, executeTimeout } from '@aztec/foundation/
|
|
|
13
13
|
import { ProtocolContractAddress } from '@aztec/protocol-contracts';
|
|
14
14
|
import { ContractClassPublishedEvent } from '@aztec/protocol-contracts/class-registry';
|
|
15
15
|
import { computeFeePayerBalanceLeafSlot, computeFeePayerBalanceStorageSlot } from '@aztec/protocol-contracts/fee-juice';
|
|
16
|
-
import { AvmCircuitInputs, PublicDataWrite } from '@aztec/stdlib/avm';
|
|
16
|
+
import { AvmCircuitInputs, AvmExecutionHints, PublicDataWrite } from '@aztec/stdlib/avm';
|
|
17
17
|
import { computeTransactionFee } from '@aztec/stdlib/fees';
|
|
18
18
|
import { Gas } from '@aztec/stdlib/gas';
|
|
19
19
|
import { ProvingRequestType } from '@aztec/stdlib/proofs';
|
|
@@ -23,7 +23,7 @@ import { Attributes, getTelemetryClient, trackSpan } from '@aztec/telemetry-clie
|
|
|
23
23
|
import { ForkCheckpoint } from '@aztec/world-state/native';
|
|
24
24
|
import { AssertionError } from 'assert';
|
|
25
25
|
import { PublicContractsDB, PublicTreesDB } from '../public_db_sources.js';
|
|
26
|
-
import {
|
|
26
|
+
import { TelemetryCppPublicTxSimulator } from '../public_tx_simulator/index.js';
|
|
27
27
|
import { GuardedMerkleTreeOperations } from './guarded_merkle_tree.js';
|
|
28
28
|
import { PublicProcessorMetrics } from './public_processor_metrics.js';
|
|
29
29
|
/**
|
|
@@ -49,7 +49,7 @@ import { PublicProcessorMetrics } from './public_processor_metrics.js';
|
|
|
49
49
|
return new PublicProcessor(globalVariables, guardedFork, contractsDB, publicTxSimulator, this.dateProvider, this.telemetryClient);
|
|
50
50
|
}
|
|
51
51
|
createPublicTxSimulator(merkleTree, contractsDB, globalVariables, config) {
|
|
52
|
-
return new
|
|
52
|
+
return new TelemetryCppPublicTxSimulator(merkleTree, contractsDB, globalVariables, this.telemetryClient, config);
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
55
|
class PublicProcessorTimeoutError extends Error {
|
|
@@ -379,26 +379,27 @@ class PublicProcessorTimeoutError extends Error {
|
|
|
379
379
|
}
|
|
380
380
|
async processTxWithPublicCalls(tx) {
|
|
381
381
|
const timer = new Timer();
|
|
382
|
-
const
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
throw new Error('Avm proving result was not generated.');
|
|
386
|
-
}
|
|
382
|
+
const result = await this.publicTxSimulator.simulate(tx);
|
|
383
|
+
// TODO: use the callStackMetadata here to extract more data about public execution
|
|
384
|
+
const { hints, publicInputs, gasUsed, revertCode/*callStackMetadata*/ } = result;
|
|
387
385
|
const contractClassLogs = revertCode.isOK() ? tx.getContractClassLogs() : tx.getSplitContractClassLogs(false);
|
|
388
386
|
this.metrics.recordClassPublication(...contractClassLogs.filter((log)=>ContractClassPublishedEvent.isContractClassPublishedEvent(log)).map((log)=>ContractClassPublishedEvent.fromLog(log)));
|
|
389
387
|
// TODO(fcarreiro): remove phase count metric.
|
|
390
|
-
const phaseCount = 1;
|
|
391
388
|
const durationMs = timer.ms();
|
|
392
|
-
this.metrics.recordTx(phaseCount, durationMs, gasUsed.publicGas);
|
|
389
|
+
this.metrics.recordTx(/*phaseCount=*/ 1, durationMs, gasUsed.publicGas);
|
|
390
|
+
// Extract the return values from the call stack metadata.
|
|
391
|
+
const appLogicReturnValues = result.getAppLogicReturnValues();
|
|
392
|
+
// Extract the revert reason from the call stack metadata.
|
|
393
|
+
const revertReason = result.findRevertReason();
|
|
393
394
|
const processedTx = makeProcessedTxFromTxWithPublicCalls(tx, PublicProcessor.generateProvingRequest(publicInputs, hints), gasUsed, revertCode, revertReason);
|
|
394
395
|
return [
|
|
395
396
|
processedTx,
|
|
396
|
-
appLogicReturnValues
|
|
397
|
+
appLogicReturnValues
|
|
397
398
|
];
|
|
398
399
|
}
|
|
399
400
|
/**
|
|
400
401
|
* Generate the proving request for the AVM circuit.
|
|
401
|
-
*/ static generateProvingRequest(publicInputs, hints) {
|
|
402
|
+
*/ static generateProvingRequest(publicInputs, hints = AvmExecutionHints.empty()) {
|
|
402
403
|
return {
|
|
403
404
|
type: ProvingRequestType.PUBLIC_VM,
|
|
404
405
|
inputs: new AvmCircuitInputs(hints, publicInputs)
|
|
@@ -2,6 +2,7 @@ import { type Logger } from '@aztec/foundation/log';
|
|
|
2
2
|
import { type PublicSimulatorConfig, PublicTxResult } from '@aztec/stdlib/avm';
|
|
3
3
|
import type { MerkleTreeWriteOperations } from '@aztec/stdlib/trees';
|
|
4
4
|
import type { GlobalVariables, Tx } from '@aztec/stdlib/tx';
|
|
5
|
+
import { type TelemetryClient, type Tracer } from '@aztec/telemetry-client';
|
|
5
6
|
import type { ExecutorMetricsInterface } from '../executor_metrics_interface.js';
|
|
6
7
|
import type { PublicContractsDB } from '../public_db_sources.js';
|
|
7
8
|
import { PublicTxSimulator } from './public_tx_simulator.js';
|
|
@@ -10,9 +11,6 @@ import type { MeasuredPublicTxSimulatorInterface, PublicTxSimulatorInterface } f
|
|
|
10
11
|
* C++ implementation of PublicTxSimulator using the C++ simulator.
|
|
11
12
|
* The C++ simulator accesses the world state directly/natively within C++.
|
|
12
13
|
* For contract DB accesses, it makes callbacks through NAPI back to the TS PublicContractsDB cache.
|
|
13
|
-
*
|
|
14
|
-
* TODO(dbanks12): for now this still simulates first in TS to generate hints and public inputs,
|
|
15
|
-
* since the C++ simulator doesn't have hinting & PI generation logic yet.
|
|
16
14
|
*/
|
|
17
15
|
export declare class CppPublicTxSimulator extends PublicTxSimulator implements PublicTxSimulatorInterface {
|
|
18
16
|
protected log: Logger;
|
|
@@ -31,36 +29,10 @@ export declare class MeasuredCppPublicTxSimulator extends CppPublicTxSimulator i
|
|
|
31
29
|
simulate(tx: Tx, txLabel?: string): Promise<PublicTxResult>;
|
|
32
30
|
}
|
|
33
31
|
/**
|
|
34
|
-
* C++
|
|
35
|
-
* This implementation runs TS simulation first to collect all hints,
|
|
36
|
-
* then passes the complete AvmCircuitInputs (hints + public inputs)
|
|
37
|
-
* to C++ to run hinted simulation.
|
|
32
|
+
* A C++ public tx simulator that tracks runtime/production metrics with telemetry.
|
|
38
33
|
*/
|
|
39
|
-
export declare class
|
|
40
|
-
|
|
41
|
-
constructor(merkleTree: MerkleTreeWriteOperations, contractsDB: PublicContractsDB, globalVariables: GlobalVariables, config?: Partial<PublicSimulatorConfig>);
|
|
42
|
-
/**
|
|
43
|
-
* Simulate a transaction's public portion using the C++ vm2 simulator with hinted DBs.
|
|
44
|
-
*
|
|
45
|
-
* This implementation:
|
|
46
|
-
* 1. Runs the full TypeScript simulation to generate AvmCircuitInputs (hints + public inputs)
|
|
47
|
-
* 2. Passes the complete AvmCircuitInputs to C++ to run hinted simulation
|
|
48
|
-
*
|
|
49
|
-
* @param tx - The transaction to simulate.
|
|
50
|
-
* @returns The result of the transaction's public execution.
|
|
51
|
-
*/
|
|
52
|
-
simulate(tx: Tx): Promise<PublicTxResult>;
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
* Class to record metrics for simulation.
|
|
56
|
-
*
|
|
57
|
-
* Note(dbanks12): We might not be able to collect all the same metrics in C++ as we do in TS!
|
|
58
|
-
* Unless we move some of the metrics collection to C++, we don't have inner functions exposed
|
|
59
|
-
* to TS for tracking.
|
|
60
|
-
*/
|
|
61
|
-
export declare class MeasuredCppPublicTxSimulatorHintedDbs extends CppPublicTxSimulatorHintedDbs implements MeasuredPublicTxSimulatorInterface {
|
|
62
|
-
protected readonly metrics: ExecutorMetricsInterface;
|
|
63
|
-
constructor(merkleTree: MerkleTreeWriteOperations, contractsDB: PublicContractsDB, globalVariables: GlobalVariables, metrics: ExecutorMetricsInterface, config?: Partial<PublicSimulatorConfig>);
|
|
64
|
-
simulate(tx: Tx, txLabel?: string): Promise<PublicTxResult>;
|
|
34
|
+
export declare class TelemetryCppPublicTxSimulator extends MeasuredCppPublicTxSimulator {
|
|
35
|
+
readonly tracer: Tracer;
|
|
36
|
+
constructor(merkleTree: MerkleTreeWriteOperations, contractsDB: PublicContractsDB, globalVariables: GlobalVariables, telemetryClient?: TelemetryClient, config?: Partial<PublicSimulatorConfig>);
|
|
65
37
|
}
|
|
66
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
38
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY3BwX3B1YmxpY190eF9zaW11bGF0b3IuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9wdWJsaWMvcHVibGljX3R4X3NpbXVsYXRvci9jcHBfcHVibGljX3R4X3NpbXVsYXRvci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsS0FBSyxNQUFN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QVcsa0NBQWtDO0lBS2hILFNBQVMsQ0FBQyxRQUFRLENBQUMsT0FBTyxFQUFFLHdCQUF3QjtJQUp0RCxZQUNFLFVBQVUsRUFBRSx5QkFBeUIsRUFDckMsV0FBVyxFQUFFLGlCQUFpQixFQUM5QixlQUFlLEVBQUUsZUFBZSxFQUNiLE9BQU8sRUFBRSx3QkFBd0IsRUFDcEQsTUFBTSxDQUFDLEVBQUUsT0FBTyxDQUFDLHFCQUFxQixDQUFDLEVBR3hDO0lBRXFCLFFBQVEsQ0FBQyxFQUFFLEVBQUUsRUFBRSxFQUFFLE9BQU8sR0FBRSxNQUFzQixHQUFHLE9BQU8sQ0FBQyxjQUFjLENBQUMsQ0FTL0Y7Q0FDRjtBQUVEOztHQUVHO0FBQ0gscUJBQWEsNkJBQThCLFNBQVEsNEJBQTRCO0lBRTdFLFNBQWdCLE1BQU0sRUFBRSxNQUFNLENBQUM7SUFFL0IsWUFDRSxVQUFVLEVBQUUseUJBQXlCLEVBQ3JDLFdBQVcsRUFBRSxpQkFBaUIsRUFDOUIsZUFBZSxFQUFFLGVBQWUsRUFDaEMsZUFBZSxHQUFFLGVBQXNDLEVBQ3ZELE1BQU0sQ0FBQyxFQUFFLE9BQU8sQ0FBQyxxQkFBcUIsQ0FBQyxFQUt4QztDQUNGIn0=
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cpp_public_tx_simulator.d.ts","sourceRoot":"","sources":["../../../src/public/public_tx_simulator/cpp_public_tx_simulator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,MAAM,
|
|
1
|
+
{"version":3,"file":"cpp_public_tx_simulator.d.ts","sourceRoot":"","sources":["../../../src/public/public_tx_simulator/cpp_public_tx_simulator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,MAAM,EAA0B,MAAM,uBAAuB,CAAC;AAG5E,OAAO,EAGL,KAAK,qBAAqB,EAC1B,cAAc,EAEf,MAAM,mBAAmB,CAAC;AAE3B,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AM,EAAE,MAAM,CAAC;IAE/B,YACE,UAAU,EAAE,yBAAyB,EACrC,WAAW,EAAE,iBAAiB,EAC9B,eAAe,EAAE,eAAe,EAChC,eAAe,GAAE,eAAsC,EACvD,MAAM,CAAC,EAAE,OAAO,CAAC,qBAAqB,CAAC,EAKxC;CACF"}
|
|
@@ -1,20 +1,18 @@
|
|
|
1
|
-
import { createLogger } from '@aztec/foundation/log';
|
|
2
|
-
import {
|
|
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 {
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
56
|
+
this.log.trace(`Deserializing C++ from buffer (size: ${resultBuffer.length})...`);
|
|
85
57
|
const cppResultJSON = deserializeFromMessagePack(resultBuffer);
|
|
86
|
-
|
|
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.
|
|
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: !
|
|
108
|
-
|
|
109
|
-
cppGasUsed: tsResult.gasUsed.totalGas.l2Gas
|
|
62
|
+
reverted: !cppResult.revertCode.isOK(),
|
|
63
|
+
cppGasUsed: cppResult.gasUsed.totalGas.l2Gas
|
|
110
64
|
});
|
|
111
|
-
|
|
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++
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
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,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY3BwX3B1YmxpY190eF9zaW11bGF0b3Jfd2l0aF9oaW50ZWRfZGJzLmQudHMiLC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ozs7T0FTRztJQUNtQixRQUFRLENBQUMsRUFBRSxFQUFFLEVBQUUsR0FBRyxPQUFPLENBQUMsY0FBYyxDQUFDLENBOEM5RDtDQUNGO0FBRUQ7Ozs7OztHQU1HO0FBQ0gscUJBQWEscUNBQ1gsU0FBUSw2QkFDUixZQUFXLGtDQUFrQztJQU0zQyxTQUFTLENBQUMsUUFBUSxDQUFDLE9BQU8sRUFBRSx3QkFBd0I7SUFKdEQsWUFDRSxVQUFVLEVBQUUseUJBQXlCLEVBQ3JDLFdBQVcsRUFBRSxpQkFBaUIsRUFDOUIsZUFBZSxFQUFFLGVBQWUsRUFDYixPQUFPLEVBQUUsd0JBQXdCLEVBQ3BELE1BQU0sQ0FBQyxFQUFFLE9BQU8sQ0FBQyxxQkFBcUIsQ0FBQyxFQUd4QztJQUVxQixRQUFRLENBQUMsRUFBRSxFQUFFLEVBQUUsRUFBRSxPQUFPLEdBQUUsTUFBc0IsR0FBRyxPQUFPLENBQUMsY0FBYyxDQUFDLENBUy9GO0NBQ0YifQ==
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cpp_public_tx_simulator_with_hinted_dbs.d.ts","sourceRoot":"","sources":["../../../src/public/public_tx_simulator/cpp_public_tx_simulator_with_hinted_dbs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,MAAM,EAA0B,MAAM,uBAAuB,CAAC;AAE5E,OAAO,EAEL,KAAK,qBAAqB,EAC1B,cAAc,EAEf,MAAM,mBAAmB,CAAC;AAE3B,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;AACrE,OAAO,KAAK,EAAE,eAAe,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AAI5D,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AACjF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AACjE,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,KAAK,EACV,kCAAkC,EAClC,0BAA0B,EAC3B,MAAM,oCAAoC,CAAC;AAE5C;;;;;GAKG;AACH,qBAAa,6BAA8B,SAAQ,iBAAkB,YAAW,0BAA0B;IACxG,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;;;;;;;;;OASG;IACmB,QAAQ,CAAC,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,cAAc,CAAC,CA8C9D;CACF;AAED;;;;;;GAMG;AACH,qBAAa,qCACX,SAAQ,6BACR,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,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,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY3BwX3ZzX3RzX3B1YmxpY190eF9zaW11bGF0b3IuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9wdWJsaWMvcHVibGljX3R4X3NpbXVsYXRvci9jcHBfdnNfdHNfcHVibGljX3R4X3NpbXVsYXRvci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsS0FBSyxNQUFNLEVBQTBCLE1BQU0sdUJBQXVCLENBQUM7QUFJNUUsT0FBTyxFQUdMLEtBQUsscUJBQXFCLEVBQzFCLGNBQWMsRUFFZixNQUFNLG1CQUFtQixDQUFDO0FBRTNCLE9BQU8sS0FBSyxFQUFFLHlCQUF5QixFQUFFLE1BQU0scUJBQXFCLENBQUM7QUFDckUsT0FBTyxLQUFLLEVBQUUsZUFBZSxFQUFrQixFQUFFLEVBQUUsTUFBTSxrQkFBa0IsQ0FBQztBQUs1RSxPQUFPLEtBQUssRUFBRSx3QkFBd0IsRUFBRSxNQUFNLGtDQUFrQyxDQUFDO0FBQ2pGLE9BQU8sS0FBSyxFQUFFLGlCQUFpQixFQUFFLE1BQU0seUJBQXlCLENBQUM7QUFFakUsT0FBTyxFQUFFLGlCQUFpQixFQUFFLE1BQU0sMEJBQTBCLENBQUM7QUFDN0QsT0FBTyxLQUFLLEVBQ1Ysa0NBQWtDLEVBQ2xDLDBCQUEwQixFQUMzQixNQUFNLG9DQUFvQyxDQUFDO0FBRTVDOzs7O0dBSUc7QUFDSCxxQkFBYSx3QkFBeUIsU0FBUSxpQkFBa0IsWUFBVywwQkFBMEI7SUFDbkcsVUFBbUIsR0FBRyxFQUFFLE1BQU0sQ0FBQztJQUUvQixZQUNFLFVBQVUsRUFBRSx5QkFBeUIsRUFDckMsV0FBVyxFQUFFLGlCQUFpQixFQUM5QixlQUFlLEVBQUUsZUFBZSxFQUNoQyxNQUFNLENBQUMsRUFBRSxPQUFPLENBQUMscUJBQXFCLENBQUMsRUFJeEM7SUFFRDs7Ozs7T0FLRztJQUNtQixRQUFRLENBQUMsRUFBRSxFQUFFLEVBQUUsR0FBRyxPQUFPLENBQUMsY0FBYyxDQUFDLENBaUs5RDtDQUNGO0FBRUQscUJBQWEsZ0NBQ1gsU0FBUSx3QkFDUixZQUFXLGtDQUFrQztJQU0zQyxTQUFTLENBQUMsUUFBUSxDQUFDLE9BQU8sRUFBRSx3QkFBd0I7SUFKdEQsWUFDRSxVQUFVLEVBQUUseUJBQXlCLEVBQ3JDLFdBQVcsRUFBRSxpQkFBaUIsRUFDOUIsZUFBZSxFQUFFLGVBQWUsRUFDYixPQUFPLEVBQUUsd0JBQXdCLEVBQ3BELE1BQU0sQ0FBQyxFQUFFLE9BQU8sQ0FBQyxxQkFBcUIsQ0FBQyxFQUd4QztJQUVxQixRQUFRLENBQUMsRUFBRSxFQUFFLEVBQUUsRUFBRSxPQUFPLEdBQUUsTUFBc0IsR0FBRyxPQUFPLENBQUMsY0FBYyxDQUFDLENBUy9GO0NBQ0YifQ==
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cpp_vs_ts_public_tx_simulator.d.ts","sourceRoot":"","sources":["../../../src/public/public_tx_simulator/cpp_vs_ts_public_tx_simulator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,MAAM,EAA0B,MAAM,uBAAuB,CAAC;AAI5E,OAAO,EAGL,KAAK,qBAAqB,EA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