@aztec/aztec 0.0.0-test.1 → 0.0.1-commit.1142ef1
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/bin/index.d.ts +1 -1
- package/dest/bin/index.js +23 -12
- package/dest/cli/aztec_start_action.d.ts +1 -1
- package/dest/cli/aztec_start_action.d.ts.map +1 -1
- package/dest/cli/aztec_start_action.js +40 -40
- package/dest/cli/aztec_start_options.d.ts +5 -3
- package/dest/cli/aztec_start_options.d.ts.map +1 -1
- package/dest/cli/aztec_start_options.js +143 -224
- package/dest/cli/cli.d.ts +1 -1
- package/dest/cli/cli.d.ts.map +1 -1
- package/dest/cli/cli.js +12 -7
- package/dest/cli/cmds/migrate_ha_db.d.ts +3 -0
- package/dest/cli/cmds/migrate_ha_db.d.ts.map +1 -0
- package/dest/cli/cmds/migrate_ha_db.js +27 -0
- package/dest/cli/cmds/start_archiver.d.ts +1 -1
- package/dest/cli/cmds/start_archiver.d.ts.map +1 -1
- package/dest/cli/cmds/start_archiver.js +20 -12
- package/dest/cli/cmds/start_bot.d.ts +4 -7
- package/dest/cli/cmds/start_bot.d.ts.map +1 -1
- package/dest/cli/cmds/start_bot.js +25 -14
- package/dest/cli/cmds/start_node.d.ts +2 -2
- package/dest/cli/cmds/start_node.d.ts.map +1 -1
- package/dest/cli/cmds/start_node.js +68 -81
- package/dest/cli/cmds/start_p2p_bootstrap.d.ts +1 -1
- package/dest/cli/cmds/start_p2p_bootstrap.d.ts.map +1 -1
- package/dest/cli/cmds/start_p2p_bootstrap.js +9 -4
- package/dest/cli/cmds/start_prover_agent.d.ts +1 -1
- package/dest/cli/cmds/start_prover_agent.d.ts.map +1 -1
- package/dest/cli/cmds/start_prover_agent.js +33 -4
- package/dest/cli/cmds/start_prover_broker.d.ts +1 -1
- package/dest/cli/cmds/start_prover_broker.d.ts.map +1 -1
- package/dest/cli/cmds/start_prover_broker.js +10 -4
- package/dest/cli/cmds/start_prover_node.d.ts +1 -1
- package/dest/cli/cmds/start_prover_node.d.ts.map +1 -1
- package/dest/cli/cmds/start_prover_node.js +44 -46
- package/dest/cli/cmds/start_txe.d.ts +1 -1
- package/dest/cli/index.d.ts +1 -1
- package/dest/cli/preload_crs.d.ts +3 -0
- package/dest/cli/preload_crs.d.ts.map +1 -0
- package/dest/cli/preload_crs.js +6 -0
- package/dest/cli/release_version.d.ts +2 -0
- package/dest/cli/release_version.d.ts.map +1 -0
- package/dest/cli/release_version.js +14 -0
- package/dest/cli/util.d.ts +38 -7
- package/dest/cli/util.d.ts.map +1 -1
- package/dest/cli/util.js +198 -28
- package/dest/cli/versioning.d.ts +1 -1
- package/dest/cli/versioning.js +3 -3
- package/dest/examples/token.d.ts +1 -1
- package/dest/examples/token.js +31 -18
- package/dest/examples/util.d.ts +5 -6
- package/dest/examples/util.d.ts.map +1 -1
- package/dest/examples/util.js +5 -6
- package/dest/index.d.ts +2 -2
- package/dest/index.d.ts.map +1 -1
- package/dest/index.js +1 -1
- package/dest/local-network/banana_fpc.d.ts +10 -0
- package/dest/local-network/banana_fpc.d.ts.map +1 -0
- package/dest/{sandbox → local-network}/banana_fpc.js +20 -22
- package/dest/local-network/index.d.ts +4 -0
- package/dest/local-network/index.d.ts.map +1 -0
- package/dest/local-network/index.js +3 -0
- package/dest/local-network/local-network.d.ts +72 -0
- package/dest/local-network/local-network.d.ts.map +1 -0
- package/dest/local-network/local-network.js +195 -0
- package/dest/local-network/sponsored_fpc.d.ts +5 -0
- package/dest/local-network/sponsored_fpc.d.ts.map +1 -0
- package/dest/local-network/sponsored_fpc.js +18 -0
- package/dest/mnemonic.d.ts +1 -1
- package/dest/splash.d.ts +1 -1
- package/dest/testing/anvil_test_watcher.d.ts +34 -0
- package/dest/testing/anvil_test_watcher.d.ts.map +1 -0
- package/dest/testing/anvil_test_watcher.js +144 -0
- package/dest/testing/cheat_codes.d.ts +41 -0
- package/dest/testing/cheat_codes.d.ts.map +1 -0
- package/dest/testing/cheat_codes.js +62 -0
- package/dest/testing/epoch_test_settler.d.ts +17 -0
- package/dest/testing/epoch_test_settler.d.ts.map +1 -0
- package/dest/testing/epoch_test_settler.js +52 -0
- package/dest/testing/index.d.ts +5 -0
- package/dest/testing/index.d.ts.map +1 -0
- package/dest/testing/index.js +4 -0
- package/package.json +55 -45
- package/scripts/aztec.sh +63 -0
- package/scripts/compile.sh +44 -0
- package/scripts/extract_function.js +47 -0
- package/scripts/flamegraph.sh +59 -0
- package/scripts/init.sh +35 -0
- package/scripts/new.sh +59 -0
- package/scripts/setup_project.sh +31 -0
- package/src/bin/index.ts +28 -12
- package/src/cli/aztec_start_action.ts +36 -38
- package/src/cli/aztec_start_options.ts +159 -222
- package/src/cli/cli.ts +20 -11
- package/src/cli/cmds/migrate_ha_db.ts +43 -0
- package/src/cli/cmds/start_archiver.ts +21 -15
- package/src/cli/cmds/start_bot.ts +36 -13
- package/src/cli/cmds/start_node.ts +91 -86
- package/src/cli/cmds/start_p2p_bootstrap.ts +12 -4
- package/src/cli/cmds/start_prover_agent.ts +24 -12
- package/src/cli/cmds/start_prover_broker.ts +24 -4
- package/src/cli/cmds/start_prover_node.ts +54 -51
- package/src/cli/preload_crs.ts +7 -0
- package/src/cli/release_version.ts +21 -0
- package/src/cli/util.ts +208 -34
- package/src/cli/versioning.ts +3 -3
- package/src/examples/token.ts +23 -19
- package/src/examples/util.ts +6 -8
- package/src/index.ts +5 -6
- package/src/{sandbox → local-network}/banana_fpc.ts +21 -26
- package/src/local-network/index.ts +7 -0
- package/src/local-network/local-network.ts +238 -0
- package/src/local-network/sponsored_fpc.ts +26 -0
- package/src/testing/anvil_test_watcher.ts +166 -0
- package/src/testing/cheat_codes.ts +79 -0
- package/src/testing/epoch_test_settler.ts +59 -0
- package/src/testing/index.ts +4 -0
- package/dest/cli/chain_l2_config.d.ts +0 -19
- package/dest/cli/chain_l2_config.d.ts.map +0 -1
- package/dest/cli/chain_l2_config.js +0 -56
- package/dest/cli/cmds/start_blob_sink.d.ts +0 -3
- package/dest/cli/cmds/start_blob_sink.d.ts.map +0 -1
- package/dest/cli/cmds/start_blob_sink.js +0 -17
- package/dest/cli/cmds/start_faucet.d.ts +0 -4
- package/dest/cli/cmds/start_faucet.d.ts.map +0 -1
- package/dest/cli/cmds/start_faucet.js +0 -20
- package/dest/cli/cmds/start_pxe.d.ts +0 -16
- package/dest/cli/cmds/start_pxe.d.ts.map +0 -1
- package/dest/cli/cmds/start_pxe.js +0 -95
- package/dest/cli/get_l1_config.d.ts +0 -7
- package/dest/cli/get_l1_config.d.ts.map +0 -1
- package/dest/cli/get_l1_config.js +0 -13
- package/dest/sandbox/banana_fpc.d.ts +0 -11
- package/dest/sandbox/banana_fpc.d.ts.map +0 -1
- package/dest/sandbox/index.d.ts +0 -5
- package/dest/sandbox/index.d.ts.map +0 -1
- package/dest/sandbox/index.js +0 -4
- package/dest/sandbox/sandbox.d.ts +0 -76
- package/dest/sandbox/sandbox.d.ts.map +0 -1
- package/dest/sandbox/sandbox.js +0 -181
- package/dest/sandbox/sponsored_fee_payment_method.d.ts +0 -23
- package/dest/sandbox/sponsored_fee_payment_method.d.ts.map +0 -1
- package/dest/sandbox/sponsored_fee_payment_method.js +0 -36
- package/dest/sandbox/sponsored_fpc.d.ts +0 -6
- package/dest/sandbox/sponsored_fpc.d.ts.map +0 -1
- package/dest/sandbox/sponsored_fpc.js +0 -26
- package/src/cli/chain_l2_config.ts +0 -74
- package/src/cli/cmds/start_blob_sink.ts +0 -31
- package/src/cli/cmds/start_faucet.ts +0 -34
- package/src/cli/cmds/start_pxe.ts +0 -129
- package/src/cli/get_l1_config.ts +0 -18
- package/src/sandbox/index.ts +0 -5
- package/src/sandbox/sandbox.ts +0 -229
- package/src/sandbox/sponsored_fee_payment_method.ts +0 -46
- package/src/sandbox/sponsored_fpc.ts +0 -38
package/src/bin/index.ts
CHANGED
|
@@ -1,21 +1,24 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
//
|
|
3
3
|
import { injectCommands as injectBuilderCommands } from '@aztec/builder';
|
|
4
|
-
import { injectCommands as
|
|
4
|
+
import { injectCommands as injectAztecNodeCommands } from '@aztec/cli/aztec_node';
|
|
5
|
+
import { enrichEnvironmentWithChainName } from '@aztec/cli/config/chain';
|
|
6
|
+
import { enrichEnvironmentWithNetworkConfig } from '@aztec/cli/config/network';
|
|
5
7
|
import { injectCommands as injectContractCommands } from '@aztec/cli/contracts';
|
|
6
|
-
import { injectCommands as injectDevnetCommands } from '@aztec/cli/devnet';
|
|
7
8
|
import { injectCommands as injectInfrastructureCommands } from '@aztec/cli/infrastructure';
|
|
8
9
|
import { injectCommands as injectL1Commands } from '@aztec/cli/l1';
|
|
9
10
|
import { injectCommands as injectMiscCommands } from '@aztec/cli/misc';
|
|
10
|
-
import { injectCommands as
|
|
11
|
+
import { injectCommands as injectValidatorKeysCommands } from '@aztec/cli/validator_keys';
|
|
12
|
+
import { getActiveNetworkName } from '@aztec/foundation/config';
|
|
11
13
|
import { createConsoleLogger, createLogger } from '@aztec/foundation/log';
|
|
12
|
-
import { fileURLToPath } from '@aztec/foundation/url';
|
|
13
14
|
|
|
14
15
|
import { Command } from 'commander';
|
|
15
|
-
import { readFileSync } from 'fs';
|
|
16
|
-
import { dirname, resolve } from 'path';
|
|
17
16
|
|
|
17
|
+
import { injectMigrateCommand } from '../cli/cmds/migrate_ha_db.js';
|
|
18
18
|
import { injectAztecCommands } from '../cli/index.js';
|
|
19
|
+
import { getCliVersion } from '../cli/release_version.js';
|
|
20
|
+
|
|
21
|
+
const NETWORK_FLAG = 'network';
|
|
19
22
|
|
|
20
23
|
const userLog = createConsoleLogger();
|
|
21
24
|
const debugLogger = createLogger('cli');
|
|
@@ -28,19 +31,32 @@ async function main() {
|
|
|
28
31
|
process.once('SIGINT', shutdown);
|
|
29
32
|
process.once('SIGTERM', shutdown);
|
|
30
33
|
|
|
31
|
-
|
|
32
|
-
|
|
34
|
+
// Intercept the setting of a network and enrich the environment with defaults for that network
|
|
35
|
+
let networkValue: string | undefined;
|
|
36
|
+
|
|
37
|
+
const args = process.argv.slice(2);
|
|
38
|
+
const networkIndex = args.findIndex(arg => arg.startsWith(`--${NETWORK_FLAG}=`) || arg === `--${NETWORK_FLAG}`);
|
|
39
|
+
|
|
40
|
+
if (networkIndex !== -1) {
|
|
41
|
+
networkValue = args[networkIndex].split('=')[1] || args[networkIndex + 1];
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
const networkName = getActiveNetworkName(networkValue);
|
|
45
|
+
await enrichEnvironmentWithNetworkConfig(networkName);
|
|
46
|
+
enrichEnvironmentWithChainName(networkName);
|
|
47
|
+
|
|
48
|
+
const cliVersion = getCliVersion();
|
|
33
49
|
let program = new Command('aztec');
|
|
34
50
|
program.description('Aztec command line interface').version(cliVersion);
|
|
35
51
|
program = injectAztecCommands(program, userLog, debugLogger);
|
|
36
52
|
program = injectBuilderCommands(program);
|
|
37
53
|
program = injectContractCommands(program, userLog, debugLogger);
|
|
38
|
-
program = injectInfrastructureCommands(program, userLog
|
|
54
|
+
program = injectInfrastructureCommands(program, userLog);
|
|
39
55
|
program = injectL1Commands(program, userLog, debugLogger);
|
|
40
|
-
program =
|
|
56
|
+
program = injectAztecNodeCommands(program, userLog, debugLogger);
|
|
41
57
|
program = injectMiscCommands(program, userLog);
|
|
42
|
-
program =
|
|
43
|
-
program =
|
|
58
|
+
program = injectValidatorKeysCommands(program, userLog);
|
|
59
|
+
program = injectMigrateCommand(program, userLog);
|
|
44
60
|
|
|
45
61
|
await program.parseAsync(process.argv);
|
|
46
62
|
}
|
|
@@ -4,43 +4,42 @@ import {
|
|
|
4
4
|
startHttpRpcServer,
|
|
5
5
|
} from '@aztec/foundation/json-rpc/server';
|
|
6
6
|
import type { LogFn, Logger } from '@aztec/foundation/log';
|
|
7
|
-
import { fileURLToPath } from '@aztec/foundation/url';
|
|
8
7
|
import type { ChainConfig } from '@aztec/stdlib/config';
|
|
9
|
-
import { AztecNodeApiSchema
|
|
8
|
+
import { AztecNodeApiSchema } from '@aztec/stdlib/interfaces/client';
|
|
10
9
|
import { getVersioningMiddleware } from '@aztec/stdlib/versioning';
|
|
11
10
|
import { getOtelJsonRpcPropagationMiddleware } from '@aztec/telemetry-client';
|
|
12
11
|
|
|
13
|
-
import {
|
|
14
|
-
import { dirname, resolve } from 'path';
|
|
15
|
-
|
|
16
|
-
import { createSandbox } from '../sandbox/index.js';
|
|
12
|
+
import { createLocalNetwork } from '../local-network/index.js';
|
|
17
13
|
import { github, splash } from '../splash.js';
|
|
18
|
-
import {
|
|
14
|
+
import { getCliVersion } from './release_version.js';
|
|
19
15
|
import { extractNamespacedOptions, installSignalHandlers } from './util.js';
|
|
20
16
|
import { getVersions } from './versioning.js';
|
|
21
17
|
|
|
22
|
-
const packageJsonPath = resolve(dirname(fileURLToPath(import.meta.url)), '../../package.json');
|
|
23
|
-
const cliVersion: string = JSON.parse(readFileSync(packageJsonPath).toString()).version;
|
|
24
|
-
|
|
25
18
|
export async function aztecStart(options: any, userLog: LogFn, debugLogger: Logger) {
|
|
26
19
|
// list of 'stop' functions to call when process ends
|
|
27
20
|
const signalHandlers: Array<() => Promise<void>> = [];
|
|
28
21
|
const services: NamespacedApiHandlers = {};
|
|
22
|
+
const adminServices: NamespacedApiHandlers = {};
|
|
29
23
|
let config: ChainConfig | undefined = undefined;
|
|
30
24
|
|
|
31
|
-
if (options.
|
|
32
|
-
const
|
|
33
|
-
const
|
|
25
|
+
if (options.localNetwork) {
|
|
26
|
+
const cliVersion = getCliVersion();
|
|
27
|
+
const localNetwork = extractNamespacedOptions(options, 'local-network');
|
|
28
|
+
localNetwork.testAccounts = true;
|
|
34
29
|
userLog(`${splash}\n${github}\n\n`);
|
|
35
|
-
userLog(`Setting up Aztec
|
|
30
|
+
userLog(`Setting up Aztec local network ${cliVersion}, please stand by...`);
|
|
36
31
|
|
|
37
|
-
const { node,
|
|
32
|
+
const { node, stop } = await createLocalNetwork(
|
|
38
33
|
{
|
|
39
|
-
l1Mnemonic:
|
|
34
|
+
l1Mnemonic: localNetwork.l1Mnemonic,
|
|
40
35
|
l1RpcUrls: options.l1RpcUrls,
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
36
|
+
testAccounts: localNetwork.testAccounts,
|
|
37
|
+
realProofs: false,
|
|
38
|
+
// Setting the epoch duration to 4 by default for local network. This allows the epoch to be "proven" faster, so
|
|
39
|
+
// the users can consume out hash without having to wait for a long time.
|
|
40
|
+
// Note: We are not proving anything in the local network (realProofs == false). But in `createLocalNetwork`,
|
|
41
|
+
// the EpochTestSettler will set the out hash to the outbox when an epoch is complete.
|
|
42
|
+
aztecEpochDuration: 4,
|
|
44
43
|
},
|
|
45
44
|
userLog,
|
|
46
45
|
);
|
|
@@ -48,31 +47,16 @@ export async function aztecStart(options: any, userLog: LogFn, debugLogger: Logg
|
|
|
48
47
|
// Start Node and PXE JSON-RPC server
|
|
49
48
|
signalHandlers.push(stop);
|
|
50
49
|
services.node = [node, AztecNodeApiSchema];
|
|
51
|
-
if (!sandboxOptions.noPXE) {
|
|
52
|
-
services.pxe = [pxe, PXESchema];
|
|
53
|
-
} else {
|
|
54
|
-
userLog(`Not exposing PXE API through JSON-RPC server`);
|
|
55
|
-
}
|
|
56
50
|
} else {
|
|
57
|
-
// If a network is specified, enrich the environment with the chain config
|
|
58
|
-
if (options.network) {
|
|
59
|
-
await enrichEnvironmentWithChainConfig(options.network);
|
|
60
|
-
}
|
|
61
51
|
if (options.node) {
|
|
62
52
|
const { startNode } = await import('./cmds/start_node.js');
|
|
63
|
-
({ config } = await startNode(options, signalHandlers, services, userLog));
|
|
53
|
+
({ config } = await startNode(options, signalHandlers, services, adminServices, userLog));
|
|
64
54
|
} else if (options.bot) {
|
|
65
55
|
const { startBot } = await import('./cmds/start_bot.js');
|
|
66
56
|
await startBot(options, signalHandlers, services, userLog);
|
|
67
57
|
} else if (options.proverNode) {
|
|
68
58
|
const { startProverNode } = await import('./cmds/start_prover_node.js');
|
|
69
59
|
({ config } = await startProverNode(options, signalHandlers, services, userLog));
|
|
70
|
-
} else if (options.blobSink) {
|
|
71
|
-
const { startBlobSink } = await import('./cmds/start_blob_sink.js');
|
|
72
|
-
await startBlobSink(options, signalHandlers, userLog);
|
|
73
|
-
} else if (options.pxe) {
|
|
74
|
-
const { startPXE } = await import('./cmds/start_pxe.js');
|
|
75
|
-
({ config } = await startPXE(options, signalHandlers, services, userLog));
|
|
76
60
|
} else if (options.archiver) {
|
|
77
61
|
const { startArchiver } = await import('./cmds/start_archiver.js');
|
|
78
62
|
({ config } = await startArchiver(options, signalHandlers, services));
|
|
@@ -91,9 +75,6 @@ export async function aztecStart(options: any, userLog: LogFn, debugLogger: Logg
|
|
|
91
75
|
} else if (options.sequencer) {
|
|
92
76
|
userLog(`Cannot run a standalone sequencer without a node`);
|
|
93
77
|
process.exit(1);
|
|
94
|
-
} else if (options.faucet) {
|
|
95
|
-
const { startFaucet } = await import('./cmds/start_faucet.js');
|
|
96
|
-
await startFaucet(options, signalHandlers, services, userLog);
|
|
97
78
|
} else {
|
|
98
79
|
userLog(`No module specified to start`);
|
|
99
80
|
process.exit(1);
|
|
@@ -102,13 +83,30 @@ export async function aztecStart(options: any, userLog: LogFn, debugLogger: Logg
|
|
|
102
83
|
|
|
103
84
|
installSignalHandlers(debugLogger.info, signalHandlers);
|
|
104
85
|
const versions = getVersions(config);
|
|
86
|
+
|
|
87
|
+
// Start the main JSON-RPC server
|
|
105
88
|
if (Object.entries(services).length > 0) {
|
|
106
89
|
const rpcServer = createNamespacedSafeJsonRpcServer(services, {
|
|
107
90
|
http200OnError: false,
|
|
108
91
|
log: debugLogger,
|
|
109
92
|
middlewares: [getOtelJsonRpcPropagationMiddleware(), getVersioningMiddleware(versions)],
|
|
93
|
+
maxBatchSize: options.rpcMaxBatchSize,
|
|
94
|
+
maxBodySizeBytes: options.rpcMaxBodySize,
|
|
110
95
|
});
|
|
111
96
|
const { port } = await startHttpRpcServer(rpcServer, { port: options.port });
|
|
112
97
|
debugLogger.info(`Aztec Server listening on port ${port}`, versions);
|
|
113
98
|
}
|
|
99
|
+
|
|
100
|
+
// If there are any admin services, start a separate JSON-RPC server for them
|
|
101
|
+
if (Object.entries(adminServices).length > 0) {
|
|
102
|
+
const rpcServer = createNamespacedSafeJsonRpcServer(adminServices, {
|
|
103
|
+
http200OnError: false,
|
|
104
|
+
log: debugLogger,
|
|
105
|
+
middlewares: [getOtelJsonRpcPropagationMiddleware(), getVersioningMiddleware(versions)],
|
|
106
|
+
maxBatchSize: options.rpcMaxBatchSize,
|
|
107
|
+
maxBodySizeBytes: options.rpcMaxBodySize,
|
|
108
|
+
});
|
|
109
|
+
const { port } = await startHttpRpcServer(rpcServer, { port: options.adminPort });
|
|
110
|
+
debugLogger.info(`Aztec Server admin API listening on port ${port}`, versions);
|
|
111
|
+
}
|
|
114
112
|
}
|