@aztec/cli-wallet 0.87.5 → 0.87.6
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/cmds/authorize_action.d.ts.map +1 -1
- package/dest/cmds/authorize_action.js +4 -1
- package/dest/cmds/cancel_tx.d.ts.map +1 -1
- package/dest/cmds/cancel_tx.js +4 -1
- package/dest/cmds/create_account.d.ts.map +1 -1
- package/dest/cmds/create_account.js +5 -2
- package/dest/cmds/deploy.d.ts.map +1 -1
- package/dest/cmds/deploy.js +5 -2
- package/dest/cmds/deploy_account.d.ts.map +1 -1
- package/dest/cmds/deploy_account.js +5 -2
- package/dest/cmds/profile.js +1 -1
- package/dest/cmds/send.d.ts.map +1 -1
- package/dest/cmds/send.js +5 -2
- package/dest/cmds/simulate.js +2 -2
- package/dest/utils/profiling.d.ts +2 -2
- package/dest/utils/profiling.d.ts.map +1 -1
- package/dest/utils/profiling.js +37 -9
- package/dest/utils/pxe_wrapper.d.ts +1 -0
- package/dest/utils/pxe_wrapper.d.ts.map +1 -1
- package/dest/utils/pxe_wrapper.js +1 -0
- package/package.json +12 -12
- package/src/cmds/authorize_action.ts +3 -1
- package/src/cmds/cancel_tx.ts +3 -1
- package/src/cmds/create_account.ts +3 -2
- package/src/cmds/deploy.ts +3 -2
- package/src/cmds/deploy_account.ts +3 -2
- package/src/cmds/profile.ts +1 -1
- package/src/cmds/send.ts +3 -2
- package/src/cmds/simulate.ts +2 -2
- package/src/utils/profiling.ts +87 -17
- package/src/utils/pxe_wrapper.ts +2 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authorize_action.d.ts","sourceRoot":"","sources":["../../src/cmds/authorize_action.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,0BAA0B,EAAE,KAAK,YAAY,EAAY,MAAM,iBAAiB,CAAC;AAE/F,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"authorize_action.d.ts","sourceRoot":"","sources":["../../src/cmds/authorize_action.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,0BAA0B,EAAE,KAAK,YAAY,EAAY,MAAM,iBAAiB,CAAC;AAE/F,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAInD,wBAAsB,eAAe,CACnC,MAAM,EAAE,0BAA0B,EAClC,YAAY,EAAE,MAAM,EACpB,MAAM,EAAE,YAAY,EACpB,cAAc,EAAE,GAAG,EAAE,EACrB,oBAAoB,EAAE,MAAM,EAC5B,eAAe,EAAE,YAAY,EAC7B,GAAG,EAAE,KAAK,oFAwBX"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Contract } from '@aztec/aztec.js';
|
|
2
2
|
import { prepTx } from '@aztec/cli/utils';
|
|
3
|
+
import { DEFAULT_TX_TIMEOUT_S } from '../utils/pxe_wrapper.js';
|
|
3
4
|
export async function authorizeAction(wallet, functionName, caller, functionArgsIn, contractArtifactPath, contractAddress, log) {
|
|
4
5
|
const { functionArgs, contractArtifact, isPrivate } = await prepTx(contractArtifactPath, functionName, functionArgsIn, log);
|
|
5
6
|
if (isPrivate) {
|
|
@@ -11,7 +12,9 @@ export async function authorizeAction(wallet, functionName, caller, functionArgs
|
|
|
11
12
|
caller,
|
|
12
13
|
action
|
|
13
14
|
}, true);
|
|
14
|
-
const witness = await setAuthwitnessInteraction.send().wait(
|
|
15
|
+
const witness = await setAuthwitnessInteraction.send().wait({
|
|
16
|
+
timeout: DEFAULT_TX_TIMEOUT_S
|
|
17
|
+
});
|
|
15
18
|
log(`Authorized action ${functionName} on contract ${contractAddress} for caller ${caller}`);
|
|
16
19
|
return witness;
|
|
17
20
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cancel_tx.d.ts","sourceRoot":"","sources":["../../src/cmds/cancel_tx.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,0BAA0B,EAAE,KAAK,gBAAgB,EAAU,KAAK,MAAM,EAAY,MAAM,iBAAiB,CAAC;AAGxH,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAC9C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"cancel_tx.d.ts","sourceRoot":"","sources":["../../src/cmds/cancel_tx.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,0BAA0B,EAAE,KAAK,gBAAgB,EAAU,KAAK,MAAM,EAAY,MAAM,iBAAiB,CAAC;AAGxH,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAC9C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAIzD,wBAAsB,QAAQ,CAC5B,MAAM,EAAE,0BAA0B,EAClC,EACE,MAAM,EACN,WAAW,EAAE,iBAAiB,EAC9B,KAAK,EACL,WAAW,GACZ,EAAE;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,WAAW,CAAC;IAAC,KAAK,EAAE,EAAE,CAAC;IAAC,WAAW,EAAE,OAAO,CAAA;CAAE,EAChF,aAAa,EAAE,gBAAgB,EAC/B,aAAa,EAAE,OAAO,EACtB,aAAa,EAAE,OAAO,GAAG,SAAS,EAClC,GAAG,EAAE,KAAK,iBA0CX"}
|
package/dest/cmds/cancel_tx.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { SentTx, TxStatus } from '@aztec/aztec.js';
|
|
2
2
|
import { ExecutionPayload } from '@aztec/entrypoints/payload';
|
|
3
3
|
import { GasFees, GasSettings } from '@aztec/stdlib/gas';
|
|
4
|
+
import { DEFAULT_TX_TIMEOUT_S } from '../utils/pxe_wrapper.js';
|
|
4
5
|
export async function cancelTx(wallet, { txHash, gasSettings: prevTxGasSettings, nonce, cancellable }, paymentMethod, increasedFees, maxFeesPerGas, log) {
|
|
5
6
|
const receipt = await wallet.getTxReceipt(txHash);
|
|
6
7
|
if (receipt.status !== TxStatus.PENDING || !cancellable) {
|
|
@@ -24,7 +25,9 @@ export async function cancelTx(wallet, { txHash, gasSettings: prevTxGasSettings,
|
|
|
24
25
|
const txProvingResult = await wallet.proveTx(txRequest, txSimulationResult.privateExecutionResult);
|
|
25
26
|
const sentTx = new SentTx(wallet, wallet.sendTx(txProvingResult.toTx()));
|
|
26
27
|
try {
|
|
27
|
-
await sentTx.wait(
|
|
28
|
+
await sentTx.wait({
|
|
29
|
+
timeout: DEFAULT_TX_TIMEOUT_S
|
|
30
|
+
});
|
|
28
31
|
log('Transaction has been cancelled');
|
|
29
32
|
const cancelReceipt = await sentTx.getReceipt();
|
|
30
33
|
log(` Tx fee: ${cancelReceipt.transactionFee}`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create_account.d.ts","sourceRoot":"","sources":["../../src/cmds/create_account.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAwB,GAAG,EAAE,MAAM,iBAAiB,CAAC;AAEjE,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAC9C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAE3D,OAAO,EAAE,KAAK,WAAW,EAA2B,MAAM,sBAAsB,CAAC;AACjF,OAAO,EAAE,KAAK,QAAQ,EAAqB,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"create_account.d.ts","sourceRoot":"","sources":["../../src/cmds/create_account.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAwB,GAAG,EAAE,MAAM,iBAAiB,CAAC;AAEjE,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAC9C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAE3D,OAAO,EAAE,KAAK,WAAW,EAA2B,MAAM,sBAAsB,CAAC;AACjF,OAAO,EAAE,KAAK,QAAQ,EAAqB,MAAM,0BAA0B,CAAC;AAI5E,wBAAsB,aAAa,CACjC,MAAM,EAAE,GAAG,EACX,WAAW,EAAE,WAAW,EACxB,SAAS,EAAE,EAAE,GAAG,SAAS,EACzB,SAAS,EAAE,MAAM,GAAG,SAAS,EAC7B,KAAK,EAAE,MAAM,GAAG,SAAS,EACzB,YAAY,EAAE,OAAO,EACrB,YAAY,EAAE,OAAO,EACrB,kBAAkB,EAAE,OAAO,EAC3B,IAAI,EAAE,OAAO,EACb,OAAO,EAAE,QAAQ,EACjB,IAAI,EAAE,OAAO,EACb,OAAO,EAAE,OAAO,EAChB,WAAW,EAAE,MAAM,EACnB,GAAG,EAAE,KAAK;;;;;GAsHX"}
|
|
@@ -3,6 +3,7 @@ import { Fr } from '@aztec/foundation/fields';
|
|
|
3
3
|
import { createOrRetrieveAccount } from '../utils/accounts.js';
|
|
4
4
|
import { printGasEstimates } from '../utils/options/fees.js';
|
|
5
5
|
import { printProfileResult } from '../utils/profiling.js';
|
|
6
|
+
import { DEFAULT_TX_TIMEOUT_S } from '../utils/pxe_wrapper.js';
|
|
6
7
|
export async function createAccount(client, accountType, secretKey, publicKey, alias, registerOnly, publicDeploy, skipInitialization, wait, feeOpts, json, verbose, debugLogger, log) {
|
|
7
8
|
secretKey ??= Fr.random();
|
|
8
9
|
const account = await createOrRetrieveAccount(client, undefined /* address, we don't have it yet */ , undefined /* db, as we want to create from scratch */ , secretKey, accountType, Fr.ZERO, publicKey);
|
|
@@ -82,7 +83,7 @@ export async function createAccount(client, accountType, secretKey, publicKey, a
|
|
|
82
83
|
contractAddressSalt: salt
|
|
83
84
|
});
|
|
84
85
|
if (verbose) {
|
|
85
|
-
printProfileResult(provenTx.
|
|
86
|
+
printProfileResult(provenTx.stats, log);
|
|
86
87
|
}
|
|
87
88
|
tx = provenTx.send();
|
|
88
89
|
const txHash = await tx.getTxHash();
|
|
@@ -92,7 +93,9 @@ export async function createAccount(client, accountType, secretKey, publicKey, a
|
|
|
92
93
|
if (!json) {
|
|
93
94
|
log(`\nWaiting for account contract deployment...`);
|
|
94
95
|
}
|
|
95
|
-
txReceipt = await tx.wait(
|
|
96
|
+
txReceipt = await tx.wait({
|
|
97
|
+
timeout: DEFAULT_TX_TIMEOUT_S
|
|
98
|
+
});
|
|
96
99
|
out.txReceipt = {
|
|
97
100
|
status: txReceipt.status,
|
|
98
101
|
transactionFee: txReceipt.transactionFee
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deploy.d.ts","sourceRoot":"","sources":["../../src/cmds/deploy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,0BAA0B,EAAwC,EAAE,EAAE,MAAM,iBAAiB,CAAC;AAE5G,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAE3D,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAEhD,OAAO,EAAE,KAAK,QAAQ,EAAqB,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"deploy.d.ts","sourceRoot":"","sources":["../../src/cmds/deploy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,0BAA0B,EAAwC,EAAE,EAAE,MAAM,iBAAiB,CAAC;AAE5G,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAE3D,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAEhD,OAAO,EAAE,KAAK,QAAQ,EAAqB,MAAM,0BAA0B,CAAC;AAI5E,wBAAsB,MAAM,CAC1B,MAAM,EAAE,0BAA0B,EAClC,YAAY,EAAE,MAAM,EACpB,IAAI,EAAE,OAAO,EACb,UAAU,EAAE,UAAU,GAAG,SAAS,EAClC,OAAO,EAAE,GAAG,EAAE,EACd,IAAI,EAAE,EAAE,GAAG,SAAS,EACpB,WAAW,EAAE,MAAM,GAAG,SAAS,EAC/B,oBAAoB,EAAE,OAAO,EAC7B,qBAAqB,EAAE,OAAO,EAC9B,kBAAkB,EAAE,OAAO,GAAG,SAAS,EACvC,eAAe,EAAE,OAAO,GAAG,SAAS,EACpC,IAAI,EAAE,OAAO,EACb,OAAO,EAAE,QAAQ,EACjB,OAAO,EAAE,OAAO,EAChB,WAAW,EAAE,MAAM,EACnB,GAAG,EAAE,KAAK,EACV,OAAO,EAAE,CAAC,MAAM,EAAE,GAAG,KAAK,IAAI,+DAuF/B"}
|
package/dest/cmds/deploy.js
CHANGED
|
@@ -4,6 +4,7 @@ import { getAllFunctionAbis, getInitializer } from '@aztec/stdlib/abi';
|
|
|
4
4
|
import { PublicKeys } from '@aztec/stdlib/keys';
|
|
5
5
|
import { printGasEstimates } from '../utils/options/fees.js';
|
|
6
6
|
import { printProfileResult } from '../utils/profiling.js';
|
|
7
|
+
import { DEFAULT_TX_TIMEOUT_S } from '../utils/pxe_wrapper.js';
|
|
7
8
|
export async function deploy(wallet, artifactPath, json, publicKeys, rawArgs, salt, initializer, skipPublicDeployment, skipClassRegistration, skipInitialization, universalDeploy, wait, feeOpts, verbose, debugLogger, log, logJson) {
|
|
8
9
|
salt ??= Fr.random();
|
|
9
10
|
const contractArtifact = await getContractArtifact(artifactPath, log);
|
|
@@ -36,13 +37,15 @@ export async function deploy(wallet, artifactPath, json, publicKeys, rawArgs, sa
|
|
|
36
37
|
}
|
|
37
38
|
const provenTx = await deploy.prove(deployOpts);
|
|
38
39
|
if (verbose) {
|
|
39
|
-
printProfileResult(provenTx.
|
|
40
|
+
printProfileResult(provenTx.stats, log);
|
|
40
41
|
}
|
|
41
42
|
const tx = provenTx.send();
|
|
42
43
|
const txHash = await tx.getTxHash();
|
|
43
44
|
debugLogger.debug(`Deploy tx sent with hash ${txHash}`);
|
|
44
45
|
if (wait) {
|
|
45
|
-
const deployed = await tx.wait(
|
|
46
|
+
const deployed = await tx.wait({
|
|
47
|
+
timeout: DEFAULT_TX_TIMEOUT_S
|
|
48
|
+
});
|
|
46
49
|
const { address, partialAddress, instance } = deployed.contract;
|
|
47
50
|
if (json) {
|
|
48
51
|
logJson({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deploy_account.d.ts","sourceRoot":"","sources":["../../src/cmds/deploy_account.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAwB,MAAM,iBAAiB,CAAC;AAE5E,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAE3D,OAAO,EAAE,KAAK,QAAQ,EAAqB,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"deploy_account.d.ts","sourceRoot":"","sources":["../../src/cmds/deploy_account.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAwB,MAAM,iBAAiB,CAAC;AAE5E,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAE3D,OAAO,EAAE,KAAK,QAAQ,EAAqB,MAAM,0BAA0B,CAAC;AAI5E,wBAAsB,aAAa,CACjC,OAAO,EAAE,cAAc,EACvB,IAAI,EAAE,OAAO,EACb,aAAa,EAAE,OAAO,EACtB,YAAY,EAAE,OAAO,EACrB,OAAO,EAAE,QAAQ,EACjB,IAAI,EAAE,OAAO,EACb,OAAO,EAAE,OAAO,EAChB,WAAW,EAAE,MAAM,EACnB,GAAG,EAAE,KAAK;;;;GAqGX"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { prettyPrintJSON } from '@aztec/cli/cli-utils';
|
|
2
2
|
import { printGasEstimates } from '../utils/options/fees.js';
|
|
3
3
|
import { printProfileResult } from '../utils/profiling.js';
|
|
4
|
+
import { DEFAULT_TX_TIMEOUT_S } from '../utils/pxe_wrapper.js';
|
|
4
5
|
export async function deployAccount(account, wait, registerClass, publicDeploy, feeOpts, json, verbose, debugLogger, log) {
|
|
5
6
|
const out = {};
|
|
6
7
|
const { address, partialAddress, publicKeys } = await account.getCompleteAddress();
|
|
@@ -71,7 +72,7 @@ export async function deployAccount(account, wait, registerClass, publicDeploy,
|
|
|
71
72
|
contractAddressSalt: salt
|
|
72
73
|
});
|
|
73
74
|
if (verbose) {
|
|
74
|
-
printProfileResult(provenTx.
|
|
75
|
+
printProfileResult(provenTx.stats, log);
|
|
75
76
|
}
|
|
76
77
|
tx = provenTx.send();
|
|
77
78
|
const txHash = await tx.getTxHash();
|
|
@@ -81,7 +82,9 @@ export async function deployAccount(account, wait, registerClass, publicDeploy,
|
|
|
81
82
|
if (!json) {
|
|
82
83
|
log(`\nWaiting for account contract deployment...`);
|
|
83
84
|
}
|
|
84
|
-
txReceipt = await tx.wait(
|
|
85
|
+
txReceipt = await tx.wait({
|
|
86
|
+
timeout: DEFAULT_TX_TIMEOUT_S
|
|
87
|
+
});
|
|
85
88
|
out.txReceipt = {
|
|
86
89
|
status: txReceipt.status,
|
|
87
90
|
transactionFee: txReceipt.transactionFee
|
package/dest/cmds/profile.js
CHANGED
|
@@ -14,7 +14,7 @@ export async function profile(wallet, functionName, functionArgsIn, contractArti
|
|
|
14
14
|
authWitnesses,
|
|
15
15
|
skipProofGeneration: false
|
|
16
16
|
});
|
|
17
|
-
printProfileResult(result.
|
|
17
|
+
printProfileResult(result.stats, log, result.executionSteps);
|
|
18
18
|
if (debugOutputPath) {
|
|
19
19
|
const ivcInputsPath = path.join(debugOutputPath, 'ivc-inputs.msgpack');
|
|
20
20
|
log(`Debug output written to ${ivcInputsPath}.`);
|
package/dest/cmds/send.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"send.d.ts","sourceRoot":"","sources":["../../src/cmds/send.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,0BAA0B,EAC/B,WAAW,EACX,KAAK,YAAY,EAEjB,EAAE,EAEH,MAAM,iBAAiB,CAAC;AAEzB,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,KAAK,QAAQ,EAAqB,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"send.d.ts","sourceRoot":"","sources":["../../src/cmds/send.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,0BAA0B,EAC/B,WAAW,EACX,KAAK,YAAY,EAEjB,EAAE,EAEH,MAAM,iBAAiB,CAAC;AAEzB,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,KAAK,QAAQ,EAAqB,MAAM,0BAA0B,CAAC;AAI5E,wBAAsB,IAAI,CACxB,MAAM,EAAE,0BAA0B,EAClC,YAAY,EAAE,MAAM,EACpB,cAAc,EAAE,GAAG,EAAE,EACrB,oBAAoB,EAAE,MAAM,EAC5B,eAAe,EAAE,YAAY,EAC7B,IAAI,EAAE,OAAO,EACb,WAAW,EAAE,OAAO,EACpB,OAAO,EAAE,QAAQ,EACjB,aAAa,EAAE,WAAW,EAAE,EAC5B,OAAO,EAAE,OAAO,EAChB,GAAG,EAAE,KAAK;;;;;eA0DX"}
|
package/dest/cmds/send.js
CHANGED
|
@@ -3,6 +3,7 @@ import { prepTx } from '@aztec/cli/utils';
|
|
|
3
3
|
import { GasSettings } from '@aztec/stdlib/gas';
|
|
4
4
|
import { printGasEstimates } from '../utils/options/fees.js';
|
|
5
5
|
import { printProfileResult } from '../utils/profiling.js';
|
|
6
|
+
import { DEFAULT_TX_TIMEOUT_S } from '../utils/pxe_wrapper.js';
|
|
6
7
|
export async function send(wallet, functionName, functionArgsIn, contractArtifactPath, contractAddress, wait, cancellable, feeOpts, authWitnesses, verbose, log) {
|
|
7
8
|
const { functionArgs, contractArtifact } = await prepTx(contractArtifactPath, functionName, functionArgsIn, log);
|
|
8
9
|
const contract = await Contract.at(contractAddress, contractArtifact, wallet);
|
|
@@ -21,14 +22,16 @@ export async function send(wallet, functionName, functionArgsIn, contractArtifac
|
|
|
21
22
|
}
|
|
22
23
|
const provenTx = await call.prove(sendOptions);
|
|
23
24
|
if (verbose) {
|
|
24
|
-
printProfileResult(provenTx.
|
|
25
|
+
printProfileResult(provenTx.stats, log);
|
|
25
26
|
}
|
|
26
27
|
const tx = provenTx.send();
|
|
27
28
|
const txHash = await tx.getTxHash();
|
|
28
29
|
log(`\nTransaction hash: ${txHash.toString()}`);
|
|
29
30
|
if (wait) {
|
|
30
31
|
try {
|
|
31
|
-
await tx.wait(
|
|
32
|
+
await tx.wait({
|
|
33
|
+
timeout: DEFAULT_TX_TIMEOUT_S
|
|
34
|
+
});
|
|
32
35
|
log('Transaction has been mined');
|
|
33
36
|
const receipt = await tx.getReceipt();
|
|
34
37
|
log(` Tx fee: ${receipt.transactionFee}`);
|
package/dest/cmds/simulate.js
CHANGED
|
@@ -9,10 +9,10 @@ export async function simulate(wallet, functionName, functionArgsIn, contractArt
|
|
|
9
9
|
const simulationResult = await call.simulate({
|
|
10
10
|
...await feeOpts.toSendOpts(wallet),
|
|
11
11
|
authWitnesses,
|
|
12
|
-
|
|
12
|
+
includeStats: true
|
|
13
13
|
});
|
|
14
14
|
if (verbose) {
|
|
15
|
-
printProfileResult(simulationResult.
|
|
15
|
+
printProfileResult(simulationResult.stats, log);
|
|
16
16
|
}
|
|
17
17
|
log(format('\nSimulation result: ', simulationResult.result, '\n'));
|
|
18
18
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { LogFn } from '@aztec/foundation/log';
|
|
2
2
|
import type { PrivateExecutionStep } from '@aztec/stdlib/kernel';
|
|
3
|
-
import type {
|
|
4
|
-
export declare function printProfileResult(
|
|
3
|
+
import type { ProvingStats, SimulationStats } from '@aztec/stdlib/tx';
|
|
4
|
+
export declare function printProfileResult(stats: ProvingStats | SimulationStats, log: LogFn, executionSteps?: PrivateExecutionStep[]): void;
|
|
5
5
|
//# sourceMappingURL=profiling.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"profiling.d.ts","sourceRoot":"","sources":["../../src/utils/profiling.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AACjE,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"profiling.d.ts","sourceRoot":"","sources":["../../src/utils/profiling.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AACjE,OAAO,KAAK,EAAE,YAAY,EAAkB,eAAe,EAAqB,MAAM,kBAAkB,CAAC;AAUzG,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,YAAY,GAAG,eAAe,EACrC,GAAG,EAAE,KAAK,EACV,cAAc,CAAC,EAAE,oBAAoB,EAAE,QA6IxC"}
|
package/dest/utils/profiling.js
CHANGED
|
@@ -1,32 +1,60 @@
|
|
|
1
1
|
import { format } from 'util';
|
|
2
|
-
|
|
2
|
+
const FN_NAME_PADDING = 50;
|
|
3
|
+
const COLUMN_MIN_WIDTH = 13;
|
|
4
|
+
const COLUMN_MAX_WIDTH = 15;
|
|
5
|
+
const ORACLE_NAME_PADDING = 50;
|
|
6
|
+
export function printProfileResult(stats, log, executionSteps) {
|
|
3
7
|
log(format('\nPer circuit breakdown:\n'));
|
|
4
|
-
log(format(' ', 'Function name'.padEnd(
|
|
5
|
-
log(format(''.padEnd(
|
|
8
|
+
log(format(' ', 'Function name'.padEnd(FN_NAME_PADDING), 'Time'.padStart(COLUMN_MIN_WIDTH).padEnd(COLUMN_MAX_WIDTH), executionSteps ? 'Gates'.padStart(COLUMN_MIN_WIDTH).padEnd(COLUMN_MAX_WIDTH) : '', executionSteps ? 'Subtotal'.padStart(COLUMN_MIN_WIDTH).padEnd(COLUMN_MAX_WIDTH) : ''));
|
|
9
|
+
log(format(''.padEnd(FN_NAME_PADDING + COLUMN_MAX_WIDTH + COLUMN_MAX_WIDTH + (executionSteps ? COLUMN_MAX_WIDTH + COLUMN_MAX_WIDTH : 0), '-')));
|
|
6
10
|
let acc = 0;
|
|
7
11
|
let biggest = executionSteps?.[0];
|
|
12
|
+
const timings = stats.timings;
|
|
8
13
|
timings.perFunction.forEach((fn, i)=>{
|
|
9
14
|
const currentExecutionStep = executionSteps?.[i];
|
|
10
15
|
if (currentExecutionStep && biggest && currentExecutionStep.gateCount > biggest.gateCount) {
|
|
11
16
|
biggest = currentExecutionStep;
|
|
12
17
|
}
|
|
13
18
|
acc += currentExecutionStep ? currentExecutionStep.gateCount : 0;
|
|
14
|
-
log(format('
|
|
19
|
+
log(format(' - ', fn.functionName.padEnd(FN_NAME_PADDING), `${fn.time.toFixed(2)}ms`.padStart(COLUMN_MIN_WIDTH).padEnd(COLUMN_MAX_WIDTH), currentExecutionStep ? currentExecutionStep.gateCount.toLocaleString().padStart(COLUMN_MIN_WIDTH).padEnd(COLUMN_MAX_WIDTH) : '', currentExecutionStep ? acc.toLocaleString().padStart(COLUMN_MAX_WIDTH) : ''));
|
|
20
|
+
if (fn.oracles) {
|
|
21
|
+
log('');
|
|
22
|
+
for (const [oracleName, { times }] of Object.entries(fn.oracles)){
|
|
23
|
+
const calls = times.length;
|
|
24
|
+
const min = Math.min(...times);
|
|
25
|
+
const max = Math.max(...times);
|
|
26
|
+
const total = times.reduce((acc, time)=>acc + time, 0);
|
|
27
|
+
const avg = total / calls;
|
|
28
|
+
log(format(' ', oracleName.padEnd(ORACLE_NAME_PADDING), `${calls} calls`.padStart(COLUMN_MIN_WIDTH).padEnd(COLUMN_MAX_WIDTH), `${total.toFixed(2)}ms`.padStart(COLUMN_MIN_WIDTH).padEnd(COLUMN_MAX_WIDTH), `min: ${min.toFixed(2)}ms`.padStart(COLUMN_MIN_WIDTH).padEnd(COLUMN_MAX_WIDTH), `avg: ${avg.toFixed(2)}ms`.padStart(COLUMN_MIN_WIDTH).padEnd(COLUMN_MAX_WIDTH), `max: ${max.toFixed(2)}ms`.padStart(COLUMN_MIN_WIDTH).padEnd(COLUMN_MAX_WIDTH)));
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
log('');
|
|
15
32
|
});
|
|
16
33
|
if (biggest) {
|
|
17
34
|
log(format('\nTotal gates:', acc.toLocaleString(), `(Biggest circuit: ${biggest.functionName} -> ${biggest.gateCount.toLocaleString()})`));
|
|
18
35
|
}
|
|
36
|
+
if (stats.nodeRPCCalls) {
|
|
37
|
+
log(format('\nRPC calls:\n'));
|
|
38
|
+
for (const [method, { times }] of Object.entries(stats.nodeRPCCalls)){
|
|
39
|
+
const calls = times.length;
|
|
40
|
+
const total = times.reduce((acc, time)=>acc + time, 0);
|
|
41
|
+
const avg = total / calls;
|
|
42
|
+
const min = Math.min(...times);
|
|
43
|
+
const max = Math.max(...times);
|
|
44
|
+
log(format(method.padEnd(ORACLE_NAME_PADDING), `${calls} calls`.padStart(COLUMN_MIN_WIDTH).padEnd(COLUMN_MAX_WIDTH), `${total.toFixed(2)}ms`.padStart(COLUMN_MIN_WIDTH).padEnd(COLUMN_MAX_WIDTH), `min: ${min.toFixed(2)}ms`.padStart(COLUMN_MIN_WIDTH).padEnd(COLUMN_MAX_WIDTH), `avg: ${avg.toFixed(2)}ms`.padStart(COLUMN_MIN_WIDTH).padEnd(COLUMN_MAX_WIDTH), `max: ${max.toFixed(2)}ms`.padStart(COLUMN_MIN_WIDTH).padEnd(COLUMN_MAX_WIDTH)));
|
|
45
|
+
}
|
|
46
|
+
}
|
|
19
47
|
log(format('\nSync time:'.padEnd(25), `${timings.sync?.toFixed(2)}ms`.padStart(16)));
|
|
20
|
-
log(format('Private simulation time:'.padEnd(25), `${timings.perFunction.reduce((acc, { time })=>acc + time, 0).toFixed(2)}ms`.padStart(
|
|
48
|
+
log(format('Private simulation time:'.padEnd(25), `${timings.perFunction.reduce((acc, { time })=>acc + time, 0).toFixed(2)}ms`.padStart(COLUMN_MAX_WIDTH)));
|
|
21
49
|
if (timings.proving) {
|
|
22
|
-
log(format('Proving time:'.padEnd(25), `${timings.proving?.toFixed(2)}ms`.padStart(
|
|
50
|
+
log(format('Proving time:'.padEnd(25), `${timings.proving?.toFixed(2)}ms`.padStart(COLUMN_MAX_WIDTH)));
|
|
23
51
|
}
|
|
24
52
|
if (timings.publicSimulation) {
|
|
25
|
-
log(format('Public simulation time:'.padEnd(25), `${timings.publicSimulation?.toFixed(2)}ms`.padStart(
|
|
53
|
+
log(format('Public simulation time:'.padEnd(25), `${timings.publicSimulation?.toFixed(2)}ms`.padStart(COLUMN_MAX_WIDTH)));
|
|
26
54
|
}
|
|
27
55
|
if (timings.validation) {
|
|
28
|
-
log(format('Validation time:'.padEnd(25), `${timings.validation?.toFixed(2)}ms`.padStart(
|
|
56
|
+
log(format('Validation time:'.padEnd(25), `${timings.validation?.toFixed(2)}ms`.padStart(COLUMN_MAX_WIDTH)));
|
|
29
57
|
}
|
|
30
|
-
log(format('Total time:'.padEnd(25), `${timings.total.toFixed(2)}ms`.padStart(
|
|
58
|
+
log(format('Total time:'.padEnd(25), `${timings.total.toFixed(2)}ms`.padStart(COLUMN_MAX_WIDTH), `(${timings.unaccounted.toFixed(2)}ms unaccounted)`));
|
|
31
59
|
log('\n');
|
|
32
60
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type PXEServiceConfig } from '@aztec/pxe/server';
|
|
2
2
|
import { type AztecNode, type PXE } from '@aztec/stdlib/interfaces/client';
|
|
3
|
+
export declare const DEFAULT_TX_TIMEOUT_S = 180;
|
|
3
4
|
export declare class PXEWrapper {
|
|
4
5
|
private static pxeConfig;
|
|
5
6
|
private static pxe;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pxe_wrapper.d.ts","sourceRoot":"","sources":["../../src/utils/pxe_wrapper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,gBAAgB,EAAyC,MAAM,mBAAmB,CAAC;AACjG,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,GAAG,EAAyB,MAAM,iCAAiC,CAAC;
|
|
1
|
+
{"version":3,"file":"pxe_wrapper.d.ts","sourceRoot":"","sources":["../../src/utils/pxe_wrapper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,gBAAgB,EAAyC,MAAM,mBAAmB,CAAC;AACjG,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,GAAG,EAAyB,MAAM,iCAAiC,CAAC;AAElG,eAAO,MAAM,oBAAoB,MAAM,CAAC;AAMxC,qBAAa,UAAU;IACrB,OAAO,CAAC,MAAM,CAAC,SAAS,CAA+B;IACvD,OAAO,CAAC,MAAM,CAAC,GAAG,CAAkB;IACpC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAwB;IAErC,MAAM;IAOZ,OAAO,IAAI,SAAS,GAAG,SAAS;IAIhC,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,wBAAwB,CAAC,EAAE,OAAO,CAAC,gBAAgB,CAAC;CAM/F"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { createPXEService, getPXEServiceConfig } from '@aztec/pxe/server';
|
|
2
2
|
import { createAztecNodeClient } from '@aztec/stdlib/interfaces/client';
|
|
3
|
+
export const DEFAULT_TX_TIMEOUT_S = 180;
|
|
3
4
|
/*
|
|
4
5
|
* Wrapper class for PXE service, avoids initialization issues due to
|
|
5
6
|
* closures when providing PXE service to injected commander.js commands
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/cli-wallet",
|
|
3
|
-
"version": "0.87.
|
|
3
|
+
"version": "0.87.6",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./dest/cmds/index.js",
|
|
@@ -63,17 +63,17 @@
|
|
|
63
63
|
]
|
|
64
64
|
},
|
|
65
65
|
"dependencies": {
|
|
66
|
-
"@aztec/accounts": "0.87.
|
|
67
|
-
"@aztec/aztec.js": "0.87.
|
|
68
|
-
"@aztec/cli": "0.87.
|
|
69
|
-
"@aztec/entrypoints": "0.87.
|
|
70
|
-
"@aztec/ethereum": "0.87.
|
|
71
|
-
"@aztec/foundation": "0.87.
|
|
72
|
-
"@aztec/kv-store": "0.87.
|
|
73
|
-
"@aztec/noir-contracts.js": "0.87.
|
|
74
|
-
"@aztec/noir-noirc_abi": "0.87.
|
|
75
|
-
"@aztec/pxe": "0.87.
|
|
76
|
-
"@aztec/stdlib": "0.87.
|
|
66
|
+
"@aztec/accounts": "0.87.6",
|
|
67
|
+
"@aztec/aztec.js": "0.87.6",
|
|
68
|
+
"@aztec/cli": "0.87.6",
|
|
69
|
+
"@aztec/entrypoints": "0.87.6",
|
|
70
|
+
"@aztec/ethereum": "0.87.6",
|
|
71
|
+
"@aztec/foundation": "0.87.6",
|
|
72
|
+
"@aztec/kv-store": "0.87.6",
|
|
73
|
+
"@aztec/noir-contracts.js": "0.87.6",
|
|
74
|
+
"@aztec/noir-noirc_abi": "0.87.6",
|
|
75
|
+
"@aztec/pxe": "0.87.6",
|
|
76
|
+
"@aztec/stdlib": "0.87.6",
|
|
77
77
|
"commander": "^12.1.0",
|
|
78
78
|
"inquirer": "^10.1.8",
|
|
79
79
|
"source-map-support": "^0.5.21",
|
|
@@ -2,6 +2,8 @@ import { type AccountWalletWithSecretKey, type AztecAddress, Contract } from '@a
|
|
|
2
2
|
import { prepTx } from '@aztec/cli/utils';
|
|
3
3
|
import type { LogFn } from '@aztec/foundation/log';
|
|
4
4
|
|
|
5
|
+
import { DEFAULT_TX_TIMEOUT_S } from '../utils/pxe_wrapper.js';
|
|
6
|
+
|
|
5
7
|
export async function authorizeAction(
|
|
6
8
|
wallet: AccountWalletWithSecretKey,
|
|
7
9
|
functionName: string,
|
|
@@ -28,7 +30,7 @@ export async function authorizeAction(
|
|
|
28
30
|
const action = contract.methods[functionName](...functionArgs);
|
|
29
31
|
|
|
30
32
|
const setAuthwitnessInteraction = await wallet.setPublicAuthWit({ caller, action }, true);
|
|
31
|
-
const witness = await setAuthwitnessInteraction.send().wait();
|
|
33
|
+
const witness = await setAuthwitnessInteraction.send().wait({ timeout: DEFAULT_TX_TIMEOUT_S });
|
|
32
34
|
|
|
33
35
|
log(`Authorized action ${functionName} on contract ${contractAddress} for caller ${caller}`);
|
|
34
36
|
|
package/src/cmds/cancel_tx.ts
CHANGED
|
@@ -5,6 +5,8 @@ import { Fr } from '@aztec/foundation/fields';
|
|
|
5
5
|
import type { LogFn } from '@aztec/foundation/log';
|
|
6
6
|
import { GasFees, GasSettings } from '@aztec/stdlib/gas';
|
|
7
7
|
|
|
8
|
+
import { DEFAULT_TX_TIMEOUT_S } from '../utils/pxe_wrapper.js';
|
|
9
|
+
|
|
8
10
|
export async function cancelTx(
|
|
9
11
|
wallet: AccountWalletWithSecretKey,
|
|
10
12
|
{
|
|
@@ -46,7 +48,7 @@ export async function cancelTx(
|
|
|
46
48
|
const txProvingResult = await wallet.proveTx(txRequest, txSimulationResult.privateExecutionResult);
|
|
47
49
|
const sentTx = new SentTx(wallet, wallet.sendTx(txProvingResult.toTx()));
|
|
48
50
|
try {
|
|
49
|
-
await sentTx.wait();
|
|
51
|
+
await sentTx.wait({ timeout: DEFAULT_TX_TIMEOUT_S });
|
|
50
52
|
|
|
51
53
|
log('Transaction has been cancelled');
|
|
52
54
|
|
|
@@ -6,6 +6,7 @@ import type { LogFn, Logger } from '@aztec/foundation/log';
|
|
|
6
6
|
import { type AccountType, createOrRetrieveAccount } from '../utils/accounts.js';
|
|
7
7
|
import { type IFeeOpts, printGasEstimates } from '../utils/options/fees.js';
|
|
8
8
|
import { printProfileResult } from '../utils/profiling.js';
|
|
9
|
+
import { DEFAULT_TX_TIMEOUT_S } from '../utils/pxe_wrapper.js';
|
|
9
10
|
|
|
10
11
|
export async function createAccount(
|
|
11
12
|
client: PXE,
|
|
@@ -107,7 +108,7 @@ export async function createAccount(
|
|
|
107
108
|
} else {
|
|
108
109
|
const provenTx = await deployMethod.prove({ ...deployOpts, universalDeploy: true, contractAddressSalt: salt });
|
|
109
110
|
if (verbose) {
|
|
110
|
-
printProfileResult(provenTx.
|
|
111
|
+
printProfileResult(provenTx.stats!, log);
|
|
111
112
|
}
|
|
112
113
|
tx = provenTx.send();
|
|
113
114
|
|
|
@@ -118,7 +119,7 @@ export async function createAccount(
|
|
|
118
119
|
if (!json) {
|
|
119
120
|
log(`\nWaiting for account contract deployment...`);
|
|
120
121
|
}
|
|
121
|
-
txReceipt = await tx.wait();
|
|
122
|
+
txReceipt = await tx.wait({ timeout: DEFAULT_TX_TIMEOUT_S });
|
|
122
123
|
out.txReceipt = {
|
|
123
124
|
status: txReceipt.status,
|
|
124
125
|
transactionFee: txReceipt.transactionFee,
|
package/src/cmds/deploy.ts
CHANGED
|
@@ -6,6 +6,7 @@ import { PublicKeys } from '@aztec/stdlib/keys';
|
|
|
6
6
|
|
|
7
7
|
import { type IFeeOpts, printGasEstimates } from '../utils/options/fees.js';
|
|
8
8
|
import { printProfileResult } from '../utils/profiling.js';
|
|
9
|
+
import { DEFAULT_TX_TIMEOUT_S } from '../utils/pxe_wrapper.js';
|
|
9
10
|
|
|
10
11
|
export async function deploy(
|
|
11
12
|
wallet: AccountWalletWithSecretKey,
|
|
@@ -63,7 +64,7 @@ export async function deploy(
|
|
|
63
64
|
|
|
64
65
|
const provenTx = await deploy.prove(deployOpts);
|
|
65
66
|
if (verbose) {
|
|
66
|
-
printProfileResult(provenTx.
|
|
67
|
+
printProfileResult(provenTx.stats!, log);
|
|
67
68
|
}
|
|
68
69
|
|
|
69
70
|
const tx = provenTx.send();
|
|
@@ -71,7 +72,7 @@ export async function deploy(
|
|
|
71
72
|
const txHash = await tx.getTxHash();
|
|
72
73
|
debugLogger.debug(`Deploy tx sent with hash ${txHash}`);
|
|
73
74
|
if (wait) {
|
|
74
|
-
const deployed = await tx.wait();
|
|
75
|
+
const deployed = await tx.wait({ timeout: DEFAULT_TX_TIMEOUT_S });
|
|
75
76
|
const { address, partialAddress, instance } = deployed.contract;
|
|
76
77
|
if (json) {
|
|
77
78
|
logJson({
|
|
@@ -4,6 +4,7 @@ import type { LogFn, Logger } from '@aztec/foundation/log';
|
|
|
4
4
|
|
|
5
5
|
import { type IFeeOpts, printGasEstimates } from '../utils/options/fees.js';
|
|
6
6
|
import { printProfileResult } from '../utils/profiling.js';
|
|
7
|
+
import { DEFAULT_TX_TIMEOUT_S } from '../utils/pxe_wrapper.js';
|
|
7
8
|
|
|
8
9
|
export async function deployAccount(
|
|
9
10
|
account: AccountManager,
|
|
@@ -84,7 +85,7 @@ export async function deployAccount(
|
|
|
84
85
|
} else {
|
|
85
86
|
const provenTx = await deployMethod.prove({ ...deployOpts, universalDeploy: true, contractAddressSalt: salt });
|
|
86
87
|
if (verbose) {
|
|
87
|
-
printProfileResult(provenTx.
|
|
88
|
+
printProfileResult(provenTx.stats!, log);
|
|
88
89
|
}
|
|
89
90
|
tx = provenTx.send();
|
|
90
91
|
|
|
@@ -95,7 +96,7 @@ export async function deployAccount(
|
|
|
95
96
|
if (!json) {
|
|
96
97
|
log(`\nWaiting for account contract deployment...`);
|
|
97
98
|
}
|
|
98
|
-
txReceipt = await tx.wait();
|
|
99
|
+
txReceipt = await tx.wait({ timeout: DEFAULT_TX_TIMEOUT_S });
|
|
99
100
|
out.txReceipt = {
|
|
100
101
|
status: txReceipt.status,
|
|
101
102
|
transactionFee: txReceipt.transactionFee,
|
package/src/cmds/profile.ts
CHANGED
|
@@ -31,7 +31,7 @@ export async function profile(
|
|
|
31
31
|
authWitnesses,
|
|
32
32
|
skipProofGeneration: false,
|
|
33
33
|
});
|
|
34
|
-
printProfileResult(result.
|
|
34
|
+
printProfileResult(result.stats, log, result.executionSteps);
|
|
35
35
|
if (debugOutputPath) {
|
|
36
36
|
const ivcInputsPath = path.join(debugOutputPath, 'ivc-inputs.msgpack');
|
|
37
37
|
log(`Debug output written to ${ivcInputsPath}.`);
|
package/src/cmds/send.ts
CHANGED
|
@@ -12,6 +12,7 @@ import { GasSettings } from '@aztec/stdlib/gas';
|
|
|
12
12
|
|
|
13
13
|
import { type IFeeOpts, printGasEstimates } from '../utils/options/fees.js';
|
|
14
14
|
import { printProfileResult } from '../utils/profiling.js';
|
|
15
|
+
import { DEFAULT_TX_TIMEOUT_S } from '../utils/pxe_wrapper.js';
|
|
15
16
|
|
|
16
17
|
export async function send(
|
|
17
18
|
wallet: AccountWalletWithSecretKey,
|
|
@@ -49,7 +50,7 @@ export async function send(
|
|
|
49
50
|
|
|
50
51
|
const provenTx = await call.prove(sendOptions);
|
|
51
52
|
if (verbose) {
|
|
52
|
-
printProfileResult(provenTx.
|
|
53
|
+
printProfileResult(provenTx.stats!, log);
|
|
53
54
|
}
|
|
54
55
|
|
|
55
56
|
const tx = provenTx.send();
|
|
@@ -57,7 +58,7 @@ export async function send(
|
|
|
57
58
|
log(`\nTransaction hash: ${txHash.toString()}`);
|
|
58
59
|
if (wait) {
|
|
59
60
|
try {
|
|
60
|
-
await tx.wait();
|
|
61
|
+
await tx.wait({ timeout: DEFAULT_TX_TIMEOUT_S });
|
|
61
62
|
|
|
62
63
|
log('Transaction has been mined');
|
|
63
64
|
|
package/src/cmds/simulate.ts
CHANGED
|
@@ -25,10 +25,10 @@ export async function simulate(
|
|
|
25
25
|
const simulationResult = await call.simulate({
|
|
26
26
|
...(await feeOpts.toSendOpts(wallet)),
|
|
27
27
|
authWitnesses,
|
|
28
|
-
|
|
28
|
+
includeStats: true,
|
|
29
29
|
});
|
|
30
30
|
if (verbose) {
|
|
31
|
-
printProfileResult(simulationResult.
|
|
31
|
+
printProfileResult(simulationResult.stats!, log);
|
|
32
32
|
}
|
|
33
33
|
log(format('\nSimulation result: ', simulationResult.result, '\n'));
|
|
34
34
|
}
|
package/src/utils/profiling.ts
CHANGED
|
@@ -1,11 +1,17 @@
|
|
|
1
1
|
import type { LogFn } from '@aztec/foundation/log';
|
|
2
2
|
import type { PrivateExecutionStep } from '@aztec/stdlib/kernel';
|
|
3
|
-
import type { ProvingTimings, SimulationTimings } from '@aztec/stdlib/tx';
|
|
3
|
+
import type { ProvingStats, ProvingTimings, SimulationStats, SimulationTimings } from '@aztec/stdlib/tx';
|
|
4
4
|
|
|
5
5
|
import { format } from 'util';
|
|
6
6
|
|
|
7
|
+
const FN_NAME_PADDING = 50;
|
|
8
|
+
const COLUMN_MIN_WIDTH = 13;
|
|
9
|
+
const COLUMN_MAX_WIDTH = 15;
|
|
10
|
+
|
|
11
|
+
const ORACLE_NAME_PADDING = 50;
|
|
12
|
+
|
|
7
13
|
export function printProfileResult(
|
|
8
|
-
|
|
14
|
+
stats: ProvingStats | SimulationStats,
|
|
9
15
|
log: LogFn,
|
|
10
16
|
executionSteps?: PrivateExecutionStep[],
|
|
11
17
|
) {
|
|
@@ -13,16 +19,27 @@ export function printProfileResult(
|
|
|
13
19
|
log(
|
|
14
20
|
format(
|
|
15
21
|
' ',
|
|
16
|
-
'Function name'.padEnd(
|
|
17
|
-
'Time'.padStart(
|
|
18
|
-
executionSteps ? 'Gates'.padStart(
|
|
19
|
-
executionSteps ? 'Subtotal'.padStart(
|
|
22
|
+
'Function name'.padEnd(FN_NAME_PADDING),
|
|
23
|
+
'Time'.padStart(COLUMN_MIN_WIDTH).padEnd(COLUMN_MAX_WIDTH),
|
|
24
|
+
executionSteps ? 'Gates'.padStart(COLUMN_MIN_WIDTH).padEnd(COLUMN_MAX_WIDTH) : '',
|
|
25
|
+
executionSteps ? 'Subtotal'.padStart(COLUMN_MIN_WIDTH).padEnd(COLUMN_MAX_WIDTH) : '',
|
|
26
|
+
),
|
|
27
|
+
);
|
|
28
|
+
log(
|
|
29
|
+
format(
|
|
30
|
+
''.padEnd(
|
|
31
|
+
FN_NAME_PADDING +
|
|
32
|
+
COLUMN_MAX_WIDTH +
|
|
33
|
+
COLUMN_MAX_WIDTH +
|
|
34
|
+
(executionSteps ? COLUMN_MAX_WIDTH + COLUMN_MAX_WIDTH : 0),
|
|
35
|
+
'-',
|
|
36
|
+
),
|
|
20
37
|
),
|
|
21
38
|
);
|
|
22
|
-
log(format(''.padEnd(50 + 15 + 15 + (executionSteps ? 15 + 15 : 0), '-')));
|
|
23
39
|
let acc = 0;
|
|
24
40
|
let biggest: PrivateExecutionStep | undefined = executionSteps?.[0];
|
|
25
41
|
|
|
42
|
+
const timings = stats.timings;
|
|
26
43
|
timings.perFunction.forEach((fn, i) => {
|
|
27
44
|
const currentExecutionStep = executionSteps?.[i];
|
|
28
45
|
if (currentExecutionStep && biggest && currentExecutionStep.gateCount! > biggest.gateCount!) {
|
|
@@ -32,13 +49,37 @@ export function printProfileResult(
|
|
|
32
49
|
|
|
33
50
|
log(
|
|
34
51
|
format(
|
|
35
|
-
'
|
|
36
|
-
fn.functionName.padEnd(
|
|
37
|
-
`${fn.time.toFixed(2)}ms`.padStart(
|
|
38
|
-
currentExecutionStep
|
|
39
|
-
|
|
52
|
+
' - ',
|
|
53
|
+
fn.functionName.padEnd(FN_NAME_PADDING),
|
|
54
|
+
`${fn.time.toFixed(2)}ms`.padStart(COLUMN_MIN_WIDTH).padEnd(COLUMN_MAX_WIDTH),
|
|
55
|
+
currentExecutionStep
|
|
56
|
+
? currentExecutionStep.gateCount!.toLocaleString().padStart(COLUMN_MIN_WIDTH).padEnd(COLUMN_MAX_WIDTH)
|
|
57
|
+
: '',
|
|
58
|
+
currentExecutionStep ? acc.toLocaleString().padStart(COLUMN_MAX_WIDTH) : '',
|
|
40
59
|
),
|
|
41
60
|
);
|
|
61
|
+
if (fn.oracles) {
|
|
62
|
+
log('');
|
|
63
|
+
for (const [oracleName, { times }] of Object.entries(fn.oracles)) {
|
|
64
|
+
const calls = times.length;
|
|
65
|
+
const min = Math.min(...times);
|
|
66
|
+
const max = Math.max(...times);
|
|
67
|
+
const total = times.reduce((acc, time) => acc + time, 0);
|
|
68
|
+
const avg = total / calls;
|
|
69
|
+
log(
|
|
70
|
+
format(
|
|
71
|
+
' ',
|
|
72
|
+
oracleName.padEnd(ORACLE_NAME_PADDING),
|
|
73
|
+
`${calls} calls`.padStart(COLUMN_MIN_WIDTH).padEnd(COLUMN_MAX_WIDTH),
|
|
74
|
+
`${total.toFixed(2)}ms`.padStart(COLUMN_MIN_WIDTH).padEnd(COLUMN_MAX_WIDTH),
|
|
75
|
+
`min: ${min.toFixed(2)}ms`.padStart(COLUMN_MIN_WIDTH).padEnd(COLUMN_MAX_WIDTH),
|
|
76
|
+
`avg: ${avg.toFixed(2)}ms`.padStart(COLUMN_MIN_WIDTH).padEnd(COLUMN_MAX_WIDTH),
|
|
77
|
+
`max: ${max.toFixed(2)}ms`.padStart(COLUMN_MIN_WIDTH).padEnd(COLUMN_MAX_WIDTH),
|
|
78
|
+
),
|
|
79
|
+
);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
log('');
|
|
42
83
|
});
|
|
43
84
|
|
|
44
85
|
if (biggest) {
|
|
@@ -51,35 +92,64 @@ export function printProfileResult(
|
|
|
51
92
|
);
|
|
52
93
|
}
|
|
53
94
|
|
|
95
|
+
if (stats.nodeRPCCalls) {
|
|
96
|
+
log(format('\nRPC calls:\n'));
|
|
97
|
+
for (const [method, { times }] of Object.entries(stats.nodeRPCCalls)) {
|
|
98
|
+
const calls = times.length;
|
|
99
|
+
const total = times.reduce((acc, time) => acc + time, 0);
|
|
100
|
+
const avg = total / calls;
|
|
101
|
+
const min = Math.min(...times);
|
|
102
|
+
const max = Math.max(...times);
|
|
103
|
+
log(
|
|
104
|
+
format(
|
|
105
|
+
method.padEnd(ORACLE_NAME_PADDING),
|
|
106
|
+
`${calls} calls`.padStart(COLUMN_MIN_WIDTH).padEnd(COLUMN_MAX_WIDTH),
|
|
107
|
+
`${total.toFixed(2)}ms`.padStart(COLUMN_MIN_WIDTH).padEnd(COLUMN_MAX_WIDTH),
|
|
108
|
+
`min: ${min.toFixed(2)}ms`.padStart(COLUMN_MIN_WIDTH).padEnd(COLUMN_MAX_WIDTH),
|
|
109
|
+
`avg: ${avg.toFixed(2)}ms`.padStart(COLUMN_MIN_WIDTH).padEnd(COLUMN_MAX_WIDTH),
|
|
110
|
+
`max: ${max.toFixed(2)}ms`.padStart(COLUMN_MIN_WIDTH).padEnd(COLUMN_MAX_WIDTH),
|
|
111
|
+
),
|
|
112
|
+
);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
54
116
|
log(format('\nSync time:'.padEnd(25), `${timings.sync?.toFixed(2)}ms`.padStart(16)));
|
|
55
117
|
log(
|
|
56
118
|
format(
|
|
57
119
|
'Private simulation time:'.padEnd(25),
|
|
58
|
-
`${timings.perFunction.reduce((acc, { time }) => acc + time, 0).toFixed(2)}ms`.padStart(
|
|
120
|
+
`${timings.perFunction.reduce((acc, { time }) => acc + time, 0).toFixed(2)}ms`.padStart(COLUMN_MAX_WIDTH),
|
|
59
121
|
),
|
|
60
122
|
);
|
|
61
123
|
if ((timings as ProvingTimings).proving) {
|
|
62
|
-
log(
|
|
124
|
+
log(
|
|
125
|
+
format(
|
|
126
|
+
'Proving time:'.padEnd(25),
|
|
127
|
+
`${(timings as ProvingTimings).proving?.toFixed(2)}ms`.padStart(COLUMN_MAX_WIDTH),
|
|
128
|
+
),
|
|
129
|
+
);
|
|
63
130
|
}
|
|
64
131
|
if ((timings as SimulationTimings).publicSimulation) {
|
|
65
132
|
log(
|
|
66
133
|
format(
|
|
67
134
|
'Public simulation time:'.padEnd(25),
|
|
68
|
-
`${(timings as SimulationTimings).publicSimulation?.toFixed(2)}ms`.padStart(
|
|
135
|
+
`${(timings as SimulationTimings).publicSimulation?.toFixed(2)}ms`.padStart(COLUMN_MAX_WIDTH),
|
|
69
136
|
),
|
|
70
137
|
);
|
|
71
138
|
}
|
|
72
139
|
|
|
73
140
|
if ((timings as SimulationTimings).validation) {
|
|
74
141
|
log(
|
|
75
|
-
format(
|
|
142
|
+
format(
|
|
143
|
+
'Validation time:'.padEnd(25),
|
|
144
|
+
`${(timings as SimulationTimings).validation?.toFixed(2)}ms`.padStart(COLUMN_MAX_WIDTH),
|
|
145
|
+
),
|
|
76
146
|
);
|
|
77
147
|
}
|
|
78
148
|
|
|
79
149
|
log(
|
|
80
150
|
format(
|
|
81
151
|
'Total time:'.padEnd(25),
|
|
82
|
-
`${timings.total.toFixed(2)}ms`.padStart(
|
|
152
|
+
`${timings.total.toFixed(2)}ms`.padStart(COLUMN_MAX_WIDTH),
|
|
83
153
|
`(${timings.unaccounted.toFixed(2)}ms unaccounted)`,
|
|
84
154
|
),
|
|
85
155
|
);
|
package/src/utils/pxe_wrapper.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { type PXEServiceConfig, createPXEService, getPXEServiceConfig } from '@aztec/pxe/server';
|
|
2
2
|
import { type AztecNode, type PXE, createAztecNodeClient } from '@aztec/stdlib/interfaces/client';
|
|
3
3
|
|
|
4
|
+
export const DEFAULT_TX_TIMEOUT_S = 180;
|
|
5
|
+
|
|
4
6
|
/*
|
|
5
7
|
* Wrapper class for PXE service, avoids initialization issues due to
|
|
6
8
|
* closures when providing PXE service to injected commander.js commands
|