@aztec/cli 3.0.0-nightly.20250917 → 3.0.0-nightly.20250919
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.d.ts +3 -0
- package/dest/cmds/aztec_node/block_number.d.ts.map +1 -0
- package/dest/cmds/aztec_node/block_number.js +10 -0
- package/dest/cmds/aztec_node/get_block.d.ts +3 -0
- package/dest/cmds/aztec_node/get_block.d.ts.map +1 -0
- package/dest/cmds/aztec_node/get_block.js +10 -0
- package/dest/cmds/aztec_node/get_l1_to_l2_message_witness.d.ts +4 -0
- package/dest/cmds/aztec_node/get_l1_to_l2_message_witness.d.ts.map +1 -0
- package/dest/cmds/aztec_node/get_l1_to_l2_message_witness.js +12 -0
- package/dest/cmds/{pxe → aztec_node}/get_logs.d.ts +2 -2
- package/dest/cmds/aztec_node/get_logs.d.ts.map +1 -0
- package/dest/cmds/{pxe → aztec_node}/get_logs.js +4 -4
- package/dest/cmds/aztec_node/index.d.ts +4 -0
- package/dest/cmds/aztec_node/index.d.ts.map +1 -0
- package/dest/cmds/aztec_node/index.js +20 -0
- package/dest/cmds/devnet/bootstrap_network.d.ts +1 -1
- package/dest/cmds/devnet/bootstrap_network.d.ts.map +1 -1
- package/dest/cmds/devnet/bootstrap_network.js +7 -6
- package/dest/cmds/devnet/index.d.ts.map +1 -1
- package/dest/cmds/devnet/index.js +3 -3
- package/dest/cmds/l1/assume_proven_through.d.ts +1 -1
- package/dest/cmds/l1/assume_proven_through.d.ts.map +1 -1
- package/dest/cmds/l1/assume_proven_through.js +5 -5
- package/dest/cmds/l1/index.d.ts.map +1 -1
- package/dest/cmds/l1/index.js +3 -3
- package/dest/cmds/pxe/index.d.ts.map +1 -1
- package/dest/cmds/pxe/index.js +1 -17
- package/dest/config/chain_l2_config.d.ts.map +1 -1
- package/dest/config/chain_l2_config.js +45 -10
- package/dest/utils/commands.d.ts +2 -0
- package/dest/utils/commands.d.ts.map +1 -1
- package/dest/utils/commands.js +2 -0
- package/dest/utils/inspect.d.ts +3 -3
- package/dest/utils/inspect.d.ts.map +1 -1
- package/dest/utils/inspect.js +6 -6
- package/package.json +25 -24
- package/src/cmds/aztec_node/block_number.ts +9 -0
- package/src/cmds/aztec_node/get_block.ts +17 -0
- package/src/cmds/aztec_node/get_l1_to_l2_message_witness.ts +25 -0
- package/src/cmds/{pxe → aztec_node}/get_logs.ts +5 -6
- package/src/cmds/aztec_node/index.ts +69 -0
- package/src/cmds/devnet/bootstrap_network.ts +13 -3
- package/src/cmds/devnet/index.ts +3 -1
- package/src/cmds/l1/assume_proven_through.ts +5 -5
- package/src/cmds/l1/index.ts +3 -2
- package/src/cmds/pxe/index.ts +0 -55
- package/src/config/chain_l2_config.ts +52 -9
- package/src/utils/commands.ts +8 -0
- package/src/utils/inspect.ts +12 -5
- package/dest/cmds/pxe/block_number.d.ts +0 -3
- package/dest/cmds/pxe/block_number.d.ts.map +0 -1
- package/dest/cmds/pxe/block_number.js +0 -10
- package/dest/cmds/pxe/get_block.d.ts +0 -3
- package/dest/cmds/pxe/get_block.d.ts.map +0 -1
- package/dest/cmds/pxe/get_block.js +0 -9
- package/dest/cmds/pxe/get_l1_to_l2_message_witness.d.ts +0 -4
- package/dest/cmds/pxe/get_l1_to_l2_message_witness.d.ts.map +0 -1
- package/dest/cmds/pxe/get_l1_to_l2_message_witness.js +0 -11
- package/dest/cmds/pxe/get_logs.d.ts.map +0 -1
- package/src/cmds/pxe/block_number.ts +0 -9
- package/src/cmds/pxe/get_block.ts +0 -10
- package/src/cmds/pxe/get_l1_to_l2_message_witness.ts +0 -25
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { createAztecNodeClient, createCompatibleClient } from '@aztec/aztec.js';
|
|
2
|
+
import type { LogFn, Logger } from '@aztec/foundation/log';
|
|
3
|
+
|
|
4
|
+
import { inspectBlock } from '../../utils/inspect.js';
|
|
5
|
+
|
|
6
|
+
export async function getBlock(
|
|
7
|
+
pxeUrl: string,
|
|
8
|
+
nodeUrl: string,
|
|
9
|
+
maybeBlockNumber: number | undefined,
|
|
10
|
+
debugLogger: Logger,
|
|
11
|
+
log: LogFn,
|
|
12
|
+
) {
|
|
13
|
+
const client = await createCompatibleClient(pxeUrl, debugLogger);
|
|
14
|
+
const aztecNode = createAztecNodeClient(nodeUrl);
|
|
15
|
+
const blockNumber = maybeBlockNumber ?? (await aztecNode.getBlockNumber());
|
|
16
|
+
await inspectBlock(client, aztecNode, blockNumber, log, { showTxs: true });
|
|
17
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { type AztecAddress, type Fr, createAztecNodeClient } from '@aztec/aztec.js';
|
|
2
|
+
import type { LogFn } from '@aztec/foundation/log';
|
|
3
|
+
import { getNonNullifiedL1ToL2MessageWitness } from '@aztec/stdlib/messaging';
|
|
4
|
+
|
|
5
|
+
export async function getL1ToL2MessageWitness(
|
|
6
|
+
nodeUrl: string,
|
|
7
|
+
contractAddress: AztecAddress,
|
|
8
|
+
messageHash: Fr,
|
|
9
|
+
secret: Fr,
|
|
10
|
+
log: LogFn,
|
|
11
|
+
) {
|
|
12
|
+
const node = createAztecNodeClient(nodeUrl);
|
|
13
|
+
const messageWitness = await getNonNullifiedL1ToL2MessageWitness(node, contractAddress, messageHash, secret);
|
|
14
|
+
|
|
15
|
+
log(
|
|
16
|
+
messageWitness === undefined
|
|
17
|
+
? `
|
|
18
|
+
L1 to L2 Message not found.
|
|
19
|
+
`
|
|
20
|
+
: `
|
|
21
|
+
L1 to L2 message index: ${messageWitness[0]}
|
|
22
|
+
L1 to L2 message sibling path: ${messageWitness[1]}
|
|
23
|
+
`,
|
|
24
|
+
);
|
|
25
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { AztecAddress, LogFilter, LogId, TxHash } from '@aztec/aztec.js';
|
|
2
|
-
import {
|
|
3
|
-
import type { LogFn
|
|
2
|
+
import { createAztecNodeClient } from '@aztec/aztec.js';
|
|
3
|
+
import type { LogFn } from '@aztec/foundation/log';
|
|
4
4
|
import { sleep } from '@aztec/foundation/sleep';
|
|
5
5
|
|
|
6
6
|
export async function getLogs(
|
|
@@ -9,12 +9,11 @@ export async function getLogs(
|
|
|
9
9
|
toBlock: number,
|
|
10
10
|
afterLog: LogId,
|
|
11
11
|
contractAddress: AztecAddress,
|
|
12
|
-
|
|
12
|
+
nodeUrl: string,
|
|
13
13
|
follow: boolean,
|
|
14
|
-
debugLogger: Logger,
|
|
15
14
|
log: LogFn,
|
|
16
15
|
) {
|
|
17
|
-
const
|
|
16
|
+
const node = createAztecNodeClient(nodeUrl);
|
|
18
17
|
|
|
19
18
|
if (follow) {
|
|
20
19
|
if (txHash) {
|
|
@@ -28,7 +27,7 @@ export async function getLogs(
|
|
|
28
27
|
const filter: LogFilter = { txHash, fromBlock, toBlock, afterLog, contractAddress };
|
|
29
28
|
|
|
30
29
|
const fetchLogs = async () => {
|
|
31
|
-
const response = await
|
|
30
|
+
const response = await node.getPublicLogs(filter);
|
|
32
31
|
const logs = response.logs;
|
|
33
32
|
|
|
34
33
|
if (!logs.length) {
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import type { LogFn, Logger } from '@aztec/foundation/log';
|
|
2
|
+
|
|
3
|
+
import type { Command } from 'commander';
|
|
4
|
+
|
|
5
|
+
import {
|
|
6
|
+
nodeOption,
|
|
7
|
+
parseAztecAddress,
|
|
8
|
+
parseField,
|
|
9
|
+
parseOptionalAztecAddress,
|
|
10
|
+
parseOptionalInteger,
|
|
11
|
+
parseOptionalLogId,
|
|
12
|
+
parseOptionalTxHash,
|
|
13
|
+
pxeOption,
|
|
14
|
+
} from '../../utils/commands.js';
|
|
15
|
+
|
|
16
|
+
export function injectCommands(program: Command, log: LogFn, debugLogger: Logger) {
|
|
17
|
+
program
|
|
18
|
+
.command('get-block')
|
|
19
|
+
.description('Gets info for a given block or latest.')
|
|
20
|
+
.argument('[blockNumber]', 'Block height', parseOptionalInteger)
|
|
21
|
+
.addOption(pxeOption)
|
|
22
|
+
.addOption(nodeOption)
|
|
23
|
+
.action(async (blockNumber, options) => {
|
|
24
|
+
const { getBlock } = await import('./get_block.js');
|
|
25
|
+
await getBlock(options.rpcUrl, options.nodeUrl, blockNumber, debugLogger, log);
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
program
|
|
29
|
+
.command('get-l1-to-l2-message-witness')
|
|
30
|
+
.description('Gets a L1 to L2 message witness.')
|
|
31
|
+
.requiredOption('-ca, --contract-address <address>', 'Aztec address of the contract.', parseAztecAddress)
|
|
32
|
+
.requiredOption('--message-hash <messageHash>', 'The L1 to L2 message hash.', parseField)
|
|
33
|
+
.requiredOption('--secret <secret>', 'The secret used to claim the L1 to L2 message', parseField)
|
|
34
|
+
.addOption(nodeOption)
|
|
35
|
+
.action(async ({ contractAddress, messageHash, secret, nodeUrl }) => {
|
|
36
|
+
const { getL1ToL2MessageWitness } = await import('./get_l1_to_l2_message_witness.js');
|
|
37
|
+
await getL1ToL2MessageWitness(nodeUrl, contractAddress, messageHash, secret, log);
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
program
|
|
41
|
+
.command('get-logs')
|
|
42
|
+
.description('Gets all the public logs from an intersection of all the filter params.')
|
|
43
|
+
.option('-tx, --tx-hash <txHash>', 'A transaction hash to get the receipt for.', parseOptionalTxHash)
|
|
44
|
+
.option(
|
|
45
|
+
'-fb, --from-block <blockNum>',
|
|
46
|
+
'Initial block number for getting logs (defaults to 1).',
|
|
47
|
+
parseOptionalInteger,
|
|
48
|
+
)
|
|
49
|
+
.option('-tb, --to-block <blockNum>', 'Up to which block to fetch logs (defaults to latest).', parseOptionalInteger)
|
|
50
|
+
.option('-al --after-log <logId>', 'ID of a log after which to fetch the logs.', parseOptionalLogId)
|
|
51
|
+
.option('-ca, --contract-address <address>', 'Contract address to filter logs by.', parseOptionalAztecAddress)
|
|
52
|
+
.addOption(nodeOption)
|
|
53
|
+
.option('--follow', 'If set, will keep polling for new logs until interrupted.')
|
|
54
|
+
.action(async ({ txHash, fromBlock, toBlock, afterLog, contractAddress, aztecNodeRpcUrl: nodeUrl, follow }) => {
|
|
55
|
+
const { getLogs } = await import('./get_logs.js');
|
|
56
|
+
await getLogs(txHash, fromBlock, toBlock, afterLog, contractAddress, nodeUrl, follow, log);
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
program
|
|
60
|
+
.command('block-number')
|
|
61
|
+
.description('Gets the current Aztec L2 block number.')
|
|
62
|
+
.addOption(nodeOption)
|
|
63
|
+
.action(async (options: any) => {
|
|
64
|
+
const { blockNumber } = await import('./block_number.js');
|
|
65
|
+
await blockNumber(options.nodeUrl, log);
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
return program;
|
|
69
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { getInitialTestAccountsData } from '@aztec/accounts/testing';
|
|
2
2
|
import {
|
|
3
3
|
AztecAddress,
|
|
4
|
+
type AztecNode,
|
|
4
5
|
BatchCall,
|
|
5
6
|
EthAddress,
|
|
6
7
|
Fr,
|
|
@@ -9,6 +10,7 @@ import {
|
|
|
9
10
|
type WaitForProvenOpts,
|
|
10
11
|
type WaitOpts,
|
|
11
12
|
type Wallet,
|
|
13
|
+
createAztecNodeClient,
|
|
12
14
|
createCompatibleClient,
|
|
13
15
|
retryUntil,
|
|
14
16
|
waitForProven,
|
|
@@ -44,6 +46,7 @@ const provenWaitOpts: WaitForProvenOpts = {
|
|
|
44
46
|
|
|
45
47
|
export async function bootstrapNetwork(
|
|
46
48
|
pxeUrl: string,
|
|
49
|
+
nodeUrl: string,
|
|
47
50
|
l1Urls: string[],
|
|
48
51
|
l1ChainId: string,
|
|
49
52
|
l1PrivateKey: `0x${string}` | undefined,
|
|
@@ -54,6 +57,7 @@ export async function bootstrapNetwork(
|
|
|
54
57
|
debugLog: Logger,
|
|
55
58
|
) {
|
|
56
59
|
const pxe = await createCompatibleClient(pxeUrl, debugLog);
|
|
60
|
+
const node = createAztecNodeClient(nodeUrl);
|
|
57
61
|
const wallet = new TestWallet(pxe);
|
|
58
62
|
|
|
59
63
|
// We assume here that the initial test accounts were prefunded with deploy-l1-contracts, and deployed with setup-l2-contracts
|
|
@@ -88,7 +92,7 @@ export async function bootstrapNetwork(
|
|
|
88
92
|
|
|
89
93
|
const counter = await deployCounter(wallet, defaultAccountAddress);
|
|
90
94
|
|
|
91
|
-
await fundFPC(pxe, counter.address, wallet, defaultAccountAddress, l1Client, fpc.address, debugLog);
|
|
95
|
+
await fundFPC(pxe, node, counter.address, wallet, defaultAccountAddress, l1Client, fpc.address, debugLog);
|
|
92
96
|
|
|
93
97
|
if (json) {
|
|
94
98
|
log(
|
|
@@ -275,6 +279,7 @@ async function deployCounter(wallet: Wallet, defaultAccountAddress: AztecAddress
|
|
|
275
279
|
// NOTE: Disabling for now in order to get devnet running
|
|
276
280
|
async function fundFPC(
|
|
277
281
|
pxe: PXE,
|
|
282
|
+
node: AztecNode,
|
|
278
283
|
counterAddress: AztecAddress,
|
|
279
284
|
wallet: Wallet,
|
|
280
285
|
defaultAccountAddress: AztecAddress,
|
|
@@ -302,7 +307,12 @@ async function fundFPC(
|
|
|
302
307
|
true,
|
|
303
308
|
);
|
|
304
309
|
|
|
305
|
-
await retryUntil(
|
|
310
|
+
await retryUntil(
|
|
311
|
+
async () => (await node.getL1ToL2MessageBlock(Fr.fromHexString(messageHash))) !== undefined,
|
|
312
|
+
'message sync',
|
|
313
|
+
600,
|
|
314
|
+
1,
|
|
315
|
+
);
|
|
306
316
|
|
|
307
317
|
const counter = await CounterContract.at(counterAddress, wallet);
|
|
308
318
|
|
|
@@ -320,7 +330,7 @@ async function fundFPC(
|
|
|
320
330
|
.send({ from: defaultAccountAddress })
|
|
321
331
|
.wait({ ...waitOpts });
|
|
322
332
|
|
|
323
|
-
await waitForProven(
|
|
333
|
+
await waitForProven(node, receipt, provenWaitOpts);
|
|
324
334
|
|
|
325
335
|
debugLog.info('Finished claiming FPC');
|
|
326
336
|
}
|
package/src/cmds/devnet/index.ts
CHANGED
|
@@ -2,13 +2,14 @@ import type { LogFn, Logger } from '@aztec/foundation/log';
|
|
|
2
2
|
|
|
3
3
|
import type { Command } from 'commander';
|
|
4
4
|
|
|
5
|
-
import { ETHEREUM_HOSTS, l1ChainIdOption, parseEthereumAddress, pxeOption } from '../../utils/commands.js';
|
|
5
|
+
import { ETHEREUM_HOSTS, l1ChainIdOption, nodeOption, parseEthereumAddress, pxeOption } from '../../utils/commands.js';
|
|
6
6
|
|
|
7
7
|
export function injectCommands(program: Command, log: LogFn, debugLogger: Logger) {
|
|
8
8
|
program
|
|
9
9
|
.command('bootstrap-network')
|
|
10
10
|
.description('Bootstrap a new network')
|
|
11
11
|
.addOption(pxeOption)
|
|
12
|
+
.addOption(nodeOption)
|
|
12
13
|
.addOption(l1ChainIdOption)
|
|
13
14
|
.requiredOption<string[]>(
|
|
14
15
|
'--l1-rpc-urls <string>',
|
|
@@ -33,6 +34,7 @@ export function injectCommands(program: Command, log: LogFn, debugLogger: Logger
|
|
|
33
34
|
const { bootstrapNetwork } = await import('./bootstrap_network.js');
|
|
34
35
|
await bootstrapNetwork(
|
|
35
36
|
options[pxeOption.attributeName()],
|
|
37
|
+
options[nodeOption.attributeName()],
|
|
36
38
|
options.l1RpcUrls,
|
|
37
39
|
options[l1ChainIdOption.attributeName()],
|
|
38
40
|
options.l1PrivateKey,
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { createAztecNodeClient } from '@aztec/aztec.js';
|
|
2
2
|
import { RollupCheatCodes } from '@aztec/ethereum/test';
|
|
3
3
|
import type { LogFn } from '@aztec/foundation/log';
|
|
4
4
|
|
|
5
5
|
export async function assumeProvenThrough(
|
|
6
6
|
blockNumberOrLatest: number | undefined,
|
|
7
7
|
l1RpcUrls: string[],
|
|
8
|
-
|
|
8
|
+
nodeUrl: string,
|
|
9
9
|
log: LogFn,
|
|
10
10
|
) {
|
|
11
|
-
const
|
|
12
|
-
const rollupAddress = await
|
|
13
|
-
const blockNumber = blockNumberOrLatest ?? (await
|
|
11
|
+
const aztecNode = createAztecNodeClient(nodeUrl);
|
|
12
|
+
const rollupAddress = await aztecNode.getNodeInfo().then(i => i.l1ContractAddresses.rollupAddress);
|
|
13
|
+
const blockNumber = blockNumberOrLatest ?? (await aztecNode.getBlockNumber());
|
|
14
14
|
|
|
15
15
|
const rollupCheatCodes = RollupCheatCodes.create(l1RpcUrls, { rollupAddress });
|
|
16
16
|
|
package/src/cmds/l1/index.ts
CHANGED
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
MNEMONIC,
|
|
10
10
|
PRIVATE_KEY,
|
|
11
11
|
l1ChainIdOption,
|
|
12
|
+
nodeOption,
|
|
12
13
|
parseAztecAddress,
|
|
13
14
|
parseBigint,
|
|
14
15
|
parseEthereumAddress,
|
|
@@ -509,10 +510,10 @@ export function injectCommands(program: Command, log: LogFn, debugLogger: Logger
|
|
|
509
510
|
)
|
|
510
511
|
.argument('[blockNumber]', 'The target block number, defaults to the latest pending block number.', parseBigint)
|
|
511
512
|
.addOption(l1RpcUrlsOption)
|
|
512
|
-
.addOption(
|
|
513
|
+
.addOption(nodeOption)
|
|
513
514
|
.action(async (blockNumber, options) => {
|
|
514
515
|
const { assumeProvenThrough } = await import('./assume_proven_through.js');
|
|
515
|
-
await assumeProvenThrough(blockNumber, options.l1RpcUrls, options.
|
|
516
|
+
await assumeProvenThrough(blockNumber, options.l1RpcUrls, options.nodeUrl, log);
|
|
516
517
|
});
|
|
517
518
|
|
|
518
519
|
program
|
package/src/cmds/pxe/index.ts
CHANGED
|
@@ -8,12 +8,7 @@ import {
|
|
|
8
8
|
makePxeOption,
|
|
9
9
|
parseAztecAddress,
|
|
10
10
|
parseEthereumAddress,
|
|
11
|
-
parseField,
|
|
12
11
|
parseFieldFromHexString,
|
|
13
|
-
parseOptionalAztecAddress,
|
|
14
|
-
parseOptionalInteger,
|
|
15
|
-
parseOptionalLogId,
|
|
16
|
-
parseOptionalTxHash,
|
|
17
12
|
parsePublicKey,
|
|
18
13
|
pxeOption,
|
|
19
14
|
} from '../../utils/commands.js';
|
|
@@ -50,16 +45,6 @@ export function injectCommands(program: Command, log: LogFn, debugLogger: Logger
|
|
|
50
45
|
);
|
|
51
46
|
});
|
|
52
47
|
|
|
53
|
-
program
|
|
54
|
-
.command('get-block')
|
|
55
|
-
.description('Gets info for a given block or latest.')
|
|
56
|
-
.argument('[blockNumber]', 'Block height', parseOptionalInteger)
|
|
57
|
-
.addOption(pxeOption)
|
|
58
|
-
.action(async (blockNumber, options) => {
|
|
59
|
-
const { getBlock } = await import('./get_block.js');
|
|
60
|
-
await getBlock(options.rpcUrl, blockNumber, debugLogger, log);
|
|
61
|
-
});
|
|
62
|
-
|
|
63
48
|
program
|
|
64
49
|
.command('get-current-base-fee')
|
|
65
50
|
.description('Gets the current base fee.')
|
|
@@ -80,25 +65,6 @@ export function injectCommands(program: Command, log: LogFn, debugLogger: Logger
|
|
|
80
65
|
await getContractData(options.rpcUrl, contractAddress, options.includeBytecode, debugLogger, log);
|
|
81
66
|
});
|
|
82
67
|
|
|
83
|
-
program
|
|
84
|
-
.command('get-logs')
|
|
85
|
-
.description('Gets all the public logs from an intersection of all the filter params.')
|
|
86
|
-
.option('-tx, --tx-hash <txHash>', 'A transaction hash to get the receipt for.', parseOptionalTxHash)
|
|
87
|
-
.option(
|
|
88
|
-
'-fb, --from-block <blockNum>',
|
|
89
|
-
'Initial block number for getting logs (defaults to 1).',
|
|
90
|
-
parseOptionalInteger,
|
|
91
|
-
)
|
|
92
|
-
.option('-tb, --to-block <blockNum>', 'Up to which block to fetch logs (defaults to latest).', parseOptionalInteger)
|
|
93
|
-
.option('-al --after-log <logId>', 'ID of a log after which to fetch the logs.', parseOptionalLogId)
|
|
94
|
-
.option('-ca, --contract-address <address>', 'Contract address to filter logs by.', parseOptionalAztecAddress)
|
|
95
|
-
.addOption(pxeOption)
|
|
96
|
-
.option('--follow', 'If set, will keep polling for new logs until interrupted.')
|
|
97
|
-
.action(async ({ txHash, fromBlock, toBlock, afterLog, contractAddress, rpcUrl, follow }) => {
|
|
98
|
-
const { getLogs } = await import('./get_logs.js');
|
|
99
|
-
await getLogs(txHash, fromBlock, toBlock, afterLog, contractAddress, rpcUrl, follow, debugLogger, log);
|
|
100
|
-
});
|
|
101
|
-
|
|
102
68
|
program
|
|
103
69
|
.command('get-accounts')
|
|
104
70
|
.description('Gets all the Aztec accounts stored in the PXE.')
|
|
@@ -119,27 +85,6 @@ export function injectCommands(program: Command, log: LogFn, debugLogger: Logger
|
|
|
119
85
|
await getAccount(address, options.rpcUrl, debugLogger, log);
|
|
120
86
|
});
|
|
121
87
|
|
|
122
|
-
program
|
|
123
|
-
.command('block-number')
|
|
124
|
-
.description('Gets the current Aztec L2 block number.')
|
|
125
|
-
.addOption(pxeOption)
|
|
126
|
-
.action(async (options: any) => {
|
|
127
|
-
const { blockNumber } = await import('./block_number.js');
|
|
128
|
-
await blockNumber(options.rpcUrl, debugLogger, log);
|
|
129
|
-
});
|
|
130
|
-
|
|
131
|
-
program
|
|
132
|
-
.command('get-l1-to-l2-message-witness')
|
|
133
|
-
.description('Gets a L1 to L2 message witness.')
|
|
134
|
-
.requiredOption('-ca, --contract-address <address>', 'Aztec address of the contract.', parseAztecAddress)
|
|
135
|
-
.requiredOption('--message-hash <messageHash>', 'The L1 to L2 message hash.', parseField)
|
|
136
|
-
.requiredOption('--secret <secret>', 'The secret used to claim the L1 to L2 message', parseField)
|
|
137
|
-
.addOption(pxeOption)
|
|
138
|
-
.action(async ({ contractAddress, messageHash, secret, rpcUrl }) => {
|
|
139
|
-
const { getL1ToL2MessageWitness } = await import('./get_l1_to_l2_message_witness.js');
|
|
140
|
-
await getL1ToL2MessageWitness(rpcUrl, contractAddress, messageHash, secret, debugLogger, log);
|
|
141
|
-
});
|
|
142
|
-
|
|
143
88
|
program
|
|
144
89
|
.command('get-node-info')
|
|
145
90
|
.description('Gets the information of an Aztec node from a PXE or directly from an Aztec node.')
|
|
@@ -72,13 +72,13 @@ const DefaultSlashConfig = {
|
|
|
72
72
|
|
|
73
73
|
export const stagingIgnitionL2ChainConfig: L2ChainConfig = {
|
|
74
74
|
l1ChainId: 11155111,
|
|
75
|
-
testAccounts:
|
|
75
|
+
testAccounts: false,
|
|
76
76
|
sponsoredFPC: false,
|
|
77
77
|
p2pEnabled: true,
|
|
78
78
|
p2pBootstrapNodes: [],
|
|
79
|
-
registryAddress: '
|
|
80
|
-
slashFactoryAddress: '',
|
|
81
|
-
feeAssetHandlerAddress: '',
|
|
79
|
+
registryAddress: '0xa2ed20f46dc58e5af6035ec61d463ac85a6d52d3',
|
|
80
|
+
slashFactoryAddress: '0x2c03d596f4b5f0c1d0d2dbf92a5964dfc658763c',
|
|
81
|
+
feeAssetHandlerAddress: '0x48be40187f2932bd14cd4d111fba26646da96c36',
|
|
82
82
|
seqMinTxsPerBlock: 0,
|
|
83
83
|
seqMaxTxsPerBlock: 0,
|
|
84
84
|
realProofs: true,
|
|
@@ -90,23 +90,64 @@ export const stagingIgnitionL2ChainConfig: L2ChainConfig = {
|
|
|
90
90
|
publicMetricsCollectorUrl: 'https://telemetry.alpha-testnet.aztec-labs.com/v1/metrics',
|
|
91
91
|
publicMetricsCollectFrom: ['sequencer'],
|
|
92
92
|
|
|
93
|
-
...DefaultL1ContractsConfig,
|
|
94
|
-
...DefaultSlashConfig,
|
|
95
|
-
|
|
96
93
|
/** How many seconds an L1 slot lasts. */
|
|
97
94
|
ethereumSlotDuration: 12,
|
|
98
95
|
/** How many seconds an L2 slots lasts (must be multiple of ethereum slot duration). */
|
|
99
|
-
aztecSlotDuration:
|
|
96
|
+
aztecSlotDuration: 72,
|
|
100
97
|
/** How many L2 slots an epoch lasts. */
|
|
101
98
|
aztecEpochDuration: 32,
|
|
102
99
|
/** The target validator committee size. */
|
|
103
|
-
aztecTargetCommitteeSize:
|
|
100
|
+
aztecTargetCommitteeSize: 24,
|
|
101
|
+
/** The number of epochs to lag behind the current epoch for validator selection. */
|
|
102
|
+
lagInEpochs: 2,
|
|
104
103
|
/** The number of epochs after an epoch ends that proofs are still accepted. */
|
|
105
104
|
aztecProofSubmissionEpochs: 1,
|
|
105
|
+
/** How many sequencers must agree with a slash for it to be executed. */
|
|
106
|
+
slashingQuorum: 65,
|
|
107
|
+
|
|
108
|
+
slashingRoundSizeInEpochs: 4,
|
|
109
|
+
slashingLifetimeInRounds: 40,
|
|
110
|
+
slashingExecutionDelayInRounds: 28,
|
|
111
|
+
slashAmountSmall: 2_000n * 10n ** 18n,
|
|
112
|
+
slashAmountMedium: 10_000n * 10n ** 18n,
|
|
113
|
+
slashAmountLarge: 50_000n * 10n ** 18n,
|
|
114
|
+
slashingOffsetInRounds: 2,
|
|
115
|
+
slasherFlavor: 'tally',
|
|
116
|
+
slashingVetoer: EthAddress.ZERO, // TODO TMNT-329
|
|
117
|
+
|
|
106
118
|
/** The mana target for the rollup */
|
|
107
119
|
manaTarget: 0n,
|
|
120
|
+
|
|
121
|
+
exitDelaySeconds: 5 * 24 * 60 * 60,
|
|
122
|
+
|
|
108
123
|
/** The proving cost per mana */
|
|
109
124
|
provingCostPerMana: 0n,
|
|
125
|
+
localEjectionThreshold: 196_000n * 10n ** 18n,
|
|
126
|
+
|
|
127
|
+
ejectionThreshold: 100_000n * 10n ** 18n,
|
|
128
|
+
activationThreshold: 200_000n * 10n ** 18n,
|
|
129
|
+
|
|
130
|
+
governanceProposerRoundSize: 300, // TODO TMNT-322
|
|
131
|
+
governanceProposerQuorum: 151, // TODO TMNT-322
|
|
132
|
+
|
|
133
|
+
// Node slashing config
|
|
134
|
+
// TODO TMNT-330
|
|
135
|
+
slashMinPenaltyPercentage: 0.5,
|
|
136
|
+
slashMaxPenaltyPercentage: 2.0,
|
|
137
|
+
slashInactivityTargetPercentage: 0.7,
|
|
138
|
+
slashInactivityConsecutiveEpochThreshold: 2,
|
|
139
|
+
slashInactivityPenalty: 2_000n * 10n ** 18n,
|
|
140
|
+
slashPrunePenalty: 0n, // 2_000n * 10n ** 18n, We disable slashing for prune offenses right now
|
|
141
|
+
slashDataWithholdingPenalty: 0n, // 2_000n * 10n ** 18n, We disable slashing for data withholding offenses right now
|
|
142
|
+
slashProposeInvalidAttestationsPenalty: 50_000n * 10n ** 18n,
|
|
143
|
+
slashAttestDescendantOfInvalidPenalty: 50_000n * 10n ** 18n,
|
|
144
|
+
slashUnknownPenalty: 2_000n * 10n ** 18n,
|
|
145
|
+
slashBroadcastedInvalidBlockPenalty: 10_000n * 10n ** 18n,
|
|
146
|
+
slashMaxPayloadSize: 50,
|
|
147
|
+
slashGracePeriodL2Slots: 32 * 4, // One round from genesis
|
|
148
|
+
slashOffenseExpirationRounds: 8,
|
|
149
|
+
sentinelEnabled: true,
|
|
150
|
+
slashingDisableDuration: 5 * 24 * 60 * 60,
|
|
110
151
|
};
|
|
111
152
|
|
|
112
153
|
export const stagingPublicL2ChainConfig: L2ChainConfig = {
|
|
@@ -213,6 +254,8 @@ export const testnetL2ChainConfig: L2ChainConfig = {
|
|
|
213
254
|
exitDelaySeconds: DefaultL1ContractsConfig.exitDelaySeconds,
|
|
214
255
|
|
|
215
256
|
...DefaultSlashConfig,
|
|
257
|
+
slashPrunePenalty: 0n,
|
|
258
|
+
slashDataWithholdingPenalty: 0n,
|
|
216
259
|
};
|
|
217
260
|
|
|
218
261
|
const BOOTNODE_CACHE_DURATION_MS = 60 * 60 * 1000; // 1 hour;
|
package/src/utils/commands.ts
CHANGED
|
@@ -38,6 +38,14 @@ export const makePxeOption = (mandatory: boolean) =>
|
|
|
38
38
|
|
|
39
39
|
export const pxeOption = makePxeOption(true);
|
|
40
40
|
|
|
41
|
+
export const makeNodeOption = (mandatory: boolean) =>
|
|
42
|
+
new Option('-n, --node-url <string>', 'URL of the Aztec node')
|
|
43
|
+
.env('AZTEC_NODE_URL')
|
|
44
|
+
.default(`http://${LOCALHOST}:8079`)
|
|
45
|
+
.makeOptionMandatory(mandatory);
|
|
46
|
+
|
|
47
|
+
export const nodeOption = makeNodeOption(true);
|
|
48
|
+
|
|
41
49
|
export const l1ChainIdOption = new Option('-c, --l1-chain-id <number>', 'Chain ID of the ethereum host')
|
|
42
50
|
.env('L1_CHAIN_ID')
|
|
43
51
|
.default(31337)
|
package/src/utils/inspect.ts
CHANGED
|
@@ -2,12 +2,18 @@ import type { AztecAddress, ContractArtifact, Fr } from '@aztec/aztec.js';
|
|
|
2
2
|
import type { LogFn } from '@aztec/foundation/log';
|
|
3
3
|
import { ProtocolContractAddress } from '@aztec/protocol-contracts';
|
|
4
4
|
import { siloNullifier } from '@aztec/stdlib/hash';
|
|
5
|
-
import type { PXE } from '@aztec/stdlib/interfaces/client';
|
|
5
|
+
import type { AztecNode, PXE } from '@aztec/stdlib/interfaces/client';
|
|
6
6
|
import type { ExtendedNote } from '@aztec/stdlib/note';
|
|
7
7
|
import type { TxHash } from '@aztec/stdlib/tx';
|
|
8
8
|
|
|
9
|
-
export async function inspectBlock(
|
|
10
|
-
|
|
9
|
+
export async function inspectBlock(
|
|
10
|
+
pxe: PXE,
|
|
11
|
+
aztecNode: AztecNode,
|
|
12
|
+
blockNumber: number,
|
|
13
|
+
log: LogFn,
|
|
14
|
+
opts: { showTxs?: boolean } = {},
|
|
15
|
+
) {
|
|
16
|
+
const block = await aztecNode.getBlock(blockNumber);
|
|
11
17
|
if (!block) {
|
|
12
18
|
log(`No block found for block number ${blockNumber}`);
|
|
13
19
|
return;
|
|
@@ -27,7 +33,7 @@ export async function inspectBlock(pxe: PXE, blockNumber: number, log: LogFn, op
|
|
|
27
33
|
log(``);
|
|
28
34
|
const artifactMap = await getKnownArtifacts(pxe);
|
|
29
35
|
for (const txHash of block.body.txEffects.map(tx => tx.txHash)) {
|
|
30
|
-
await inspectTx(pxe, txHash, log, { includeBlockInfo: false, artifactMap });
|
|
36
|
+
await inspectTx(pxe, aztecNode, txHash, log, { includeBlockInfo: false, artifactMap });
|
|
31
37
|
}
|
|
32
38
|
} else {
|
|
33
39
|
log(` Transactions: ${block.body.txEffects.length}`);
|
|
@@ -36,11 +42,12 @@ export async function inspectBlock(pxe: PXE, blockNumber: number, log: LogFn, op
|
|
|
36
42
|
|
|
37
43
|
export async function inspectTx(
|
|
38
44
|
pxe: PXE,
|
|
45
|
+
aztecNode: AztecNode,
|
|
39
46
|
txHash: TxHash,
|
|
40
47
|
log: LogFn,
|
|
41
48
|
opts: { includeBlockInfo?: boolean; artifactMap?: ArtifactMap } = {},
|
|
42
49
|
) {
|
|
43
|
-
const [receipt, effectsInBlock] = await Promise.all([
|
|
50
|
+
const [receipt, effectsInBlock] = await Promise.all([aztecNode.getTxReceipt(txHash), aztecNode.getTxEffect(txHash)]);
|
|
44
51
|
// Base tx data
|
|
45
52
|
log(`Tx ${txHash.toString()}`);
|
|
46
53
|
log(` Status: ${receipt.status} ${effectsInBlock ? `(${effectsInBlock.data.revertCode.getDescription()})` : ''}`);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"block_number.d.ts","sourceRoot":"","sources":["../../../src/cmds/pxe/block_number.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAE3D,wBAAsB,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,GAAG,EAAE,KAAK,iBAKhF"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { createCompatibleClient } from '@aztec/aztec.js';
|
|
2
|
-
export async function blockNumber(rpcUrl, debugLogger, log) {
|
|
3
|
-
const client = await createCompatibleClient(rpcUrl, debugLogger);
|
|
4
|
-
const [latestNum, provenNum] = await Promise.all([
|
|
5
|
-
client.getBlockNumber(),
|
|
6
|
-
client.getProvenBlockNumber()
|
|
7
|
-
]);
|
|
8
|
-
log(`Latest block: ${latestNum}`);
|
|
9
|
-
log(`Proven block: ${provenNum}`);
|
|
10
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"get_block.d.ts","sourceRoot":"","sources":["../../../src/cmds/pxe/get_block.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAI3D,wBAAsB,QAAQ,CAAC,MAAM,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,GAAG,SAAS,EAAE,WAAW,EAAE,MAAM,EAAE,GAAG,EAAE,KAAK,iBAInH"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { createCompatibleClient } from '@aztec/aztec.js';
|
|
2
|
-
import { inspectBlock } from '../../utils/inspect.js';
|
|
3
|
-
export async function getBlock(rpcUrl, maybeBlockNumber, debugLogger, log) {
|
|
4
|
-
const client = await createCompatibleClient(rpcUrl, debugLogger);
|
|
5
|
-
const blockNumber = maybeBlockNumber ?? await client.getBlockNumber();
|
|
6
|
-
await inspectBlock(client, blockNumber, log, {
|
|
7
|
-
showTxs: true
|
|
8
|
-
});
|
|
9
|
-
}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { type AztecAddress, type Fr } from '@aztec/aztec.js';
|
|
2
|
-
import type { LogFn, Logger } from '@aztec/foundation/log';
|
|
3
|
-
export declare function getL1ToL2MessageWitness(rpcUrl: string, contractAddress: AztecAddress, messageHash: Fr, secret: Fr, debugLogger: Logger, log: LogFn): Promise<void>;
|
|
4
|
-
//# sourceMappingURL=get_l1_to_l2_message_witness.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"get_l1_to_l2_message_witness.d.ts","sourceRoot":"","sources":["../../../src/cmds/pxe/get_l1_to_l2_message_witness.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,YAAY,EAAE,KAAK,EAAE,EAA0B,MAAM,iBAAiB,CAAC;AACrF,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAE3D,wBAAsB,uBAAuB,CAC3C,MAAM,EAAE,MAAM,EACd,eAAe,EAAE,YAAY,EAC7B,WAAW,EAAE,EAAE,EACf,MAAM,EAAE,EAAE,EACV,WAAW,EAAE,MAAM,EACnB,GAAG,EAAE,KAAK,iBAeX"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { createCompatibleClient } from '@aztec/aztec.js';
|
|
2
|
-
export async function getL1ToL2MessageWitness(rpcUrl, contractAddress, messageHash, secret, debugLogger, log) {
|
|
3
|
-
const client = await createCompatibleClient(rpcUrl, debugLogger);
|
|
4
|
-
const messageWitness = await client.getL1ToL2MembershipWitness(contractAddress, messageHash, secret);
|
|
5
|
-
log(messageWitness === undefined ? `
|
|
6
|
-
L1 to L2 Message not found.
|
|
7
|
-
` : `
|
|
8
|
-
L1 to L2 message index: ${messageWitness[0]}
|
|
9
|
-
L1 to L2 message sibling path: ${messageWitness[1]}
|
|
10
|
-
`);
|
|
11
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"get_logs.d.ts","sourceRoot":"","sources":["../../../src/cmds/pxe/get_logs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAa,KAAK,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAE9E,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAG3D,wBAAsB,OAAO,CAC3B,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,KAAK,EACf,eAAe,EAAE,YAAY,EAC7B,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,OAAO,EACf,WAAW,EAAE,MAAM,EACnB,GAAG,EAAE,KAAK,iBAmDX"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { createCompatibleClient } from '@aztec/aztec.js';
|
|
2
|
-
import type { LogFn, Logger } from '@aztec/foundation/log';
|
|
3
|
-
|
|
4
|
-
export async function blockNumber(rpcUrl: string, debugLogger: Logger, log: LogFn) {
|
|
5
|
-
const client = await createCompatibleClient(rpcUrl, debugLogger);
|
|
6
|
-
const [latestNum, provenNum] = await Promise.all([client.getBlockNumber(), client.getProvenBlockNumber()]);
|
|
7
|
-
log(`Latest block: ${latestNum}`);
|
|
8
|
-
log(`Proven block: ${provenNum}`);
|
|
9
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { createCompatibleClient } from '@aztec/aztec.js';
|
|
2
|
-
import type { LogFn, Logger } from '@aztec/foundation/log';
|
|
3
|
-
|
|
4
|
-
import { inspectBlock } from '../../utils/inspect.js';
|
|
5
|
-
|
|
6
|
-
export async function getBlock(rpcUrl: string, maybeBlockNumber: number | undefined, debugLogger: Logger, log: LogFn) {
|
|
7
|
-
const client = await createCompatibleClient(rpcUrl, debugLogger);
|
|
8
|
-
const blockNumber = maybeBlockNumber ?? (await client.getBlockNumber());
|
|
9
|
-
await inspectBlock(client, blockNumber, log, { showTxs: true });
|
|
10
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { type AztecAddress, type Fr, createCompatibleClient } from '@aztec/aztec.js';
|
|
2
|
-
import type { LogFn, Logger } from '@aztec/foundation/log';
|
|
3
|
-
|
|
4
|
-
export async function getL1ToL2MessageWitness(
|
|
5
|
-
rpcUrl: string,
|
|
6
|
-
contractAddress: AztecAddress,
|
|
7
|
-
messageHash: Fr,
|
|
8
|
-
secret: Fr,
|
|
9
|
-
debugLogger: Logger,
|
|
10
|
-
log: LogFn,
|
|
11
|
-
) {
|
|
12
|
-
const client = await createCompatibleClient(rpcUrl, debugLogger);
|
|
13
|
-
const messageWitness = await client.getL1ToL2MembershipWitness(contractAddress, messageHash, secret);
|
|
14
|
-
|
|
15
|
-
log(
|
|
16
|
-
messageWitness === undefined
|
|
17
|
-
? `
|
|
18
|
-
L1 to L2 Message not found.
|
|
19
|
-
`
|
|
20
|
-
: `
|
|
21
|
-
L1 to L2 message index: ${messageWitness[0]}
|
|
22
|
-
L1 to L2 message sibling path: ${messageWitness[1]}
|
|
23
|
-
`,
|
|
24
|
-
);
|
|
25
|
-
}
|