@aztec/simulator 0.0.1-commit.03f7ef2 → 0.0.1-commit.1142ef1
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/private/circuit_recording/circuit_recorder.d.ts +1 -1
- package/dest/private/circuit_recording/circuit_recorder.d.ts.map +1 -1
- package/dest/private/circuit_recording/circuit_recorder.js +15 -14
- package/dest/public/avm/opcodes/accrued_substate.js +1 -1
- package/dest/public/avm/opcodes/environment_getters.d.ts +3 -3
- package/dest/public/avm/opcodes/environment_getters.d.ts.map +1 -1
- package/dest/public/avm/opcodes/environment_getters.js +2 -2
- package/dest/public/avm/opcodes/external_calls.d.ts +1 -1
- package/dest/public/avm/opcodes/external_calls.d.ts.map +1 -1
- package/dest/public/avm/opcodes/external_calls.js +1 -0
- package/dest/public/executor_metrics.d.ts +1 -1
- package/dest/public/executor_metrics.d.ts.map +1 -1
- package/dest/public/executor_metrics.js +8 -34
- package/dest/public/fixtures/bulk_test.js +1 -17
- package/dest/public/fuzzing/avm_simulator_bin.js +14 -3
- package/dest/public/hinting_db_sources.js +3 -1
- package/dest/public/public_processor/guarded_merkle_tree.js +3 -1
- package/dest/public/public_processor/public_processor.js +399 -20
- package/dest/public/public_processor/public_processor_metrics.d.ts +1 -1
- package/dest/public/public_processor/public_processor_metrics.d.ts.map +1 -1
- package/dest/public/public_processor/public_processor_metrics.js +12 -45
- package/dest/public/public_tx_simulator/cpp_public_tx_simulator.d.ts +1 -1
- 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 +1 -1
- package/dest/public/public_tx_simulator/telemetry_public_tx_simulator.js +395 -19
- package/package.json +16 -16
- package/src/private/circuit_recording/circuit_recorder.ts +16 -15
- package/src/public/avm/opcodes/accrued_substate.ts +1 -1
- package/src/public/avm/opcodes/environment_getters.ts +4 -4
- package/src/public/avm/opcodes/external_calls.ts +1 -0
- package/src/public/executor_metrics.ts +7 -34
- package/src/public/fixtures/bulk_test.ts +2 -2
- package/src/public/fuzzing/avm_simulator_bin.ts +17 -4
- package/src/public/public_processor/public_processor_metrics.ts +11 -45
- package/src/public/public_tx_simulator/cpp_public_tx_simulator.ts +8 -1
|
@@ -118,7 +118,7 @@ export async function megaBulkTest(
|
|
|
118
118
|
const argsField2 = [5, 2, 3, 4, 5, 6, 7, 8, 9, 10].map(x => new Fr(x));
|
|
119
119
|
const argsField3 = [7, 2, 3, 4, 5, 6, 7, 8, 9, 10].map(x => new Fr(x));
|
|
120
120
|
const argsField4 = [9, 2, 3, 4, 5, 6, 7, 8, 9, 10].map(x => new Fr(x));
|
|
121
|
-
const argsField5 = [11, 2, 3, 4, 5, 6, 7, 8, 9, 10].map(x => new Fr(x));
|
|
121
|
+
//const argsField5 = [11, 2, 3, 4, 5, 6, 7, 8, 9, 10].map(x => new Fr(x));
|
|
122
122
|
//const argsField6 = [13, 2, 3, 4, 5, 6, 7, 8, 9, 10].map(x => new Fr(x));
|
|
123
123
|
//const argsField7 = [15, 2, 3, 4, 5, 6, 7, 8, 9, 10].map(x => new Fr(x));
|
|
124
124
|
//const argsField8 = [17, 2, 3, 4, 5, 6, 7, 8, 9, 10].map(x => new Fr(x));
|
|
@@ -144,7 +144,7 @@ export async function megaBulkTest(
|
|
|
144
144
|
{ address: avmTestContract.address, fnName: 'bulk_testing', args: genArgs(argsField2) },
|
|
145
145
|
{ address: avmTestContract.address, fnName: 'bulk_testing', args: genArgs(argsField3) },
|
|
146
146
|
{ address: avmTestContract.address, fnName: 'bulk_testing', args: genArgs(argsField4) },
|
|
147
|
-
{ address: avmTestContract.address, fnName: 'bulk_testing', args: genArgs(argsField5) },
|
|
147
|
+
//{ address: avmTestContract.address, fnName: 'bulk_testing', args: genArgs(argsField5) },
|
|
148
148
|
//{ address: avmTestContract.address, fnName: 'bulk_testing', args: genArgs(argsField6) },
|
|
149
149
|
//{ address: avmTestContract.address, fnName: 'bulk_testing', args: genArgs(argsField7) },
|
|
150
150
|
//{ address: avmTestContract.address, fnName: 'bulk_testing', args: genArgs(argsField8) },
|
|
@@ -9,11 +9,23 @@ import {
|
|
|
9
9
|
import { GlobalVariables, TreeSnapshots } from '@aztec/stdlib/tx';
|
|
10
10
|
import { NativeWorldStateService } from '@aztec/world-state';
|
|
11
11
|
|
|
12
|
-
import { writeSync } from 'fs';
|
|
13
12
|
import { createInterface } from 'readline';
|
|
14
13
|
|
|
15
14
|
import { AvmFuzzerSimulator, FuzzerSimulationRequest } from './avm_fuzzer_simulator.js';
|
|
16
15
|
|
|
16
|
+
/** Write data to stdout, letting Node handle buffering. */
|
|
17
|
+
function writeOutput(data: string): Promise<void> {
|
|
18
|
+
return new Promise<void>((resolve, reject) => {
|
|
19
|
+
process.stdout.write(data, err => {
|
|
20
|
+
if (err) {
|
|
21
|
+
reject(err);
|
|
22
|
+
} else {
|
|
23
|
+
resolve();
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
|
|
17
29
|
// This cache holds opened world states to avoid reopening them for each invocation.
|
|
18
30
|
// It's a map so that in the future we could support multiple world states (if we had multiple fuzzers).
|
|
19
31
|
const worldStateCache = new Map<string, NativeWorldStateService>();
|
|
@@ -96,16 +108,17 @@ async function execute(base64Line: string): Promise<void> {
|
|
|
96
108
|
revertReason: result.revertReason ?? '',
|
|
97
109
|
endTreeSnapshots: result.publicInputs.endTreeSnapshots,
|
|
98
110
|
});
|
|
99
|
-
|
|
111
|
+
const base64Response = resultBuffer.toString('base64') + '\n';
|
|
112
|
+
await writeOutput(base64Response);
|
|
100
113
|
} catch (error: any) {
|
|
101
114
|
// If we error, treat as reverted
|
|
102
115
|
const errorResult = serializeWithMessagePack({
|
|
103
116
|
reverted: true,
|
|
104
|
-
output: [] as
|
|
117
|
+
output: [] as Fr[],
|
|
105
118
|
revertReason: `Unexpected Error ${error.message}`,
|
|
106
119
|
endTreeSnapshots: TreeSnapshots.empty(),
|
|
107
120
|
});
|
|
108
|
-
|
|
121
|
+
await writeOutput(errorResult.toString('base64') + '\n');
|
|
109
122
|
}
|
|
110
123
|
}
|
|
111
124
|
|
|
@@ -9,7 +9,6 @@ import {
|
|
|
9
9
|
type TelemetryClient,
|
|
10
10
|
type Tracer,
|
|
11
11
|
type UpDownCounter,
|
|
12
|
-
ValueType,
|
|
13
12
|
} from '@aztec/telemetry-client';
|
|
14
13
|
|
|
15
14
|
export class PublicProcessorMetrics {
|
|
@@ -34,60 +33,27 @@ export class PublicProcessorMetrics {
|
|
|
34
33
|
this.tracer = client.getTracer(name);
|
|
35
34
|
const meter = client.getMeter(name);
|
|
36
35
|
|
|
37
|
-
this.txDuration = meter.createHistogram(Metrics.PUBLIC_PROCESSOR_TX_DURATION
|
|
38
|
-
description: 'How long it takes to process a transaction',
|
|
39
|
-
unit: 'ms',
|
|
40
|
-
valueType: ValueType.INT,
|
|
41
|
-
});
|
|
36
|
+
this.txDuration = meter.createHistogram(Metrics.PUBLIC_PROCESSOR_TX_DURATION);
|
|
42
37
|
|
|
43
|
-
this.txCount = meter.createUpDownCounter(Metrics.PUBLIC_PROCESSOR_TX_COUNT
|
|
44
|
-
description: 'Number of transactions processed',
|
|
45
|
-
});
|
|
38
|
+
this.txCount = meter.createUpDownCounter(Metrics.PUBLIC_PROCESSOR_TX_COUNT);
|
|
46
39
|
|
|
47
|
-
this.txPhaseCount = meter.createUpDownCounter(Metrics.PUBLIC_PROCESSOR_TX_PHASE_COUNT
|
|
48
|
-
description: 'Number of phases processed',
|
|
49
|
-
});
|
|
40
|
+
this.txPhaseCount = meter.createUpDownCounter(Metrics.PUBLIC_PROCESSOR_TX_PHASE_COUNT);
|
|
50
41
|
|
|
51
|
-
this.phaseDuration = meter.createHistogram(Metrics.PUBLIC_PROCESSOR_PHASE_DURATION
|
|
52
|
-
description: 'How long it takes to process a phase',
|
|
53
|
-
unit: 'ms',
|
|
54
|
-
valueType: ValueType.INT,
|
|
55
|
-
});
|
|
42
|
+
this.phaseDuration = meter.createHistogram(Metrics.PUBLIC_PROCESSOR_PHASE_DURATION);
|
|
56
43
|
|
|
57
|
-
this.phaseCount = meter.createUpDownCounter(Metrics.PUBLIC_PROCESSOR_PHASE_COUNT
|
|
58
|
-
description: 'Number of failed phases',
|
|
59
|
-
});
|
|
44
|
+
this.phaseCount = meter.createUpDownCounter(Metrics.PUBLIC_PROCESSOR_PHASE_COUNT);
|
|
60
45
|
|
|
61
|
-
this.bytecodeDeployed = meter.createHistogram(Metrics.PUBLIC_PROCESSOR_DEPLOY_BYTECODE_SIZE
|
|
62
|
-
description: 'Size of deployed bytecode',
|
|
63
|
-
unit: 'By',
|
|
64
|
-
});
|
|
46
|
+
this.bytecodeDeployed = meter.createHistogram(Metrics.PUBLIC_PROCESSOR_DEPLOY_BYTECODE_SIZE);
|
|
65
47
|
|
|
66
|
-
this.totalGas = meter.createGauge(Metrics.PUBLIC_PROCESSOR_TOTAL_GAS
|
|
67
|
-
description: 'Total gas used in block',
|
|
68
|
-
unit: 'gas',
|
|
69
|
-
});
|
|
48
|
+
this.totalGas = meter.createGauge(Metrics.PUBLIC_PROCESSOR_TOTAL_GAS);
|
|
70
49
|
|
|
71
|
-
this.totalGasHistogram = meter.createHistogram(Metrics.PUBLIC_PROCESSOR_TOTAL_GAS_HISTOGRAM
|
|
72
|
-
description: 'Total gas used in block as histogram',
|
|
73
|
-
unit: 'gas/block',
|
|
74
|
-
});
|
|
50
|
+
this.totalGasHistogram = meter.createHistogram(Metrics.PUBLIC_PROCESSOR_TOTAL_GAS_HISTOGRAM);
|
|
75
51
|
|
|
76
|
-
this.txGas = meter.createHistogram(Metrics.PUBLIC_PROCESSOR_TX_GAS
|
|
77
|
-
description: 'Gas used in transaction',
|
|
78
|
-
unit: 'gas/tx',
|
|
79
|
-
});
|
|
52
|
+
this.txGas = meter.createHistogram(Metrics.PUBLIC_PROCESSOR_TX_GAS);
|
|
80
53
|
|
|
81
|
-
this.gasRate = meter.createHistogram(Metrics.PUBLIC_PROCESSOR_GAS_RATE
|
|
82
|
-
description: 'L2 gas per second for complete block',
|
|
83
|
-
unit: 'gas/s',
|
|
84
|
-
});
|
|
54
|
+
this.gasRate = meter.createHistogram(Metrics.PUBLIC_PROCESSOR_GAS_RATE);
|
|
85
55
|
|
|
86
|
-
this.treeInsertionDuration = meter.createHistogram(Metrics.PUBLIC_PROCESSOR_TREE_INSERTION
|
|
87
|
-
description: 'How long it takes for tree insertion',
|
|
88
|
-
unit: 'us',
|
|
89
|
-
valueType: ValueType.INT,
|
|
90
|
-
});
|
|
56
|
+
this.treeInsertionDuration = meter.createHistogram(Metrics.PUBLIC_PROCESSOR_TREE_INSERTION);
|
|
91
57
|
}
|
|
92
58
|
|
|
93
59
|
recordPhaseDuration(phaseName: TxExecutionPhase, durationMs: number) {
|
|
@@ -95,7 +95,14 @@ export class CppPublicTxSimulator extends PublicTxSimulator implements PublicTxS
|
|
|
95
95
|
|
|
96
96
|
// Store the promise so cancel() can wait for it
|
|
97
97
|
this.log.debug(`Calling C++ simulator for tx ${txHash}`);
|
|
98
|
-
this.simulationPromise = avmSimulate(
|
|
98
|
+
this.simulationPromise = avmSimulate(
|
|
99
|
+
inputBuffer,
|
|
100
|
+
contractProvider,
|
|
101
|
+
wsCppHandle,
|
|
102
|
+
logLevel,
|
|
103
|
+
this.log,
|
|
104
|
+
this.cancellationToken,
|
|
105
|
+
);
|
|
99
106
|
|
|
100
107
|
let resultBuffer: Buffer;
|
|
101
108
|
try {
|