@aztec/cli-wallet 0.86.0 → 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.
Files changed (57) hide show
  1. package/dest/bin/index.js +7 -9
  2. package/dest/cmds/create_account.d.ts +1 -1
  3. package/dest/cmds/create_account.d.ts.map +1 -1
  4. package/dest/cmds/create_account.js +25 -15
  5. package/dest/cmds/deploy.d.ts +1 -1
  6. package/dest/cmds/deploy.d.ts.map +1 -1
  7. package/dest/cmds/deploy.js +7 -2
  8. package/dest/cmds/deploy_account.d.ts +1 -1
  9. package/dest/cmds/deploy_account.d.ts.map +1 -1
  10. package/dest/cmds/deploy_account.js +26 -17
  11. package/dest/cmds/index.d.ts.map +1 -1
  12. package/dest/cmds/index.js +34 -32
  13. package/dest/cmds/profile.d.ts +2 -1
  14. package/dest/cmds/profile.d.ts.map +1 -1
  15. package/dest/cmds/profile.js +7 -17
  16. package/dest/cmds/register_contract.d.ts +1 -1
  17. package/dest/cmds/register_contract.d.ts.map +1 -1
  18. package/dest/cmds/send.d.ts +1 -1
  19. package/dest/cmds/send.d.ts.map +1 -1
  20. package/dest/cmds/send.js +7 -2
  21. package/dest/cmds/simulate.d.ts +2 -1
  22. package/dest/cmds/simulate.d.ts.map +1 -1
  23. package/dest/cmds/simulate.js +10 -4
  24. package/dest/storage/wallet_db.d.ts +1 -3
  25. package/dest/storage/wallet_db.d.ts.map +1 -1
  26. package/dest/storage/wallet_db.js +1 -1
  27. package/dest/utils/accounts.d.ts +1 -1
  28. package/dest/utils/accounts.d.ts.map +1 -1
  29. package/dest/utils/ecdsa.d.ts +0 -2
  30. package/dest/utils/ecdsa.d.ts.map +1 -1
  31. package/dest/utils/options/fees.d.ts.map +1 -1
  32. package/dest/utils/options/fees.js +1 -1
  33. package/dest/utils/options/options.d.ts +1 -0
  34. package/dest/utils/options/options.d.ts.map +1 -1
  35. package/dest/utils/options/options.js +6 -3
  36. package/dest/utils/profiling.d.ts +5 -0
  37. package/dest/utils/profiling.d.ts.map +1 -0
  38. package/dest/utils/profiling.js +32 -0
  39. package/dest/utils/pxe_wrapper.d.ts +3 -2
  40. package/dest/utils/pxe_wrapper.d.ts.map +1 -1
  41. package/dest/utils/pxe_wrapper.js +7 -3
  42. package/package.json +15 -15
  43. package/src/bin/index.ts +7 -9
  44. package/src/cmds/create_account.ts +24 -14
  45. package/src/cmds/deploy.ts +8 -1
  46. package/src/cmds/deploy_account.ts +26 -16
  47. package/src/cmds/index.ts +98 -69
  48. package/src/cmds/profile.ts +10 -25
  49. package/src/cmds/register_contract.ts +1 -1
  50. package/src/cmds/send.ts +8 -1
  51. package/src/cmds/simulate.ts +14 -2
  52. package/src/storage/wallet_db.ts +1 -1
  53. package/src/utils/accounts.ts +1 -1
  54. package/src/utils/options/fees.ts +25 -16
  55. package/src/utils/options/options.ts +10 -3
  56. package/src/utils/profiling.ts +87 -0
  57. package/src/utils/pxe_wrapper.ts +7 -3
@@ -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
+ }
@@ -6,10 +6,14 @@ import { type AztecNode, type PXE, createAztecNodeClient } from '@aztec/stdlib/i
6
6
  * closures when providing PXE service to injected commander.js commands
7
7
  */
8
8
  export class PXEWrapper {
9
+ private static pxeConfig: PXEServiceConfig | undefined;
9
10
  private static pxe: PXE | undefined;
10
11
  private static node: AztecNode | undefined;
11
12
 
12
- getPXE(): PXE | undefined {
13
+ async getPXE() {
14
+ if (!PXEWrapper.pxe) {
15
+ PXEWrapper.pxe = await createPXEService(PXEWrapper.node!, PXEWrapper.pxeConfig!);
16
+ }
13
17
  return PXEWrapper.pxe;
14
18
  }
15
19
 
@@ -17,10 +21,10 @@ export class PXEWrapper {
17
21
  return PXEWrapper.node;
18
22
  }
19
23
 
20
- async init(nodeUrl: string, dataDir: string, overridePXEServiceConfig?: Partial<PXEServiceConfig>) {
24
+ prepare(nodeUrl: string, dataDir: string, overridePXEServiceConfig?: Partial<PXEServiceConfig>) {
21
25
  PXEWrapper.node = createAztecNodeClient(nodeUrl);
22
26
  const pxeConfig = Object.assign(getPXEServiceConfig(), overridePXEServiceConfig);
23
27
  pxeConfig.dataDirectory = dataDir;
24
- PXEWrapper.pxe = await createPXEService(PXEWrapper.node, pxeConfig);
28
+ PXEWrapper.pxeConfig = pxeConfig;
25
29
  }
26
30
  }