@aztec/cli 0.0.1-commit.f504929 → 0.0.1-commit.f5a9928
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/aztec_node/block_number.js +1 -1
- package/dest/cmds/aztec_node/get_logs.d.ts +30 -4
- package/dest/cmds/aztec_node/get_logs.d.ts.map +1 -1
- package/dest/cmds/aztec_node/get_logs.js +39 -29
- package/dest/cmds/aztec_node/get_node_info.d.ts +1 -1
- package/dest/cmds/aztec_node/get_node_info.d.ts.map +1 -1
- package/dest/cmds/aztec_node/get_node_info.js +0 -2
- package/dest/cmds/aztec_node/index.d.ts +1 -1
- package/dest/cmds/aztec_node/index.d.ts.map +1 -1
- package/dest/cmds/aztec_node/index.js +13 -3
- package/dest/cmds/infrastructure/setup_l2_contract.d.ts +1 -1
- package/dest/cmds/infrastructure/setup_l2_contract.d.ts.map +1 -1
- package/dest/cmds/infrastructure/setup_l2_contract.js +10 -6
- package/dest/cmds/l1/deploy_l1_contracts_cmd.d.ts +1 -1
- package/dest/cmds/l1/deploy_l1_contracts_cmd.d.ts.map +1 -1
- package/dest/cmds/l1/deploy_l1_contracts_cmd.js +0 -1
- package/dest/cmds/l1/deploy_new_rollup.d.ts +1 -1
- package/dest/cmds/l1/deploy_new_rollup.d.ts.map +1 -1
- package/dest/cmds/l1/deploy_new_rollup.js +2 -4
- package/dest/cmds/l1/update_l1_validators.d.ts +1 -1
- package/dest/cmds/l1/update_l1_validators.d.ts.map +1 -1
- package/dest/cmds/l1/update_l1_validators.js +0 -1
- package/dest/cmds/validator_keys/eth_json_v3_worker.d.ts +2 -0
- package/dest/cmds/validator_keys/eth_json_v3_worker.d.ts.map +1 -0
- package/dest/cmds/validator_keys/eth_json_v3_worker.js +27 -0
- package/dest/cmds/validator_keys/index.d.ts +1 -1
- package/dest/cmds/validator_keys/index.d.ts.map +1 -1
- package/dest/cmds/validator_keys/index.js +7 -6
- package/dest/cmds/validator_keys/new.d.ts +7 -1
- package/dest/cmds/validator_keys/new.d.ts.map +1 -1
- package/dest/cmds/validator_keys/new.js +98 -12
- package/dest/cmds/validator_keys/set_funding_account.d.ts +14 -0
- package/dest/cmds/validator_keys/set_funding_account.d.ts.map +1 -0
- package/dest/cmds/validator_keys/set_funding_account.js +37 -0
- package/dest/cmds/validator_keys/shared.d.ts +15 -2
- package/dest/cmds/validator_keys/shared.d.ts.map +1 -1
- package/dest/cmds/validator_keys/shared.js +100 -23
- package/dest/cmds/validator_keys/utils.d.ts +12 -2
- package/dest/cmds/validator_keys/utils.d.ts.map +1 -1
- package/dest/cmds/validator_keys/utils.js +34 -0
- package/dest/config/cached_fetch.d.ts +19 -10
- package/dest/config/cached_fetch.d.ts.map +1 -1
- package/dest/config/cached_fetch.js +110 -32
- package/dest/config/chain_l2_config.d.ts +7 -2
- package/dest/config/chain_l2_config.d.ts.map +1 -1
- package/dest/config/chain_l2_config.js +14 -1
- package/dest/config/generated/networks.d.ts +63 -56
- package/dest/config/generated/networks.d.ts.map +1 -1
- package/dest/config/generated/networks.js +64 -57
- package/dest/config/network_config.d.ts +1 -1
- package/dest/config/network_config.d.ts.map +1 -1
- package/dest/config/network_config.js +3 -2
- package/dest/utils/aztec.d.ts +1 -2
- package/dest/utils/aztec.d.ts.map +1 -1
- package/dest/utils/aztec.js +4 -5
- package/dest/utils/commands.d.ts +20 -11
- package/dest/utils/commands.d.ts.map +1 -1
- package/dest/utils/commands.js +29 -18
- package/dest/utils/inspect.d.ts +1 -1
- package/dest/utils/inspect.d.ts.map +1 -1
- package/dest/utils/inspect.js +11 -11
- package/package.json +30 -30
- package/src/cmds/aztec_node/block_number.ts +1 -1
- package/src/cmds/aztec_node/get_logs.ts +70 -38
- package/src/cmds/aztec_node/get_node_info.ts +0 -2
- package/src/cmds/aztec_node/index.ts +13 -8
- package/src/cmds/infrastructure/setup_l2_contract.ts +9 -5
- package/src/cmds/l1/deploy_l1_contracts_cmd.ts +0 -1
- package/src/cmds/l1/deploy_new_rollup.ts +1 -3
- package/src/cmds/l1/update_l1_validators.ts +0 -1
- package/src/cmds/validator_keys/eth_json_v3_worker.ts +30 -0
- package/src/cmds/validator_keys/index.ts +48 -8
- package/src/cmds/validator_keys/new.ts +129 -9
- package/src/cmds/validator_keys/set_funding_account.ts +55 -0
- package/src/cmds/validator_keys/shared.ts +123 -35
- package/src/cmds/validator_keys/utils.ts +44 -1
- package/src/config/cached_fetch.ts +119 -31
- package/src/config/chain_l2_config.ts +14 -1
- package/src/config/generated/networks.ts +62 -55
- package/src/config/network_config.ts +3 -2
- package/src/utils/aztec.ts +14 -20
- package/src/utils/commands.ts +36 -22
- package/src/utils/inspect.ts +7 -8
package/dest/utils/inspect.js
CHANGED
|
@@ -1,33 +1,33 @@
|
|
|
1
1
|
export async function inspectBlock(aztecNode, blockNumber, log, opts = {}) {
|
|
2
|
-
const block = await aztecNode.getBlock(blockNumber
|
|
2
|
+
const block = await aztecNode.getBlock(blockNumber, {
|
|
3
|
+
includeTransactions: opts.showTxs
|
|
4
|
+
});
|
|
3
5
|
if (!block) {
|
|
4
6
|
log(`No block found for block number ${blockNumber}`);
|
|
5
7
|
return;
|
|
6
8
|
}
|
|
7
|
-
|
|
8
|
-
log(`Block ${blockNumber} (${blockHash.toString()})`);
|
|
9
|
+
log(`Block ${blockNumber} (${block.hash.toString()})`);
|
|
9
10
|
log(` Total fees: ${block.header.totalFees.toBigInt()}`);
|
|
10
11
|
log(` Total mana used: ${block.header.totalManaUsed.toBigInt()}`);
|
|
11
12
|
log(` Fee per gas unit: DA=${block.header.globalVariables.gasFees.feePerDaGas} L2=${block.header.globalVariables.gasFees.feePerL2Gas}`);
|
|
12
13
|
log(` Coinbase: ${block.header.globalVariables.coinbase}`);
|
|
13
14
|
log(` Fee recipient: ${block.header.globalVariables.feeRecipient}`);
|
|
14
15
|
log(` Timestamp: ${new Date(Number(block.header.globalVariables.timestamp) * 500)}`);
|
|
15
|
-
if (opts.showTxs) {
|
|
16
|
+
if (opts.showTxs && block.body) {
|
|
16
17
|
log(``);
|
|
17
18
|
for (const txHash of block.body.txEffects.map((tx)=>tx.txHash)){
|
|
18
19
|
await inspectTx(aztecNode, txHash, log, {
|
|
19
20
|
includeBlockInfo: false
|
|
20
21
|
});
|
|
21
22
|
}
|
|
22
|
-
} else {
|
|
23
|
+
} else if (block.body) {
|
|
23
24
|
log(` Transactions: ${block.body.txEffects.length}`);
|
|
24
25
|
}
|
|
25
26
|
}
|
|
26
27
|
export async function inspectTx(aztecNode, txHash, log, opts = {}) {
|
|
27
|
-
const
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
]);
|
|
28
|
+
const receipt = await aztecNode.getTxReceipt(txHash, {
|
|
29
|
+
includeTxEffect: true
|
|
30
|
+
});
|
|
31
31
|
// Base tx data
|
|
32
32
|
log(`Tx ${txHash.toString()}`);
|
|
33
33
|
log(` Status: ${receipt.status}`);
|
|
@@ -37,10 +37,10 @@ export async function inspectTx(aztecNode, txHash, log, opts = {}) {
|
|
|
37
37
|
if (receipt.error) {
|
|
38
38
|
log(` Error: ${receipt.error}`);
|
|
39
39
|
}
|
|
40
|
-
if (!
|
|
40
|
+
if (!receipt.isMined() || !receipt.txEffect) {
|
|
41
41
|
return;
|
|
42
42
|
}
|
|
43
|
-
const effects =
|
|
43
|
+
const effects = receipt.txEffect;
|
|
44
44
|
if (opts.includeBlockInfo) {
|
|
45
45
|
log(` Block: ${receipt.blockNumber} (${receipt.blockHash?.toString()})`);
|
|
46
46
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/cli",
|
|
3
|
-
"version": "0.0.1-commit.
|
|
3
|
+
"version": "0.0.1-commit.f5a9928",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
"./contracts": "./dest/cmds/contracts/index.js",
|
|
@@ -77,23 +77,23 @@
|
|
|
77
77
|
]
|
|
78
78
|
},
|
|
79
79
|
"dependencies": {
|
|
80
|
-
"@aztec/accounts": "0.0.1-commit.
|
|
81
|
-
"@aztec/archiver": "0.0.1-commit.
|
|
82
|
-
"@aztec/aztec.js": "0.0.1-commit.
|
|
83
|
-
"@aztec/constants": "0.0.1-commit.
|
|
84
|
-
"@aztec/entrypoints": "0.0.1-commit.
|
|
85
|
-
"@aztec/ethereum": "0.0.1-commit.
|
|
86
|
-
"@aztec/foundation": "0.0.1-commit.
|
|
87
|
-
"@aztec/l1-artifacts": "0.0.1-commit.
|
|
88
|
-
"@aztec/node-keystore": "0.0.1-commit.
|
|
89
|
-
"@aztec/node-lib": "0.0.1-commit.
|
|
90
|
-
"@aztec/p2p": "0.0.1-commit.
|
|
91
|
-
"@aztec/protocol-contracts": "0.0.1-commit.
|
|
92
|
-
"@aztec/sequencer-client": "0.0.1-commit.
|
|
93
|
-
"@aztec/slasher": "0.0.1-commit.
|
|
94
|
-
"@aztec/stdlib": "0.0.1-commit.
|
|
95
|
-
"@aztec/wallets": "0.0.1-commit.
|
|
96
|
-
"@aztec/world-state": "0.0.1-commit.
|
|
80
|
+
"@aztec/accounts": "0.0.1-commit.f5a9928",
|
|
81
|
+
"@aztec/archiver": "0.0.1-commit.f5a9928",
|
|
82
|
+
"@aztec/aztec.js": "0.0.1-commit.f5a9928",
|
|
83
|
+
"@aztec/constants": "0.0.1-commit.f5a9928",
|
|
84
|
+
"@aztec/entrypoints": "0.0.1-commit.f5a9928",
|
|
85
|
+
"@aztec/ethereum": "0.0.1-commit.f5a9928",
|
|
86
|
+
"@aztec/foundation": "0.0.1-commit.f5a9928",
|
|
87
|
+
"@aztec/l1-artifacts": "0.0.1-commit.f5a9928",
|
|
88
|
+
"@aztec/node-keystore": "0.0.1-commit.f5a9928",
|
|
89
|
+
"@aztec/node-lib": "0.0.1-commit.f5a9928",
|
|
90
|
+
"@aztec/p2p": "0.0.1-commit.f5a9928",
|
|
91
|
+
"@aztec/protocol-contracts": "0.0.1-commit.f5a9928",
|
|
92
|
+
"@aztec/sequencer-client": "0.0.1-commit.f5a9928",
|
|
93
|
+
"@aztec/slasher": "0.0.1-commit.f5a9928",
|
|
94
|
+
"@aztec/stdlib": "0.0.1-commit.f5a9928",
|
|
95
|
+
"@aztec/wallets": "0.0.1-commit.f5a9928",
|
|
96
|
+
"@aztec/world-state": "0.0.1-commit.f5a9928",
|
|
97
97
|
"@ethersproject/wallet": "^5.8.0",
|
|
98
98
|
"@iarna/toml": "^2.2.5",
|
|
99
99
|
"@libp2p/peer-id-factory": "^3.0.4",
|
|
@@ -107,9 +107,9 @@
|
|
|
107
107
|
"viem": "npm:@aztec/viem@2.38.2"
|
|
108
108
|
},
|
|
109
109
|
"devDependencies": {
|
|
110
|
-
"@aztec/aztec-node": "0.0.1-commit.
|
|
111
|
-
"@aztec/kv-store": "0.0.1-commit.
|
|
112
|
-
"@aztec/telemetry-client": "0.0.1-commit.
|
|
110
|
+
"@aztec/aztec-node": "0.0.1-commit.f5a9928",
|
|
111
|
+
"@aztec/kv-store": "0.0.1-commit.f5a9928",
|
|
112
|
+
"@aztec/telemetry-client": "0.0.1-commit.f5a9928",
|
|
113
113
|
"@jest/globals": "^30.0.0",
|
|
114
114
|
"@types/jest": "^30.0.0",
|
|
115
115
|
"@types/lodash.chunk": "^4.2.9",
|
|
@@ -126,15 +126,15 @@
|
|
|
126
126
|
"typescript": "^5.3.3"
|
|
127
127
|
},
|
|
128
128
|
"peerDependencies": {
|
|
129
|
-
"@aztec/accounts": "0.0.1-commit.
|
|
130
|
-
"@aztec/bb-prover": "0.0.1-commit.
|
|
131
|
-
"@aztec/ethereum": "0.0.1-commit.
|
|
132
|
-
"@aztec/l1-artifacts": "0.0.1-commit.
|
|
133
|
-
"@aztec/noir-contracts.js": "0.0.1-commit.
|
|
134
|
-
"@aztec/noir-protocol-circuits-types": "0.0.1-commit.
|
|
135
|
-
"@aztec/noir-test-contracts.js": "0.0.1-commit.
|
|
136
|
-
"@aztec/protocol-contracts": "0.0.1-commit.
|
|
137
|
-
"@aztec/stdlib": "0.0.1-commit.
|
|
129
|
+
"@aztec/accounts": "0.0.1-commit.f5a9928",
|
|
130
|
+
"@aztec/bb-prover": "0.0.1-commit.f5a9928",
|
|
131
|
+
"@aztec/ethereum": "0.0.1-commit.f5a9928",
|
|
132
|
+
"@aztec/l1-artifacts": "0.0.1-commit.f5a9928",
|
|
133
|
+
"@aztec/noir-contracts.js": "0.0.1-commit.f5a9928",
|
|
134
|
+
"@aztec/noir-protocol-circuits-types": "0.0.1-commit.f5a9928",
|
|
135
|
+
"@aztec/noir-test-contracts.js": "0.0.1-commit.f5a9928",
|
|
136
|
+
"@aztec/protocol-contracts": "0.0.1-commit.f5a9928",
|
|
137
|
+
"@aztec/stdlib": "0.0.1-commit.f5a9928"
|
|
138
138
|
},
|
|
139
139
|
"files": [
|
|
140
140
|
"dest",
|
|
@@ -3,7 +3,7 @@ import type { LogFn } from '@aztec/foundation/log';
|
|
|
3
3
|
|
|
4
4
|
export async function blockNumber(nodeUrl: string, log: LogFn) {
|
|
5
5
|
const aztecNode = createAztecNodeClient(nodeUrl);
|
|
6
|
-
const [latestNum, provenNum] = await Promise.all([aztecNode.getBlockNumber(), aztecNode.
|
|
6
|
+
const [latestNum, provenNum] = await Promise.all([aztecNode.getBlockNumber(), aztecNode.getBlockNumber('proven')]);
|
|
7
7
|
log(`Latest block: ${latestNum}`);
|
|
8
8
|
log(`Proven block: ${provenNum}`);
|
|
9
9
|
}
|
|
@@ -1,22 +1,47 @@
|
|
|
1
1
|
import type { AztecAddress } from '@aztec/aztec.js/addresses';
|
|
2
|
-
import type { LogFilter, LogId } from '@aztec/aztec.js/log';
|
|
3
2
|
import { createAztecNodeClient } from '@aztec/aztec.js/node';
|
|
4
3
|
import type { TxHash } from '@aztec/aztec.js/tx';
|
|
5
|
-
import { BlockNumber } from '@aztec/foundation/branded-types';
|
|
4
|
+
import type { BlockNumber } from '@aztec/foundation/branded-types';
|
|
6
5
|
import type { LogFn } from '@aztec/foundation/log';
|
|
7
6
|
import { sleep } from '@aztec/foundation/sleep';
|
|
7
|
+
import {
|
|
8
|
+
LogCursor,
|
|
9
|
+
type PublicLogsQuery,
|
|
10
|
+
type Tag,
|
|
11
|
+
logResultToHumanReadable,
|
|
12
|
+
queryAllPublicLogsByTags,
|
|
13
|
+
} from '@aztec/stdlib/logs';
|
|
8
14
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
15
|
+
/** Options for the `get-logs` CLI command. */
|
|
16
|
+
export type GetLogsOptions = {
|
|
17
|
+
/** Contract address that emitted the logs (required). */
|
|
18
|
+
contractAddress: AztecAddress;
|
|
19
|
+
/** Tag to filter logs by (required). */
|
|
20
|
+
tag: Tag;
|
|
21
|
+
/** Restrict the search to this tx hash. Mutually exclusive with `fromBlock`/`toBlock`. */
|
|
22
|
+
txHash?: TxHash;
|
|
23
|
+
/** Lower block bound, inclusive. */
|
|
24
|
+
fromBlock?: BlockNumber;
|
|
25
|
+
/** Upper block bound, exclusive. */
|
|
26
|
+
toBlock?: BlockNumber;
|
|
27
|
+
/** Log cursor to resume pagination strictly after a previously-seen log. */
|
|
28
|
+
afterLog?: LogCursor;
|
|
29
|
+
/** Node RPC URL. */
|
|
30
|
+
nodeUrl: string;
|
|
31
|
+
/** When set, polls indefinitely for new logs. Incompatible with `txHash` and `toBlock`. */
|
|
32
|
+
follow: boolean;
|
|
33
|
+
/** Log function. */
|
|
34
|
+
log: LogFn;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Fetches public logs for a (contract, tag) pair, draining all pages via the stdlib pagination helper.
|
|
39
|
+
* In `--follow` mode, polls indefinitely: each round drains all currently-available logs, then sleeps
|
|
40
|
+
* until the next poll if nothing new was found.
|
|
41
|
+
*/
|
|
42
|
+
export async function getLogs(options: GetLogsOptions): Promise<void> {
|
|
43
|
+
const { txHash, fromBlock, toBlock, contractAddress, tag, nodeUrl, follow, log } = options;
|
|
44
|
+
let afterLog = options.afterLog;
|
|
20
45
|
|
|
21
46
|
if (follow) {
|
|
22
47
|
if (txHash) {
|
|
@@ -26,43 +51,50 @@ export async function getLogs(
|
|
|
26
51
|
throw Error('Cannot use --follow with --to-block');
|
|
27
52
|
}
|
|
28
53
|
}
|
|
54
|
+
if (txHash !== undefined && (fromBlock !== undefined || toBlock !== undefined)) {
|
|
55
|
+
throw Error('Cannot combine --tx-hash with --from-block / --to-block');
|
|
56
|
+
}
|
|
29
57
|
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
const fetchLogs = async () => {
|
|
33
|
-
const response = await node.getPublicLogs(filter);
|
|
34
|
-
const logs = response.logs;
|
|
58
|
+
const node = createAztecNodeClient(nodeUrl);
|
|
35
59
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
}
|
|
48
|
-
logs.forEach(publicLog => log(publicLog.toHumanReadable()));
|
|
49
|
-
// Set the continuation parameter for the following requests
|
|
50
|
-
filter.afterLog = logs[logs.length - 1].id;
|
|
60
|
+
const drainLogs = async () => {
|
|
61
|
+
const query: PublicLogsQuery = {
|
|
62
|
+
contractAddress,
|
|
63
|
+
tags: [afterLog !== undefined ? { tag, afterLog } : tag],
|
|
64
|
+
fromBlock,
|
|
65
|
+
toBlock,
|
|
66
|
+
txHash,
|
|
67
|
+
};
|
|
68
|
+
const [logsForTag] = await queryAllPublicLogsByTags(node, query);
|
|
69
|
+
if (logsForTag.length > 0) {
|
|
70
|
+
afterLog = LogCursor.fromLog(logsForTag[logsForTag.length - 1]);
|
|
51
71
|
}
|
|
52
|
-
return
|
|
72
|
+
return logsForTag;
|
|
53
73
|
};
|
|
54
74
|
|
|
55
75
|
if (follow) {
|
|
56
76
|
log('Fetching logs...');
|
|
57
77
|
while (true) {
|
|
58
|
-
const
|
|
59
|
-
if (
|
|
78
|
+
const results = await drainLogs();
|
|
79
|
+
if (results.length === 0) {
|
|
60
80
|
await sleep(1000);
|
|
81
|
+
} else {
|
|
82
|
+
results.forEach(r => log(logResultToHumanReadable(r)));
|
|
61
83
|
}
|
|
62
84
|
}
|
|
63
85
|
} else {
|
|
64
|
-
|
|
65
|
-
|
|
86
|
+
const results = await drainLogs();
|
|
87
|
+
if (results.length === 0) {
|
|
88
|
+
log(
|
|
89
|
+
`No logs found for {contractAddress: ${contractAddress.toString()}, tag: ${tag.toString()}` +
|
|
90
|
+
`${txHash ? `, txHash: ${txHash.toString()}` : ''}` +
|
|
91
|
+
`${fromBlock !== undefined ? `, fromBlock: ${fromBlock}` : ''}` +
|
|
92
|
+
`${toBlock !== undefined ? `, toBlock: ${toBlock}` : ''}` +
|
|
93
|
+
`${afterLog ? `, afterLog: ${afterLog.toString()}` : ''}}`,
|
|
94
|
+
);
|
|
95
|
+
} else {
|
|
96
|
+
log('Logs found: \n');
|
|
97
|
+
results.forEach(r => log(logResultToHumanReadable(r)));
|
|
66
98
|
}
|
|
67
99
|
}
|
|
68
100
|
}
|
|
@@ -23,7 +23,6 @@ export async function getNodeInfo(nodeUrl: string, json: boolean, log: LogFn, lo
|
|
|
23
23
|
rewardDistributor: info.l1ContractAddresses.rewardDistributorAddress.toString(),
|
|
24
24
|
governanceProposer: info.l1ContractAddresses.governanceProposerAddress.toString(),
|
|
25
25
|
governance: info.l1ContractAddresses.governanceAddress.toString(),
|
|
26
|
-
slashFactory: info.l1ContractAddresses.slashFactoryAddress?.toString(),
|
|
27
26
|
feeAssetHandler: info.l1ContractAddresses.feeAssetHandlerAddress?.toString(),
|
|
28
27
|
stakingAssetHandler: info.l1ContractAddresses.stakingAssetHandlerAddress?.toString(),
|
|
29
28
|
},
|
|
@@ -51,7 +50,6 @@ export async function getNodeInfo(nodeUrl: string, json: boolean, log: LogFn, lo
|
|
|
51
50
|
log(` RewardDistributor Address: ${info.l1ContractAddresses.rewardDistributorAddress.toString()}`);
|
|
52
51
|
log(` GovernanceProposer Address: ${info.l1ContractAddresses.governanceProposerAddress.toString()}`);
|
|
53
52
|
log(` Governance Address: ${info.l1ContractAddresses.governanceAddress.toString()}`);
|
|
54
|
-
log(` SlashFactory Address: ${info.l1ContractAddresses.slashFactoryAddress?.toString()}`);
|
|
55
53
|
log(` FeeAssetHandler Address: ${info.l1ContractAddresses.feeAssetHandlerAddress?.toString()}`);
|
|
56
54
|
log(` StakingAssetHandler Address: ${info.l1ContractAddresses.stakingAssetHandlerAddress?.toString()}`);
|
|
57
55
|
log(`L2 Contract Addresses:`);
|
|
@@ -7,10 +7,10 @@ import {
|
|
|
7
7
|
nodeOption,
|
|
8
8
|
parseAztecAddress,
|
|
9
9
|
parseField,
|
|
10
|
-
parseOptionalAztecAddress,
|
|
11
10
|
parseOptionalInteger,
|
|
12
|
-
|
|
11
|
+
parseOptionalLogCursor,
|
|
13
12
|
parseOptionalTxHash,
|
|
13
|
+
parseTag,
|
|
14
14
|
} from '../../utils/commands.js';
|
|
15
15
|
|
|
16
16
|
export function injectCommands(program: Command, log: LogFn, debugLogger: Logger) {
|
|
@@ -47,21 +47,26 @@ export function injectCommands(program: Command, log: LogFn, debugLogger: Logger
|
|
|
47
47
|
|
|
48
48
|
program
|
|
49
49
|
.command('get-logs')
|
|
50
|
-
.description('Gets
|
|
51
|
-
.
|
|
50
|
+
.description('Gets public logs for a contract and tag, optionally restricted by block range or tx hash.')
|
|
51
|
+
.requiredOption('-ca, --contract-address <address>', 'Contract address that emitted the logs.', parseAztecAddress)
|
|
52
|
+
.requiredOption('--tag <tag>', 'Tag (Fr value) to filter logs by.', parseTag)
|
|
53
|
+
.option('-tx, --tx-hash <txHash>', 'A transaction hash to restrict the search to.', parseOptionalTxHash)
|
|
52
54
|
.option(
|
|
53
55
|
'-fb, --from-block <blockNum>',
|
|
54
56
|
'Initial block number for getting logs (defaults to 1).',
|
|
55
57
|
parseOptionalInteger,
|
|
56
58
|
)
|
|
57
59
|
.option('-tb, --to-block <blockNum>', 'Up to which block to fetch logs (defaults to latest).', parseOptionalInteger)
|
|
58
|
-
.option(
|
|
59
|
-
|
|
60
|
+
.option(
|
|
61
|
+
'-al --after-log <cursor>',
|
|
62
|
+
'Log cursor of the form <blockNumber>-<txIndexWithinBlock>-<logIndexWithinTx> to resume pagination after.',
|
|
63
|
+
parseOptionalLogCursor,
|
|
64
|
+
)
|
|
60
65
|
.addOption(nodeOption)
|
|
61
66
|
.option('--follow', 'If set, will keep polling for new logs until interrupted.')
|
|
62
|
-
.action(async ({ txHash, fromBlock, toBlock, afterLog, contractAddress,
|
|
67
|
+
.action(async ({ txHash, fromBlock, toBlock, afterLog, contractAddress, tag, nodeUrl, follow }) => {
|
|
63
68
|
const { getLogs } = await import('./get_logs.js');
|
|
64
|
-
await getLogs(txHash, fromBlock, toBlock, afterLog, contractAddress, nodeUrl, follow, log);
|
|
69
|
+
await getLogs({ txHash, fromBlock, toBlock, afterLog, contractAddress, tag, nodeUrl, follow, log });
|
|
65
70
|
});
|
|
66
71
|
|
|
67
72
|
program
|
|
@@ -2,33 +2,37 @@ import { getInitialTestAccountsData } from '@aztec/accounts/testing';
|
|
|
2
2
|
import { AztecAddress } from '@aztec/aztec.js/addresses';
|
|
3
3
|
import type { WaitOpts } from '@aztec/aztec.js/contracts';
|
|
4
4
|
import { createAztecNodeClient } from '@aztec/aztec.js/node';
|
|
5
|
+
import { TxStatus } from '@aztec/aztec.js/tx';
|
|
5
6
|
import { AccountManager } from '@aztec/aztec.js/wallet';
|
|
6
7
|
import { jsonStringify } from '@aztec/foundation/json-rpc';
|
|
7
8
|
import type { LogFn } from '@aztec/foundation/log';
|
|
8
9
|
import { ProtocolContractAddress } from '@aztec/protocol-contracts';
|
|
9
10
|
import { EmbeddedWallet } from '@aztec/wallets/embedded';
|
|
10
|
-
import {
|
|
11
|
+
import { createFundedInitializerlessAccounts } from '@aztec/wallets/testing';
|
|
11
12
|
|
|
12
13
|
export async function setupL2Contracts(nodeUrl: string, testAccounts: boolean, json: boolean, log: LogFn) {
|
|
13
14
|
const waitOpts: WaitOpts = {
|
|
14
15
|
timeout: 180,
|
|
15
16
|
interval: 1,
|
|
17
|
+
// The embedded wallet defaults to PROPOSED, which can be dropped if its proposed block is pruned
|
|
18
|
+
// before the checkpoint lands. Wait for the checkpoint so serial setup is reliable.
|
|
19
|
+
waitForStatus: TxStatus.CHECKPOINTED,
|
|
16
20
|
};
|
|
17
21
|
log('setupL2Contracts: Wait options' + jsonStringify(waitOpts));
|
|
18
22
|
log('setupL2Contracts: Creating PXE client...');
|
|
19
23
|
const node = createAztecNodeClient(nodeUrl);
|
|
20
24
|
const wallet = await EmbeddedWallet.create(node);
|
|
21
25
|
|
|
22
|
-
let
|
|
26
|
+
let accountManagers: AccountManager[] = [];
|
|
23
27
|
if (testAccounts) {
|
|
24
|
-
log('setupL2Contracts:
|
|
28
|
+
log('setupL2Contracts: Creating test accounts...');
|
|
25
29
|
const initialAccountsData = await getInitialTestAccountsData();
|
|
26
|
-
|
|
30
|
+
accountManagers = await createFundedInitializerlessAccounts(wallet, initialAccountsData);
|
|
27
31
|
}
|
|
28
32
|
|
|
29
33
|
if (json) {
|
|
30
34
|
const toPrint: Record<string, AztecAddress> = { ...ProtocolContractAddress };
|
|
31
|
-
|
|
35
|
+
accountManagers.forEach((a, i) => {
|
|
32
36
|
toPrint[`testAccount${i}`] = a.address;
|
|
33
37
|
});
|
|
34
38
|
log(JSON.stringify(toPrint, null, 2));
|
|
@@ -96,7 +96,6 @@ export async function deployL1ContractsCmd(
|
|
|
96
96
|
log(`RewardDistributor Address: ${l1ContractAddresses.rewardDistributorAddress.toString()}`);
|
|
97
97
|
log(`GovernanceProposer Address: ${l1ContractAddresses.governanceProposerAddress.toString()}`);
|
|
98
98
|
log(`Governance Address: ${l1ContractAddresses.governanceAddress.toString()}`);
|
|
99
|
-
log(`SlashFactory Address: ${l1ContractAddresses.slashFactoryAddress?.toString()}`);
|
|
100
99
|
log(`FeeAssetHandler Address: ${l1ContractAddresses.feeAssetHandlerAddress?.toString()}`);
|
|
101
100
|
log(`StakingAssetHandler Address: ${l1ContractAddresses.stakingAssetHandlerAddress?.toString()}`);
|
|
102
101
|
log(`ZK Passport Verifier Address: ${l1ContractAddresses.zkPassportVerifierAddress?.toString()}`);
|
|
@@ -29,7 +29,7 @@ export async function deployNewRollup(
|
|
|
29
29
|
const initialFundedAccounts = initialAccounts.map(a => a.address).concat(sponsoredFPCAddress);
|
|
30
30
|
const { genesisArchiveRoot, fundingNeeded } = await getGenesisValues(initialFundedAccounts);
|
|
31
31
|
|
|
32
|
-
const { rollup
|
|
32
|
+
const { rollup } = await deployNewRollupContracts(
|
|
33
33
|
registryAddress,
|
|
34
34
|
rpcUrls,
|
|
35
35
|
privateKey,
|
|
@@ -51,7 +51,6 @@ export async function deployNewRollup(
|
|
|
51
51
|
initialFundedAccounts: initialFundedAccounts.map(a => a.toString()),
|
|
52
52
|
initialValidators: initialValidators.map(a => a.attester.toString()),
|
|
53
53
|
genesisArchiveRoot: genesisArchiveRoot.toString(),
|
|
54
|
-
slashFactoryAddress: slashFactoryAddress.toString(),
|
|
55
54
|
},
|
|
56
55
|
null,
|
|
57
56
|
2,
|
|
@@ -62,6 +61,5 @@ export async function deployNewRollup(
|
|
|
62
61
|
log(`Initial funded accounts: ${initialFundedAccounts.map(a => a.toString()).join(', ')}`);
|
|
63
62
|
log(`Initial validators: ${initialValidators.map(a => a.attester.toString()).join(', ')}`);
|
|
64
63
|
log(`Genesis archive root: ${genesisArchiveRoot.toString()}`);
|
|
65
|
-
log(`Slash Factory Address: ${slashFactoryAddress.toString()}`);
|
|
66
64
|
}
|
|
67
65
|
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Wallet } from '@ethersproject/wallet';
|
|
2
|
+
import { parentPort, workerData } from 'worker_threads';
|
|
3
|
+
|
|
4
|
+
type EthJsonV3WorkerData = {
|
|
5
|
+
privateKeyHex: string;
|
|
6
|
+
password: string;
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
type SerializedError = {
|
|
10
|
+
message: string;
|
|
11
|
+
name?: string;
|
|
12
|
+
stack?: string;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
function serializeError(error: unknown): SerializedError {
|
|
16
|
+
if (error instanceof Error) {
|
|
17
|
+
return { message: error.message, name: error.name, stack: error.stack };
|
|
18
|
+
}
|
|
19
|
+
return { message: String(error) };
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
void (async () => {
|
|
23
|
+
try {
|
|
24
|
+
const { privateKeyHex, password } = workerData as EthJsonV3WorkerData;
|
|
25
|
+
const json = await new Wallet(privateKeyHex).encrypt(password);
|
|
26
|
+
parentPort?.postMessage({ json });
|
|
27
|
+
} catch (error) {
|
|
28
|
+
parentPort?.postMessage({ error: serializeError(error) });
|
|
29
|
+
}
|
|
30
|
+
})();
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { LogFn } from '@aztec/foundation/log';
|
|
2
2
|
|
|
3
|
-
import { Command } from 'commander';
|
|
3
|
+
import { Command, Option } from 'commander';
|
|
4
4
|
|
|
5
5
|
import { parseAztecAddress, parseEthereumAddress, parseHex, parseOptionalInteger } from '../../utils/commands.js';
|
|
6
6
|
import { defaultBlsPath } from './utils.js';
|
|
@@ -33,15 +33,31 @@ export function injectCommands(program: Command, log: LogFn) {
|
|
|
33
33
|
'Coinbase ETH address to use when proposing. Defaults to attester address.',
|
|
34
34
|
parseEthereumAddress,
|
|
35
35
|
)
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
.option(
|
|
37
|
+
'--funding-account <privateKey|address>',
|
|
38
|
+
'ETH funding account used to top up publisher EOAs. Provide a private key, or an address together with --remote-signer.',
|
|
39
|
+
)
|
|
38
40
|
.option('--remote-signer <url>', 'Default remote signer URL for accounts in this file')
|
|
39
41
|
.option('--ikm <hex>', 'Initial keying material for BLS (alternative to mnemonic)', value => parseHex(value, 32))
|
|
40
42
|
.option('--bls-path <path>', `EIP-2334 path (default ${defaultBlsPath})`)
|
|
41
|
-
.
|
|
42
|
-
'--password <str>',
|
|
43
|
-
|
|
43
|
+
.addOption(
|
|
44
|
+
new Option('--password <str>', 'Shared password for writing ETH JSON V3 and BLS EIP-2335 keystore files').env(
|
|
45
|
+
'AZTEC_KEYSTORE_PASSWORD',
|
|
46
|
+
),
|
|
44
47
|
)
|
|
48
|
+
.option('--password-file <path>', 'File containing the shared password for writing keystore files')
|
|
49
|
+
.addOption(
|
|
50
|
+
new Option('--eth-password <str>', 'Password for writing ETH JSON V3 keystore files').env(
|
|
51
|
+
'AZTEC_ETH_KEYSTORE_PASSWORD',
|
|
52
|
+
),
|
|
53
|
+
)
|
|
54
|
+
.option('--eth-password-file <path>', 'File containing the password for writing ETH JSON V3 keystore files')
|
|
55
|
+
.addOption(
|
|
56
|
+
new Option('--bls-password <str>', 'Password for writing BLS EIP-2335 keystore files').env(
|
|
57
|
+
'AZTEC_BLS_KEYSTORE_PASSWORD',
|
|
58
|
+
),
|
|
59
|
+
)
|
|
60
|
+
.option('--bls-password-file <path>', 'File containing the password for writing BLS EIP-2335 keystore files')
|
|
45
61
|
.option('--encrypted-keystore-dir <dir>', 'Output directory for encrypted keystore file(s)')
|
|
46
62
|
.option('--json', 'Echo resulting JSON to stdout')
|
|
47
63
|
.option('--staker-output', 'Generate a single staker output JSON file with an array of validator entries')
|
|
@@ -85,8 +101,6 @@ export function injectCommands(program: Command, log: LogFn) {
|
|
|
85
101
|
'Coinbase ETH address to use when proposing. Defaults to attester address.',
|
|
86
102
|
parseEthereumAddress,
|
|
87
103
|
)
|
|
88
|
-
// TODO: add funding account back in when implemented
|
|
89
|
-
// .option('--funding-account <privateKey|address>', 'ETH private key (or address for remote signer setup) to fund publishers')
|
|
90
104
|
.option('--remote-signer <url>', 'Default remote signer URL for accounts in this file')
|
|
91
105
|
.option('--ikm <hex>', 'Initial keying material for BLS (alternative to mnemonic)', value => parseHex(value, 32))
|
|
92
106
|
.option('--bls-path <path>', `EIP-2334 path (default ${defaultBlsPath})`)
|
|
@@ -103,6 +117,32 @@ export function injectCommands(program: Command, log: LogFn) {
|
|
|
103
117
|
await addValidatorKeys(existing, options, log);
|
|
104
118
|
});
|
|
105
119
|
|
|
120
|
+
group
|
|
121
|
+
.command('set-funding-account')
|
|
122
|
+
.summary('Set the funding account of an existing keystore')
|
|
123
|
+
.description(
|
|
124
|
+
'Sets the keystore-level ETH funding account used to top up publisher EOAs, replacing any existing one',
|
|
125
|
+
)
|
|
126
|
+
.argument('<existing>', 'Path to existing keystore JSON')
|
|
127
|
+
.argument(
|
|
128
|
+
'<privateKey|address>',
|
|
129
|
+
'Funding account: a private key, or an address (needs --remote-signer unless the keystore already defines one)',
|
|
130
|
+
)
|
|
131
|
+
.option(
|
|
132
|
+
'--remote-signer <url>',
|
|
133
|
+
'Remote signer URL for the funding account (required with an address unless the keystore already defines one)',
|
|
134
|
+
)
|
|
135
|
+
.option(
|
|
136
|
+
'--password <str>',
|
|
137
|
+
'Password for writing the funding key as an encrypted ETH JSON V3 file. Empty string allowed',
|
|
138
|
+
)
|
|
139
|
+
.option('--encrypted-keystore-dir <dir>', 'Output directory for the encrypted funding key file')
|
|
140
|
+
.option('--json', 'Echo resulting JSON to stdout')
|
|
141
|
+
.action(async (existing: string, fundingAccount: string, options) => {
|
|
142
|
+
const { setFundingAccount } = await import('./set_funding_account.js');
|
|
143
|
+
await setFundingAccount(existing, fundingAccount, options, log);
|
|
144
|
+
});
|
|
145
|
+
|
|
106
146
|
group
|
|
107
147
|
.command('staker')
|
|
108
148
|
.summary('Generate staking JSON from keystore')
|