@aztec/cli 0.0.1-commit.96bb3f7 → 0.0.1-commit.993d240
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 +4 -3
- package/dest/cmds/l1/assume_proven_through.d.ts +3 -2
- package/dest/cmds/l1/assume_proven_through.d.ts.map +1 -1
- package/dest/cmds/l1/assume_proven_through.js +3 -5
- package/dest/cmds/l1/compute_genesis_values.d.ts +4 -0
- package/dest/cmds/l1/compute_genesis_values.d.ts.map +1 -0
- package/dest/cmds/l1/compute_genesis_values.js +17 -0
- 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/index.d.ts +1 -1
- package/dest/cmds/l1/index.d.ts.map +1 -1
- package/dest/cmds/l1/index.js +7 -2
- package/dest/cmds/l1/update_l1_validators.d.ts +3 -3
- package/dest/cmds/l1/update_l1_validators.d.ts.map +1 -1
- package/dest/cmds/l1/update_l1_validators.js +52 -18
- 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 +12 -39
- package/dest/config/chain_l2_config.d.ts.map +1 -1
- package/dest/config/chain_l2_config.js +35 -512
- package/dest/config/generated/networks.d.ts +221 -0
- package/dest/config/generated/networks.d.ts.map +1 -0
- package/dest/config/generated/networks.js +222 -0
- package/dest/config/network_config.d.ts +2 -2
- package/dest/config/network_config.d.ts.map +1 -1
- package/dest/config/network_config.js +7 -3
- package/dest/utils/aztec.d.ts +1 -2
- package/dest/utils/aztec.d.ts.map +1 -1
- package/dest/utils/aztec.js +2 -3
- 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 +10 -6
- package/package.json +35 -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 +5 -4
- package/src/cmds/l1/assume_proven_through.ts +4 -7
- package/src/cmds/l1/compute_genesis_values.ts +29 -0
- 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/index.ts +23 -4
- package/src/cmds/l1/update_l1_validators.ts +46 -21
- package/src/config/cached_fetch.ts +119 -31
- package/src/config/chain_l2_config.ts +35 -670
- package/src/config/generated/networks.ts +226 -0
- package/src/config/network_config.ts +7 -3
- package/src/utils/aztec.ts +12 -18
- package/src/utils/commands.ts +22 -9
- package/src/utils/inspect.ts +8 -6
package/dest/utils/commands.js
CHANGED
|
@@ -3,11 +3,12 @@ import { EthAddress } from '@aztec/foundation/eth-address';
|
|
|
3
3
|
import { FunctionSelector } from '@aztec/stdlib/abi/function-selector';
|
|
4
4
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
5
5
|
import { PublicKeys } from '@aztec/stdlib/keys';
|
|
6
|
-
import {
|
|
6
|
+
import { LogCursor, Tag } from '@aztec/stdlib/logs';
|
|
7
7
|
import { TxHash } from '@aztec/stdlib/tx/tx-hash';
|
|
8
8
|
import { CommanderError, InvalidArgumentError, Option } from 'commander';
|
|
9
9
|
import { lookup } from 'dns/promises';
|
|
10
10
|
import { rename, writeFile } from 'fs/promises';
|
|
11
|
+
export { LogCursor };
|
|
11
12
|
/**
|
|
12
13
|
* If we can successfully resolve 'host.docker.internal', then we are running in a container, and we should treat
|
|
13
14
|
* localhost as being host.docker.internal.
|
|
@@ -166,15 +167,24 @@ export function parseBigint(bigint) {
|
|
|
166
167
|
return parseAztecAddress(address);
|
|
167
168
|
}
|
|
168
169
|
/**
|
|
169
|
-
* Parses an optional
|
|
170
|
-
*
|
|
171
|
-
* @
|
|
172
|
-
* @
|
|
173
|
-
*/ export function
|
|
174
|
-
|
|
175
|
-
return
|
|
170
|
+
* Parses an optional `<blockNumber>-<txIndexWithinBlock>-<logIndexWithinTx>` triple into a {@link LogCursor},
|
|
171
|
+
* used as the `--after-log` argument of `get-logs` to resume pagination strictly after a previously-seen log.
|
|
172
|
+
* Thin wrapper over {@link LogCursor.parseOptional} that surfaces parse errors as commander's
|
|
173
|
+
* {@link InvalidArgumentError}.
|
|
174
|
+
*/ export function parseOptionalLogCursor(value) {
|
|
175
|
+
try {
|
|
176
|
+
return LogCursor.parseOptional(value);
|
|
177
|
+
} catch (err) {
|
|
178
|
+
throw new InvalidArgumentError(err instanceof Error ? err.message : String(err));
|
|
176
179
|
}
|
|
177
|
-
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* Parses a log tag from a string. Tags are field-element values; we delegate to the {@link parseField} parser.
|
|
183
|
+
*
|
|
184
|
+
* @param tag - A hex string, integer, or boolean string representing the tag.
|
|
185
|
+
* @returns A {@link Tag} wrapping the parsed field.
|
|
186
|
+
*/ export function parseTag(tag) {
|
|
187
|
+
return new Tag(parseField(tag));
|
|
178
188
|
}
|
|
179
189
|
/**
|
|
180
190
|
* Parses a selector from a string.
|
package/dest/utils/inspect.d.ts
CHANGED
|
@@ -8,4 +8,4 @@ export declare function inspectBlock(aztecNode: AztecNode, blockNumber: BlockNum
|
|
|
8
8
|
export declare function inspectTx(aztecNode: AztecNode, txHash: TxHash, log: LogFn, opts?: {
|
|
9
9
|
includeBlockInfo?: boolean;
|
|
10
10
|
}): Promise<void>;
|
|
11
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
11
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5zcGVjdC5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL3V0aWxzL2luc3BlY3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLFdBQVcsRUFBRSxNQUFNLGlDQUFpQyxDQUFDO0FBQzlELE9BQU8sS0FBSyxFQUFFLEtBQUssRUFBRSxNQUFNLHVCQUF1QixDQUFDO0FBQ25ELE9BQU8sS0FBSyxFQUFFLFNBQVMsRUFBRSxNQUFNLGlDQUFpQyxDQUFDO0FBQ2pFLE9BQU8sS0FBSyxFQUFFLE1BQU0sRUFBRSxNQUFNLGtCQUFrQixDQUFDO0FBRS9DLHdCQUFzQixZQUFZLENBQ2hDLFNBQVMsRUFBRSxTQUFTLEVBQ3BCLFdBQVcsRUFBRSxXQUFXLEVBQ3hCLEdBQUcsRUFBRSxLQUFLLEVBQ1YsSUFBSSxHQUFFO0lBQUUsT0FBTyxDQUFDLEVBQUUsT0FBTyxDQUFBO0NBQU8saUJBeUJqQztBQUVELHdCQUFzQixTQUFTLENBQzdCLFNBQVMsRUFBRSxTQUFTLEVBQ3BCLE1BQU0sRUFBRSxNQUFNLEVBQ2QsR0FBRyxFQUFFLEtBQUssRUFDVixJQUFJLEdBQUU7SUFBRSxnQkFBZ0IsQ0FBQyxFQUFFLE9BQU8sQ0FBQTtDQUFPLGlCQXNFMUMifQ==
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inspect.d.ts","sourceRoot":"","sources":["../../src/utils/inspect.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAC9D,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAE/C,wBAAsB,YAAY,CAChC,SAAS,EAAE,SAAS,EACpB,WAAW,EAAE,WAAW,EACxB,GAAG,EAAE,KAAK,EACV,IAAI,GAAE;IAAE,OAAO,CAAC,EAAE,OAAO,CAAA;CAAO,
|
|
1
|
+
{"version":3,"file":"inspect.d.ts","sourceRoot":"","sources":["../../src/utils/inspect.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAC9D,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAE/C,wBAAsB,YAAY,CAChC,SAAS,EAAE,SAAS,EACpB,WAAW,EAAE,WAAW,EACxB,GAAG,EAAE,KAAK,EACV,IAAI,GAAE;IAAE,OAAO,CAAC,EAAE,OAAO,CAAA;CAAO,iBAyBjC;AAED,wBAAsB,SAAS,CAC7B,SAAS,EAAE,SAAS,EACpB,MAAM,EAAE,MAAM,EACd,GAAG,EAAE,KAAK,EACV,IAAI,GAAE;IAAE,gBAAgB,CAAC,EAAE,OAAO,CAAA;CAAO,iBAsE1C"}
|
package/dest/utils/inspect.js
CHANGED
|
@@ -1,25 +1,26 @@
|
|
|
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
|
}
|
|
@@ -30,7 +31,10 @@ export async function inspectTx(aztecNode, txHash, log, opts = {}) {
|
|
|
30
31
|
]);
|
|
31
32
|
// Base tx data
|
|
32
33
|
log(`Tx ${txHash.toString()}`);
|
|
33
|
-
log(` Status: ${receipt.status}
|
|
34
|
+
log(` Status: ${receipt.status}`);
|
|
35
|
+
if (receipt.executionResult) {
|
|
36
|
+
log(` Execution result: ${receipt.executionResult}`);
|
|
37
|
+
}
|
|
34
38
|
if (receipt.error) {
|
|
35
39
|
log(` Error: ${receipt.error}`);
|
|
36
40
|
}
|
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.993d240",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
"./contracts": "./dest/cmds/contracts/index.js",
|
|
@@ -30,10 +30,13 @@
|
|
|
30
30
|
"build": "yarn clean && ../scripts/tsc.sh",
|
|
31
31
|
"build:dev": "../scripts/tsc.sh --watch",
|
|
32
32
|
"clean": "rm -rf ./dest .tsbuildinfo",
|
|
33
|
+
"copy-generated": "mkdir -p dest/config/generated/networks && cp src/config/generated/networks/*.json dest/config/generated/networks/",
|
|
34
|
+
"generate": "./scripts/generate.sh",
|
|
33
35
|
"test": "NODE_NO_WARNINGS=1 node --experimental-vm-modules ../node_modules/.bin/jest --passWithNoTests --maxWorkers=${JEST_MAX_WORKERS:-8}"
|
|
34
36
|
},
|
|
35
37
|
"inherits": [
|
|
36
|
-
"../package.common.json"
|
|
38
|
+
"../package.common.json",
|
|
39
|
+
"./package.local.json"
|
|
37
40
|
],
|
|
38
41
|
"jest": {
|
|
39
42
|
"preset": "ts-jest/presets/default-esm",
|
|
@@ -74,21 +77,23 @@
|
|
|
74
77
|
]
|
|
75
78
|
},
|
|
76
79
|
"dependencies": {
|
|
77
|
-
"@aztec/accounts": "0.0.1-commit.
|
|
78
|
-
"@aztec/archiver": "0.0.1-commit.
|
|
79
|
-
"@aztec/aztec.js": "0.0.1-commit.
|
|
80
|
-
"@aztec/constants": "0.0.1-commit.
|
|
81
|
-
"@aztec/entrypoints": "0.0.1-commit.
|
|
82
|
-
"@aztec/ethereum": "0.0.1-commit.
|
|
83
|
-
"@aztec/foundation": "0.0.1-commit.
|
|
84
|
-
"@aztec/l1-artifacts": "0.0.1-commit.
|
|
85
|
-
"@aztec/node-keystore": "0.0.1-commit.
|
|
86
|
-
"@aztec/node-lib": "0.0.1-commit.
|
|
87
|
-
"@aztec/p2p": "0.0.1-commit.
|
|
88
|
-
"@aztec/protocol-contracts": "0.0.1-commit.
|
|
89
|
-
"@aztec/
|
|
90
|
-
"@aztec/
|
|
91
|
-
"@aztec/
|
|
80
|
+
"@aztec/accounts": "0.0.1-commit.993d240",
|
|
81
|
+
"@aztec/archiver": "0.0.1-commit.993d240",
|
|
82
|
+
"@aztec/aztec.js": "0.0.1-commit.993d240",
|
|
83
|
+
"@aztec/constants": "0.0.1-commit.993d240",
|
|
84
|
+
"@aztec/entrypoints": "0.0.1-commit.993d240",
|
|
85
|
+
"@aztec/ethereum": "0.0.1-commit.993d240",
|
|
86
|
+
"@aztec/foundation": "0.0.1-commit.993d240",
|
|
87
|
+
"@aztec/l1-artifacts": "0.0.1-commit.993d240",
|
|
88
|
+
"@aztec/node-keystore": "0.0.1-commit.993d240",
|
|
89
|
+
"@aztec/node-lib": "0.0.1-commit.993d240",
|
|
90
|
+
"@aztec/p2p": "0.0.1-commit.993d240",
|
|
91
|
+
"@aztec/protocol-contracts": "0.0.1-commit.993d240",
|
|
92
|
+
"@aztec/sequencer-client": "0.0.1-commit.993d240",
|
|
93
|
+
"@aztec/slasher": "0.0.1-commit.993d240",
|
|
94
|
+
"@aztec/stdlib": "0.0.1-commit.993d240",
|
|
95
|
+
"@aztec/wallets": "0.0.1-commit.993d240",
|
|
96
|
+
"@aztec/world-state": "0.0.1-commit.993d240",
|
|
92
97
|
"@ethersproject/wallet": "^5.8.0",
|
|
93
98
|
"@iarna/toml": "^2.2.5",
|
|
94
99
|
"@libp2p/peer-id-factory": "^3.0.4",
|
|
@@ -102,9 +107,9 @@
|
|
|
102
107
|
"viem": "npm:@aztec/viem@2.38.2"
|
|
103
108
|
},
|
|
104
109
|
"devDependencies": {
|
|
105
|
-
"@aztec/aztec-node": "0.0.1-commit.
|
|
106
|
-
"@aztec/kv-store": "0.0.1-commit.
|
|
107
|
-
"@aztec/telemetry-client": "0.0.1-commit.
|
|
110
|
+
"@aztec/aztec-node": "0.0.1-commit.993d240",
|
|
111
|
+
"@aztec/kv-store": "0.0.1-commit.993d240",
|
|
112
|
+
"@aztec/telemetry-client": "0.0.1-commit.993d240",
|
|
108
113
|
"@jest/globals": "^30.0.0",
|
|
109
114
|
"@types/jest": "^30.0.0",
|
|
110
115
|
"@types/lodash.chunk": "^4.2.9",
|
|
@@ -113,7 +118,7 @@
|
|
|
113
118
|
"@types/node": "^22.15.17",
|
|
114
119
|
"@types/semver": "^7.5.2",
|
|
115
120
|
"@types/source-map-support": "^0.5.10",
|
|
116
|
-
"@typescript/native-preview": "7.0.0-dev.
|
|
121
|
+
"@typescript/native-preview": "7.0.0-dev.20260113.1",
|
|
117
122
|
"jest": "^30.0.0",
|
|
118
123
|
"jest-mock-extended": "^4.0.0",
|
|
119
124
|
"ts-jest": "^29.4.0",
|
|
@@ -121,15 +126,15 @@
|
|
|
121
126
|
"typescript": "^5.3.3"
|
|
122
127
|
},
|
|
123
128
|
"peerDependencies": {
|
|
124
|
-
"@aztec/accounts": "0.0.1-commit.
|
|
125
|
-
"@aztec/bb-prover": "0.0.1-commit.
|
|
126
|
-
"@aztec/ethereum": "0.0.1-commit.
|
|
127
|
-
"@aztec/l1-artifacts": "0.0.1-commit.
|
|
128
|
-
"@aztec/noir-contracts.js": "0.0.1-commit.
|
|
129
|
-
"@aztec/noir-protocol-circuits-types": "0.0.1-commit.
|
|
130
|
-
"@aztec/noir-test-contracts.js": "0.0.1-commit.
|
|
131
|
-
"@aztec/protocol-contracts": "0.0.1-commit.
|
|
132
|
-
"@aztec/stdlib": "0.0.1-commit.
|
|
129
|
+
"@aztec/accounts": "0.0.1-commit.993d240",
|
|
130
|
+
"@aztec/bb-prover": "0.0.1-commit.993d240",
|
|
131
|
+
"@aztec/ethereum": "0.0.1-commit.993d240",
|
|
132
|
+
"@aztec/l1-artifacts": "0.0.1-commit.993d240",
|
|
133
|
+
"@aztec/noir-contracts.js": "0.0.1-commit.993d240",
|
|
134
|
+
"@aztec/noir-protocol-circuits-types": "0.0.1-commit.993d240",
|
|
135
|
+
"@aztec/noir-test-contracts.js": "0.0.1-commit.993d240",
|
|
136
|
+
"@aztec/protocol-contracts": "0.0.1-commit.993d240",
|
|
137
|
+
"@aztec/stdlib": "0.0.1-commit.993d240"
|
|
133
138
|
},
|
|
134
139
|
"files": [
|
|
135
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
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { getInitialTestAccountsData } from '@aztec/accounts/testing';
|
|
2
|
-
import
|
|
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
5
|
import { AccountManager } from '@aztec/aztec.js/wallet';
|
|
6
6
|
import { jsonStringify } from '@aztec/foundation/json-rpc';
|
|
7
7
|
import type { LogFn } from '@aztec/foundation/log';
|
|
8
8
|
import { ProtocolContractAddress } from '@aztec/protocol-contracts';
|
|
9
|
-
import {
|
|
9
|
+
import { EmbeddedWallet } from '@aztec/wallets/embedded';
|
|
10
|
+
import { deployFundedSchnorrAccounts } from '@aztec/wallets/testing';
|
|
10
11
|
|
|
11
12
|
export async function setupL2Contracts(nodeUrl: string, testAccounts: boolean, json: boolean, log: LogFn) {
|
|
12
13
|
const waitOpts: WaitOpts = {
|
|
@@ -16,13 +17,13 @@ export async function setupL2Contracts(nodeUrl: string, testAccounts: boolean, j
|
|
|
16
17
|
log('setupL2Contracts: Wait options' + jsonStringify(waitOpts));
|
|
17
18
|
log('setupL2Contracts: Creating PXE client...');
|
|
18
19
|
const node = createAztecNodeClient(nodeUrl);
|
|
19
|
-
const wallet = await
|
|
20
|
+
const wallet = await EmbeddedWallet.create(node);
|
|
20
21
|
|
|
21
22
|
let deployedAccountManagers: AccountManager[] = [];
|
|
22
23
|
if (testAccounts) {
|
|
23
24
|
log('setupL2Contracts: Deploying test accounts...');
|
|
24
25
|
const initialAccountsData = await getInitialTestAccountsData();
|
|
25
|
-
deployedAccountManagers = await deployFundedSchnorrAccounts(wallet,
|
|
26
|
+
deployedAccountManagers = await deployFundedSchnorrAccounts(wallet, initialAccountsData, waitOpts);
|
|
26
27
|
}
|
|
27
28
|
|
|
28
29
|
if (json) {
|
|
@@ -1,23 +1,20 @@
|
|
|
1
1
|
import { createAztecNodeClient } from '@aztec/aztec.js/node';
|
|
2
2
|
import { RollupCheatCodes } from '@aztec/ethereum/test';
|
|
3
|
-
import {
|
|
3
|
+
import { CheckpointNumber } from '@aztec/foundation/branded-types';
|
|
4
4
|
import type { LogFn } from '@aztec/foundation/log';
|
|
5
5
|
import { DateProvider } from '@aztec/foundation/timer';
|
|
6
6
|
|
|
7
7
|
export async function assumeProvenThrough(
|
|
8
|
-
|
|
8
|
+
checkpointOrLatest: CheckpointNumber | undefined,
|
|
9
9
|
l1RpcUrls: string[],
|
|
10
10
|
nodeUrl: string,
|
|
11
11
|
log: LogFn,
|
|
12
12
|
) {
|
|
13
13
|
const aztecNode = createAztecNodeClient(nodeUrl);
|
|
14
14
|
const rollupAddress = await aztecNode.getNodeInfo().then(i => i.l1ContractAddresses.rollupAddress);
|
|
15
|
-
const blockNumber: BlockNumber = blockNumberOrLatest
|
|
16
|
-
? BlockNumber(blockNumberOrLatest)
|
|
17
|
-
: await aztecNode.getBlockNumber();
|
|
18
15
|
|
|
19
16
|
const rollupCheatCodes = RollupCheatCodes.create(l1RpcUrls, { rollupAddress }, new DateProvider());
|
|
20
17
|
|
|
21
|
-
await rollupCheatCodes.markAsProven(
|
|
22
|
-
log(`Assumed proven through
|
|
18
|
+
await rollupCheatCodes.markAsProven(checkpointOrLatest);
|
|
19
|
+
log(`Assumed proven through checkpoint ${checkpointOrLatest ?? 'latest'}`);
|
|
23
20
|
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { getInitialTestAccountsData } from '@aztec/accounts/testing';
|
|
2
|
+
import type { LogFn } from '@aztec/foundation/log';
|
|
3
|
+
import { protocolContractsHash } from '@aztec/protocol-contracts';
|
|
4
|
+
import { getGenesisValues } from '@aztec/world-state/testing';
|
|
5
|
+
|
|
6
|
+
import { getSponsoredFPCAddress } from '../../utils/setup_contracts.js';
|
|
7
|
+
|
|
8
|
+
/** Computes and prints genesis values needed for L1 contract deployment. */
|
|
9
|
+
export async function computeGenesisValuesCmd(testAccounts: boolean, sponsoredFPC: boolean, log: LogFn) {
|
|
10
|
+
const initialAccounts = testAccounts ? await getInitialTestAccountsData() : [];
|
|
11
|
+
const sponsoredFPCAddresses = sponsoredFPC ? await getSponsoredFPCAddress() : [];
|
|
12
|
+
const initialFundedAccounts = initialAccounts.map(a => a.address).concat(sponsoredFPCAddresses);
|
|
13
|
+
const { genesisArchiveRoot } = await getGenesisValues(initialFundedAccounts);
|
|
14
|
+
|
|
15
|
+
const { getVKTreeRoot } = await import('@aztec/noir-protocol-circuits-types/vk-tree');
|
|
16
|
+
const vkTreeRoot = getVKTreeRoot();
|
|
17
|
+
|
|
18
|
+
log(
|
|
19
|
+
JSON.stringify(
|
|
20
|
+
{
|
|
21
|
+
vkTreeRoot: vkTreeRoot.toString(),
|
|
22
|
+
protocolContractsHash: protocolContractsHash.toString(),
|
|
23
|
+
genesisArchiveRoot: genesisArchiveRoot.toString(),
|
|
24
|
+
},
|
|
25
|
+
null,
|
|
26
|
+
2,
|
|
27
|
+
),
|
|
28
|
+
);
|
|
29
|
+
}
|
|
@@ -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
|
}
|
package/src/cmds/l1/index.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { CheckpointNumber } from '@aztec/foundation/branded-types';
|
|
1
2
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
2
3
|
import type { LogFn, Logger } from '@aztec/foundation/log';
|
|
3
4
|
|
|
@@ -105,6 +106,24 @@ export function injectCommands(program: Command, log: LogFn, debugLogger: Logger
|
|
|
105
106
|
);
|
|
106
107
|
});
|
|
107
108
|
|
|
109
|
+
program
|
|
110
|
+
.command('compute-genesis-values')
|
|
111
|
+
.description('Computes genesis values (VK tree root, protocol contracts hash, genesis archive root).')
|
|
112
|
+
.addOption(
|
|
113
|
+
new Option('--test-accounts <boolean>', 'Include initial test accounts in genesis state')
|
|
114
|
+
.env('TEST_ACCOUNTS')
|
|
115
|
+
.argParser(arg => arg === 'true'),
|
|
116
|
+
)
|
|
117
|
+
.addOption(
|
|
118
|
+
new Option('--sponsored-fpc <boolean>', 'Include sponsored FPC contract in genesis state')
|
|
119
|
+
.env('SPONSORED_FPC')
|
|
120
|
+
.argParser(arg => arg === 'true'),
|
|
121
|
+
)
|
|
122
|
+
.action(async options => {
|
|
123
|
+
const { computeGenesisValuesCmd } = await import('./compute_genesis_values.js');
|
|
124
|
+
await computeGenesisValuesCmd(options.testAccounts, options.sponsoredFpc, log);
|
|
125
|
+
});
|
|
126
|
+
|
|
108
127
|
program
|
|
109
128
|
.command('deposit-governance-tokens')
|
|
110
129
|
.description('Deposits governance tokens to the governance contract.')
|
|
@@ -497,14 +516,14 @@ export function injectCommands(program: Command, log: LogFn, debugLogger: Logger
|
|
|
497
516
|
program
|
|
498
517
|
.command('set-proven-through', { hidden: true })
|
|
499
518
|
.description(
|
|
500
|
-
'Instructs the L1 rollup contract to assume all blocks until the given
|
|
519
|
+
'Instructs the L1 rollup contract to assume all blocks until the given checkpoint are automatically proven.',
|
|
501
520
|
)
|
|
502
|
-
.argument('[
|
|
521
|
+
.argument('[checkpoint]', 'The target checkpoint, defaults to the latest pending checkpoint.', parseBigint)
|
|
503
522
|
.addOption(l1RpcUrlsOption)
|
|
504
523
|
.addOption(nodeOption)
|
|
505
|
-
.action(async (
|
|
524
|
+
.action(async (checkpoint, options) => {
|
|
506
525
|
const { assumeProvenThrough } = await import('./assume_proven_through.js');
|
|
507
|
-
await assumeProvenThrough(
|
|
526
|
+
await assumeProvenThrough(CheckpointNumber.fromBigInt(checkpoint), options.l1RpcUrls, options.nodeUrl, log);
|
|
508
527
|
});
|
|
509
528
|
|
|
510
529
|
program
|