@aztec/cli 0.0.1-commit.b2a5d0dd1 → 0.0.1-commit.b3d3157a

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. package/dest/cmds/aztec_node/block_number.js +1 -1
  2. package/dest/cmds/aztec_node/get_logs.d.ts +30 -4
  3. package/dest/cmds/aztec_node/get_logs.d.ts.map +1 -1
  4. package/dest/cmds/aztec_node/get_logs.js +39 -29
  5. package/dest/cmds/aztec_node/index.d.ts +1 -1
  6. package/dest/cmds/aztec_node/index.d.ts.map +1 -1
  7. package/dest/cmds/aztec_node/index.js +13 -3
  8. package/dest/cmds/infrastructure/setup_l2_contract.d.ts +1 -1
  9. package/dest/cmds/infrastructure/setup_l2_contract.d.ts.map +1 -1
  10. package/dest/cmds/infrastructure/setup_l2_contract.js +5 -1
  11. package/dest/cmds/l1/update_l1_validators.d.ts +1 -1
  12. package/dest/cmds/l1/update_l1_validators.d.ts.map +1 -1
  13. package/dest/cmds/l1/update_l1_validators.js +0 -1
  14. package/dest/config/generated/networks.d.ts +28 -22
  15. package/dest/config/generated/networks.d.ts.map +1 -1
  16. package/dest/config/generated/networks.js +27 -21
  17. package/dest/utils/commands.d.ts +14 -6
  18. package/dest/utils/commands.d.ts.map +1 -1
  19. package/dest/utils/commands.js +19 -9
  20. package/dest/utils/inspect.d.ts +1 -1
  21. package/dest/utils/inspect.d.ts.map +1 -1
  22. package/dest/utils/inspect.js +11 -11
  23. package/package.json +30 -30
  24. package/src/cmds/aztec_node/block_number.ts +1 -1
  25. package/src/cmds/aztec_node/get_logs.ts +70 -38
  26. package/src/cmds/aztec_node/index.ts +13 -8
  27. package/src/cmds/infrastructure/setup_l2_contract.ts +4 -0
  28. package/src/cmds/l1/update_l1_validators.ts +0 -1
  29. package/src/config/generated/networks.ts +27 -21
  30. package/src/utils/commands.ts +22 -9
  31. package/src/utils/inspect.ts +7 -8
@@ -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 { LogId } from '@aztec/stdlib/logs/log-id';
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 log ID string into a LogId object.
170
- *
171
- * @param logId - The log ID string to parse.
172
- * @returns The parsed LogId object, or undefined if the log ID is missing or empty.
173
- */ export function parseOptionalLogId(logId) {
174
- if (!logId) {
175
- return undefined;
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
- return LogId.fromString(logId);
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.
@@ -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,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5zcGVjdC5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL3V0aWxzL2luc3BlY3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLFdBQVcsRUFBRSxNQUFNLGlDQUFpQyxDQUFDO0FBQzlELE9BQU8sS0FBSyxFQUFFLEtBQUssRUFBRSxNQUFNLHVCQUF1QixDQUFDO0FBQ25ELE9BQU8sS0FBSyxFQUFFLFNBQVMsRUFBRSxNQUFNLGlDQUFpQyxDQUFDO0FBQ2pFLE9BQU8sS0FBSyxFQUFFLE1BQU0sRUFBRSxNQUFNLGtCQUFrQixDQUFDO0FBRS9DLHdCQUFzQixZQUFZLENBQ2hDLFNBQVMsRUFBRSxTQUFTLEVBQ3BCLFdBQVcsRUFBRSxXQUFXLEVBQ3hCLEdBQUcsRUFBRSxLQUFLLEVBQ1YsSUFBSSxHQUFFO0lBQUUsT0FBTyxDQUFDLEVBQUUsT0FBTyxDQUFBO0NBQU8saUJBMEJqQztBQUVELHdCQUFzQixTQUFTLENBQzdCLFNBQVMsRUFBRSxTQUFTLEVBQ3BCLE1BQU0sRUFBRSxNQUFNLEVBQ2QsR0FBRyxFQUFFLEtBQUssRUFDVixJQUFJLEdBQUU7SUFBRSxnQkFBZ0IsQ0FBQyxFQUFFLE9BQU8sQ0FBQTtDQUFPLGlCQXNFMUMifQ==
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,iBA0BjC;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"}
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"}
@@ -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
- const blockHash = await block.hash();
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 [receipt, effectsInBlock] = await Promise.all([
28
- aztecNode.getTxReceipt(txHash),
29
- aztecNode.getTxEffect(txHash)
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 (!effectsInBlock) {
40
+ if (!receipt.isMined() || !receipt.txEffect) {
41
41
  return;
42
42
  }
43
- const effects = effectsInBlock.data;
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.b2a5d0dd1",
3
+ "version": "0.0.1-commit.b3d3157a",
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.b2a5d0dd1",
81
- "@aztec/archiver": "0.0.1-commit.b2a5d0dd1",
82
- "@aztec/aztec.js": "0.0.1-commit.b2a5d0dd1",
83
- "@aztec/constants": "0.0.1-commit.b2a5d0dd1",
84
- "@aztec/entrypoints": "0.0.1-commit.b2a5d0dd1",
85
- "@aztec/ethereum": "0.0.1-commit.b2a5d0dd1",
86
- "@aztec/foundation": "0.0.1-commit.b2a5d0dd1",
87
- "@aztec/l1-artifacts": "0.0.1-commit.b2a5d0dd1",
88
- "@aztec/node-keystore": "0.0.1-commit.b2a5d0dd1",
89
- "@aztec/node-lib": "0.0.1-commit.b2a5d0dd1",
90
- "@aztec/p2p": "0.0.1-commit.b2a5d0dd1",
91
- "@aztec/protocol-contracts": "0.0.1-commit.b2a5d0dd1",
92
- "@aztec/sequencer-client": "0.0.1-commit.b2a5d0dd1",
93
- "@aztec/slasher": "0.0.1-commit.b2a5d0dd1",
94
- "@aztec/stdlib": "0.0.1-commit.b2a5d0dd1",
95
- "@aztec/wallets": "0.0.1-commit.b2a5d0dd1",
96
- "@aztec/world-state": "0.0.1-commit.b2a5d0dd1",
80
+ "@aztec/accounts": "0.0.1-commit.b3d3157a",
81
+ "@aztec/archiver": "0.0.1-commit.b3d3157a",
82
+ "@aztec/aztec.js": "0.0.1-commit.b3d3157a",
83
+ "@aztec/constants": "0.0.1-commit.b3d3157a",
84
+ "@aztec/entrypoints": "0.0.1-commit.b3d3157a",
85
+ "@aztec/ethereum": "0.0.1-commit.b3d3157a",
86
+ "@aztec/foundation": "0.0.1-commit.b3d3157a",
87
+ "@aztec/l1-artifacts": "0.0.1-commit.b3d3157a",
88
+ "@aztec/node-keystore": "0.0.1-commit.b3d3157a",
89
+ "@aztec/node-lib": "0.0.1-commit.b3d3157a",
90
+ "@aztec/p2p": "0.0.1-commit.b3d3157a",
91
+ "@aztec/protocol-contracts": "0.0.1-commit.b3d3157a",
92
+ "@aztec/sequencer-client": "0.0.1-commit.b3d3157a",
93
+ "@aztec/slasher": "0.0.1-commit.b3d3157a",
94
+ "@aztec/stdlib": "0.0.1-commit.b3d3157a",
95
+ "@aztec/wallets": "0.0.1-commit.b3d3157a",
96
+ "@aztec/world-state": "0.0.1-commit.b3d3157a",
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.b2a5d0dd1",
111
- "@aztec/kv-store": "0.0.1-commit.b2a5d0dd1",
112
- "@aztec/telemetry-client": "0.0.1-commit.b2a5d0dd1",
110
+ "@aztec/aztec-node": "0.0.1-commit.b3d3157a",
111
+ "@aztec/kv-store": "0.0.1-commit.b3d3157a",
112
+ "@aztec/telemetry-client": "0.0.1-commit.b3d3157a",
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.b2a5d0dd1",
130
- "@aztec/bb-prover": "0.0.1-commit.b2a5d0dd1",
131
- "@aztec/ethereum": "0.0.1-commit.b2a5d0dd1",
132
- "@aztec/l1-artifacts": "0.0.1-commit.b2a5d0dd1",
133
- "@aztec/noir-contracts.js": "0.0.1-commit.b2a5d0dd1",
134
- "@aztec/noir-protocol-circuits-types": "0.0.1-commit.b2a5d0dd1",
135
- "@aztec/noir-test-contracts.js": "0.0.1-commit.b2a5d0dd1",
136
- "@aztec/protocol-contracts": "0.0.1-commit.b2a5d0dd1",
137
- "@aztec/stdlib": "0.0.1-commit.b2a5d0dd1"
129
+ "@aztec/accounts": "0.0.1-commit.b3d3157a",
130
+ "@aztec/bb-prover": "0.0.1-commit.b3d3157a",
131
+ "@aztec/ethereum": "0.0.1-commit.b3d3157a",
132
+ "@aztec/l1-artifacts": "0.0.1-commit.b3d3157a",
133
+ "@aztec/noir-contracts.js": "0.0.1-commit.b3d3157a",
134
+ "@aztec/noir-protocol-circuits-types": "0.0.1-commit.b3d3157a",
135
+ "@aztec/noir-test-contracts.js": "0.0.1-commit.b3d3157a",
136
+ "@aztec/protocol-contracts": "0.0.1-commit.b3d3157a",
137
+ "@aztec/stdlib": "0.0.1-commit.b3d3157a"
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.getProvenBlockNumber()]);
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
- export async function getLogs(
10
- txHash: TxHash,
11
- fromBlock: BlockNumber,
12
- toBlock: BlockNumber,
13
- afterLog: LogId,
14
- contractAddress: AztecAddress,
15
- nodeUrl: string,
16
- follow: boolean,
17
- log: LogFn,
18
- ) {
19
- const node = createAztecNodeClient(nodeUrl);
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 filter: LogFilter = { txHash, fromBlock, toBlock, afterLog, contractAddress };
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
- if (!logs.length) {
37
- const filterOptions = Object.entries(filter)
38
- .filter(([, value]) => value !== undefined)
39
- .map(([key, value]) => `${key}: ${value}`)
40
- .join(', ');
41
- if (!follow) {
42
- log(`No logs found for filter: {${filterOptions}}`);
43
- }
44
- } else {
45
- if (!follow && !filter.afterLog) {
46
- log('Logs found: \n');
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 response.maxLogsHit;
72
+ return logsForTag;
53
73
  };
54
74
 
55
75
  if (follow) {
56
76
  log('Fetching logs...');
57
77
  while (true) {
58
- const maxLogsHit = await fetchLogs();
59
- if (!maxLogsHit) {
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
- while (await fetchLogs()) {
65
- // Keep fetching logs until we reach the end.
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
  }
@@ -7,10 +7,10 @@ import {
7
7
  nodeOption,
8
8
  parseAztecAddress,
9
9
  parseField,
10
- parseOptionalAztecAddress,
11
10
  parseOptionalInteger,
12
- parseOptionalLogId,
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 all the public logs from an intersection of all the filter params.')
51
- .option('-tx, --tx-hash <txHash>', 'A transaction hash to get the receipt for.', parseOptionalTxHash)
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('-al --after-log <logId>', 'ID of a log after which to fetch the logs.', parseOptionalLogId)
59
- .option('-ca, --contract-address <address>', 'Contract address to filter logs by.', parseOptionalAztecAddress)
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, aztecNodeRpcUrl: nodeUrl, follow }) => {
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,6 +2,7 @@ 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';
@@ -13,6 +14,9 @@ export async function setupL2Contracts(nodeUrl: string, testAccounts: boolean, j
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...');
@@ -38,7 +38,6 @@ export interface LoggerArgs {
38
38
  export function generateL1Account() {
39
39
  const privateKey = generatePrivateKey();
40
40
  const account = privateKeyToAccount(privateKey);
41
- account.address;
42
41
  return {
43
42
  privateKey,
44
43
  address: account.address,
@@ -27,6 +27,7 @@ export const devnetConfig = {
27
27
  SLASH_OFFENSE_EXPIRATION_ROUNDS: 4,
28
28
  SLASH_MAX_PAYLOAD_SIZE: 80,
29
29
  SLASH_EXECUTE_ROUNDS_LOOK_BACK: 4,
30
+ SLASH_DATA_WITHHOLDING_TOLERANCE_SLOTS: 3,
30
31
  P2P_ENABLED: true,
31
32
  BOOTSTRAP_NODES: '',
32
33
  SEQ_MIN_TX_PER_BLOCK: 1,
@@ -59,7 +60,6 @@ export const devnetConfig = {
59
60
  PUBLIC_OTEL_OPT_OUT: true,
60
61
  PUBLIC_OTEL_EXPORTER_OTLP_METRICS_ENDPOINT: '',
61
62
  PUBLIC_OTEL_COLLECT_FROM: '',
62
- SLASH_PRUNE_PENALTY: 10000000000000000000,
63
63
  SLASH_DATA_WITHHOLDING_PENALTY: 10000000000000000000,
64
64
  SLASH_INACTIVITY_TARGET_PERCENTAGE: 0.9,
65
65
  SLASH_INACTIVITY_CONSECUTIVE_EPOCH_THRESHOLD: 1,
@@ -67,9 +67,11 @@ export const devnetConfig = {
67
67
  SLASH_PROPOSE_INVALID_ATTESTATIONS_PENALTY: 10000000000000000000,
68
68
  SLASH_DUPLICATE_PROPOSAL_PENALTY: 10000000000000000000,
69
69
  SLASH_DUPLICATE_ATTESTATION_PENALTY: 10000000000000000000,
70
- SLASH_ATTEST_DESCENDANT_OF_INVALID_PENALTY: 10000000000000000000,
70
+ SLASH_PROPOSE_DESCENDANT_OF_CHECKPOINT_WITH_INVALID_ATTESTATIONS_PENALTY: 10000000000000000000,
71
+ SLASH_ATTEST_INVALID_CHECKPOINT_PROPOSAL_PENALTY: 10000000000000000000,
71
72
  SLASH_UNKNOWN_PENALTY: 10000000000000000000,
72
73
  SLASH_INVALID_BLOCK_PENALTY: 10000000000000000000,
74
+ SLASH_INVALID_CHECKPOINT_PROPOSAL_PENALTY: 0,
73
75
  SLASH_GRACE_PERIOD_L2_SLOTS: 0,
74
76
  ENABLE_VERSION_CHECK: true,
75
77
  } as const;
@@ -92,6 +94,7 @@ export const testnetConfig = {
92
94
  SLASH_OFFENSE_EXPIRATION_ROUNDS: 4,
93
95
  SLASH_MAX_PAYLOAD_SIZE: 80,
94
96
  SLASH_EXECUTE_ROUNDS_LOOK_BACK: 4,
97
+ SLASH_DATA_WITHHOLDING_TOLERANCE_SLOTS: 3,
95
98
  P2P_ENABLED: true,
96
99
  BOOTSTRAP_NODES: '',
97
100
  SEQ_MIN_TX_PER_BLOCK: 1,
@@ -115,10 +118,10 @@ export const testnetConfig = {
115
118
  AZTEC_GOVERNANCE_PROPOSER_ROUND_SIZE: 100,
116
119
  AZTEC_GOVERNANCE_PROPOSER_QUORUM: 60,
117
120
  AZTEC_MANA_TARGET: 75000000,
118
- AZTEC_PROVING_COST_PER_MANA: 25000000,
121
+ AZTEC_PROVING_COST_PER_MANA: 12500000,
119
122
  AZTEC_SLASH_AMOUNT_SMALL: 1E+23,
120
- AZTEC_SLASH_AMOUNT_MEDIUM: 1E+23,
121
- AZTEC_SLASH_AMOUNT_LARGE: 1E+23,
123
+ AZTEC_SLASH_AMOUNT_MEDIUM: 2.5E+23,
124
+ AZTEC_SLASH_AMOUNT_LARGE: 2.5E+23,
122
125
  L1_CHAIN_ID: 11155111,
123
126
  TEST_ACCOUNTS: false,
124
127
  SPONSORED_FPC: false,
@@ -127,17 +130,18 @@ export const testnetConfig = {
127
130
  PROVER_REAL_PROOFS: true,
128
131
  P2P_MAX_PENDING_TX_COUNT: 1000,
129
132
  P2P_TX_POOL_DELETE_TXS_AFTER_REORG: true,
130
- SLASH_PRUNE_PENALTY: 10000000000000000000,
131
- SLASH_DATA_WITHHOLDING_PENALTY: 10000000000000000000,
133
+ SLASH_DATA_WITHHOLDING_PENALTY: 0,
132
134
  SLASH_INACTIVITY_TARGET_PERCENTAGE: 0.9,
133
135
  SLASH_INACTIVITY_CONSECUTIVE_EPOCH_THRESHOLD: 1,
134
- SLASH_INACTIVITY_PENALTY: 10000000000000000000,
135
- SLASH_PROPOSE_INVALID_ATTESTATIONS_PENALTY: 10000000000000000000,
136
- SLASH_DUPLICATE_PROPOSAL_PENALTY: 10000000000000000000,
137
- SLASH_DUPLICATE_ATTESTATION_PENALTY: 10000000000000000000,
138
- SLASH_ATTEST_DESCENDANT_OF_INVALID_PENALTY: 10000000000000000000,
139
- SLASH_UNKNOWN_PENALTY: 10000000000000000000,
140
- SLASH_INVALID_BLOCK_PENALTY: 10000000000000000000,
136
+ SLASH_INACTIVITY_PENALTY: 1E+23,
137
+ SLASH_PROPOSE_INVALID_ATTESTATIONS_PENALTY: 1E+23,
138
+ SLASH_DUPLICATE_PROPOSAL_PENALTY: 2.5E+23,
139
+ SLASH_DUPLICATE_ATTESTATION_PENALTY: 2.5E+23,
140
+ SLASH_PROPOSE_DESCENDANT_OF_CHECKPOINT_WITH_INVALID_ATTESTATIONS_PENALTY: 0,
141
+ SLASH_ATTEST_INVALID_CHECKPOINT_PROPOSAL_PENALTY: 0,
142
+ SLASH_UNKNOWN_PENALTY: 1E+23,
143
+ SLASH_INVALID_BLOCK_PENALTY: 1E+23,
144
+ SLASH_INVALID_CHECKPOINT_PROPOSAL_PENALTY: 1E+23,
141
145
  SLASH_GRACE_PERIOD_L2_SLOTS: 64,
142
146
  ENABLE_VERSION_CHECK: true,
143
147
  } as const;
@@ -157,6 +161,7 @@ export const mainnetConfig = {
157
161
  SLASH_OFFENSE_EXPIRATION_ROUNDS: 4,
158
162
  SLASH_MAX_PAYLOAD_SIZE: 80,
159
163
  SLASH_EXECUTE_ROUNDS_LOOK_BACK: 4,
164
+ SLASH_DATA_WITHHOLDING_TOLERANCE_SLOTS: 3,
160
165
  P2P_ENABLED: true,
161
166
  BOOTSTRAP_NODES: '',
162
167
  SEQ_MIN_TX_PER_BLOCK: 1,
@@ -175,8 +180,8 @@ export const mainnetConfig = {
175
180
  AZTEC_EJECTION_THRESHOLD: 1E+23,
176
181
  AZTEC_LOCAL_EJECTION_THRESHOLD: 1.9E+23,
177
182
  AZTEC_SLASH_AMOUNT_SMALL: 2E+21,
178
- AZTEC_SLASH_AMOUNT_MEDIUM: 2E+21,
179
- AZTEC_SLASH_AMOUNT_LARGE: 2E+21,
183
+ AZTEC_SLASH_AMOUNT_MEDIUM: 5E+21,
184
+ AZTEC_SLASH_AMOUNT_LARGE: 5E+21,
180
185
  AZTEC_SLASHING_LIFETIME_IN_ROUNDS: 34,
181
186
  AZTEC_SLASHING_EXECUTION_DELAY_IN_ROUNDS: 28,
182
187
  AZTEC_SLASHING_VETOER: '0xBbB4aF368d02827945748b28CD4b2D42e4A37480',
@@ -184,7 +189,7 @@ export const mainnetConfig = {
184
189
  AZTEC_GOVERNANCE_PROPOSER_QUORUM: 600,
185
190
  AZTEC_GOVERNANCE_PROPOSER_ROUND_SIZE: 1000,
186
191
  AZTEC_MANA_TARGET: 75000000,
187
- AZTEC_PROVING_COST_PER_MANA: 25000000,
192
+ AZTEC_PROVING_COST_PER_MANA: 12500000,
188
193
  AZTEC_EXIT_DELAY_SECONDS: 345600,
189
194
  AZTEC_SLASHING_DISABLE_DURATION: 259200,
190
195
  AZTEC_ENTRY_QUEUE_BOOTSTRAP_VALIDATOR_SET_SIZE: 500,
@@ -204,17 +209,18 @@ export const mainnetConfig = {
204
209
  PUBLIC_OTEL_EXPORTER_OTLP_METRICS_ENDPOINT: '',
205
210
  PUBLIC_OTEL_COLLECT_FROM: '',
206
211
  ENABLE_VERSION_CHECK: false,
207
- SLASH_PRUNE_PENALTY: 0,
208
212
  SLASH_DATA_WITHHOLDING_PENALTY: 0,
209
213
  SLASH_INACTIVITY_TARGET_PERCENTAGE: 0.8,
210
214
  SLASH_INACTIVITY_CONSECUTIVE_EPOCH_THRESHOLD: 2,
211
215
  SLASH_INACTIVITY_PENALTY: 2E+21,
212
216
  SLASH_PROPOSE_INVALID_ATTESTATIONS_PENALTY: 2E+21,
213
- SLASH_DUPLICATE_PROPOSAL_PENALTY: 2E+21,
214
- SLASH_DUPLICATE_ATTESTATION_PENALTY: 2E+21,
215
- SLASH_ATTEST_DESCENDANT_OF_INVALID_PENALTY: 2E+21,
217
+ SLASH_DUPLICATE_PROPOSAL_PENALTY: 5E+21,
218
+ SLASH_DUPLICATE_ATTESTATION_PENALTY: 5E+21,
219
+ SLASH_PROPOSE_DESCENDANT_OF_CHECKPOINT_WITH_INVALID_ATTESTATIONS_PENALTY: 0,
220
+ SLASH_ATTEST_INVALID_CHECKPOINT_PROPOSAL_PENALTY: 0,
216
221
  SLASH_UNKNOWN_PENALTY: 2E+21,
217
222
  SLASH_INVALID_BLOCK_PENALTY: 2E+21,
223
+ SLASH_INVALID_CHECKPOINT_PROPOSAL_PENALTY: 2E+21,
218
224
  SLASH_GRACE_PERIOD_L2_SLOTS: 1200,
219
225
  } as const;
220
226
 
@@ -5,13 +5,15 @@ import type { PXE } from '@aztec/pxe/server';
5
5
  import { FunctionSelector } from '@aztec/stdlib/abi/function-selector';
6
6
  import { AztecAddress } from '@aztec/stdlib/aztec-address';
7
7
  import { PublicKeys } from '@aztec/stdlib/keys';
8
- import { LogId } from '@aztec/stdlib/logs/log-id';
8
+ import { LogCursor, Tag } from '@aztec/stdlib/logs';
9
9
  import { TxHash } from '@aztec/stdlib/tx/tx-hash';
10
10
 
11
11
  import { type Command, CommanderError, InvalidArgumentError, Option } from 'commander';
12
12
  import { lookup } from 'dns/promises';
13
13
  import { rename, writeFile } from 'fs/promises';
14
14
 
15
+ export { LogCursor };
16
+
15
17
  /**
16
18
  * If we can successfully resolve 'host.docker.internal', then we are running in a container, and we should treat
17
19
  * localhost as being host.docker.internal.
@@ -227,16 +229,27 @@ export function parseOptionalAztecAddress(address: string): AztecAddress | undef
227
229
  }
228
230
 
229
231
  /**
230
- * Parses an optional log ID string into a LogId object.
231
- *
232
- * @param logId - The log ID string to parse.
233
- * @returns The parsed LogId object, or undefined if the log ID is missing or empty.
232
+ * Parses an optional `<blockNumber>-<txIndexWithinBlock>-<logIndexWithinTx>` triple into a {@link LogCursor},
233
+ * used as the `--after-log` argument of `get-logs` to resume pagination strictly after a previously-seen log.
234
+ * Thin wrapper over {@link LogCursor.parseOptional} that surfaces parse errors as commander's
235
+ * {@link InvalidArgumentError}.
234
236
  */
235
- export function parseOptionalLogId(logId: string): LogId | undefined {
236
- if (!logId) {
237
- return undefined;
237
+ export function parseOptionalLogCursor(value: string): LogCursor | undefined {
238
+ try {
239
+ return LogCursor.parseOptional(value);
240
+ } catch (err) {
241
+ throw new InvalidArgumentError(err instanceof Error ? err.message : String(err));
238
242
  }
239
- return LogId.fromString(logId);
243
+ }
244
+
245
+ /**
246
+ * Parses a log tag from a string. Tags are field-element values; we delegate to the {@link parseField} parser.
247
+ *
248
+ * @param tag - A hex string, integer, or boolean string representing the tag.
249
+ * @returns A {@link Tag} wrapping the parsed field.
250
+ */
251
+ export function parseTag(tag: string): Tag {
252
+ return new Tag(parseField(tag));
240
253
  }
241
254
 
242
255
  /**