@aztec/stdlib 0.87.5 → 0.87.7
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/abi/decoder.d.ts +1 -1
- package/dest/abi/decoder.d.ts.map +1 -1
- package/dest/abi/decoder.js +4 -3
- package/dest/interfaces/prover-agent.d.ts +31 -6
- package/dest/interfaces/prover-agent.d.ts.map +1 -1
- package/dest/interfaces/prover-agent.js +15 -6
- package/dest/kernel/private_kernel_prover_output.d.ts +3 -0
- package/dest/kernel/private_kernel_prover_output.d.ts.map +1 -1
- package/dest/logs/pending_tagged_log.d.ts +1 -1
- package/dest/logs/pending_tagged_log.js +1 -1
- package/dest/tx/private_execution_result.d.ts +6 -0
- package/dest/tx/private_execution_result.d.ts.map +1 -1
- package/dest/tx/profiling.d.ts +254 -4
- package/dest/tx/profiling.d.ts.map +1 -1
- package/dest/tx/profiling.js +62 -30
- package/dest/tx/proven_tx.d.ts +43 -21
- package/dest/tx/proven_tx.d.ts.map +1 -1
- package/dest/tx/proven_tx.js +5 -5
- package/dest/tx/simulated_tx.d.ts +4 -4
- package/dest/tx/simulated_tx.d.ts.map +1 -1
- package/dest/tx/simulated_tx.js +8 -8
- package/package.json +7 -7
- package/src/abi/decoder.ts +5 -4
- package/src/interfaces/prover-agent.ts +9 -10
- package/src/kernel/private_kernel_prover_output.ts +1 -0
- package/src/logs/pending_tagged_log.ts +1 -1
- package/src/tx/private_execution_result.ts +1 -1
- package/src/tx/profiling.ts +64 -28
- package/src/tx/proven_tx.ts +3 -3
- package/src/tx/simulated_tx.ts +6 -6
package/src/tx/profiling.ts
CHANGED
|
@@ -4,15 +4,25 @@ import { type ZodFor, optional } from '@aztec/foundation/schemas';
|
|
|
4
4
|
import { z } from 'zod';
|
|
5
5
|
|
|
6
6
|
import type { AbiDecoded } from '../abi/decoder.js';
|
|
7
|
+
import type { AztecNode } from '../interfaces/aztec-node.js';
|
|
7
8
|
import { type PrivateExecutionStep, PrivateExecutionStepSchema } from '../kernel/private_kernel_prover_output.js';
|
|
8
9
|
import { AbiDecodedSchema } from '../schemas/schemas.js';
|
|
9
10
|
|
|
11
|
+
export type NodeStats = Partial<Record<keyof AztecNode, { times: number[] }>>;
|
|
12
|
+
|
|
13
|
+
const NodeStatsSchema = z.record(z.string(), z.object({ times: z.array(z.number()) }));
|
|
14
|
+
|
|
10
15
|
type FunctionTiming = {
|
|
11
16
|
functionName: string;
|
|
12
17
|
time: number;
|
|
18
|
+
oracles?: Record<string, { times: number[] }>;
|
|
13
19
|
};
|
|
14
20
|
|
|
15
|
-
const FunctionTimingSchema = z.object({
|
|
21
|
+
const FunctionTimingSchema = z.object({
|
|
22
|
+
functionName: z.string(),
|
|
23
|
+
time: z.number(),
|
|
24
|
+
oracles: optional(z.record(z.string(), z.object({ times: z.array(z.number()) }))),
|
|
25
|
+
});
|
|
16
26
|
|
|
17
27
|
export type ProvingTimings = {
|
|
18
28
|
sync?: number;
|
|
@@ -30,6 +40,16 @@ export const ProvingTimingsSchema = z.object({
|
|
|
30
40
|
total: z.number(),
|
|
31
41
|
});
|
|
32
42
|
|
|
43
|
+
export interface ProvingStats {
|
|
44
|
+
timings: ProvingTimings;
|
|
45
|
+
nodeRPCCalls?: NodeStats;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export const ProvingStatsSchema = z.object({
|
|
49
|
+
timings: ProvingTimingsSchema,
|
|
50
|
+
nodeRPCCalls: optional(NodeStatsSchema),
|
|
51
|
+
});
|
|
52
|
+
|
|
33
53
|
export interface SimulationTimings {
|
|
34
54
|
sync: number;
|
|
35
55
|
publicSimulation?: number;
|
|
@@ -48,19 +68,29 @@ export const SimulationTimingsSchema = z.object({
|
|
|
48
68
|
total: z.number(),
|
|
49
69
|
});
|
|
50
70
|
|
|
71
|
+
export interface SimulationStats {
|
|
72
|
+
timings: SimulationTimings;
|
|
73
|
+
nodeRPCCalls: NodeStats;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export const SimulationStatsSchema = z.object({
|
|
77
|
+
timings: SimulationTimingsSchema,
|
|
78
|
+
nodeRPCCalls: NodeStatsSchema,
|
|
79
|
+
});
|
|
80
|
+
|
|
51
81
|
export class TxProfileResult {
|
|
52
82
|
constructor(
|
|
53
83
|
public executionSteps: PrivateExecutionStep[],
|
|
54
|
-
public
|
|
84
|
+
public stats: ProvingStats,
|
|
55
85
|
) {}
|
|
56
86
|
|
|
57
87
|
static get schema(): ZodFor<TxProfileResult> {
|
|
58
88
|
return z
|
|
59
89
|
.object({
|
|
60
90
|
executionSteps: z.array(PrivateExecutionStepSchema),
|
|
61
|
-
|
|
91
|
+
stats: ProvingStatsSchema,
|
|
62
92
|
})
|
|
63
|
-
.transform(({ executionSteps,
|
|
93
|
+
.transform(({ executionSteps, stats }) => new TxProfileResult(executionSteps, stats));
|
|
64
94
|
}
|
|
65
95
|
|
|
66
96
|
static random(): TxProfileResult {
|
|
@@ -78,16 +108,19 @@ export class TxProfileResult {
|
|
|
78
108
|
},
|
|
79
109
|
],
|
|
80
110
|
{
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
111
|
+
nodeRPCCalls: { getBlockHeader: { times: [1] } },
|
|
112
|
+
timings: {
|
|
113
|
+
sync: 1,
|
|
114
|
+
proving: 1,
|
|
115
|
+
perFunction: [
|
|
116
|
+
{
|
|
117
|
+
functionName: 'random',
|
|
118
|
+
time: 1,
|
|
119
|
+
},
|
|
120
|
+
],
|
|
121
|
+
unaccounted: 1,
|
|
122
|
+
total: 4,
|
|
123
|
+
},
|
|
91
124
|
},
|
|
92
125
|
);
|
|
93
126
|
}
|
|
@@ -96,31 +129,34 @@ export class TxProfileResult {
|
|
|
96
129
|
export class UtilitySimulationResult {
|
|
97
130
|
constructor(
|
|
98
131
|
public result: AbiDecoded,
|
|
99
|
-
public
|
|
132
|
+
public stats?: SimulationStats,
|
|
100
133
|
) {}
|
|
101
134
|
|
|
102
135
|
static get schema(): ZodFor<UtilitySimulationResult> {
|
|
103
136
|
return z
|
|
104
137
|
.object({
|
|
105
138
|
result: AbiDecodedSchema,
|
|
106
|
-
|
|
139
|
+
stats: optional(SimulationStatsSchema),
|
|
107
140
|
})
|
|
108
|
-
.transform(({ result,
|
|
141
|
+
.transform(({ result, stats }) => new UtilitySimulationResult(result, stats));
|
|
109
142
|
}
|
|
110
143
|
|
|
111
144
|
static random(): UtilitySimulationResult {
|
|
112
145
|
return new UtilitySimulationResult(Fr.random().toBigInt(), {
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
146
|
+
nodeRPCCalls: { getBlockHeader: { times: [1] } },
|
|
147
|
+
timings: {
|
|
148
|
+
sync: 1,
|
|
149
|
+
publicSimulation: 1,
|
|
150
|
+
validation: 1,
|
|
151
|
+
perFunction: [
|
|
152
|
+
{
|
|
153
|
+
functionName: 'random',
|
|
154
|
+
time: 1,
|
|
155
|
+
},
|
|
156
|
+
],
|
|
157
|
+
unaccounted: 1,
|
|
158
|
+
total: 5,
|
|
159
|
+
},
|
|
124
160
|
});
|
|
125
161
|
}
|
|
126
162
|
}
|
package/src/tx/proven_tx.ts
CHANGED
|
@@ -6,7 +6,7 @@ import { z } from 'zod';
|
|
|
6
6
|
import { PrivateKernelTailCircuitPublicInputs } from '../kernel/private_kernel_tail_circuit_public_inputs.js';
|
|
7
7
|
import { ClientIvcProof } from '../proofs/client_ivc_proof.js';
|
|
8
8
|
import { PrivateExecutionResult, collectSortedContractClassLogs } from './private_execution_result.js';
|
|
9
|
-
import { type
|
|
9
|
+
import { type ProvingStats, ProvingTimingsSchema } from './profiling.js';
|
|
10
10
|
import { Tx } from './tx.js';
|
|
11
11
|
|
|
12
12
|
export class TxProvingResult {
|
|
@@ -14,7 +14,7 @@ export class TxProvingResult {
|
|
|
14
14
|
public privateExecutionResult: PrivateExecutionResult,
|
|
15
15
|
public publicInputs: PrivateKernelTailCircuitPublicInputs,
|
|
16
16
|
public clientIvcProof: ClientIvcProof,
|
|
17
|
-
public
|
|
17
|
+
public stats?: ProvingStats,
|
|
18
18
|
) {}
|
|
19
19
|
|
|
20
20
|
toTx(): Tx {
|
|
@@ -35,7 +35,7 @@ export class TxProvingResult {
|
|
|
35
35
|
privateExecutionResult: PrivateExecutionResult.schema,
|
|
36
36
|
publicInputs: PrivateKernelTailCircuitPublicInputs.schema,
|
|
37
37
|
clientIvcProof: ClientIvcProof.schema,
|
|
38
|
-
timings: optional(
|
|
38
|
+
timings: optional(ProvingTimingsSchema),
|
|
39
39
|
})
|
|
40
40
|
.transform(TxProvingResult.from);
|
|
41
41
|
}
|
package/src/tx/simulated_tx.ts
CHANGED
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
PrivateExecutionResult,
|
|
13
13
|
collectSortedContractClassLogs,
|
|
14
14
|
} from './private_execution_result.js';
|
|
15
|
-
import { type
|
|
15
|
+
import { type SimulationStats, SimulationStatsSchema } from './profiling.js';
|
|
16
16
|
import { NestedProcessReturnValues, PublicSimulationOutput } from './public_simulation_output.js';
|
|
17
17
|
import { Tx } from './tx.js';
|
|
18
18
|
|
|
@@ -44,7 +44,7 @@ export class TxSimulationResult {
|
|
|
44
44
|
public privateExecutionResult: PrivateExecutionResult,
|
|
45
45
|
public publicInputs: PrivateKernelTailCircuitPublicInputs,
|
|
46
46
|
public publicOutput?: PublicSimulationOutput,
|
|
47
|
-
public
|
|
47
|
+
public stats?: SimulationStats,
|
|
48
48
|
) {}
|
|
49
49
|
|
|
50
50
|
get gasUsed(): GasUsed {
|
|
@@ -64,7 +64,7 @@ export class TxSimulationResult {
|
|
|
64
64
|
privateExecutionResult: PrivateExecutionResult.schema,
|
|
65
65
|
publicInputs: PrivateKernelTailCircuitPublicInputs.schema,
|
|
66
66
|
publicOutput: PublicSimulationOutput.schema.optional(),
|
|
67
|
-
|
|
67
|
+
stats: optional(SimulationStatsSchema),
|
|
68
68
|
})
|
|
69
69
|
.transform(TxSimulationResult.from);
|
|
70
70
|
}
|
|
@@ -74,20 +74,20 @@ export class TxSimulationResult {
|
|
|
74
74
|
fields.privateExecutionResult,
|
|
75
75
|
fields.publicInputs,
|
|
76
76
|
fields.publicOutput,
|
|
77
|
-
fields.
|
|
77
|
+
fields.stats,
|
|
78
78
|
);
|
|
79
79
|
}
|
|
80
80
|
|
|
81
81
|
static fromPrivateSimulationResultAndPublicOutput(
|
|
82
82
|
privateSimulationResult: PrivateSimulationResult,
|
|
83
83
|
publicOutput?: PublicSimulationOutput,
|
|
84
|
-
|
|
84
|
+
stats?: SimulationStats,
|
|
85
85
|
) {
|
|
86
86
|
return new TxSimulationResult(
|
|
87
87
|
privateSimulationResult.privateExecutionResult,
|
|
88
88
|
privateSimulationResult.publicInputs,
|
|
89
89
|
publicOutput,
|
|
90
|
-
|
|
90
|
+
stats,
|
|
91
91
|
);
|
|
92
92
|
}
|
|
93
93
|
|