@aztec/cli 0.0.1-commit.2448fdb → 0.0.1-commit.2606882
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 +5 -1
- package/dest/cmds/l1/deploy_l1_contracts_cmd.d.ts +1 -1
- package/dest/cmds/l1/deploy_l1_contracts_cmd.d.ts.map +1 -1
- package/dest/cmds/l1/deploy_l1_contracts_cmd.js +0 -1
- package/dest/cmds/l1/deploy_new_rollup.d.ts +1 -1
- package/dest/cmds/l1/deploy_new_rollup.d.ts.map +1 -1
- package/dest/cmds/l1/deploy_new_rollup.js +2 -4
- package/dest/cmds/l1/update_l1_validators.d.ts +1 -1
- package/dest/cmds/l1/update_l1_validators.d.ts.map +1 -1
- package/dest/cmds/l1/update_l1_validators.js +0 -1
- package/dest/config/chain_l2_config.d.ts +1 -1
- package/dest/config/chain_l2_config.d.ts.map +1 -1
- package/dest/config/chain_l2_config.js +3 -1
- package/dest/config/generated/networks.d.ts +35 -35
- package/dest/config/generated/networks.js +35 -35
- 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 +11 -11
- package/package.json +30 -30
- package/src/cmds/aztec_node/block_number.ts +1 -1
- package/src/cmds/aztec_node/get_logs.ts +70 -38
- package/src/cmds/aztec_node/get_node_info.ts +0 -2
- package/src/cmds/aztec_node/index.ts +13 -8
- package/src/cmds/infrastructure/setup_l2_contract.ts +4 -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/update_l1_validators.ts +0 -1
- package/src/config/chain_l2_config.ts +3 -1
- package/src/config/generated/networks.ts +35 -35
- package/src/utils/aztec.ts +12 -18
- package/src/utils/commands.ts +22 -9
- package/src/utils/inspect.ts +7 -8
|
@@ -1,22 +1,47 @@
|
|
|
1
1
|
import type { AztecAddress } from '@aztec/aztec.js/addresses';
|
|
2
|
-
import type { LogFilter, LogId } from '@aztec/aztec.js/log';
|
|
3
2
|
import { createAztecNodeClient } from '@aztec/aztec.js/node';
|
|
4
3
|
import type { TxHash } from '@aztec/aztec.js/tx';
|
|
5
|
-
import { BlockNumber } from '@aztec/foundation/branded-types';
|
|
4
|
+
import type { BlockNumber } from '@aztec/foundation/branded-types';
|
|
6
5
|
import type { LogFn } from '@aztec/foundation/log';
|
|
7
6
|
import { sleep } from '@aztec/foundation/sleep';
|
|
7
|
+
import {
|
|
8
|
+
LogCursor,
|
|
9
|
+
type PublicLogsQuery,
|
|
10
|
+
type Tag,
|
|
11
|
+
logResultToHumanReadable,
|
|
12
|
+
queryAllPublicLogsByTags,
|
|
13
|
+
} from '@aztec/stdlib/logs';
|
|
8
14
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
15
|
+
/** Options for the `get-logs` CLI command. */
|
|
16
|
+
export type GetLogsOptions = {
|
|
17
|
+
/** Contract address that emitted the logs (required). */
|
|
18
|
+
contractAddress: AztecAddress;
|
|
19
|
+
/** Tag to filter logs by (required). */
|
|
20
|
+
tag: Tag;
|
|
21
|
+
/** Restrict the search to this tx hash. Mutually exclusive with `fromBlock`/`toBlock`. */
|
|
22
|
+
txHash?: TxHash;
|
|
23
|
+
/** Lower block bound, inclusive. */
|
|
24
|
+
fromBlock?: BlockNumber;
|
|
25
|
+
/** Upper block bound, exclusive. */
|
|
26
|
+
toBlock?: BlockNumber;
|
|
27
|
+
/** Log cursor to resume pagination strictly after a previously-seen log. */
|
|
28
|
+
afterLog?: LogCursor;
|
|
29
|
+
/** Node RPC URL. */
|
|
30
|
+
nodeUrl: string;
|
|
31
|
+
/** When set, polls indefinitely for new logs. Incompatible with `txHash` and `toBlock`. */
|
|
32
|
+
follow: boolean;
|
|
33
|
+
/** Log function. */
|
|
34
|
+
log: LogFn;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Fetches public logs for a (contract, tag) pair, draining all pages via the stdlib pagination helper.
|
|
39
|
+
* In `--follow` mode, polls indefinitely: each round drains all currently-available logs, then sleeps
|
|
40
|
+
* until the next poll if nothing new was found.
|
|
41
|
+
*/
|
|
42
|
+
export async function getLogs(options: GetLogsOptions): Promise<void> {
|
|
43
|
+
const { txHash, fromBlock, toBlock, contractAddress, tag, nodeUrl, follow, log } = options;
|
|
44
|
+
let afterLog = options.afterLog;
|
|
20
45
|
|
|
21
46
|
if (follow) {
|
|
22
47
|
if (txHash) {
|
|
@@ -26,43 +51,50 @@ export async function getLogs(
|
|
|
26
51
|
throw Error('Cannot use --follow with --to-block');
|
|
27
52
|
}
|
|
28
53
|
}
|
|
54
|
+
if (txHash !== undefined && (fromBlock !== undefined || toBlock !== undefined)) {
|
|
55
|
+
throw Error('Cannot combine --tx-hash with --from-block / --to-block');
|
|
56
|
+
}
|
|
29
57
|
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
const fetchLogs = async () => {
|
|
33
|
-
const response = await node.getPublicLogs(filter);
|
|
34
|
-
const logs = response.logs;
|
|
58
|
+
const node = createAztecNodeClient(nodeUrl);
|
|
35
59
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
}
|
|
48
|
-
logs.forEach(publicLog => log(publicLog.toHumanReadable()));
|
|
49
|
-
// Set the continuation parameter for the following requests
|
|
50
|
-
filter.afterLog = logs[logs.length - 1].id;
|
|
60
|
+
const drainLogs = async () => {
|
|
61
|
+
const query: PublicLogsQuery = {
|
|
62
|
+
contractAddress,
|
|
63
|
+
tags: [afterLog !== undefined ? { tag, afterLog } : tag],
|
|
64
|
+
fromBlock,
|
|
65
|
+
toBlock,
|
|
66
|
+
txHash,
|
|
67
|
+
};
|
|
68
|
+
const [logsForTag] = await queryAllPublicLogsByTags(node, query);
|
|
69
|
+
if (logsForTag.length > 0) {
|
|
70
|
+
afterLog = LogCursor.fromLog(logsForTag[logsForTag.length - 1]);
|
|
51
71
|
}
|
|
52
|
-
return
|
|
72
|
+
return logsForTag;
|
|
53
73
|
};
|
|
54
74
|
|
|
55
75
|
if (follow) {
|
|
56
76
|
log('Fetching logs...');
|
|
57
77
|
while (true) {
|
|
58
|
-
const
|
|
59
|
-
if (
|
|
78
|
+
const results = await drainLogs();
|
|
79
|
+
if (results.length === 0) {
|
|
60
80
|
await sleep(1000);
|
|
81
|
+
} else {
|
|
82
|
+
results.forEach(r => log(logResultToHumanReadable(r)));
|
|
61
83
|
}
|
|
62
84
|
}
|
|
63
85
|
} else {
|
|
64
|
-
|
|
65
|
-
|
|
86
|
+
const results = await drainLogs();
|
|
87
|
+
if (results.length === 0) {
|
|
88
|
+
log(
|
|
89
|
+
`No logs found for {contractAddress: ${contractAddress.toString()}, tag: ${tag.toString()}` +
|
|
90
|
+
`${txHash ? `, txHash: ${txHash.toString()}` : ''}` +
|
|
91
|
+
`${fromBlock !== undefined ? `, fromBlock: ${fromBlock}` : ''}` +
|
|
92
|
+
`${toBlock !== undefined ? `, toBlock: ${toBlock}` : ''}` +
|
|
93
|
+
`${afterLog ? `, afterLog: ${afterLog.toString()}` : ''}}`,
|
|
94
|
+
);
|
|
95
|
+
} else {
|
|
96
|
+
log('Logs found: \n');
|
|
97
|
+
results.forEach(r => log(logResultToHumanReadable(r)));
|
|
66
98
|
}
|
|
67
99
|
}
|
|
68
100
|
}
|
|
@@ -23,7 +23,6 @@ export async function getNodeInfo(nodeUrl: string, json: boolean, log: LogFn, lo
|
|
|
23
23
|
rewardDistributor: info.l1ContractAddresses.rewardDistributorAddress.toString(),
|
|
24
24
|
governanceProposer: info.l1ContractAddresses.governanceProposerAddress.toString(),
|
|
25
25
|
governance: info.l1ContractAddresses.governanceAddress.toString(),
|
|
26
|
-
slashFactory: info.l1ContractAddresses.slashFactoryAddress?.toString(),
|
|
27
26
|
feeAssetHandler: info.l1ContractAddresses.feeAssetHandlerAddress?.toString(),
|
|
28
27
|
stakingAssetHandler: info.l1ContractAddresses.stakingAssetHandlerAddress?.toString(),
|
|
29
28
|
},
|
|
@@ -51,7 +50,6 @@ export async function getNodeInfo(nodeUrl: string, json: boolean, log: LogFn, lo
|
|
|
51
50
|
log(` RewardDistributor Address: ${info.l1ContractAddresses.rewardDistributorAddress.toString()}`);
|
|
52
51
|
log(` GovernanceProposer Address: ${info.l1ContractAddresses.governanceProposerAddress.toString()}`);
|
|
53
52
|
log(` Governance Address: ${info.l1ContractAddresses.governanceAddress.toString()}`);
|
|
54
|
-
log(` SlashFactory Address: ${info.l1ContractAddresses.slashFactoryAddress?.toString()}`);
|
|
55
53
|
log(` FeeAssetHandler Address: ${info.l1ContractAddresses.feeAssetHandlerAddress?.toString()}`);
|
|
56
54
|
log(` StakingAssetHandler Address: ${info.l1ContractAddresses.stakingAssetHandlerAddress?.toString()}`);
|
|
57
55
|
log(`L2 Contract Addresses:`);
|
|
@@ -7,10 +7,10 @@ import {
|
|
|
7
7
|
nodeOption,
|
|
8
8
|
parseAztecAddress,
|
|
9
9
|
parseField,
|
|
10
|
-
parseOptionalAztecAddress,
|
|
11
10
|
parseOptionalInteger,
|
|
12
|
-
|
|
11
|
+
parseOptionalLogCursor,
|
|
13
12
|
parseOptionalTxHash,
|
|
13
|
+
parseTag,
|
|
14
14
|
} from '../../utils/commands.js';
|
|
15
15
|
|
|
16
16
|
export function injectCommands(program: Command, log: LogFn, debugLogger: Logger) {
|
|
@@ -47,21 +47,26 @@ export function injectCommands(program: Command, log: LogFn, debugLogger: Logger
|
|
|
47
47
|
|
|
48
48
|
program
|
|
49
49
|
.command('get-logs')
|
|
50
|
-
.description('Gets
|
|
51
|
-
.
|
|
50
|
+
.description('Gets public logs for a contract and tag, optionally restricted by block range or tx hash.')
|
|
51
|
+
.requiredOption('-ca, --contract-address <address>', 'Contract address that emitted the logs.', parseAztecAddress)
|
|
52
|
+
.requiredOption('--tag <tag>', 'Tag (Fr value) to filter logs by.', parseTag)
|
|
53
|
+
.option('-tx, --tx-hash <txHash>', 'A transaction hash to restrict the search to.', parseOptionalTxHash)
|
|
52
54
|
.option(
|
|
53
55
|
'-fb, --from-block <blockNum>',
|
|
54
56
|
'Initial block number for getting logs (defaults to 1).',
|
|
55
57
|
parseOptionalInteger,
|
|
56
58
|
)
|
|
57
59
|
.option('-tb, --to-block <blockNum>', 'Up to which block to fetch logs (defaults to latest).', parseOptionalInteger)
|
|
58
|
-
.option(
|
|
59
|
-
|
|
60
|
+
.option(
|
|
61
|
+
'-al --after-log <cursor>',
|
|
62
|
+
'Log cursor of the form <blockNumber>-<txIndexWithinBlock>-<logIndexWithinTx> to resume pagination after.',
|
|
63
|
+
parseOptionalLogCursor,
|
|
64
|
+
)
|
|
60
65
|
.addOption(nodeOption)
|
|
61
66
|
.option('--follow', 'If set, will keep polling for new logs until interrupted.')
|
|
62
|
-
.action(async ({ txHash, fromBlock, toBlock, afterLog, contractAddress,
|
|
67
|
+
.action(async ({ txHash, fromBlock, toBlock, afterLog, contractAddress, tag, nodeUrl, follow }) => {
|
|
63
68
|
const { getLogs } = await import('./get_logs.js');
|
|
64
|
-
await getLogs(txHash, fromBlock, toBlock, afterLog, contractAddress, nodeUrl, follow, log);
|
|
69
|
+
await getLogs({ txHash, fromBlock, toBlock, afterLog, contractAddress, tag, nodeUrl, follow, log });
|
|
65
70
|
});
|
|
66
71
|
|
|
67
72
|
program
|
|
@@ -2,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...');
|
|
@@ -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
|
}
|
|
@@ -45,7 +45,9 @@ export function enrichEnvironmentWithChainName(networkName: NetworkNames) {
|
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
// Apply generated network config from defaults.yml
|
|
48
|
-
|
|
48
|
+
// For devnet iterations (v4-devnet-1, etc.), use the base devnet config
|
|
49
|
+
const configKey = /^v\d+-devnet-\d+$/.test(networkName) ? 'devnet' : networkName;
|
|
50
|
+
const generatedConfig = NetworkConfigs[configKey];
|
|
49
51
|
if (generatedConfig) {
|
|
50
52
|
enrichEnvironmentWithNetworkConfig(generatedConfig);
|
|
51
53
|
}
|
|
@@ -14,7 +14,7 @@ export const devnetConfig = {
|
|
|
14
14
|
AZTEC_MANA_TARGET: 100000000,
|
|
15
15
|
AZTEC_PROVING_COST_PER_MANA: 100,
|
|
16
16
|
AZTEC_INITIAL_ETH_PER_FEE_ASSET: 10000000,
|
|
17
|
-
|
|
17
|
+
AZTEC_SLASHER_ENABLED: true,
|
|
18
18
|
AZTEC_SLASHING_ROUND_SIZE_IN_EPOCHS: 4,
|
|
19
19
|
AZTEC_SLASHING_LIFETIME_IN_ROUNDS: 5,
|
|
20
20
|
AZTEC_SLASHING_OFFSET_IN_ROUNDS: 2,
|
|
@@ -24,11 +24,10 @@ export const devnetConfig = {
|
|
|
24
24
|
AZTEC_SLASH_AMOUNT_MEDIUM: 20000000000000000000,
|
|
25
25
|
AZTEC_SLASH_AMOUNT_LARGE: 50000000000000000000,
|
|
26
26
|
AZTEC_GOVERNANCE_PROPOSER_ROUND_SIZE: 300,
|
|
27
|
-
SLASH_MIN_PENALTY_PERCENTAGE: 0.5,
|
|
28
|
-
SLASH_MAX_PENALTY_PERCENTAGE: 2,
|
|
29
27
|
SLASH_OFFENSE_EXPIRATION_ROUNDS: 4,
|
|
30
|
-
SLASH_MAX_PAYLOAD_SIZE:
|
|
28
|
+
SLASH_MAX_PAYLOAD_SIZE: 80,
|
|
31
29
|
SLASH_EXECUTE_ROUNDS_LOOK_BACK: 4,
|
|
30
|
+
SLASH_DATA_WITHHOLDING_TOLERANCE_SLOTS: 3,
|
|
32
31
|
P2P_ENABLED: true,
|
|
33
32
|
BOOTSTRAP_NODES: '',
|
|
34
33
|
SEQ_MIN_TX_PER_BLOCK: 1,
|
|
@@ -61,7 +60,6 @@ export const devnetConfig = {
|
|
|
61
60
|
PUBLIC_OTEL_OPT_OUT: true,
|
|
62
61
|
PUBLIC_OTEL_EXPORTER_OTLP_METRICS_ENDPOINT: '',
|
|
63
62
|
PUBLIC_OTEL_COLLECT_FROM: '',
|
|
64
|
-
SLASH_PRUNE_PENALTY: 10000000000000000000,
|
|
65
63
|
SLASH_DATA_WITHHOLDING_PENALTY: 10000000000000000000,
|
|
66
64
|
SLASH_INACTIVITY_TARGET_PERCENTAGE: 0.9,
|
|
67
65
|
SLASH_INACTIVITY_CONSECUTIVE_EPOCH_THRESHOLD: 1,
|
|
@@ -69,9 +67,11 @@ export const devnetConfig = {
|
|
|
69
67
|
SLASH_PROPOSE_INVALID_ATTESTATIONS_PENALTY: 10000000000000000000,
|
|
70
68
|
SLASH_DUPLICATE_PROPOSAL_PENALTY: 10000000000000000000,
|
|
71
69
|
SLASH_DUPLICATE_ATTESTATION_PENALTY: 10000000000000000000,
|
|
72
|
-
|
|
70
|
+
SLASH_PROPOSE_DESCENDANT_OF_CHECKPOINT_WITH_INVALID_ATTESTATIONS_PENALTY: 10000000000000000000,
|
|
71
|
+
SLASH_ATTEST_INVALID_CHECKPOINT_PROPOSAL_PENALTY: 10000000000000000000,
|
|
73
72
|
SLASH_UNKNOWN_PENALTY: 10000000000000000000,
|
|
74
73
|
SLASH_INVALID_BLOCK_PENALTY: 10000000000000000000,
|
|
74
|
+
SLASH_INVALID_CHECKPOINT_PROPOSAL_PENALTY: 0,
|
|
75
75
|
SLASH_GRACE_PERIOD_L2_SLOTS: 0,
|
|
76
76
|
ENABLE_VERSION_CHECK: true,
|
|
77
77
|
} as const;
|
|
@@ -81,21 +81,20 @@ export const testnetConfig = {
|
|
|
81
81
|
AZTEC_EPOCH_DURATION: 32,
|
|
82
82
|
AZTEC_TARGET_COMMITTEE_SIZE: 48,
|
|
83
83
|
AZTEC_LAG_IN_EPOCHS_FOR_VALIDATOR_SET: 2,
|
|
84
|
-
AZTEC_LAG_IN_EPOCHS_FOR_RANDAO:
|
|
84
|
+
AZTEC_LAG_IN_EPOCHS_FOR_RANDAO: 2,
|
|
85
85
|
AZTEC_EXIT_DELAY_SECONDS: 172800,
|
|
86
86
|
AZTEC_INBOX_LAG: 1,
|
|
87
87
|
AZTEC_PROOF_SUBMISSION_EPOCHS: 1,
|
|
88
88
|
AZTEC_INITIAL_ETH_PER_FEE_ASSET: 10000000,
|
|
89
|
-
|
|
89
|
+
AZTEC_SLASHER_ENABLED: true,
|
|
90
90
|
AZTEC_SLASHING_ROUND_SIZE_IN_EPOCHS: 4,
|
|
91
91
|
AZTEC_SLASHING_LIFETIME_IN_ROUNDS: 5,
|
|
92
92
|
AZTEC_SLASHING_OFFSET_IN_ROUNDS: 2,
|
|
93
93
|
AZTEC_SLASHING_DISABLE_DURATION: 432000,
|
|
94
|
-
SLASH_MIN_PENALTY_PERCENTAGE: 0.5,
|
|
95
|
-
SLASH_MAX_PENALTY_PERCENTAGE: 2,
|
|
96
94
|
SLASH_OFFENSE_EXPIRATION_ROUNDS: 4,
|
|
97
|
-
SLASH_MAX_PAYLOAD_SIZE:
|
|
95
|
+
SLASH_MAX_PAYLOAD_SIZE: 80,
|
|
98
96
|
SLASH_EXECUTE_ROUNDS_LOOK_BACK: 4,
|
|
97
|
+
SLASH_DATA_WITHHOLDING_TOLERANCE_SLOTS: 3,
|
|
99
98
|
P2P_ENABLED: true,
|
|
100
99
|
BOOTSTRAP_NODES: '',
|
|
101
100
|
SEQ_MIN_TX_PER_BLOCK: 1,
|
|
@@ -119,10 +118,10 @@ export const testnetConfig = {
|
|
|
119
118
|
AZTEC_GOVERNANCE_PROPOSER_ROUND_SIZE: 100,
|
|
120
119
|
AZTEC_GOVERNANCE_PROPOSER_QUORUM: 60,
|
|
121
120
|
AZTEC_MANA_TARGET: 75000000,
|
|
122
|
-
AZTEC_PROVING_COST_PER_MANA:
|
|
121
|
+
AZTEC_PROVING_COST_PER_MANA: 12500000,
|
|
123
122
|
AZTEC_SLASH_AMOUNT_SMALL: 1E+23,
|
|
124
|
-
AZTEC_SLASH_AMOUNT_MEDIUM:
|
|
125
|
-
AZTEC_SLASH_AMOUNT_LARGE:
|
|
123
|
+
AZTEC_SLASH_AMOUNT_MEDIUM: 2.5E+23,
|
|
124
|
+
AZTEC_SLASH_AMOUNT_LARGE: 2.5E+23,
|
|
126
125
|
L1_CHAIN_ID: 11155111,
|
|
127
126
|
TEST_ACCOUNTS: false,
|
|
128
127
|
SPONSORED_FPC: false,
|
|
@@ -131,18 +130,19 @@ export const testnetConfig = {
|
|
|
131
130
|
PROVER_REAL_PROOFS: true,
|
|
132
131
|
P2P_MAX_PENDING_TX_COUNT: 1000,
|
|
133
132
|
P2P_TX_POOL_DELETE_TXS_AFTER_REORG: true,
|
|
134
|
-
SLASH_PRUNE_PENALTY: 0,
|
|
135
133
|
SLASH_DATA_WITHHOLDING_PENALTY: 0,
|
|
136
|
-
SLASH_INACTIVITY_TARGET_PERCENTAGE: 0.
|
|
137
|
-
SLASH_INACTIVITY_CONSECUTIVE_EPOCH_THRESHOLD:
|
|
134
|
+
SLASH_INACTIVITY_TARGET_PERCENTAGE: 0.9,
|
|
135
|
+
SLASH_INACTIVITY_CONSECUTIVE_EPOCH_THRESHOLD: 1,
|
|
138
136
|
SLASH_INACTIVITY_PENALTY: 1E+23,
|
|
139
137
|
SLASH_PROPOSE_INVALID_ATTESTATIONS_PENALTY: 1E+23,
|
|
140
|
-
SLASH_DUPLICATE_PROPOSAL_PENALTY:
|
|
141
|
-
SLASH_DUPLICATE_ATTESTATION_PENALTY:
|
|
142
|
-
|
|
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,
|
|
143
142
|
SLASH_UNKNOWN_PENALTY: 1E+23,
|
|
144
143
|
SLASH_INVALID_BLOCK_PENALTY: 1E+23,
|
|
145
|
-
|
|
144
|
+
SLASH_INVALID_CHECKPOINT_PROPOSAL_PENALTY: 1E+23,
|
|
145
|
+
SLASH_GRACE_PERIOD_L2_SLOTS: 64,
|
|
146
146
|
ENABLE_VERSION_CHECK: true,
|
|
147
147
|
} as const;
|
|
148
148
|
|
|
@@ -151,18 +151,17 @@ export const mainnetConfig = {
|
|
|
151
151
|
AZTEC_EPOCH_DURATION: 32,
|
|
152
152
|
AZTEC_TARGET_COMMITTEE_SIZE: 48,
|
|
153
153
|
AZTEC_LAG_IN_EPOCHS_FOR_VALIDATOR_SET: 2,
|
|
154
|
-
AZTEC_LAG_IN_EPOCHS_FOR_RANDAO:
|
|
154
|
+
AZTEC_LAG_IN_EPOCHS_FOR_RANDAO: 2,
|
|
155
155
|
AZTEC_INBOX_LAG: 1,
|
|
156
156
|
AZTEC_PROOF_SUBMISSION_EPOCHS: 1,
|
|
157
157
|
AZTEC_INITIAL_ETH_PER_FEE_ASSET: 10000000,
|
|
158
|
-
|
|
158
|
+
AZTEC_SLASHER_ENABLED: true,
|
|
159
159
|
AZTEC_SLASHING_ROUND_SIZE_IN_EPOCHS: 4,
|
|
160
160
|
AZTEC_SLASHING_OFFSET_IN_ROUNDS: 2,
|
|
161
|
-
SLASH_MIN_PENALTY_PERCENTAGE: 0.5,
|
|
162
|
-
SLASH_MAX_PENALTY_PERCENTAGE: 2,
|
|
163
161
|
SLASH_OFFENSE_EXPIRATION_ROUNDS: 4,
|
|
164
|
-
SLASH_MAX_PAYLOAD_SIZE:
|
|
162
|
+
SLASH_MAX_PAYLOAD_SIZE: 80,
|
|
165
163
|
SLASH_EXECUTE_ROUNDS_LOOK_BACK: 4,
|
|
164
|
+
SLASH_DATA_WITHHOLDING_TOLERANCE_SLOTS: 3,
|
|
166
165
|
P2P_ENABLED: true,
|
|
167
166
|
BOOTSTRAP_NODES: '',
|
|
168
167
|
SEQ_MIN_TX_PER_BLOCK: 1,
|
|
@@ -181,8 +180,8 @@ export const mainnetConfig = {
|
|
|
181
180
|
AZTEC_EJECTION_THRESHOLD: 1E+23,
|
|
182
181
|
AZTEC_LOCAL_EJECTION_THRESHOLD: 1.9E+23,
|
|
183
182
|
AZTEC_SLASH_AMOUNT_SMALL: 2E+21,
|
|
184
|
-
AZTEC_SLASH_AMOUNT_MEDIUM:
|
|
185
|
-
AZTEC_SLASH_AMOUNT_LARGE:
|
|
183
|
+
AZTEC_SLASH_AMOUNT_MEDIUM: 5E+21,
|
|
184
|
+
AZTEC_SLASH_AMOUNT_LARGE: 5E+21,
|
|
186
185
|
AZTEC_SLASHING_LIFETIME_IN_ROUNDS: 34,
|
|
187
186
|
AZTEC_SLASHING_EXECUTION_DELAY_IN_ROUNDS: 28,
|
|
188
187
|
AZTEC_SLASHING_VETOER: '0xBbB4aF368d02827945748b28CD4b2D42e4A37480',
|
|
@@ -190,7 +189,7 @@ export const mainnetConfig = {
|
|
|
190
189
|
AZTEC_GOVERNANCE_PROPOSER_QUORUM: 600,
|
|
191
190
|
AZTEC_GOVERNANCE_PROPOSER_ROUND_SIZE: 1000,
|
|
192
191
|
AZTEC_MANA_TARGET: 75000000,
|
|
193
|
-
AZTEC_PROVING_COST_PER_MANA:
|
|
192
|
+
AZTEC_PROVING_COST_PER_MANA: 12500000,
|
|
194
193
|
AZTEC_EXIT_DELAY_SECONDS: 345600,
|
|
195
194
|
AZTEC_SLASHING_DISABLE_DURATION: 259200,
|
|
196
195
|
AZTEC_ENTRY_QUEUE_BOOTSTRAP_VALIDATOR_SET_SIZE: 500,
|
|
@@ -210,17 +209,18 @@ export const mainnetConfig = {
|
|
|
210
209
|
PUBLIC_OTEL_EXPORTER_OTLP_METRICS_ENDPOINT: '',
|
|
211
210
|
PUBLIC_OTEL_COLLECT_FROM: '',
|
|
212
211
|
ENABLE_VERSION_CHECK: false,
|
|
213
|
-
SLASH_PRUNE_PENALTY: 0,
|
|
214
212
|
SLASH_DATA_WITHHOLDING_PENALTY: 0,
|
|
215
|
-
SLASH_INACTIVITY_TARGET_PERCENTAGE: 0.
|
|
213
|
+
SLASH_INACTIVITY_TARGET_PERCENTAGE: 0.8,
|
|
216
214
|
SLASH_INACTIVITY_CONSECUTIVE_EPOCH_THRESHOLD: 2,
|
|
217
215
|
SLASH_INACTIVITY_PENALTY: 2E+21,
|
|
218
216
|
SLASH_PROPOSE_INVALID_ATTESTATIONS_PENALTY: 2E+21,
|
|
219
|
-
SLASH_DUPLICATE_PROPOSAL_PENALTY:
|
|
220
|
-
SLASH_DUPLICATE_ATTESTATION_PENALTY:
|
|
221
|
-
|
|
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,
|
|
222
221
|
SLASH_UNKNOWN_PENALTY: 2E+21,
|
|
223
222
|
SLASH_INVALID_BLOCK_PENALTY: 2E+21,
|
|
224
|
-
|
|
223
|
+
SLASH_INVALID_CHECKPOINT_PROPOSAL_PENALTY: 2E+21,
|
|
224
|
+
SLASH_GRACE_PERIOD_L2_SLOTS: 1200,
|
|
225
225
|
} as const;
|
|
226
226
|
|
package/src/utils/aztec.ts
CHANGED
|
@@ -49,7 +49,7 @@ export async function deployNewRollupContracts(
|
|
|
49
49
|
feeJuicePortalInitialBalance: bigint,
|
|
50
50
|
config: L1ContractsConfig,
|
|
51
51
|
realVerifier: boolean,
|
|
52
|
-
): Promise<{ rollup: RollupContract
|
|
52
|
+
): Promise<{ rollup: RollupContract }> {
|
|
53
53
|
const { deployRollupForUpgrade } = await import('@aztec/ethereum/deploy-aztec-l1-contracts');
|
|
54
54
|
const { mnemonicToAccount, privateKeyToAccount } = await import('viem/accounts');
|
|
55
55
|
const { getVKTreeRoot } = await import('@aztec/noir-protocol-circuits-types/vk-tree');
|
|
@@ -80,23 +80,17 @@ export async function deployNewRollupContracts(
|
|
|
80
80
|
logger.info('Initializing new rollup with old attesters', { initialValidators });
|
|
81
81
|
}
|
|
82
82
|
|
|
83
|
-
const { rollup
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
realVerifier,
|
|
95
|
-
...config,
|
|
96
|
-
},
|
|
97
|
-
);
|
|
98
|
-
|
|
99
|
-
return { rollup, slashFactoryAddress: EthAddress.fromString(slashFactoryAddress!) };
|
|
83
|
+
const { rollup } = await deployRollupForUpgrade(privateKey as Hex, rpcUrls[0], chainId, registryAddress, {
|
|
84
|
+
vkTreeRoot: getVKTreeRoot(),
|
|
85
|
+
protocolContractsHash,
|
|
86
|
+
genesisArchiveRoot,
|
|
87
|
+
initialValidators,
|
|
88
|
+
feeJuicePortalInitialBalance,
|
|
89
|
+
realVerifier,
|
|
90
|
+
...config,
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
return { rollup };
|
|
100
94
|
}
|
|
101
95
|
|
|
102
96
|
/**
|
package/src/utils/commands.ts
CHANGED
|
@@ -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 {
|
|
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
|
|
231
|
-
*
|
|
232
|
-
* @
|
|
233
|
-
* @
|
|
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
|
|
236
|
-
|
|
237
|
-
return
|
|
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
|
-
|
|
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
|
/**
|
package/src/utils/inspect.ts
CHANGED
|
@@ -9,14 +9,13 @@ export async function inspectBlock(
|
|
|
9
9
|
log: LogFn,
|
|
10
10
|
opts: { showTxs?: boolean } = {},
|
|
11
11
|
) {
|
|
12
|
-
const block = await aztecNode.getBlock(blockNumber);
|
|
12
|
+
const block = await aztecNode.getBlock(blockNumber, { includeTransactions: opts.showTxs });
|
|
13
13
|
if (!block) {
|
|
14
14
|
log(`No block found for block number ${blockNumber}`);
|
|
15
15
|
return;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
log(`Block ${blockNumber} (${blockHash.toString()})`);
|
|
18
|
+
log(`Block ${blockNumber} (${block.hash.toString()})`);
|
|
20
19
|
log(` Total fees: ${block.header.totalFees.toBigInt()}`);
|
|
21
20
|
log(` Total mana used: ${block.header.totalManaUsed.toBigInt()}`);
|
|
22
21
|
log(
|
|
@@ -25,12 +24,12 @@ export async function inspectBlock(
|
|
|
25
24
|
log(` Coinbase: ${block.header.globalVariables.coinbase}`);
|
|
26
25
|
log(` Fee recipient: ${block.header.globalVariables.feeRecipient}`);
|
|
27
26
|
log(` Timestamp: ${new Date(Number(block.header.globalVariables.timestamp) * 500)}`);
|
|
28
|
-
if (opts.showTxs) {
|
|
27
|
+
if (opts.showTxs && block.body) {
|
|
29
28
|
log(``);
|
|
30
29
|
for (const txHash of block.body.txEffects.map(tx => tx.txHash)) {
|
|
31
30
|
await inspectTx(aztecNode, txHash, log, { includeBlockInfo: false });
|
|
32
31
|
}
|
|
33
|
-
} else {
|
|
32
|
+
} else if (block.body) {
|
|
34
33
|
log(` Transactions: ${block.body.txEffects.length}`);
|
|
35
34
|
}
|
|
36
35
|
}
|
|
@@ -41,7 +40,7 @@ export async function inspectTx(
|
|
|
41
40
|
log: LogFn,
|
|
42
41
|
opts: { includeBlockInfo?: boolean } = {},
|
|
43
42
|
) {
|
|
44
|
-
const
|
|
43
|
+
const receipt = await aztecNode.getTxReceipt(txHash, { includeTxEffect: true });
|
|
45
44
|
// Base tx data
|
|
46
45
|
log(`Tx ${txHash.toString()}`);
|
|
47
46
|
log(` Status: ${receipt.status}`);
|
|
@@ -52,11 +51,11 @@ export async function inspectTx(
|
|
|
52
51
|
log(` Error: ${receipt.error}`);
|
|
53
52
|
}
|
|
54
53
|
|
|
55
|
-
if (!
|
|
54
|
+
if (!receipt.isMined() || !receipt.txEffect) {
|
|
56
55
|
return;
|
|
57
56
|
}
|
|
58
57
|
|
|
59
|
-
const effects =
|
|
58
|
+
const effects = receipt.txEffect;
|
|
60
59
|
|
|
61
60
|
if (opts.includeBlockInfo) {
|
|
62
61
|
log(` Block: ${receipt.blockNumber} (${receipt.blockHash?.toString()})`);
|