@aztec/cli-wallet 0.86.0-starknet.1 → 0.87.0
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/bin/index.js +1 -1
- package/dest/cmds/create_account.d.ts +1 -1
- package/dest/cmds/create_account.d.ts.map +1 -1
- package/dest/cmds/create_account.js +25 -15
- package/dest/cmds/deploy.d.ts +1 -1
- package/dest/cmds/deploy.d.ts.map +1 -1
- package/dest/cmds/deploy.js +7 -2
- package/dest/cmds/deploy_account.d.ts +1 -1
- package/dest/cmds/deploy_account.d.ts.map +1 -1
- package/dest/cmds/deploy_account.js +25 -16
- package/dest/cmds/index.d.ts.map +1 -1
- package/dest/cmds/index.js +17 -16
- package/dest/cmds/profile.d.ts.map +1 -1
- package/dest/cmds/profile.js +2 -22
- package/dest/cmds/register_contract.d.ts +1 -1
- package/dest/cmds/register_contract.d.ts.map +1 -1
- package/dest/cmds/send.d.ts +1 -1
- package/dest/cmds/send.d.ts.map +1 -1
- package/dest/cmds/send.js +7 -2
- package/dest/cmds/simulate.d.ts +2 -1
- package/dest/cmds/simulate.d.ts.map +1 -1
- package/dest/cmds/simulate.js +10 -4
- package/dest/storage/wallet_db.d.ts +1 -3
- package/dest/storage/wallet_db.d.ts.map +1 -1
- package/dest/storage/wallet_db.js +1 -1
- package/dest/utils/accounts.d.ts +1 -1
- package/dest/utils/accounts.d.ts.map +1 -1
- package/dest/utils/ecdsa.d.ts +0 -2
- package/dest/utils/ecdsa.d.ts.map +1 -1
- package/dest/utils/options/fees.d.ts.map +1 -1
- package/dest/utils/options/options.d.ts +1 -0
- package/dest/utils/options/options.d.ts.map +1 -1
- package/dest/utils/options/options.js +6 -3
- package/dest/utils/profiling.d.ts +5 -0
- package/dest/utils/profiling.d.ts.map +1 -0
- package/dest/utils/profiling.js +32 -0
- package/package.json +15 -15
- package/src/bin/index.ts +1 -1
- package/src/cmds/create_account.ts +24 -14
- package/src/cmds/deploy.ts +8 -1
- package/src/cmds/deploy_account.ts +24 -15
- package/src/cmds/index.ts +51 -26
- package/src/cmds/profile.ts +3 -60
- package/src/cmds/register_contract.ts +1 -1
- package/src/cmds/send.ts +8 -1
- package/src/cmds/simulate.ts +14 -2
- package/src/storage/wallet_db.ts +1 -1
- package/src/utils/accounts.ts +1 -1
- package/src/utils/options/fees.ts +24 -15
- package/src/utils/options/options.ts +10 -3
- package/src/utils/profiling.ts +87 -0
package/src/utils/accounts.ts
CHANGED
|
@@ -254,11 +254,14 @@ export function parsePaymentMethod(
|
|
|
254
254
|
log: LogFn,
|
|
255
255
|
db?: WalletDB,
|
|
256
256
|
): (sender: AccountWallet) => Promise<FeePaymentMethod> {
|
|
257
|
-
const parsed = payment.split(',').reduce(
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
257
|
+
const parsed = payment.split(',').reduce(
|
|
258
|
+
(acc, item) => {
|
|
259
|
+
const [dimension, value] = item.split('=');
|
|
260
|
+
acc[dimension] = value ?? 1;
|
|
261
|
+
return acc;
|
|
262
|
+
},
|
|
263
|
+
{} as Record<string, string>,
|
|
264
|
+
);
|
|
262
265
|
|
|
263
266
|
const getFpc = () => {
|
|
264
267
|
if (!parsed.fpc) {
|
|
@@ -337,11 +340,14 @@ export function parsePaymentMethod(
|
|
|
337
340
|
}
|
|
338
341
|
|
|
339
342
|
function parseGasLimits(gasLimits: string): { gasLimits: Gas; teardownGasLimits: Gas } {
|
|
340
|
-
const parsed = gasLimits.split(',').reduce(
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
343
|
+
const parsed = gasLimits.split(',').reduce(
|
|
344
|
+
(acc, limit) => {
|
|
345
|
+
const [dimension, value] = limit.split('=');
|
|
346
|
+
acc[dimension] = parseInt(value, 10);
|
|
347
|
+
return acc;
|
|
348
|
+
},
|
|
349
|
+
{} as Record<string, number>,
|
|
350
|
+
);
|
|
345
351
|
|
|
346
352
|
const expected = ['da', 'l2', 'teardownDA', 'teardownL2'];
|
|
347
353
|
for (const dimension of expected) {
|
|
@@ -357,11 +363,14 @@ function parseGasLimits(gasLimits: string): { gasLimits: Gas; teardownGasLimits:
|
|
|
357
363
|
}
|
|
358
364
|
|
|
359
365
|
export function parseGasFees(gasFees: string): GasFees {
|
|
360
|
-
const parsed = gasFees.split(',').reduce(
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
366
|
+
const parsed = gasFees.split(',').reduce(
|
|
367
|
+
(acc, fee) => {
|
|
368
|
+
const [dimension, value] = fee.split('=');
|
|
369
|
+
acc[dimension] = parseInt(value, 10);
|
|
370
|
+
return acc;
|
|
371
|
+
},
|
|
372
|
+
{} as Record<string, number>,
|
|
373
|
+
);
|
|
365
374
|
|
|
366
375
|
const expected = ['da', 'l2'];
|
|
367
376
|
for (const dimension of expected) {
|
|
@@ -32,7 +32,7 @@ export function integerArgParser(
|
|
|
32
32
|
export function aliasedTxHashParser(txHash: string, db?: WalletDB) {
|
|
33
33
|
try {
|
|
34
34
|
return parseTxHash(txHash);
|
|
35
|
-
} catch
|
|
35
|
+
} catch {
|
|
36
36
|
const prefixed = txHash.includes(':') ? txHash : `transactions:${txHash}`;
|
|
37
37
|
const rawTxHash = db ? db.tryRetrieveAlias(prefixed) : txHash;
|
|
38
38
|
return parseTxHash(rawTxHash);
|
|
@@ -43,7 +43,7 @@ export function aliasedAuthWitParser(witnesses: string, db?: WalletDB) {
|
|
|
43
43
|
const parsedWitnesses = witnesses.split(',').map(witness => {
|
|
44
44
|
try {
|
|
45
45
|
return AuthWitness.fromString(witness);
|
|
46
|
-
} catch
|
|
46
|
+
} catch {
|
|
47
47
|
const prefixed = witness.includes(':') ? witness : `authwits:${witness}`;
|
|
48
48
|
const rawAuthWitness = db ? db.tryRetrieveAlias(prefixed) : witness;
|
|
49
49
|
return AuthWitness.fromString(rawAuthWitness);
|
|
@@ -120,6 +120,13 @@ export function createDebugExecutionStepsDirOption() {
|
|
|
120
120
|
).makeOptionMandatory(false);
|
|
121
121
|
}
|
|
122
122
|
|
|
123
|
+
export function createVerboseOption() {
|
|
124
|
+
return new Option(
|
|
125
|
+
'-v, --verbose',
|
|
126
|
+
'Provide timings on all executed operations (synching, simulating, proving)',
|
|
127
|
+
).default(false);
|
|
128
|
+
}
|
|
129
|
+
|
|
123
130
|
export function artifactPathParser(filePath: string, db?: WalletDB) {
|
|
124
131
|
if (filePath.includes('@')) {
|
|
125
132
|
const [pkg, contractName] = filePath.split('@');
|
|
@@ -161,7 +168,7 @@ async function contractArtifactFromWorkspace(pkg?: string, contractName?: string
|
|
|
161
168
|
const cwd = process.cwd();
|
|
162
169
|
try {
|
|
163
170
|
await stat(`${cwd}/Nargo.toml`);
|
|
164
|
-
} catch
|
|
171
|
+
} catch {
|
|
165
172
|
throw new Error(
|
|
166
173
|
'Invalid contract artifact argument provided. To use this option, command should be called from a nargo workspace',
|
|
167
174
|
);
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import type { LogFn } from '@aztec/foundation/log';
|
|
2
|
+
import type { PrivateExecutionStep } from '@aztec/stdlib/kernel';
|
|
3
|
+
import type { ProvingTimings, SimulationTimings } from '@aztec/stdlib/tx';
|
|
4
|
+
|
|
5
|
+
import { format } from 'util';
|
|
6
|
+
|
|
7
|
+
export function printProfileResult(
|
|
8
|
+
timings: ProvingTimings | SimulationTimings,
|
|
9
|
+
log: LogFn,
|
|
10
|
+
executionSteps?: PrivateExecutionStep[],
|
|
11
|
+
) {
|
|
12
|
+
log(format('\nPer circuit breakdown:\n'));
|
|
13
|
+
log(
|
|
14
|
+
format(
|
|
15
|
+
' ',
|
|
16
|
+
'Function name'.padEnd(50),
|
|
17
|
+
'Time'.padStart(13).padEnd(15),
|
|
18
|
+
executionSteps ? 'Gates'.padStart(13).padEnd(15) : '',
|
|
19
|
+
executionSteps ? 'Subtotal'.padStart(13).padEnd(15) : '',
|
|
20
|
+
),
|
|
21
|
+
);
|
|
22
|
+
log(format(''.padEnd(50 + 15 + 15 + (executionSteps ? 15 + 15 : 0), '-')));
|
|
23
|
+
let acc = 0;
|
|
24
|
+
let biggest: PrivateExecutionStep | undefined = executionSteps?.[0];
|
|
25
|
+
|
|
26
|
+
timings.perFunction.forEach((fn, i) => {
|
|
27
|
+
const currentExecutionStep = executionSteps?.[i];
|
|
28
|
+
if (currentExecutionStep && biggest && currentExecutionStep.gateCount! > biggest.gateCount!) {
|
|
29
|
+
biggest = currentExecutionStep;
|
|
30
|
+
}
|
|
31
|
+
acc += currentExecutionStep ? currentExecutionStep.gateCount! : 0;
|
|
32
|
+
|
|
33
|
+
log(
|
|
34
|
+
format(
|
|
35
|
+
' ',
|
|
36
|
+
fn.functionName.padEnd(50),
|
|
37
|
+
`${fn.time.toFixed(2)}ms`.padStart(13).padEnd(15),
|
|
38
|
+
currentExecutionStep ? currentExecutionStep.gateCount!.toLocaleString().padStart(13).padEnd(15) : '',
|
|
39
|
+
currentExecutionStep ? acc.toLocaleString().padStart(15) : '',
|
|
40
|
+
),
|
|
41
|
+
);
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
if (biggest) {
|
|
45
|
+
log(
|
|
46
|
+
format(
|
|
47
|
+
'\nTotal gates:',
|
|
48
|
+
acc.toLocaleString(),
|
|
49
|
+
`(Biggest circuit: ${biggest.functionName} -> ${biggest.gateCount!.toLocaleString()})`,
|
|
50
|
+
),
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
log(format('\nSync time:'.padEnd(25), `${timings.sync?.toFixed(2)}ms`.padStart(16)));
|
|
55
|
+
log(
|
|
56
|
+
format(
|
|
57
|
+
'Private simulation time:'.padEnd(25),
|
|
58
|
+
`${timings.perFunction.reduce((acc, { time }) => acc + time, 0).toFixed(2)}ms`.padStart(15),
|
|
59
|
+
),
|
|
60
|
+
);
|
|
61
|
+
if ((timings as ProvingTimings).proving) {
|
|
62
|
+
log(format('Proving time:'.padEnd(25), `${(timings as ProvingTimings).proving?.toFixed(2)}ms`.padStart(15)));
|
|
63
|
+
}
|
|
64
|
+
if ((timings as SimulationTimings).publicSimulation) {
|
|
65
|
+
log(
|
|
66
|
+
format(
|
|
67
|
+
'Public simulation time:'.padEnd(25),
|
|
68
|
+
`${(timings as SimulationTimings).publicSimulation?.toFixed(2)}ms`.padStart(15),
|
|
69
|
+
),
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
if ((timings as SimulationTimings).validation) {
|
|
74
|
+
log(
|
|
75
|
+
format('Validation time:'.padEnd(25), `${(timings as SimulationTimings).validation?.toFixed(2)}ms`.padStart(15)),
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
log(
|
|
80
|
+
format(
|
|
81
|
+
'Total time:'.padEnd(25),
|
|
82
|
+
`${timings.total.toFixed(2)}ms`.padStart(15),
|
|
83
|
+
`(${timings.unaccounted.toFixed(2)}ms unaccounted)`,
|
|
84
|
+
),
|
|
85
|
+
);
|
|
86
|
+
log('\n');
|
|
87
|
+
}
|