@aztec/cli 5.0.0-private.20260318 → 5.0.0-rc.1
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/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 +41 -36
- package/dest/config/generated/networks.d.ts.map +1 -1
- package/dest/config/generated/networks.js +40 -35
- 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 +14 -6
- package/dest/utils/commands.d.ts.map +1 -1
- package/dest/utils/commands.js +19 -9
- 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/config/chain_l2_config.ts +14 -1
- package/src/config/generated/networks.ts +40 -35
- package/src/utils/aztec.ts +14 -20
- package/src/utils/commands.ts +22 -9
- 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": "5.0.0-
|
|
3
|
+
"version": "5.0.0-rc.1",
|
|
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": "5.0.0-
|
|
81
|
-
"@aztec/archiver": "5.0.0-
|
|
82
|
-
"@aztec/aztec.js": "5.0.0-
|
|
83
|
-
"@aztec/constants": "5.0.0-
|
|
84
|
-
"@aztec/entrypoints": "5.0.0-
|
|
85
|
-
"@aztec/ethereum": "5.0.0-
|
|
86
|
-
"@aztec/foundation": "5.0.0-
|
|
87
|
-
"@aztec/l1-artifacts": "5.0.0-
|
|
88
|
-
"@aztec/node-keystore": "5.0.0-
|
|
89
|
-
"@aztec/node-lib": "5.0.0-
|
|
90
|
-
"@aztec/p2p": "5.0.0-
|
|
91
|
-
"@aztec/protocol-contracts": "5.0.0-
|
|
92
|
-
"@aztec/sequencer-client": "5.0.0-
|
|
93
|
-
"@aztec/slasher": "5.0.0-
|
|
94
|
-
"@aztec/stdlib": "5.0.0-
|
|
95
|
-
"@aztec/wallets": "5.0.0-
|
|
96
|
-
"@aztec/world-state": "5.0.0-
|
|
80
|
+
"@aztec/accounts": "5.0.0-rc.1",
|
|
81
|
+
"@aztec/archiver": "5.0.0-rc.1",
|
|
82
|
+
"@aztec/aztec.js": "5.0.0-rc.1",
|
|
83
|
+
"@aztec/constants": "5.0.0-rc.1",
|
|
84
|
+
"@aztec/entrypoints": "5.0.0-rc.1",
|
|
85
|
+
"@aztec/ethereum": "5.0.0-rc.1",
|
|
86
|
+
"@aztec/foundation": "5.0.0-rc.1",
|
|
87
|
+
"@aztec/l1-artifacts": "5.0.0-rc.1",
|
|
88
|
+
"@aztec/node-keystore": "5.0.0-rc.1",
|
|
89
|
+
"@aztec/node-lib": "5.0.0-rc.1",
|
|
90
|
+
"@aztec/p2p": "5.0.0-rc.1",
|
|
91
|
+
"@aztec/protocol-contracts": "5.0.0-rc.1",
|
|
92
|
+
"@aztec/sequencer-client": "5.0.0-rc.1",
|
|
93
|
+
"@aztec/slasher": "5.0.0-rc.1",
|
|
94
|
+
"@aztec/stdlib": "5.0.0-rc.1",
|
|
95
|
+
"@aztec/wallets": "5.0.0-rc.1",
|
|
96
|
+
"@aztec/world-state": "5.0.0-rc.1",
|
|
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": "5.0.0-
|
|
111
|
-
"@aztec/kv-store": "5.0.0-
|
|
112
|
-
"@aztec/telemetry-client": "5.0.0-
|
|
110
|
+
"@aztec/aztec-node": "5.0.0-rc.1",
|
|
111
|
+
"@aztec/kv-store": "5.0.0-rc.1",
|
|
112
|
+
"@aztec/telemetry-client": "5.0.0-rc.1",
|
|
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": "5.0.0-
|
|
130
|
-
"@aztec/bb-prover": "5.0.0-
|
|
131
|
-
"@aztec/ethereum": "5.0.0-
|
|
132
|
-
"@aztec/l1-artifacts": "5.0.0-
|
|
133
|
-
"@aztec/noir-contracts.js": "5.0.0-
|
|
134
|
-
"@aztec/noir-protocol-circuits-types": "5.0.0-
|
|
135
|
-
"@aztec/noir-test-contracts.js": "5.0.0-
|
|
136
|
-
"@aztec/protocol-contracts": "5.0.0-
|
|
137
|
-
"@aztec/stdlib": "5.0.0-
|
|
129
|
+
"@aztec/accounts": "5.0.0-rc.1",
|
|
130
|
+
"@aztec/bb-prover": "5.0.0-rc.1",
|
|
131
|
+
"@aztec/ethereum": "5.0.0-rc.1",
|
|
132
|
+
"@aztec/l1-artifacts": "5.0.0-rc.1",
|
|
133
|
+
"@aztec/noir-contracts.js": "5.0.0-rc.1",
|
|
134
|
+
"@aztec/noir-protocol-circuits-types": "5.0.0-rc.1",
|
|
135
|
+
"@aztec/noir-test-contracts.js": "5.0.0-rc.1",
|
|
136
|
+
"@aztec/protocol-contracts": "5.0.0-rc.1",
|
|
137
|
+
"@aztec/stdlib": "5.0.0-rc.1"
|
|
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
|
}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import type { NetworkNames } from '@aztec/foundation/config';
|
|
2
|
+
import { createLogger } from '@aztec/foundation/log';
|
|
3
|
+
import { type ConsensusEnvVar, checkConsensusEnvOverrides } from '@aztec/stdlib/config';
|
|
2
4
|
|
|
3
5
|
import path from 'path';
|
|
4
6
|
|
|
@@ -12,6 +14,12 @@ const NetworkConfigs: Partial<Record<NetworkNames, NetworkConfigEnv>> = {
|
|
|
12
14
|
mainnet: mainnetConfig,
|
|
13
15
|
};
|
|
14
16
|
|
|
17
|
+
/** Every generated network config must define every consensus-critical env var. */
|
|
18
|
+
export type ConsensusComplete = Record<ConsensusEnvVar, string | number | boolean>;
|
|
19
|
+
({ devnetConfig, testnetConfig, mainnetConfig }) satisfies Record<string, ConsensusComplete>;
|
|
20
|
+
|
|
21
|
+
const log = createLogger('cli:chain_l2_config');
|
|
22
|
+
|
|
15
23
|
function enrichEnvironmentWithNetworkConfig(config: NetworkConfigEnv): void {
|
|
16
24
|
for (const [key, value] of Object.entries(config)) {
|
|
17
25
|
if (process.env[key] === undefined && value !== undefined) {
|
|
@@ -31,7 +39,9 @@ function getDefaultDataDir(networkName: NetworkNames): string {
|
|
|
31
39
|
* and DefaultSlasherConfig (which match the 'defaults' section of defaults.yml).
|
|
32
40
|
*
|
|
33
41
|
* For deployed networks: applies network configuration from generated defaults.yml,
|
|
34
|
-
* merging base defaults with network-specific overrides.
|
|
42
|
+
* merging base defaults with network-specific overrides. Before merging, enforces that operators have not
|
|
43
|
+
* overridden any consensus-critical env var with a value diverging from the network config (throwing unless
|
|
44
|
+
* ALLOW_OVERRIDING_NETWORK_CONFIG is set), so all nodes of a network agree on consensus-critical values.
|
|
35
45
|
*
|
|
36
46
|
* @param networkName - The network name
|
|
37
47
|
*/
|
|
@@ -49,6 +59,9 @@ export function enrichEnvironmentWithChainName(networkName: NetworkNames) {
|
|
|
49
59
|
const configKey = /^v\d+-devnet-\d+$/.test(networkName) ? 'devnet' : networkName;
|
|
50
60
|
const generatedConfig = NetworkConfigs[configKey];
|
|
51
61
|
if (generatedConfig) {
|
|
62
|
+
// The check is pure; this layer owns env mutation, so apply its canonical writes before enriching.
|
|
63
|
+
const canonical = checkConsensusEnvOverrides(generatedConfig, process.env, msg => log.warn(msg));
|
|
64
|
+
Object.assign(process.env, canonical);
|
|
52
65
|
enrichEnvironmentWithNetworkConfig(generatedConfig);
|
|
53
66
|
}
|
|
54
67
|
|