@aztec/simulator 0.86.0-nightly.20250430 → 0.86.0-nightly.20250501
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/opcodes/external_calls.d.ts +4 -4
- package/dest/public/avm/opcodes/external_calls.d.ts.map +1 -1
- package/dest/public/avm/opcodes/external_calls.js +12 -12
- package/dest/public/executor_metrics.d.ts +3 -3
- package/dest/public/executor_metrics.d.ts.map +1 -1
- package/dest/public/executor_metrics.js +6 -6
- package/dest/public/executor_metrics_interface.d.ts +1 -1
- package/dest/public/executor_metrics_interface.d.ts.map +1 -1
- package/dest/public/fixtures/public_tx_simulation_tester.js +2 -2
- package/dest/public/public_tx_simulator/apps_tests/amm_test.js +5 -5
- package/dest/public/public_tx_simulator/apps_tests/token_test.js +6 -6
- package/dest/public/test_executor_metrics.d.ts +5 -4
- package/dest/public/test_executor_metrics.d.ts.map +1 -1
- package/dest/public/test_executor_metrics.js +47 -11
- package/package.json +15 -15
- package/src/public/avm/opcodes/external_calls.ts +6 -6
- package/src/public/executor_metrics.ts +11 -6
- package/src/public/executor_metrics_interface.ts +1 -1
- package/src/public/fixtures/public_tx_simulation_tester.ts +2 -2
- package/src/public/public_tx_simulator/apps_tests/amm_test.ts +5 -5
- package/src/public/public_tx_simulator/apps_tests/token_test.ts +6 -6
- package/src/public/test_executor_metrics.ts +60 -13
|
@@ -34,24 +34,24 @@ export declare class SuccessCopy extends Instruction {
|
|
|
34
34
|
}
|
|
35
35
|
export declare class Return extends Instruction {
|
|
36
36
|
private indirect;
|
|
37
|
-
private returnOffset;
|
|
38
37
|
private returnSizeOffset;
|
|
38
|
+
private returnOffset;
|
|
39
39
|
static type: string;
|
|
40
40
|
static readonly opcode: Opcode;
|
|
41
41
|
static readonly wireFormat: OperandType[];
|
|
42
|
-
constructor(indirect: number,
|
|
42
|
+
constructor(indirect: number, returnSizeOffset: number, returnOffset: number);
|
|
43
43
|
execute(context: AvmContext): Promise<void>;
|
|
44
44
|
handlesPC(): boolean;
|
|
45
45
|
}
|
|
46
46
|
export declare class Revert extends Instruction {
|
|
47
47
|
private indirect;
|
|
48
|
-
private returnOffset;
|
|
49
48
|
private retSizeOffset;
|
|
49
|
+
private returnOffset;
|
|
50
50
|
static type: string;
|
|
51
51
|
static readonly opcode: Opcode;
|
|
52
52
|
static readonly wireFormat8: OperandType[];
|
|
53
53
|
static readonly wireFormat16: OperandType[];
|
|
54
|
-
constructor(indirect: number,
|
|
54
|
+
constructor(indirect: number, retSizeOffset: number, returnOffset: number);
|
|
55
55
|
execute(context: AvmContext): Promise<void>;
|
|
56
56
|
handlesPC(): boolean;
|
|
57
57
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"external_calls.d.ts","sourceRoot":"","sources":["../../../../src/public/avm/opcodes/external_calls.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAGpD,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,+CAA+C,CAAC;AAEpF,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,uBAAe,YAAa,SAAQ,WAAW;IAa3C,OAAO,CAAC,QAAQ;IAChB,OAAO,CAAC,WAAW;IACnB,OAAO,CAAC,WAAW;IACnB,OAAO,CAAC,UAAU;IAClB,OAAO,CAAC,UAAU;IAClB,OAAO,CAAC,cAAc;IAhBxB,MAAM,CAAC,QAAQ,CAAC,UAAU,EAAE,WAAW,EAAE,CAQvC;gBAGQ,QAAQ,EAAE,MAAM,EAChB,WAAW,EAAE,MAAM,EACnB,WAAW,EAAE,MAAM,EACnB,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,MAAM,EAClB,cAAc,EAAE,MAAM;IAKnB,OAAO,CAAC,OAAO,EAAE,UAAU;IA0ExC,aAA6B,IAAI,IAAI,MAAM,GAAG,YAAY,CAAC;CAC5D;AAED,qBAAa,IAAK,SAAQ,YAAY;IACpC,MAAM,CAAC,IAAI,SAAmB;IAC9B,MAAM,CAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAe;IAE7C,IAAW,IAAI,WAEd;CACF;AAED,qBAAa,UAAW,SAAQ,YAAY;IAC1C,MAAM,CAAC,IAAI,eAAyB;IACpC,MAAM,CAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAqB;IAEnD,IAAW,IAAI,iBAEd;CACF;AAED,qBAAa,WAAY,SAAQ,WAAW;IAU9B,OAAO,CAAC,QAAQ;IAAU,OAAO,CAAC,SAAS;IATvD,MAAM,CAAC,IAAI,EAAE,MAAM,CAAiB;IACpC,MAAM,CAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAsB;IAEpD,MAAM,CAAC,QAAQ,CAAC,UAAU,EAAE,WAAW,EAAE,CAIvC;gBAEkB,QAAQ,EAAE,MAAM,EAAU,SAAS,EAAE,MAAM;IAIlD,OAAO,CAAC,OAAO,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC;CAazD;AAED,qBAAa,MAAO,SAAQ,WAAW;IAWzB,OAAO,CAAC,QAAQ;IAAU,OAAO,CAAC,
|
|
1
|
+
{"version":3,"file":"external_calls.d.ts","sourceRoot":"","sources":["../../../../src/public/avm/opcodes/external_calls.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAGpD,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,+CAA+C,CAAC;AAEpF,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,uBAAe,YAAa,SAAQ,WAAW;IAa3C,OAAO,CAAC,QAAQ;IAChB,OAAO,CAAC,WAAW;IACnB,OAAO,CAAC,WAAW;IACnB,OAAO,CAAC,UAAU;IAClB,OAAO,CAAC,UAAU;IAClB,OAAO,CAAC,cAAc;IAhBxB,MAAM,CAAC,QAAQ,CAAC,UAAU,EAAE,WAAW,EAAE,CAQvC;gBAGQ,QAAQ,EAAE,MAAM,EAChB,WAAW,EAAE,MAAM,EACnB,WAAW,EAAE,MAAM,EACnB,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,MAAM,EAClB,cAAc,EAAE,MAAM;IAKnB,OAAO,CAAC,OAAO,EAAE,UAAU;IA0ExC,aAA6B,IAAI,IAAI,MAAM,GAAG,YAAY,CAAC;CAC5D;AAED,qBAAa,IAAK,SAAQ,YAAY;IACpC,MAAM,CAAC,IAAI,SAAmB;IAC9B,MAAM,CAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAe;IAE7C,IAAW,IAAI,WAEd;CACF;AAED,qBAAa,UAAW,SAAQ,YAAY;IAC1C,MAAM,CAAC,IAAI,eAAyB;IACpC,MAAM,CAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAqB;IAEnD,IAAW,IAAI,iBAEd;CACF;AAED,qBAAa,WAAY,SAAQ,WAAW;IAU9B,OAAO,CAAC,QAAQ;IAAU,OAAO,CAAC,SAAS;IATvD,MAAM,CAAC,IAAI,EAAE,MAAM,CAAiB;IACpC,MAAM,CAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAsB;IAEpD,MAAM,CAAC,QAAQ,CAAC,UAAU,EAAE,WAAW,EAAE,CAIvC;gBAEkB,QAAQ,EAAE,MAAM,EAAU,SAAS,EAAE,MAAM;IAIlD,OAAO,CAAC,OAAO,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC;CAazD;AAED,qBAAa,MAAO,SAAQ,WAAW;IAWzB,OAAO,CAAC,QAAQ;IAAU,OAAO,CAAC,gBAAgB;IAAU,OAAO,CAAC,YAAY;IAV5F,MAAM,CAAC,IAAI,EAAE,MAAM,CAAY;IAC/B,MAAM,CAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAiB;IAE/C,MAAM,CAAC,QAAQ,CAAC,UAAU,EAAE,WAAW,EAAE,CAKvC;gBAEkB,QAAQ,EAAE,MAAM,EAAU,gBAAgB,EAAE,MAAM,EAAU,YAAY,EAAE,MAAM;IAIvF,OAAO,CAAC,OAAO,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC;IAgBxC,SAAS,IAAI,OAAO;CAGrC;AAED,qBAAa,MAAO,SAAQ,WAAW;IAiBzB,OAAO,CAAC,QAAQ;IAAU,OAAO,CAAC,aAAa;IAAU,OAAO,CAAC,YAAY;IAhBzF,MAAM,CAAC,IAAI,EAAE,MAAM,CAAY;IAC/B,MAAM,CAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAmB;IAEjD,MAAM,CAAC,QAAQ,CAAC,WAAW,EAAE,WAAW,EAAE,CAKxC;IACF,MAAM,CAAC,QAAQ,CAAC,YAAY,EAAE,WAAW,EAAE,CAKzC;gBAEkB,QAAQ,EAAE,MAAM,EAAU,aAAa,EAAE,MAAM,EAAU,YAAY,EAAE,MAAM;IAIpF,OAAO,CAAC,OAAO,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC;IAiBxC,SAAS,IAAI,OAAO;CAGrC"}
|
|
@@ -133,8 +133,8 @@ export class SuccessCopy extends Instruction {
|
|
|
133
133
|
}
|
|
134
134
|
export class Return extends Instruction {
|
|
135
135
|
indirect;
|
|
136
|
-
returnOffset;
|
|
137
136
|
returnSizeOffset;
|
|
137
|
+
returnOffset;
|
|
138
138
|
static type = 'RETURN';
|
|
139
139
|
static opcode = Opcode.RETURN;
|
|
140
140
|
// Informs (de)serialization. See Instruction.deserialize.
|
|
@@ -144,17 +144,17 @@ export class Return extends Instruction {
|
|
|
144
144
|
OperandType.UINT16,
|
|
145
145
|
OperandType.UINT16
|
|
146
146
|
];
|
|
147
|
-
constructor(indirect,
|
|
148
|
-
super(), this.indirect = indirect, this.
|
|
147
|
+
constructor(indirect, returnSizeOffset, returnOffset){
|
|
148
|
+
super(), this.indirect = indirect, this.returnSizeOffset = returnSizeOffset, this.returnOffset = returnOffset;
|
|
149
149
|
}
|
|
150
150
|
async execute(context) {
|
|
151
151
|
const memory = context.machineState.memory;
|
|
152
152
|
const operands = [
|
|
153
|
-
this.
|
|
154
|
-
this.
|
|
153
|
+
this.returnSizeOffset,
|
|
154
|
+
this.returnOffset
|
|
155
155
|
];
|
|
156
156
|
const addressing = Addressing.fromWire(this.indirect, operands.length);
|
|
157
|
-
const [
|
|
157
|
+
const [returnSizeOffset, returnOffset] = addressing.resolve(operands, memory);
|
|
158
158
|
memory.checkTag(TypeTag.UINT32, returnSizeOffset);
|
|
159
159
|
const returnSize = memory.get(returnSizeOffset).toNumber();
|
|
160
160
|
context.machineState.consumeGas(this.gasCost(returnSize));
|
|
@@ -167,8 +167,8 @@ export class Return extends Instruction {
|
|
|
167
167
|
}
|
|
168
168
|
export class Revert extends Instruction {
|
|
169
169
|
indirect;
|
|
170
|
-
returnOffset;
|
|
171
170
|
retSizeOffset;
|
|
171
|
+
returnOffset;
|
|
172
172
|
static type = 'REVERT';
|
|
173
173
|
static opcode = Opcode.REVERT_8;
|
|
174
174
|
static wireFormat8 = [
|
|
@@ -183,17 +183,17 @@ export class Revert extends Instruction {
|
|
|
183
183
|
OperandType.UINT16,
|
|
184
184
|
OperandType.UINT16
|
|
185
185
|
];
|
|
186
|
-
constructor(indirect,
|
|
187
|
-
super(), this.indirect = indirect, this.
|
|
186
|
+
constructor(indirect, retSizeOffset, returnOffset){
|
|
187
|
+
super(), this.indirect = indirect, this.retSizeOffset = retSizeOffset, this.returnOffset = returnOffset;
|
|
188
188
|
}
|
|
189
189
|
async execute(context) {
|
|
190
190
|
const memory = context.machineState.memory;
|
|
191
191
|
const operands = [
|
|
192
|
-
this.
|
|
193
|
-
this.
|
|
192
|
+
this.retSizeOffset,
|
|
193
|
+
this.returnOffset
|
|
194
194
|
];
|
|
195
195
|
const addressing = Addressing.fromWire(this.indirect, operands.length);
|
|
196
|
-
const [
|
|
196
|
+
const [retSizeOffset, returnOffset] = addressing.resolve(operands, memory);
|
|
197
197
|
memory.checkTag(TypeTag.UINT32, retSizeOffset);
|
|
198
198
|
const retSize = memory.get(retSizeOffset).toNumber();
|
|
199
199
|
context.machineState.consumeGas(this.gasCost(retSize));
|
|
@@ -7,14 +7,14 @@ export declare class ExecutorMetrics implements ExecutorMetricsInterface {
|
|
|
7
7
|
private fnDuration;
|
|
8
8
|
private manaPerSecond;
|
|
9
9
|
private manaUsed;
|
|
10
|
-
private
|
|
10
|
+
private totalInstructionsExecuted;
|
|
11
11
|
private txHashing;
|
|
12
12
|
private privateEffectsInsertions;
|
|
13
13
|
constructor(client: TelemetryClient, name?: string);
|
|
14
14
|
startRecordingTxSimulation(_txLabel: string): void;
|
|
15
15
|
stopRecordingTxSimulation(_txLabel: string, _revertedCode?: RevertCode): void;
|
|
16
|
-
recordEnqueuedCallSimulation(fnName: string, durationMs: number, manaUsed: number,
|
|
17
|
-
recordEnqueuedCallSimulationFailure(_fnName: string, _durationMs: number, _manaUsed: number,
|
|
16
|
+
recordEnqueuedCallSimulation(fnName: string, durationMs: number, manaUsed: number, totalInstructionsExecuted: number): void;
|
|
17
|
+
recordEnqueuedCallSimulationFailure(_fnName: string, _durationMs: number, _manaUsed: number, _totalInstructionsExecuted: number): void;
|
|
18
18
|
recordTxHashComputation(durationMs: number): void;
|
|
19
19
|
recordPrivateEffectsInsertion(durationUs: number, type: 'revertible' | 'non-revertible'): void;
|
|
20
20
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"executor_metrics.d.ts","sourceRoot":"","sources":["../../src/public/executor_metrics.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAIL,KAAK,eAAe,EACpB,KAAK,MAAM,EAGZ,MAAM,yBAAyB,CAAC;AAEjC,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,iCAAiC,CAAC;AAEhF,qBAAa,eAAgB,YAAW,wBAAwB;IAC9D,SAAgB,MAAM,EAAE,MAAM,CAAC;IAC/B,OAAO,CAAC,OAAO,CAAgB;IAC/B,OAAO,CAAC,UAAU,CAAY;IAC9B,OAAO,CAAC,aAAa,CAAY;IACjC,OAAO,CAAC,QAAQ,CAAY;IAC5B,OAAO,CAAC,
|
|
1
|
+
{"version":3,"file":"executor_metrics.d.ts","sourceRoot":"","sources":["../../src/public/executor_metrics.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAIL,KAAK,eAAe,EACpB,KAAK,MAAM,EAGZ,MAAM,yBAAyB,CAAC;AAEjC,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,iCAAiC,CAAC;AAEhF,qBAAa,eAAgB,YAAW,wBAAwB;IAC9D,SAAgB,MAAM,EAAE,MAAM,CAAC;IAC/B,OAAO,CAAC,OAAO,CAAgB;IAC/B,OAAO,CAAC,UAAU,CAAY;IAC9B,OAAO,CAAC,aAAa,CAAY;IACjC,OAAO,CAAC,QAAQ,CAAY;IAC5B,OAAO,CAAC,yBAAyB,CAAY;IAC7C,OAAO,CAAC,SAAS,CAAY;IAC7B,OAAO,CAAC,wBAAwB,CAAY;gBAEhC,MAAM,EAAE,eAAe,EAAE,IAAI,SAAmB;IA6C5D,0BAA0B,CAAC,QAAQ,EAAE,MAAM;IAI3C,yBAAyB,CAAC,QAAQ,EAAE,MAAM,EAAE,aAAa,CAAC,EAAE,UAAU;IAItE,4BAA4B,CAC1B,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,MAAM,EAChB,yBAAyB,EAAE,MAAM;IAuBnC,mCAAmC,CACjC,OAAO,EAAE,MAAM,EACf,WAAW,EAAE,MAAM,EACnB,SAAS,EAAE,MAAM,EACjB,0BAA0B,EAAE,MAAM;IAOpC,uBAAuB,CAAC,UAAU,EAAE,MAAM;IAI1C,6BAA6B,CAAC,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE,YAAY,GAAG,gBAAgB;CAKxF"}
|
|
@@ -5,7 +5,7 @@ export class ExecutorMetrics {
|
|
|
5
5
|
fnDuration;
|
|
6
6
|
manaPerSecond;
|
|
7
7
|
manaUsed;
|
|
8
|
-
|
|
8
|
+
totalInstructionsExecuted;
|
|
9
9
|
txHashing;
|
|
10
10
|
privateEffectsInsertions;
|
|
11
11
|
constructor(client, name = 'PublicExecutor'){
|
|
@@ -29,9 +29,9 @@ export class ExecutorMetrics {
|
|
|
29
29
|
unit: 'mana',
|
|
30
30
|
valueType: ValueType.INT
|
|
31
31
|
});
|
|
32
|
-
this.
|
|
32
|
+
this.totalInstructionsExecuted = meter.createHistogram(Metrics.PUBLIC_EXECUTOR_SIMULATION_TOTAL_INSTRUCTIONS, {
|
|
33
33
|
description: 'Total number of instructions executed',
|
|
34
|
-
unit: 'instructions',
|
|
34
|
+
unit: '#instructions',
|
|
35
35
|
valueType: ValueType.INT
|
|
36
36
|
});
|
|
37
37
|
this.txHashing = meter.createHistogram(Metrics.PUBLIC_EXECUTOR_TX_HASHING, {
|
|
@@ -51,7 +51,7 @@ export class ExecutorMetrics {
|
|
|
51
51
|
stopRecordingTxSimulation(_txLabel, _revertedCode) {
|
|
52
52
|
// do nothing (unimplemented)
|
|
53
53
|
}
|
|
54
|
-
recordEnqueuedCallSimulation(fnName, durationMs, manaUsed,
|
|
54
|
+
recordEnqueuedCallSimulation(fnName, durationMs, manaUsed, totalInstructionsExecuted) {
|
|
55
55
|
this.fnCount.add(1, {
|
|
56
56
|
[Attributes.OK]: true,
|
|
57
57
|
[Attributes.APP_CIRCUIT_NAME]: fnName
|
|
@@ -59,7 +59,7 @@ export class ExecutorMetrics {
|
|
|
59
59
|
this.manaUsed.record(Math.ceil(manaUsed), {
|
|
60
60
|
[Attributes.APP_CIRCUIT_NAME]: fnName
|
|
61
61
|
});
|
|
62
|
-
this.
|
|
62
|
+
this.totalInstructionsExecuted.record(Math.ceil(totalInstructionsExecuted), {
|
|
63
63
|
[Attributes.APP_CIRCUIT_NAME]: fnName
|
|
64
64
|
});
|
|
65
65
|
this.fnDuration.record(Math.ceil(durationMs), {
|
|
@@ -72,7 +72,7 @@ export class ExecutorMetrics {
|
|
|
72
72
|
});
|
|
73
73
|
}
|
|
74
74
|
}
|
|
75
|
-
recordEnqueuedCallSimulationFailure(_fnName, _durationMs, _manaUsed,
|
|
75
|
+
recordEnqueuedCallSimulationFailure(_fnName, _durationMs, _manaUsed, _totalInstructionsExecuted) {
|
|
76
76
|
this.fnCount.add(1, {
|
|
77
77
|
[Attributes.OK]: false
|
|
78
78
|
});
|
|
@@ -3,7 +3,7 @@ export interface ExecutorMetricsInterface {
|
|
|
3
3
|
startRecordingTxSimulation(txLabel: string): void;
|
|
4
4
|
stopRecordingTxSimulation(txLabel: string, revertedCode?: RevertCode): void;
|
|
5
5
|
recordEnqueuedCallSimulation(fnName: string, durationMs: number, manaUsed: number, totalInstructions: number): void;
|
|
6
|
-
recordEnqueuedCallSimulationFailure(fnName: string, durationMs: number, manaUsed: number,
|
|
6
|
+
recordEnqueuedCallSimulationFailure(fnName: string, durationMs: number, manaUsed: number, totalInstructionsExecuted: number): void;
|
|
7
7
|
recordTxHashComputation(durationMs: number): void;
|
|
8
8
|
recordPrivateEffectsInsertion(durationUs: number, type: 'revertible' | 'non-revertible'): void;
|
|
9
9
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"executor_metrics_interface.d.ts","sourceRoot":"","sources":["../../src/public/executor_metrics_interface.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAEpD,MAAM,WAAW,wBAAwB;IACvC,0BAA0B,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAClD,yBAAyB,CAAC,OAAO,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,UAAU,GAAG,IAAI,CAAC;IAC5E,4BAA4B,CAAC,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,iBAAiB,EAAE,MAAM,GAAG,IAAI,CAAC;IACpH,mCAAmC,CACjC,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,MAAM,EAChB,
|
|
1
|
+
{"version":3,"file":"executor_metrics_interface.d.ts","sourceRoot":"","sources":["../../src/public/executor_metrics_interface.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAEpD,MAAM,WAAW,wBAAwB;IACvC,0BAA0B,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAClD,yBAAyB,CAAC,OAAO,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,UAAU,GAAG,IAAI,CAAC;IAC5E,4BAA4B,CAAC,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,iBAAiB,EAAE,MAAM,GAAG,IAAI,CAAC;IACpH,mCAAmC,CACjC,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,MAAM,EAChB,yBAAyB,EAAE,MAAM,GAChC,IAAI,CAAC;IACR,uBAAuB,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAClD,6BAA6B,CAAC,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE,YAAY,GAAG,gBAAgB,GAAG,IAAI,CAAC;CAChG"}
|
|
@@ -45,8 +45,8 @@ const DEFAULT_GAS_FEES = new GasFees(2, 3);
|
|
|
45
45
|
async simulateTx(sender, setupCalls = [], appCalls = [], teardownCall, feePayer = sender, /* need some unique first nullifier for note-nonce computations */ firstNullifier = new Fr(420000 + this.txCount++), txLabel = 'unlabeledTx') {
|
|
46
46
|
const tx = await this.createTx(sender, setupCalls, appCalls, teardownCall, feePayer, firstNullifier);
|
|
47
47
|
await this.setFeePayerBalance(feePayer);
|
|
48
|
-
const txLabelWithCount = `${txLabel}
|
|
49
|
-
const fullTxLabel = this.metricsPrefix ? `${this.metricsPrefix}
|
|
48
|
+
const txLabelWithCount = `${txLabel}/${this.txCount - 1}`;
|
|
49
|
+
const fullTxLabel = this.metricsPrefix ? `${this.metricsPrefix}/${txLabelWithCount}` : txLabelWithCount;
|
|
50
50
|
const avmResult = await this.simulator.simulate(tx, fullTxLabel);
|
|
51
51
|
// Something like this is often useful for debugging:
|
|
52
52
|
//if (avmResult.revertReason) {
|
|
@@ -22,7 +22,7 @@ const INITIAL_TOKEN_BALANCE = 1_000_000_000n;
|
|
|
22
22
|
liquidityToken
|
|
23
23
|
];
|
|
24
24
|
const amm = await tester.registerAndDeployContract(constructorArgs, /*deployer=*/ admin, AMMContractArtifact, /*skipNullifierInsertion=*/ false, /*seed=*/ 3);
|
|
25
|
-
const ammConstructorResult = await tester.simulateTxWithLabel(/*txLabel=*/ 'constructor', /*sender=*/ admin, /*setupCalls=*/ [], /*appCalls=*/ [
|
|
25
|
+
const ammConstructorResult = await tester.simulateTxWithLabel(/*txLabel=*/ 'AMM/constructor', /*sender=*/ admin, /*setupCalls=*/ [], /*appCalls=*/ [
|
|
26
26
|
{
|
|
27
27
|
fnName: 'constructor',
|
|
28
28
|
args: constructorArgs,
|
|
@@ -32,7 +32,7 @@ const INITIAL_TOKEN_BALANCE = 1_000_000_000n;
|
|
|
32
32
|
expect(ammConstructorResult.revertCode.isOK()).toBe(true);
|
|
33
33
|
logger.debug(`Setting AMM as minter for liquidity token`);
|
|
34
34
|
// set the AMM as the minter for the liquidity token
|
|
35
|
-
const setMinterResult = await tester.simulateTxWithLabel(/*txLabel=*/ 'set_minter', /*sender=*/ admin, /*setupCalls=*/ [], /*appCalls=*/ [
|
|
35
|
+
const setMinterResult = await tester.simulateTxWithLabel(/*txLabel=*/ 'AMM/set_minter', /*sender=*/ admin, /*setupCalls=*/ [], /*appCalls=*/ [
|
|
36
36
|
{
|
|
37
37
|
fnName: 'set_minter',
|
|
38
38
|
args: [
|
|
@@ -69,7 +69,7 @@ async function addLiquidity(tester, sender, amm, token0, token1, liquidityToken,
|
|
|
69
69
|
const liquidityPartialNote = {
|
|
70
70
|
commitment: new Fr(99)
|
|
71
71
|
};
|
|
72
|
-
return await tester.simulateTxWithLabel(/*txLabel=*/ 'add_liquidity', /*sender=*/ sender, /*setupCalls=*/ [], /*appCalls=*/ [
|
|
72
|
+
return await tester.simulateTxWithLabel(/*txLabel=*/ 'AMM/add_liquidity', /*sender=*/ sender, /*setupCalls=*/ [], /*appCalls=*/ [
|
|
73
73
|
// token0.transfer_to_public enqueues a call to _increase_public_balance
|
|
74
74
|
{
|
|
75
75
|
sender: token0.address,
|
|
@@ -144,7 +144,7 @@ async function swapExactTokensForTokens(tester, sender, amm, tokenIn, tokenOut,
|
|
|
144
144
|
const tokenOutPartialNote = {
|
|
145
145
|
commitment: new Fr(66)
|
|
146
146
|
};
|
|
147
|
-
return await tester.simulateTxWithLabel(/*txLabel=*/ 'swap_exact_tokens_for_tokens', /*sender=*/ sender, /*setupCalls=*/ [], /*appCalls=*/ [
|
|
147
|
+
return await tester.simulateTxWithLabel(/*txLabel=*/ 'AMM/swap_exact_tokens_for_tokens', /*sender=*/ sender, /*setupCalls=*/ [], /*appCalls=*/ [
|
|
148
148
|
// tokenIn.transfer_to_public enqueues a call to _increase_public_balance
|
|
149
149
|
{
|
|
150
150
|
sender: tokenIn.address,
|
|
@@ -185,7 +185,7 @@ async function removeLiquidity(tester, sender, amm, token0, token1, liquidityTok
|
|
|
185
185
|
const token1PartialNote = {
|
|
186
186
|
commitment: new Fr(222)
|
|
187
187
|
};
|
|
188
|
-
return await tester.simulateTxWithLabel(/*txLabel=*/ 'remove_liquidity', /*sender=*/ sender, /*setupCalls=*/ [], /*appCalls=*/ [
|
|
188
|
+
return await tester.simulateTxWithLabel(/*txLabel=*/ 'AMM/remove_liquidity', /*sender=*/ sender, /*setupCalls=*/ [], /*appCalls=*/ [
|
|
189
189
|
// liquidityToken.transfer_to_public enqueues a call to _increase_public_balance
|
|
190
190
|
{
|
|
191
191
|
sender: liquidityToken.address,
|
|
@@ -8,7 +8,7 @@ export async function tokenTest(tester, logger) {
|
|
|
8
8
|
const receiver = AztecAddress.fromNumber(222);
|
|
9
9
|
const token = await deployToken(tester, admin);
|
|
10
10
|
const mintAmount = 100n;
|
|
11
|
-
const mintResult = await tester.simulateTxWithLabel(/*txLabel=*/ 'mint_to_public', /*sender=*/ admin, /*setupCalls=*/ [], /*appCalls=*/ [
|
|
11
|
+
const mintResult = await tester.simulateTxWithLabel(/*txLabel=*/ 'Token/mint_to_public', /*sender=*/ admin, /*setupCalls=*/ [], /*appCalls=*/ [
|
|
12
12
|
{
|
|
13
13
|
address: token.address,
|
|
14
14
|
fnName: 'mint_to_public',
|
|
@@ -22,7 +22,7 @@ export async function tokenTest(tester, logger) {
|
|
|
22
22
|
await checkBalance(tester, token, sender, sender, mintAmount);
|
|
23
23
|
const nonce = new Fr(0);
|
|
24
24
|
const transferAmount = 50n;
|
|
25
|
-
const transferResult = await tester.simulateTxWithLabel(/*txLabel=*/ 'transfer_in_public', /*sender=*/ sender, /*setupCalls=*/ [], /*appCalls=*/ [
|
|
25
|
+
const transferResult = await tester.simulateTxWithLabel(/*txLabel=*/ 'Token/transfer_in_public', /*sender=*/ sender, /*setupCalls=*/ [], /*appCalls=*/ [
|
|
26
26
|
{
|
|
27
27
|
address: token.address,
|
|
28
28
|
fnName: 'transfer_in_public',
|
|
@@ -37,7 +37,7 @@ export async function tokenTest(tester, logger) {
|
|
|
37
37
|
expect(transferResult.revertCode.isOK()).toBe(true);
|
|
38
38
|
await checkBalance(tester, token, sender, receiver, mintAmount - transferAmount);
|
|
39
39
|
await checkBalance(tester, token, sender, receiver, transferAmount);
|
|
40
|
-
const balResult = await tester.simulateTxWithLabel(/*txLabel=*/ 'balance_of_public', sender, /*setupCalls=*/ [], /*appCalls=*/ [
|
|
40
|
+
const balResult = await tester.simulateTxWithLabel(/*txLabel=*/ 'Token/balance_of_public', sender, /*setupCalls=*/ [], /*appCalls=*/ [
|
|
41
41
|
{
|
|
42
42
|
address: token.address,
|
|
43
43
|
fnName: 'balance_of_public',
|
|
@@ -48,7 +48,7 @@ export async function tokenTest(tester, logger) {
|
|
|
48
48
|
}
|
|
49
49
|
]);
|
|
50
50
|
expect(balResult.revertCode.isOK()).toBe(true);
|
|
51
|
-
const burnResult = await tester.simulateTxWithLabel(/*txLabel=*/ 'burn_public', /*sender=*/ receiver, /*setupCalls=*/ [], /*appCalls=*/ [
|
|
51
|
+
const burnResult = await tester.simulateTxWithLabel(/*txLabel=*/ 'Token/burn_public', /*sender=*/ receiver, /*setupCalls=*/ [], /*appCalls=*/ [
|
|
52
52
|
{
|
|
53
53
|
address: token.address,
|
|
54
54
|
fnName: 'burn_public',
|
|
@@ -72,7 +72,7 @@ export async function deployToken(tester, admin, seed = 0) {
|
|
|
72
72
|
/*decimals=*/ new Fr(18)
|
|
73
73
|
];
|
|
74
74
|
const token = await tester.registerAndDeployContract(constructorArgs, /*deployer=*/ admin, TokenContractArtifact, /*skipNullifierInsertion=*/ false, seed);
|
|
75
|
-
const result = await tester.simulateTxWithLabel(/*txLabel=*/ 'Token
|
|
75
|
+
const result = await tester.simulateTxWithLabel(/*txLabel=*/ 'Token/constructor', /*sender=*/ admin, /*setupCalls=*/ [], /*appCalls=*/ [
|
|
76
76
|
{
|
|
77
77
|
fnName: 'constructor',
|
|
78
78
|
args: constructorArgs,
|
|
@@ -83,7 +83,7 @@ export async function deployToken(tester, admin, seed = 0) {
|
|
|
83
83
|
return token;
|
|
84
84
|
}
|
|
85
85
|
async function checkBalance(tester, token, sender, account, expectedBalance) {
|
|
86
|
-
const balResult = await tester.simulateTxWithLabel(/*txLabel=*/ 'balance_of_public', sender, /*setupCalls=*/ [], /*appCalls=*/ [
|
|
86
|
+
const balResult = await tester.simulateTxWithLabel(/*txLabel=*/ 'Token/balance_of_public', sender, /*setupCalls=*/ [], /*appCalls=*/ [
|
|
87
87
|
{
|
|
88
88
|
address: token.address,
|
|
89
89
|
fnName: 'balance_of_public',
|
|
@@ -4,13 +4,13 @@ export interface PublicEnqueuedCallMetrics {
|
|
|
4
4
|
fnName: string;
|
|
5
5
|
durationMs: number;
|
|
6
6
|
manaUsed: number;
|
|
7
|
-
|
|
7
|
+
totalInstructionsExecuted: number;
|
|
8
8
|
reverted: boolean;
|
|
9
9
|
}
|
|
10
10
|
export interface PublicTxMetrics {
|
|
11
11
|
totalDurationMs: number;
|
|
12
12
|
manaUsed: number;
|
|
13
|
-
|
|
13
|
+
totalInstructionsExecuted: number;
|
|
14
14
|
txHashMs: number | undefined;
|
|
15
15
|
nonRevertiblePrivateInsertionsUs: number | undefined;
|
|
16
16
|
revertiblePrivateInsertionsUs: number | undefined;
|
|
@@ -32,12 +32,13 @@ export declare class TestExecutorMetrics implements ExecutorMetricsInterface {
|
|
|
32
32
|
constructor();
|
|
33
33
|
startRecordingTxSimulation(txLabel: string): void;
|
|
34
34
|
stopRecordingTxSimulation(txLabel: string, revertedCode?: RevertCode): void;
|
|
35
|
-
recordEnqueuedCallSimulation(fnName: string, durationMs: number, manaUsed: number,
|
|
36
|
-
recordEnqueuedCallSimulationFailure(fnName: string, durationMs: number, manaUsed: number,
|
|
35
|
+
recordEnqueuedCallSimulation(fnName: string, durationMs: number, manaUsed: number, totalInstructionsExecuted: number): void;
|
|
36
|
+
recordEnqueuedCallSimulationFailure(fnName: string, durationMs: number, manaUsed: number, totalInstructionsExecuted: number): void;
|
|
37
37
|
recordTxHashComputation(durationMs: number): void;
|
|
38
38
|
recordPrivateEffectsInsertion(durationUs: number, type: 'revertible' | 'non-revertible'): void;
|
|
39
39
|
prettyPrint(filter?: PublicTxMetricsFilter): void;
|
|
40
40
|
toPrettyString(filter?: PublicTxMetricsFilter): string;
|
|
41
41
|
toJSON(indent?: number): string;
|
|
42
|
+
toGithubActionBenchmarkJSON(indent?: number): string;
|
|
42
43
|
}
|
|
43
44
|
//# sourceMappingURL=test_executor_metrics.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"test_executor_metrics.d.ts","sourceRoot":"","sources":["../../src/public/test_executor_metrics.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAIpD,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,iCAAiC,CAAC;AAEhF,MAAM,WAAW,yBAAyB;IACxC,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,
|
|
1
|
+
{"version":3,"file":"test_executor_metrics.d.ts","sourceRoot":"","sources":["../../src/public/test_executor_metrics.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAIpD,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,iCAAiC,CAAC;AAEhF,MAAM,WAAW,yBAAyB;IACxC,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,yBAAyB,EAAE,MAAM,CAAC;IAClC,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,eAAe;IAC9B,eAAe,EAAE,MAAM,CAAC;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,yBAAyB,EAAE,MAAM,CAAC;IAClC,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7B,gCAAgC,EAAE,MAAM,GAAG,SAAS,CAAC;IACrD,6BAA6B,EAAE,MAAM,GAAG,SAAS,CAAC;IAClD,aAAa,EAAE,yBAAyB,EAAE,CAAC;IAC3C,YAAY,EAAE,UAAU,GAAG,SAAS,CAAC;CACtC;AAWD,oBAAY,qBAAqB;IAC/B,GAAG,IAAA;IACH,MAAM,IAAA;IACN,SAAS,IAAA;IACT,YAAY,IAAA;CACb;AAED,qBAAa,mBAAoB,YAAW,wBAAwB;;IAClE,OAAO,CAAC,MAAM,CAAS;IAEvB,OAAO,CAAC,SAAS,CAA2C;IAC5D,OAAO,CAAC,cAAc,CAAqB;IAC3C,OAAO,CAAC,OAAO,CAAoB;;IAMnC,0BAA0B,CAAC,OAAO,EAAE,MAAM;IAiB1C,yBAAyB,CAAC,OAAO,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,UAAU;IAkBpE,4BAA4B,CAC1B,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,MAAM,EAChB,yBAAyB,EAAE,MAAM;IAKnC,mCAAmC,CACjC,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,MAAM,EAChB,yBAAyB,EAAE,MAAM;IAuBnC,uBAAuB,CAAC,UAAU,EAAE,MAAM;IAO1C,6BAA6B,CAAC,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE,YAAY,GAAG,gBAAgB;IAkBvF,WAAW,CAAC,MAAM,GAAE,qBAAiD;IAIrE,cAAc,CAAC,MAAM,GAAE,qBAAiD;IAqExE,MAAM,CAAC,MAAM,SAAI;IAIjB,2BAA2B,CAAC,MAAM,SAAI;CAoCvC"}
|
|
@@ -32,7 +32,7 @@ export class TestExecutorMetrics {
|
|
|
32
32
|
this.txMetrics.set(txLabel, {
|
|
33
33
|
totalDurationMs: 0,
|
|
34
34
|
manaUsed: 0,
|
|
35
|
-
|
|
35
|
+
totalInstructionsExecuted: 0,
|
|
36
36
|
txHashMs: undefined,
|
|
37
37
|
nonRevertiblePrivateInsertionsUs: undefined,
|
|
38
38
|
revertiblePrivateInsertionsUs: undefined,
|
|
@@ -50,25 +50,25 @@ export class TestExecutorMetrics {
|
|
|
50
50
|
this.logger.debug(`Public TX simulation of ${txLabel} took ${txMetrics.totalDurationMs}ms`);
|
|
51
51
|
// add manaUsed across all enqueued calls
|
|
52
52
|
txMetrics.manaUsed = sum(txMetrics.enqueuedCalls.map((call)=>call.manaUsed));
|
|
53
|
-
// add
|
|
54
|
-
txMetrics.
|
|
53
|
+
// add totalInstructionsExecuted across all enqueued calls
|
|
54
|
+
txMetrics.totalInstructionsExecuted = sum(txMetrics.enqueuedCalls.map((call)=>call.totalInstructionsExecuted));
|
|
55
55
|
txMetrics.revertedCode = revertedCode;
|
|
56
56
|
this.currentTxLabel = undefined;
|
|
57
57
|
}
|
|
58
|
-
recordEnqueuedCallSimulation(fnName, durationMs, manaUsed,
|
|
59
|
-
this.#recordEnqueuedCallSimulation(fnName, durationMs, manaUsed,
|
|
58
|
+
recordEnqueuedCallSimulation(fnName, durationMs, manaUsed, totalInstructionsExecuted) {
|
|
59
|
+
this.#recordEnqueuedCallSimulation(fnName, durationMs, manaUsed, totalInstructionsExecuted, false);
|
|
60
60
|
}
|
|
61
|
-
recordEnqueuedCallSimulationFailure(fnName, durationMs, manaUsed,
|
|
62
|
-
this.#recordEnqueuedCallSimulation(fnName, durationMs, manaUsed,
|
|
61
|
+
recordEnqueuedCallSimulationFailure(fnName, durationMs, manaUsed, totalInstructionsExecuted) {
|
|
62
|
+
this.#recordEnqueuedCallSimulation(fnName, durationMs, manaUsed, totalInstructionsExecuted, true);
|
|
63
63
|
}
|
|
64
|
-
#recordEnqueuedCallSimulation(fnName, durationMs, manaUsed,
|
|
64
|
+
#recordEnqueuedCallSimulation(fnName, durationMs, manaUsed, totalInstructionsExecuted, reverted) {
|
|
65
65
|
assert(this.currentTxLabel, 'Cannot record enqueued call simulation when no tx is live');
|
|
66
66
|
const txMetrics = this.txMetrics.get(this.currentTxLabel);
|
|
67
67
|
txMetrics.enqueuedCalls.push({
|
|
68
68
|
fnName,
|
|
69
69
|
durationMs,
|
|
70
70
|
manaUsed,
|
|
71
|
-
|
|
71
|
+
totalInstructionsExecuted: totalInstructionsExecuted,
|
|
72
72
|
reverted
|
|
73
73
|
});
|
|
74
74
|
}
|
|
@@ -108,7 +108,7 @@ export class TestExecutorMetrics {
|
|
|
108
108
|
pretty += `${INDENT0}Mana per second: ${fmtNum(manaPerSecond)}\n`;
|
|
109
109
|
}
|
|
110
110
|
if (filter === 3 || filter === 1 || filter === 0) {
|
|
111
|
-
pretty += `${INDENT0}Total instructions executed: ${fmtNum(txMetrics.
|
|
111
|
+
pretty += `${INDENT0}Total instructions executed: ${fmtNum(txMetrics.totalInstructionsExecuted)}\n`;
|
|
112
112
|
}
|
|
113
113
|
if (filter === 2 || filter === 0) {
|
|
114
114
|
pretty += `${INDENT0}Tx hash computation: ${fmtNum(txMetrics.txHashMs, 'ms')}\n`;
|
|
@@ -141,7 +141,7 @@ export class TestExecutorMetrics {
|
|
|
141
141
|
pretty += `${INDENT2}Mana per second: ${fmtNum(manaPerSecond)}\n`;
|
|
142
142
|
}
|
|
143
143
|
if (filter === 3 || filter === 0) {
|
|
144
|
-
pretty += `${INDENT2}Instructions executed: ${fmtNum(enqueuedCall.
|
|
144
|
+
pretty += `${INDENT2}Instructions executed: ${fmtNum(enqueuedCall.totalInstructionsExecuted)}\n`;
|
|
145
145
|
}
|
|
146
146
|
if (enqueuedCall.reverted) {
|
|
147
147
|
pretty += `${INDENT2}Reverted!\n`;
|
|
@@ -152,6 +152,42 @@ export class TestExecutorMetrics {
|
|
|
152
152
|
toJSON(indent = 2) {
|
|
153
153
|
return JSON.stringify(Object.fromEntries(this.txMetrics.entries()), null, indent);
|
|
154
154
|
}
|
|
155
|
+
toGithubActionBenchmarkJSON(indent = 2) {
|
|
156
|
+
const data = [];
|
|
157
|
+
for (const [txLabel, txMetrics] of this.txMetrics.entries()){
|
|
158
|
+
data.push({
|
|
159
|
+
name: `${txLabel}/totalInstructionsExecuted`,
|
|
160
|
+
value: txMetrics.totalInstructionsExecuted,
|
|
161
|
+
unit: '#instructions'
|
|
162
|
+
});
|
|
163
|
+
data.push({
|
|
164
|
+
name: `${txLabel}/totalDurationMs`,
|
|
165
|
+
value: txMetrics.totalDurationMs,
|
|
166
|
+
unit: 'ms'
|
|
167
|
+
});
|
|
168
|
+
data.push({
|
|
169
|
+
name: `${txLabel}/manaUsed`,
|
|
170
|
+
value: txMetrics.manaUsed,
|
|
171
|
+
unit: 'mana'
|
|
172
|
+
});
|
|
173
|
+
data.push({
|
|
174
|
+
name: `${txLabel}/txHashMs`,
|
|
175
|
+
value: txMetrics.txHashMs,
|
|
176
|
+
unit: 'ms'
|
|
177
|
+
});
|
|
178
|
+
data.push({
|
|
179
|
+
name: `${txLabel}/nonRevertiblePrivateInsertionsUs`,
|
|
180
|
+
value: txMetrics.nonRevertiblePrivateInsertionsUs,
|
|
181
|
+
unit: 'us'
|
|
182
|
+
});
|
|
183
|
+
data.push({
|
|
184
|
+
name: `${txLabel}/revertiblePrivateInsertionsUs`,
|
|
185
|
+
value: txMetrics.revertiblePrivateInsertionsUs,
|
|
186
|
+
unit: 'us'
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
return JSON.stringify(data, null, indent);
|
|
190
|
+
}
|
|
155
191
|
}
|
|
156
192
|
function fmtNum(num, unit) {
|
|
157
193
|
return `\`${num.toLocaleString()}${unit ? ` ${unit}` : ''}\``;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/simulator",
|
|
3
|
-
"version": "0.86.0-nightly.
|
|
3
|
+
"version": "0.86.0-nightly.20250501",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
"./server": "./dest/server.js",
|
|
@@ -58,25 +58,25 @@
|
|
|
58
58
|
]
|
|
59
59
|
},
|
|
60
60
|
"dependencies": {
|
|
61
|
-
"@aztec/constants": "0.86.0-nightly.
|
|
62
|
-
"@aztec/foundation": "0.86.0-nightly.
|
|
63
|
-
"@aztec/noir-acvm_js": "0.86.0-nightly.
|
|
64
|
-
"@aztec/noir-noirc_abi": "0.86.0-nightly.
|
|
65
|
-
"@aztec/noir-protocol-circuits-types": "0.86.0-nightly.
|
|
66
|
-
"@aztec/noir-types": "0.86.0-nightly.
|
|
67
|
-
"@aztec/protocol-contracts": "0.86.0-nightly.
|
|
68
|
-
"@aztec/stdlib": "0.86.0-nightly.
|
|
69
|
-
"@aztec/telemetry-client": "0.86.0-nightly.
|
|
70
|
-
"@aztec/world-state": "0.86.0-nightly.
|
|
61
|
+
"@aztec/constants": "0.86.0-nightly.20250501",
|
|
62
|
+
"@aztec/foundation": "0.86.0-nightly.20250501",
|
|
63
|
+
"@aztec/noir-acvm_js": "0.86.0-nightly.20250501",
|
|
64
|
+
"@aztec/noir-noirc_abi": "0.86.0-nightly.20250501",
|
|
65
|
+
"@aztec/noir-protocol-circuits-types": "0.86.0-nightly.20250501",
|
|
66
|
+
"@aztec/noir-types": "0.86.0-nightly.20250501",
|
|
67
|
+
"@aztec/protocol-contracts": "0.86.0-nightly.20250501",
|
|
68
|
+
"@aztec/stdlib": "0.86.0-nightly.20250501",
|
|
69
|
+
"@aztec/telemetry-client": "0.86.0-nightly.20250501",
|
|
70
|
+
"@aztec/world-state": "0.86.0-nightly.20250501",
|
|
71
71
|
"lodash.clonedeep": "^4.5.0",
|
|
72
72
|
"lodash.merge": "^4.6.2",
|
|
73
73
|
"tslib": "^2.4.0"
|
|
74
74
|
},
|
|
75
75
|
"devDependencies": {
|
|
76
|
-
"@aztec/kv-store": "0.86.0-nightly.
|
|
77
|
-
"@aztec/merkle-tree": "0.86.0-nightly.
|
|
78
|
-
"@aztec/noir-contracts.js": "0.86.0-nightly.
|
|
79
|
-
"@aztec/noir-test-contracts.js": "0.86.0-nightly.
|
|
76
|
+
"@aztec/kv-store": "0.86.0-nightly.20250501",
|
|
77
|
+
"@aztec/merkle-tree": "0.86.0-nightly.20250501",
|
|
78
|
+
"@aztec/noir-contracts.js": "0.86.0-nightly.20250501",
|
|
79
|
+
"@aztec/noir-test-contracts.js": "0.86.0-nightly.20250501",
|
|
80
80
|
"@jest/globals": "^29.5.0",
|
|
81
81
|
"@types/jest": "^29.5.0",
|
|
82
82
|
"@types/lodash.clonedeep": "^4.5.7",
|
|
@@ -163,16 +163,16 @@ export class Return extends Instruction {
|
|
|
163
163
|
OperandType.UINT16,
|
|
164
164
|
];
|
|
165
165
|
|
|
166
|
-
constructor(private indirect: number, private
|
|
166
|
+
constructor(private indirect: number, private returnSizeOffset: number, private returnOffset: number) {
|
|
167
167
|
super();
|
|
168
168
|
}
|
|
169
169
|
|
|
170
170
|
public async execute(context: AvmContext): Promise<void> {
|
|
171
171
|
const memory = context.machineState.memory;
|
|
172
172
|
|
|
173
|
-
const operands = [this.
|
|
173
|
+
const operands = [this.returnSizeOffset, this.returnOffset];
|
|
174
174
|
const addressing = Addressing.fromWire(this.indirect, operands.length);
|
|
175
|
-
const [
|
|
175
|
+
const [returnSizeOffset, returnOffset] = addressing.resolve(operands, memory);
|
|
176
176
|
|
|
177
177
|
memory.checkTag(TypeTag.UINT32, returnSizeOffset);
|
|
178
178
|
const returnSize = memory.get(returnSizeOffset).toNumber();
|
|
@@ -205,16 +205,16 @@ export class Revert extends Instruction {
|
|
|
205
205
|
OperandType.UINT16,
|
|
206
206
|
];
|
|
207
207
|
|
|
208
|
-
constructor(private indirect: number, private
|
|
208
|
+
constructor(private indirect: number, private retSizeOffset: number, private returnOffset: number) {
|
|
209
209
|
super();
|
|
210
210
|
}
|
|
211
211
|
|
|
212
212
|
public async execute(context: AvmContext): Promise<void> {
|
|
213
213
|
const memory = context.machineState.memory;
|
|
214
214
|
|
|
215
|
-
const operands = [this.
|
|
215
|
+
const operands = [this.retSizeOffset, this.returnOffset];
|
|
216
216
|
const addressing = Addressing.fromWire(this.indirect, operands.length);
|
|
217
|
-
const [
|
|
217
|
+
const [retSizeOffset, returnOffset] = addressing.resolve(operands, memory);
|
|
218
218
|
|
|
219
219
|
memory.checkTag(TypeTag.UINT32, retSizeOffset);
|
|
220
220
|
const retSize = memory.get(retSizeOffset).toNumber();
|
|
@@ -17,7 +17,7 @@ export class ExecutorMetrics implements ExecutorMetricsInterface {
|
|
|
17
17
|
private fnDuration: Histogram;
|
|
18
18
|
private manaPerSecond: Histogram;
|
|
19
19
|
private manaUsed: Histogram;
|
|
20
|
-
private
|
|
20
|
+
private totalInstructionsExecuted: Histogram;
|
|
21
21
|
private txHashing: Histogram;
|
|
22
22
|
private privateEffectsInsertions: Histogram;
|
|
23
23
|
|
|
@@ -47,9 +47,9 @@ export class ExecutorMetrics implements ExecutorMetricsInterface {
|
|
|
47
47
|
valueType: ValueType.INT,
|
|
48
48
|
});
|
|
49
49
|
|
|
50
|
-
this.
|
|
50
|
+
this.totalInstructionsExecuted = meter.createHistogram(Metrics.PUBLIC_EXECUTOR_SIMULATION_TOTAL_INSTRUCTIONS, {
|
|
51
51
|
description: 'Total number of instructions executed',
|
|
52
|
-
unit: 'instructions',
|
|
52
|
+
unit: '#instructions',
|
|
53
53
|
valueType: ValueType.INT,
|
|
54
54
|
});
|
|
55
55
|
|
|
@@ -74,7 +74,12 @@ export class ExecutorMetrics implements ExecutorMetricsInterface {
|
|
|
74
74
|
// do nothing (unimplemented)
|
|
75
75
|
}
|
|
76
76
|
|
|
77
|
-
recordEnqueuedCallSimulation(
|
|
77
|
+
recordEnqueuedCallSimulation(
|
|
78
|
+
fnName: string,
|
|
79
|
+
durationMs: number,
|
|
80
|
+
manaUsed: number,
|
|
81
|
+
totalInstructionsExecuted: number,
|
|
82
|
+
) {
|
|
78
83
|
this.fnCount.add(1, {
|
|
79
84
|
[Attributes.OK]: true,
|
|
80
85
|
[Attributes.APP_CIRCUIT_NAME]: fnName,
|
|
@@ -82,7 +87,7 @@ export class ExecutorMetrics implements ExecutorMetricsInterface {
|
|
|
82
87
|
this.manaUsed.record(Math.ceil(manaUsed), {
|
|
83
88
|
[Attributes.APP_CIRCUIT_NAME]: fnName,
|
|
84
89
|
});
|
|
85
|
-
this.
|
|
90
|
+
this.totalInstructionsExecuted.record(Math.ceil(totalInstructionsExecuted), {
|
|
86
91
|
[Attributes.APP_CIRCUIT_NAME]: fnName,
|
|
87
92
|
});
|
|
88
93
|
this.fnDuration.record(Math.ceil(durationMs), {
|
|
@@ -100,7 +105,7 @@ export class ExecutorMetrics implements ExecutorMetricsInterface {
|
|
|
100
105
|
_fnName: string,
|
|
101
106
|
_durationMs: number,
|
|
102
107
|
_manaUsed: number,
|
|
103
|
-
|
|
108
|
+
_totalInstructionsExecuted: number,
|
|
104
109
|
) {
|
|
105
110
|
this.fnCount.add(1, {
|
|
106
111
|
[Attributes.OK]: false,
|
|
@@ -8,7 +8,7 @@ export interface ExecutorMetricsInterface {
|
|
|
8
8
|
fnName: string,
|
|
9
9
|
durationMs: number,
|
|
10
10
|
manaUsed: number,
|
|
11
|
-
|
|
11
|
+
totalInstructionsExecuted: number,
|
|
12
12
|
): void;
|
|
13
13
|
recordTxHashComputation(durationMs: number): void;
|
|
14
14
|
recordPrivateEffectsInsertion(durationUs: number, type: 'revertible' | 'non-revertible'): void;
|
|
@@ -107,8 +107,8 @@ export class PublicTxSimulationTester extends BaseAvmSimulationTester {
|
|
|
107
107
|
|
|
108
108
|
await this.setFeePayerBalance(feePayer);
|
|
109
109
|
|
|
110
|
-
const txLabelWithCount = `${txLabel}
|
|
111
|
-
const fullTxLabel = this.metricsPrefix ? `${this.metricsPrefix}
|
|
110
|
+
const txLabelWithCount = `${txLabel}/${this.txCount - 1}`;
|
|
111
|
+
const fullTxLabel = this.metricsPrefix ? `${this.metricsPrefix}/${txLabelWithCount}` : txLabelWithCount;
|
|
112
112
|
|
|
113
113
|
const avmResult = await this.simulator.simulate(tx, fullTxLabel);
|
|
114
114
|
|
|
@@ -34,7 +34,7 @@ export async function ammTest(tester: PublicTxSimulationTester, logger: Logger)
|
|
|
34
34
|
);
|
|
35
35
|
|
|
36
36
|
const ammConstructorResult = await tester.simulateTxWithLabel(
|
|
37
|
-
/*txLabel=*/ 'constructor',
|
|
37
|
+
/*txLabel=*/ 'AMM/constructor',
|
|
38
38
|
/*sender=*/ admin,
|
|
39
39
|
/*setupCalls=*/ [],
|
|
40
40
|
/*appCalls=*/ [
|
|
@@ -51,7 +51,7 @@ export async function ammTest(tester: PublicTxSimulationTester, logger: Logger)
|
|
|
51
51
|
|
|
52
52
|
// set the AMM as the minter for the liquidity token
|
|
53
53
|
const setMinterResult = await tester.simulateTxWithLabel(
|
|
54
|
-
/*txLabel=*/ 'set_minter',
|
|
54
|
+
/*txLabel=*/ 'AMM/set_minter',
|
|
55
55
|
/*sender=*/ admin,
|
|
56
56
|
/*setupCalls=*/ [],
|
|
57
57
|
/*appCalls=*/ [
|
|
@@ -139,7 +139,7 @@ async function addLiquidity(
|
|
|
139
139
|
};
|
|
140
140
|
|
|
141
141
|
return await tester.simulateTxWithLabel(
|
|
142
|
-
/*txLabel=*/ 'add_liquidity',
|
|
142
|
+
/*txLabel=*/ 'AMM/add_liquidity',
|
|
143
143
|
/*sender=*/ sender,
|
|
144
144
|
/*setupCalls=*/ [],
|
|
145
145
|
/*appCalls=*/ [
|
|
@@ -218,7 +218,7 @@ async function swapExactTokensForTokens(
|
|
|
218
218
|
};
|
|
219
219
|
|
|
220
220
|
return await tester.simulateTxWithLabel(
|
|
221
|
-
/*txLabel=*/ 'swap_exact_tokens_for_tokens',
|
|
221
|
+
/*txLabel=*/ 'AMM/swap_exact_tokens_for_tokens',
|
|
222
222
|
/*sender=*/ sender,
|
|
223
223
|
/*setupCalls=*/ [],
|
|
224
224
|
/*appCalls=*/ [
|
|
@@ -267,7 +267,7 @@ async function removeLiquidity(
|
|
|
267
267
|
};
|
|
268
268
|
|
|
269
269
|
return await tester.simulateTxWithLabel(
|
|
270
|
-
/*txLabel=*/ 'remove_liquidity',
|
|
270
|
+
/*txLabel=*/ 'AMM/remove_liquidity',
|
|
271
271
|
/*sender=*/ sender,
|
|
272
272
|
/*setupCalls=*/ [],
|
|
273
273
|
/*appCalls=*/ [
|
|
@@ -17,7 +17,7 @@ export async function tokenTest(tester: PublicTxSimulationTester, logger: Logger
|
|
|
17
17
|
|
|
18
18
|
const mintAmount = 100n;
|
|
19
19
|
const mintResult = await tester.simulateTxWithLabel(
|
|
20
|
-
/*txLabel=*/ 'mint_to_public',
|
|
20
|
+
/*txLabel=*/ 'Token/mint_to_public',
|
|
21
21
|
/*sender=*/ admin,
|
|
22
22
|
/*setupCalls=*/ [],
|
|
23
23
|
/*appCalls=*/ [
|
|
@@ -34,7 +34,7 @@ export async function tokenTest(tester: PublicTxSimulationTester, logger: Logger
|
|
|
34
34
|
const nonce = new Fr(0);
|
|
35
35
|
const transferAmount = 50n;
|
|
36
36
|
const transferResult = await tester.simulateTxWithLabel(
|
|
37
|
-
/*txLabel=*/ 'transfer_in_public',
|
|
37
|
+
/*txLabel=*/ 'Token/transfer_in_public',
|
|
38
38
|
/*sender=*/ sender,
|
|
39
39
|
/*setupCalls=*/ [],
|
|
40
40
|
/*appCalls=*/ [
|
|
@@ -50,7 +50,7 @@ export async function tokenTest(tester: PublicTxSimulationTester, logger: Logger
|
|
|
50
50
|
await checkBalance(tester, token, sender, receiver, transferAmount);
|
|
51
51
|
|
|
52
52
|
const balResult = await tester.simulateTxWithLabel(
|
|
53
|
-
/*txLabel=*/ 'balance_of_public',
|
|
53
|
+
/*txLabel=*/ 'Token/balance_of_public',
|
|
54
54
|
sender,
|
|
55
55
|
/*setupCalls=*/ [],
|
|
56
56
|
/*appCalls=*/ [
|
|
@@ -65,7 +65,7 @@ export async function tokenTest(tester: PublicTxSimulationTester, logger: Logger
|
|
|
65
65
|
expect(balResult.revertCode.isOK()).toBe(true);
|
|
66
66
|
|
|
67
67
|
const burnResult = await tester.simulateTxWithLabel(
|
|
68
|
-
/*txLabel=*/ 'burn_public',
|
|
68
|
+
/*txLabel=*/ 'Token/burn_public',
|
|
69
69
|
/*sender=*/ receiver,
|
|
70
70
|
/*setupCalls=*/ [],
|
|
71
71
|
/*appCalls=*/ [
|
|
@@ -95,7 +95,7 @@ export async function deployToken(tester: PublicTxSimulationTester, admin: Aztec
|
|
|
95
95
|
);
|
|
96
96
|
|
|
97
97
|
const result = await tester.simulateTxWithLabel(
|
|
98
|
-
/*txLabel=*/ 'Token
|
|
98
|
+
/*txLabel=*/ 'Token/constructor',
|
|
99
99
|
/*sender=*/ admin,
|
|
100
100
|
/*setupCalls=*/ [],
|
|
101
101
|
/*appCalls=*/ [
|
|
@@ -118,7 +118,7 @@ async function checkBalance(
|
|
|
118
118
|
expectedBalance: bigint,
|
|
119
119
|
) {
|
|
120
120
|
const balResult = await tester.simulateTxWithLabel(
|
|
121
|
-
/*txLabel=*/ 'balance_of_public',
|
|
121
|
+
/*txLabel=*/ 'Token/balance_of_public',
|
|
122
122
|
sender,
|
|
123
123
|
/*setupCalls=*/ [],
|
|
124
124
|
/*appCalls=*/ [
|
|
@@ -11,14 +11,14 @@ export interface PublicEnqueuedCallMetrics {
|
|
|
11
11
|
fnName: string;
|
|
12
12
|
durationMs: number;
|
|
13
13
|
manaUsed: number;
|
|
14
|
-
|
|
14
|
+
totalInstructionsExecuted: number;
|
|
15
15
|
reverted: boolean;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
export interface PublicTxMetrics {
|
|
19
19
|
totalDurationMs: number;
|
|
20
20
|
manaUsed: number;
|
|
21
|
-
|
|
21
|
+
totalInstructionsExecuted: number;
|
|
22
22
|
txHashMs: number | undefined;
|
|
23
23
|
nonRevertiblePrivateInsertionsUs: number | undefined;
|
|
24
24
|
revertiblePrivateInsertionsUs: number | undefined;
|
|
@@ -59,7 +59,7 @@ export class TestExecutorMetrics implements ExecutorMetricsInterface {
|
|
|
59
59
|
this.txMetrics.set(txLabel, {
|
|
60
60
|
totalDurationMs: 0,
|
|
61
61
|
manaUsed: 0,
|
|
62
|
-
|
|
62
|
+
totalInstructionsExecuted: 0,
|
|
63
63
|
txHashMs: undefined,
|
|
64
64
|
nonRevertiblePrivateInsertionsUs: undefined,
|
|
65
65
|
revertiblePrivateInsertionsUs: undefined,
|
|
@@ -81,26 +81,36 @@ export class TestExecutorMetrics implements ExecutorMetricsInterface {
|
|
|
81
81
|
|
|
82
82
|
// add manaUsed across all enqueued calls
|
|
83
83
|
txMetrics.manaUsed = sum(txMetrics.enqueuedCalls.map(call => call.manaUsed));
|
|
84
|
-
// add
|
|
85
|
-
txMetrics.
|
|
84
|
+
// add totalInstructionsExecuted across all enqueued calls
|
|
85
|
+
txMetrics.totalInstructionsExecuted = sum(txMetrics.enqueuedCalls.map(call => call.totalInstructionsExecuted));
|
|
86
86
|
txMetrics.revertedCode = revertedCode;
|
|
87
87
|
|
|
88
88
|
this.currentTxLabel = undefined;
|
|
89
89
|
}
|
|
90
90
|
|
|
91
|
-
recordEnqueuedCallSimulation(
|
|
92
|
-
|
|
91
|
+
recordEnqueuedCallSimulation(
|
|
92
|
+
fnName: string,
|
|
93
|
+
durationMs: number,
|
|
94
|
+
manaUsed: number,
|
|
95
|
+
totalInstructionsExecuted: number,
|
|
96
|
+
) {
|
|
97
|
+
this.#recordEnqueuedCallSimulation(fnName, durationMs, manaUsed, totalInstructionsExecuted, false);
|
|
93
98
|
}
|
|
94
99
|
|
|
95
|
-
recordEnqueuedCallSimulationFailure(
|
|
96
|
-
|
|
100
|
+
recordEnqueuedCallSimulationFailure(
|
|
101
|
+
fnName: string,
|
|
102
|
+
durationMs: number,
|
|
103
|
+
manaUsed: number,
|
|
104
|
+
totalInstructionsExecuted: number,
|
|
105
|
+
) {
|
|
106
|
+
this.#recordEnqueuedCallSimulation(fnName, durationMs, manaUsed, totalInstructionsExecuted, true);
|
|
97
107
|
}
|
|
98
108
|
|
|
99
109
|
#recordEnqueuedCallSimulation(
|
|
100
110
|
fnName: string,
|
|
101
111
|
durationMs: number,
|
|
102
112
|
manaUsed: number,
|
|
103
|
-
|
|
113
|
+
totalInstructionsExecuted: number,
|
|
104
114
|
reverted: boolean,
|
|
105
115
|
) {
|
|
106
116
|
assert(this.currentTxLabel, 'Cannot record enqueued call simulation when no tx is live');
|
|
@@ -109,7 +119,7 @@ export class TestExecutorMetrics implements ExecutorMetricsInterface {
|
|
|
109
119
|
fnName,
|
|
110
120
|
durationMs,
|
|
111
121
|
manaUsed,
|
|
112
|
-
|
|
122
|
+
totalInstructionsExecuted: totalInstructionsExecuted,
|
|
113
123
|
reverted,
|
|
114
124
|
});
|
|
115
125
|
}
|
|
@@ -168,7 +178,7 @@ export class TestExecutorMetrics implements ExecutorMetricsInterface {
|
|
|
168
178
|
filter === PublicTxMetricsFilter.TOTALS ||
|
|
169
179
|
filter === PublicTxMetricsFilter.ALL
|
|
170
180
|
) {
|
|
171
|
-
pretty += `${INDENT0}Total instructions executed: ${fmtNum(txMetrics.
|
|
181
|
+
pretty += `${INDENT0}Total instructions executed: ${fmtNum(txMetrics.totalInstructionsExecuted)}\n`;
|
|
172
182
|
}
|
|
173
183
|
if (filter === PublicTxMetricsFilter.DURATIONS || filter === PublicTxMetricsFilter.ALL) {
|
|
174
184
|
pretty += `${INDENT0}Tx hash computation: ${fmtNum(txMetrics.txHashMs!, 'ms')}\n`;
|
|
@@ -203,7 +213,7 @@ export class TestExecutorMetrics implements ExecutorMetricsInterface {
|
|
|
203
213
|
}
|
|
204
214
|
|
|
205
215
|
if (filter === PublicTxMetricsFilter.INSTRUCTIONS || filter === PublicTxMetricsFilter.ALL) {
|
|
206
|
-
pretty += `${INDENT2}Instructions executed: ${fmtNum(enqueuedCall.
|
|
216
|
+
pretty += `${INDENT2}Instructions executed: ${fmtNum(enqueuedCall.totalInstructionsExecuted)}\n`;
|
|
207
217
|
}
|
|
208
218
|
if (enqueuedCall.reverted) {
|
|
209
219
|
pretty += `${INDENT2}Reverted!\n`;
|
|
@@ -215,6 +225,43 @@ export class TestExecutorMetrics implements ExecutorMetricsInterface {
|
|
|
215
225
|
toJSON(indent = 2) {
|
|
216
226
|
return JSON.stringify(Object.fromEntries(this.txMetrics.entries()), null, indent);
|
|
217
227
|
}
|
|
228
|
+
|
|
229
|
+
toGithubActionBenchmarkJSON(indent = 2) {
|
|
230
|
+
const data = [];
|
|
231
|
+
for (const [txLabel, txMetrics] of this.txMetrics.entries()) {
|
|
232
|
+
data.push({
|
|
233
|
+
name: `${txLabel}/totalInstructionsExecuted`,
|
|
234
|
+
value: txMetrics.totalInstructionsExecuted,
|
|
235
|
+
unit: '#instructions',
|
|
236
|
+
});
|
|
237
|
+
data.push({
|
|
238
|
+
name: `${txLabel}/totalDurationMs`,
|
|
239
|
+
value: txMetrics.totalDurationMs,
|
|
240
|
+
unit: 'ms',
|
|
241
|
+
});
|
|
242
|
+
data.push({
|
|
243
|
+
name: `${txLabel}/manaUsed`,
|
|
244
|
+
value: txMetrics.manaUsed,
|
|
245
|
+
unit: 'mana',
|
|
246
|
+
});
|
|
247
|
+
data.push({
|
|
248
|
+
name: `${txLabel}/txHashMs`,
|
|
249
|
+
value: txMetrics.txHashMs,
|
|
250
|
+
unit: 'ms',
|
|
251
|
+
});
|
|
252
|
+
data.push({
|
|
253
|
+
name: `${txLabel}/nonRevertiblePrivateInsertionsUs`,
|
|
254
|
+
value: txMetrics.nonRevertiblePrivateInsertionsUs,
|
|
255
|
+
unit: 'us',
|
|
256
|
+
});
|
|
257
|
+
data.push({
|
|
258
|
+
name: `${txLabel}/revertiblePrivateInsertionsUs`,
|
|
259
|
+
value: txMetrics.revertiblePrivateInsertionsUs,
|
|
260
|
+
unit: 'us',
|
|
261
|
+
});
|
|
262
|
+
}
|
|
263
|
+
return JSON.stringify(data, null, indent);
|
|
264
|
+
}
|
|
218
265
|
}
|
|
219
266
|
|
|
220
267
|
function fmtNum(num: number, unit?: string) {
|