@aztec/cli 3.0.0-devnet.6 → 3.0.0-devnet.6-patch.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dest/cmds/aztec_node/block_number.d.ts +1 -1
- package/dest/cmds/aztec_node/get_block.d.ts +1 -1
- package/dest/cmds/aztec_node/get_block.d.ts.map +1 -1
- package/dest/cmds/aztec_node/get_block.js +2 -1
- package/dest/cmds/aztec_node/get_current_base_fee.d.ts +1 -1
- package/dest/cmds/aztec_node/get_l1_to_l2_message_witness.d.ts +1 -1
- package/dest/cmds/aztec_node/get_logs.d.ts +3 -2
- package/dest/cmds/aztec_node/get_logs.d.ts.map +1 -1
- package/dest/cmds/aztec_node/get_node_info.d.ts +1 -1
- package/dest/cmds/aztec_node/index.d.ts +1 -1
- package/dest/cmds/contracts/index.d.ts +1 -1
- package/dest/cmds/contracts/inspect_contract.d.ts +1 -1
- package/dest/cmds/contracts/inspect_contract.d.ts.map +1 -1
- package/dest/cmds/contracts/inspect_contract.js +4 -10
- package/dest/cmds/contracts/parse_parameter_struct.d.ts +1 -1
- package/dest/cmds/infrastructure/index.d.ts +1 -1
- package/dest/cmds/infrastructure/index.d.ts.map +1 -1
- package/dest/cmds/infrastructure/index.js +0 -1
- package/dest/cmds/infrastructure/sequencers.d.ts +1 -2
- package/dest/cmds/infrastructure/sequencers.d.ts.map +1 -1
- package/dest/cmds/infrastructure/sequencers.js +3 -1
- package/dest/cmds/infrastructure/setup_l2_contract.d.ts +1 -1
- package/dest/cmds/l1/advance_epoch.d.ts +1 -1
- 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 +2 -1
- package/dest/cmds/l1/bridge_erc20.d.ts +1 -1
- package/dest/cmds/l1/bridge_erc20.d.ts.map +1 -1
- package/dest/cmds/l1/bridge_erc20.js +2 -1
- package/dest/cmds/l1/create_l1_account.d.ts +1 -1
- package/dest/cmds/l1/deploy_l1_contracts.d.ts +1 -1
- package/dest/cmds/l1/deploy_l1_contracts.js +1 -1
- package/dest/cmds/l1/deploy_new_rollup.d.ts +2 -2
- package/dest/cmds/l1/deploy_new_rollup.d.ts.map +1 -1
- package/dest/cmds/l1/deploy_new_rollup.js +1 -1
- package/dest/cmds/l1/get_l1_addresses.d.ts +1 -1
- package/dest/cmds/l1/get_l1_addresses.d.ts.map +1 -1
- package/dest/cmds/l1/get_l1_addresses.js +2 -1
- package/dest/cmds/l1/get_l1_balance.d.ts +1 -1
- package/dest/cmds/l1/get_l1_balance.js +1 -1
- package/dest/cmds/l1/governance_utils.d.ts +5 -5
- package/dest/cmds/l1/governance_utils.d.ts.map +1 -1
- package/dest/cmds/l1/governance_utils.js +3 -1
- package/dest/cmds/l1/index.d.ts +1 -1
- package/dest/cmds/l1/prover_stats.d.ts +1 -1
- package/dest/cmds/l1/prover_stats.d.ts.map +1 -1
- package/dest/cmds/l1/prover_stats.js +29 -29
- package/dest/cmds/l1/trigger_seed_snapshot.d.ts +2 -2
- package/dest/cmds/l1/trigger_seed_snapshot.d.ts.map +1 -1
- package/dest/cmds/l1/trigger_seed_snapshot.js +2 -1
- package/dest/cmds/l1/update_l1_validators.d.ts +6 -6
- package/dest/cmds/l1/update_l1_validators.d.ts.map +1 -1
- package/dest/cmds/l1/update_l1_validators.js +7 -3
- package/dest/cmds/misc/compute_selector.d.ts +1 -1
- package/dest/cmds/misc/example_contracts.d.ts +1 -1
- package/dest/cmds/misc/generate_bootnode_enr.d.ts +1 -1
- package/dest/cmds/misc/generate_p2p_private_key.d.ts +1 -1
- package/dest/cmds/misc/generate_secret_and_hash.d.ts +1 -1
- package/dest/cmds/misc/generate_secret_and_hash.js +1 -1
- package/dest/cmds/misc/generate_secret_key.d.ts +1 -1
- package/dest/cmds/misc/get_canonical_sponsored_fpc_address.d.ts +1 -1
- package/dest/cmds/misc/index.d.ts +1 -1
- package/dest/cmds/misc/update/common.d.ts +1 -1
- package/dest/cmds/misc/update/github.d.ts +1 -1
- package/dest/cmds/misc/update/noir.d.ts +1 -1
- package/dest/cmds/misc/update/npm.d.ts +1 -1
- package/dest/cmds/misc/update/npm.js +1 -1
- package/dest/cmds/misc/update/utils.d.ts +1 -1
- package/dest/cmds/misc/update.d.ts +1 -1
- package/dest/cmds/validator_keys/add.d.ts +5 -0
- package/dest/cmds/validator_keys/add.d.ts.map +1 -0
- package/dest/cmds/validator_keys/add.js +83 -0
- package/dest/cmds/validator_keys/generate_bls_keypair.d.ts +12 -0
- package/dest/cmds/validator_keys/generate_bls_keypair.d.ts.map +1 -0
- package/dest/cmds/validator_keys/generate_bls_keypair.js +27 -0
- package/dest/cmds/validator_keys/index.d.ts +4 -0
- package/dest/cmds/validator_keys/index.d.ts.map +1 -0
- package/dest/cmds/validator_keys/index.js +32 -0
- package/dest/cmds/validator_keys/new.d.ts +29 -0
- package/dest/cmds/validator_keys/new.d.ts.map +1 -0
- package/dest/cmds/validator_keys/new.js +132 -0
- package/dest/cmds/validator_keys/shared.d.ts +68 -0
- package/dest/cmds/validator_keys/shared.d.ts.map +1 -0
- package/dest/cmds/validator_keys/shared.js +274 -0
- package/dest/cmds/validator_keys/staker.d.ts +38 -0
- package/dest/cmds/validator_keys/staker.d.ts.map +1 -0
- package/dest/cmds/validator_keys/staker.js +208 -0
- package/dest/cmds/validator_keys/utils.d.ts +25 -0
- package/dest/cmds/validator_keys/utils.d.ts.map +1 -0
- package/dest/cmds/validator_keys/utils.js +52 -0
- package/dest/config/cached_fetch.d.ts +1 -1
- package/dest/config/chain_l2_config.d.ts +14 -10
- package/dest/config/chain_l2_config.d.ts.map +1 -1
- package/dest/config/chain_l2_config.js +128 -67
- package/dest/config/enrich_env.d.ts +1 -1
- package/dest/config/get_l1_config.d.ts +3 -2
- package/dest/config/get_l1_config.d.ts.map +1 -1
- package/dest/config/get_l1_config.js +3 -1
- package/dest/config/index.d.ts +1 -1
- package/dest/config/network_config.d.ts +6 -3
- package/dest/config/network_config.d.ts.map +1 -1
- package/dest/config/network_config.js +58 -28
- package/dest/utils/aztec.d.ts +5 -3
- package/dest/utils/aztec.d.ts.map +1 -1
- package/dest/utils/aztec.js +6 -3
- package/dest/utils/commands.d.ts +12 -3
- package/dest/utils/commands.d.ts.map +1 -1
- package/dest/utils/commands.js +30 -3
- package/dest/utils/encoding.d.ts +1 -1
- package/dest/utils/encoding.js +1 -1
- package/dest/utils/github.d.ts +1 -1
- package/dest/utils/index.d.ts +1 -1
- package/dest/utils/inspect.d.ts +3 -2
- package/dest/utils/inspect.d.ts.map +1 -1
- package/dest/utils/setup_contracts.d.ts +1 -1
- package/package.json +37 -28
- package/public_include_metric_prefixes.json +1 -0
- package/src/cmds/aztec_node/get_block.ts +2 -1
- package/src/cmds/aztec_node/get_logs.ts +3 -2
- package/src/cmds/contracts/inspect_contract.ts +4 -11
- package/src/cmds/infrastructure/index.ts +0 -1
- package/src/cmds/infrastructure/sequencers.ts +3 -2
- package/src/cmds/l1/assume_proven_through.ts +4 -1
- package/src/cmds/l1/bridge_erc20.ts +2 -1
- package/src/cmds/l1/deploy_l1_contracts.ts +1 -1
- package/src/cmds/l1/deploy_new_rollup.ts +2 -1
- package/src/cmds/l1/get_l1_addresses.ts +3 -1
- package/src/cmds/l1/get_l1_balance.ts +1 -1
- package/src/cmds/l1/governance_utils.ts +3 -8
- package/src/cmds/l1/prover_stats.ts +38 -30
- package/src/cmds/l1/trigger_seed_snapshot.ts +2 -1
- package/src/cmds/l1/update_l1_validators.ts +7 -12
- package/src/cmds/misc/generate_secret_and_hash.ts +1 -1
- package/src/cmds/misc/update/npm.ts +1 -1
- package/src/cmds/validator_keys/add.ts +123 -0
- package/src/cmds/validator_keys/generate_bls_keypair.ts +34 -0
- package/src/cmds/validator_keys/index.ts +142 -0
- package/src/cmds/validator_keys/new.ts +207 -0
- package/src/cmds/validator_keys/shared.ts +326 -0
- package/src/cmds/validator_keys/staker.ts +301 -0
- package/src/cmds/validator_keys/utils.ts +80 -0
- package/src/config/chain_l2_config.ts +176 -92
- package/src/config/get_l1_config.ts +4 -1
- package/src/config/network_config.ts +67 -29
- package/src/utils/aztec.ts +9 -9
- package/src/utils/commands.ts +41 -3
- package/src/utils/encoding.ts +1 -1
- package/src/utils/inspect.ts +2 -1
|
@@ -8,27 +8,67 @@ import { enrichEthAddressVar, enrichVar } from './enrich_env.js';
|
|
|
8
8
|
|
|
9
9
|
const DEFAULT_CONFIG_URL =
|
|
10
10
|
'https://raw.githubusercontent.com/AztecProtocol/networks/refs/heads/main/network_config.json';
|
|
11
|
+
const FALLBACK_CONFIG_URL = 'https://metadata.aztec.network/network_config.json';
|
|
11
12
|
const NETWORK_CONFIG_CACHE_DURATION_MS = 60 * 60 * 1000; // 1 hour
|
|
12
13
|
|
|
13
14
|
/**
|
|
14
15
|
* Fetches remote network configuration from GitHub with caching support.
|
|
15
|
-
* Uses the reusable cachedFetch utility.
|
|
16
|
+
* Uses the reusable cachedFetch utility. Falls back to metadata.aztec.network if the default URL fails.
|
|
16
17
|
*
|
|
17
18
|
* @param networkName - The network name to fetch config for
|
|
18
19
|
* @param cacheDir - Optional cache directory for storing fetched config
|
|
19
|
-
* @returns Remote configuration for the specified network, or undefined if not found
|
|
20
|
+
* @returns Remote configuration for the specified network, or undefined if network not found in config
|
|
21
|
+
* @throws Error if both primary and fallback URLs fail to fetch
|
|
20
22
|
*/
|
|
21
23
|
export async function getNetworkConfig(
|
|
22
24
|
networkName: NetworkNames,
|
|
23
25
|
cacheDir?: string,
|
|
24
26
|
): Promise<NetworkConfig | undefined> {
|
|
25
|
-
|
|
27
|
+
// Try with the primary URL (env var or default)
|
|
26
28
|
const configLocation = process.env.NETWORK_CONFIG_LOCATION || DEFAULT_CONFIG_URL;
|
|
27
29
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
+
let primaryError: Error | undefined;
|
|
31
|
+
let config: NetworkConfig | undefined;
|
|
32
|
+
|
|
33
|
+
// First try the primary config location
|
|
34
|
+
try {
|
|
35
|
+
config = await fetchNetworkConfigFromUrl(configLocation, networkName, cacheDir);
|
|
36
|
+
} catch (error) {
|
|
37
|
+
primaryError = error as Error;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// If primary fails and we were using the default URL, try the fallback
|
|
41
|
+
if (!config && configLocation === DEFAULT_CONFIG_URL) {
|
|
42
|
+
try {
|
|
43
|
+
config = await fetchNetworkConfigFromUrl(FALLBACK_CONFIG_URL, networkName, cacheDir);
|
|
44
|
+
} catch {
|
|
45
|
+
// Both failed - throw the primary error
|
|
46
|
+
if (primaryError) {
|
|
47
|
+
throw primaryError;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
} else if (primaryError) {
|
|
51
|
+
// Primary failed and no fallback to try
|
|
52
|
+
throw primaryError;
|
|
30
53
|
}
|
|
31
54
|
|
|
55
|
+
return config;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Helper function to fetch network config from a specific URL.
|
|
60
|
+
* @param configLocation - The URL or file path to fetch from
|
|
61
|
+
* @param networkName - The network name to fetch config for
|
|
62
|
+
* @param cacheDir - Optional cache directory for storing fetched config
|
|
63
|
+
* @returns Remote configuration for the specified network, or undefined if network not found in config, or undefined if URL invalid
|
|
64
|
+
* @throws Error if fetch/parse fails
|
|
65
|
+
*/
|
|
66
|
+
async function fetchNetworkConfigFromUrl(
|
|
67
|
+
configLocation: string,
|
|
68
|
+
networkName: NetworkNames,
|
|
69
|
+
cacheDir?: string,
|
|
70
|
+
): Promise<NetworkConfig | undefined> {
|
|
71
|
+
let url: URL | undefined;
|
|
32
72
|
try {
|
|
33
73
|
if (configLocation.includes('://')) {
|
|
34
74
|
url = new URL(configLocation);
|
|
@@ -43,31 +83,27 @@ export async function getNetworkConfig(
|
|
|
43
83
|
return undefined;
|
|
44
84
|
}
|
|
45
85
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
}
|
|
86
|
+
let rawConfig: any;
|
|
87
|
+
|
|
88
|
+
if (url.protocol === 'http:' || url.protocol === 'https:') {
|
|
89
|
+
rawConfig = await cachedFetch(url.href, {
|
|
90
|
+
cacheDurationMs: NETWORK_CONFIG_CACHE_DURATION_MS,
|
|
91
|
+
cacheFile: cacheDir ? join(cacheDir, networkName, 'network_config.json') : undefined,
|
|
92
|
+
});
|
|
93
|
+
} else if (url.protocol === 'file:') {
|
|
94
|
+
rawConfig = JSON.parse(await readFile(url.pathname, 'utf-8'));
|
|
95
|
+
} else {
|
|
96
|
+
throw new Error('Unsupported Aztec network config protocol: ' + url.href);
|
|
97
|
+
}
|
|
59
98
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
99
|
+
if (!rawConfig) {
|
|
100
|
+
return undefined;
|
|
101
|
+
}
|
|
63
102
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
return undefined;
|
|
69
|
-
}
|
|
70
|
-
} catch {
|
|
103
|
+
const networkConfigMap = NetworkConfigMapSchema.parse(rawConfig);
|
|
104
|
+
if (networkName in networkConfigMap) {
|
|
105
|
+
return networkConfigMap[networkName];
|
|
106
|
+
} else {
|
|
71
107
|
return undefined;
|
|
72
108
|
}
|
|
73
109
|
}
|
|
@@ -78,6 +114,8 @@ export async function getNetworkConfig(
|
|
|
78
114
|
* from the remote config, following the same pattern as enrichEnvironmentWithChainConfig().
|
|
79
115
|
*
|
|
80
116
|
* @param networkName - The network name to fetch remote config for
|
|
117
|
+
* @throws Error if network config fetch fails (network errors, parse errors, etc.)
|
|
118
|
+
* Does not throw if the network simply doesn't exist in the config - just returns without enriching
|
|
81
119
|
*/
|
|
82
120
|
export async function enrichEnvironmentWithNetworkConfig(networkName: NetworkNames) {
|
|
83
121
|
if (networkName === 'local') {
|
|
@@ -88,7 +126,7 @@ export async function enrichEnvironmentWithNetworkConfig(networkName: NetworkNam
|
|
|
88
126
|
const networkConfig = await getNetworkConfig(networkName, cacheDir);
|
|
89
127
|
|
|
90
128
|
if (!networkConfig) {
|
|
91
|
-
return;
|
|
129
|
+
return; // Network not found in config, continue without enriching
|
|
92
130
|
}
|
|
93
131
|
|
|
94
132
|
enrichVar('BOOTSTRAP_NODES', networkConfig.bootnodes.join(','));
|
package/src/utils/aztec.ts
CHANGED
|
@@ -6,14 +6,11 @@ import {
|
|
|
6
6
|
loadContractArtifact,
|
|
7
7
|
} from '@aztec/aztec.js/abi';
|
|
8
8
|
import { EthAddress } from '@aztec/aztec.js/addresses';
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
type Operator,
|
|
13
|
-
RollupContract,
|
|
14
|
-
} from '@aztec/ethereum';
|
|
9
|
+
import type { L1ContractsConfig } from '@aztec/ethereum/config';
|
|
10
|
+
import { RollupContract } from '@aztec/ethereum/contracts';
|
|
11
|
+
import type { DeployL1ContractsReturnType, Operator } from '@aztec/ethereum/deploy-l1-contracts';
|
|
15
12
|
import { SecretValue } from '@aztec/foundation/config';
|
|
16
|
-
import { Fr } from '@aztec/foundation/
|
|
13
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
17
14
|
import type { LogFn, Logger } from '@aztec/foundation/log';
|
|
18
15
|
import type { NoirPackageConfig } from '@aztec/foundation/noir';
|
|
19
16
|
import { protocolContractsHash } from '@aztec/protocol-contracts';
|
|
@@ -61,7 +58,8 @@ export async function deployAztecContracts(
|
|
|
61
58
|
createVerificationJson: string | false,
|
|
62
59
|
debugLogger: Logger,
|
|
63
60
|
): Promise<DeployL1ContractsReturnType> {
|
|
64
|
-
const { createEthereumChain
|
|
61
|
+
const { createEthereumChain } = await import('@aztec/ethereum/chain');
|
|
62
|
+
const { deployL1Contracts } = await import('@aztec/ethereum/deploy-l1-contracts');
|
|
65
63
|
const { mnemonicToAccount, privateKeyToAccount } = await import('viem/accounts');
|
|
66
64
|
|
|
67
65
|
const account = !privateKey
|
|
@@ -111,7 +109,9 @@ export async function deployNewRollupContracts(
|
|
|
111
109
|
createVerificationJson: string | false,
|
|
112
110
|
logger: Logger,
|
|
113
111
|
): Promise<{ rollup: RollupContract; slashFactoryAddress: EthAddress }> {
|
|
114
|
-
const { createEthereumChain
|
|
112
|
+
const { createEthereumChain } = await import('@aztec/ethereum/chain');
|
|
113
|
+
const { createExtendedL1Client } = await import('@aztec/ethereum/client');
|
|
114
|
+
const { deployRollupForUpgrade } = await import('@aztec/ethereum/deploy-l1-contracts');
|
|
115
115
|
const { mnemonicToAccount, privateKeyToAccount } = await import('viem/accounts');
|
|
116
116
|
const { getVKTreeRoot } = await import('@aztec/noir-protocol-circuits-types/vk-tree');
|
|
117
117
|
|
package/src/utils/commands.ts
CHANGED
|
@@ -112,6 +112,34 @@ export async function getTxSender(pxe: PXE, _from?: string) {
|
|
|
112
112
|
return from;
|
|
113
113
|
}
|
|
114
114
|
|
|
115
|
+
/**
|
|
116
|
+
* Parses and validates a hex string. Removes leading 0x if present, checks for hex validity,
|
|
117
|
+
* and enforces an optional minimum length.
|
|
118
|
+
* @param hex - The hex string to validate.
|
|
119
|
+
* @param minLen - Optional minimum length (in hex characters, after stripping '0x').
|
|
120
|
+
* @returns The normalized hex string (without leading 0x).
|
|
121
|
+
* @throws InvalidArgumentError if the string is not valid hex or does not meet the minimum length.
|
|
122
|
+
*/
|
|
123
|
+
// minLen is now interpreted as the minimum number of bytes (2 hex characters per byte)
|
|
124
|
+
export function parseHex(hex: string, minLen?: number): `0x${string}` {
|
|
125
|
+
const normalized = hex.startsWith('0x') ? hex.slice(2) : hex;
|
|
126
|
+
|
|
127
|
+
if (!/^[0-9a-fA-F]*$/.test(normalized)) {
|
|
128
|
+
throw new InvalidArgumentError('Invalid hex string');
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
if (minLen !== undefined) {
|
|
132
|
+
const minHexLen = minLen * 2;
|
|
133
|
+
if (normalized.length < minHexLen) {
|
|
134
|
+
throw new InvalidArgumentError(
|
|
135
|
+
`Hex string is too short (length ${normalized.length}), minimum byte length is ${minLen} (hex chars: ${minHexLen})`,
|
|
136
|
+
);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
return `0x${normalized}`;
|
|
141
|
+
}
|
|
142
|
+
|
|
115
143
|
/**
|
|
116
144
|
* Removes the leading 0x from a hex string. If no leading 0x is found the string is returned unchanged.
|
|
117
145
|
* @param hex - A hex string
|
|
@@ -166,7 +194,7 @@ export function parseAztecAddress(address: string): AztecAddress {
|
|
|
166
194
|
try {
|
|
167
195
|
return AztecAddress.fromString(address);
|
|
168
196
|
} catch {
|
|
169
|
-
throw new InvalidArgumentError(`Invalid address: ${address}`);
|
|
197
|
+
throw new InvalidArgumentError(`Invalid Aztec address: ${address}`);
|
|
170
198
|
}
|
|
171
199
|
}
|
|
172
200
|
|
|
@@ -180,7 +208,7 @@ export function parseEthereumAddress(address: string): EthAddress {
|
|
|
180
208
|
try {
|
|
181
209
|
return EthAddress.fromString(address);
|
|
182
210
|
} catch {
|
|
183
|
-
throw new InvalidArgumentError(`Invalid
|
|
211
|
+
throw new InvalidArgumentError(`Invalid Ethereumaddress: ${address}`);
|
|
184
212
|
}
|
|
185
213
|
}
|
|
186
214
|
|
|
@@ -234,7 +262,11 @@ export function parseOptionalSelector(selector: string): FunctionSelector | unde
|
|
|
234
262
|
* @returns The parsed integer, or undefined if the input string is falsy.
|
|
235
263
|
* @throws If the input is not a valid integer.
|
|
236
264
|
*/
|
|
237
|
-
export function parseOptionalInteger(
|
|
265
|
+
export function parseOptionalInteger(
|
|
266
|
+
value: string,
|
|
267
|
+
min: number = Number.MIN_SAFE_INTEGER,
|
|
268
|
+
max: number = Number.MAX_SAFE_INTEGER,
|
|
269
|
+
): number | undefined {
|
|
238
270
|
if (!value) {
|
|
239
271
|
return undefined;
|
|
240
272
|
}
|
|
@@ -242,6 +274,12 @@ export function parseOptionalInteger(value: string): number | undefined {
|
|
|
242
274
|
if (!Number.isInteger(parsed)) {
|
|
243
275
|
throw new InvalidArgumentError('Invalid integer.');
|
|
244
276
|
}
|
|
277
|
+
if (parsed < min) {
|
|
278
|
+
throw new InvalidArgumentError(`Value must be greater than ${min}.`);
|
|
279
|
+
}
|
|
280
|
+
if (parsed > max) {
|
|
281
|
+
throw new InvalidArgumentError(`Value must be less than ${max}.`);
|
|
282
|
+
}
|
|
245
283
|
return parsed;
|
|
246
284
|
}
|
|
247
285
|
|
package/src/utils/encoding.ts
CHANGED
package/src/utils/inspect.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
import { BlockNumber } from '@aztec/foundation/branded-types';
|
|
1
2
|
import type { LogFn } from '@aztec/foundation/log';
|
|
2
3
|
import type { AztecNode } from '@aztec/stdlib/interfaces/client';
|
|
3
4
|
import type { TxHash } from '@aztec/stdlib/tx';
|
|
4
5
|
|
|
5
6
|
export async function inspectBlock(
|
|
6
7
|
aztecNode: AztecNode,
|
|
7
|
-
blockNumber:
|
|
8
|
+
blockNumber: BlockNumber,
|
|
8
9
|
log: LogFn,
|
|
9
10
|
opts: { showTxs?: boolean } = {},
|
|
10
11
|
) {
|