@aztec/aztec 0.0.1-commit.4d79d1f2d → 0.0.1-commit.4d9804df
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/bin/index.js +9 -3
- package/dest/cli/admin_api_key_store.d.ts +45 -0
- package/dest/cli/admin_api_key_store.d.ts.map +1 -0
- package/dest/cli/admin_api_key_store.js +98 -0
- 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 +69 -32
- package/dest/cli/aztec_start_options.d.ts +2 -2
- package/dest/cli/aztec_start_options.d.ts.map +1 -1
- package/dest/cli/aztec_start_options.js +39 -23
- package/dest/cli/cli.d.ts +1 -1
- package/dest/cli/cli.d.ts.map +1 -1
- package/dest/cli/cli.js +3 -4
- package/dest/cli/cmds/compile.d.ts +4 -0
- package/dest/cli/cmds/compile.d.ts.map +1 -0
- package/dest/cli/cmds/compile.js +174 -0
- package/dest/cli/cmds/profile.d.ts +4 -0
- package/dest/cli/cmds/profile.d.ts.map +1 -0
- package/dest/cli/cmds/profile.js +8 -0
- package/dest/cli/cmds/profile_flamegraph.d.ts +4 -0
- package/dest/cli/cmds/profile_flamegraph.d.ts.map +1 -0
- package/dest/cli/cmds/profile_flamegraph.js +52 -0
- package/dest/cli/cmds/profile_gates.d.ts +4 -0
- package/dest/cli/cmds/profile_gates.d.ts.map +1 -0
- package/dest/cli/cmds/profile_gates.js +76 -0
- package/dest/cli/cmds/profile_utils.d.ts +18 -0
- package/dest/cli/cmds/profile_utils.d.ts.map +1 -0
- package/dest/cli/cmds/profile_utils.js +50 -0
- package/dest/cli/cmds/prover.d.ts +4 -0
- package/dest/cli/cmds/prover.d.ts.map +1 -0
- package/dest/cli/cmds/prover.js +24 -0
- package/dest/cli/cmds/standby.d.ts +56 -0
- package/dest/cli/cmds/standby.d.ts.map +1 -0
- package/dest/cli/cmds/standby.js +140 -0
- package/dest/cli/cmds/start_bot.d.ts +2 -2
- package/dest/cli/cmds/start_bot.d.ts.map +1 -1
- package/dest/cli/cmds/start_bot.js +13 -7
- package/dest/cli/cmds/start_node.d.ts +3 -2
- package/dest/cli/cmds/start_node.d.ts.map +1 -1
- package/dest/cli/cmds/start_node.js +78 -49
- 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 +5 -17
- 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 +22 -13
- package/dest/cli/cmds/start_txe.d.ts +2 -2
- package/dest/cli/cmds/start_txe.d.ts.map +1 -1
- package/dest/cli/cmds/start_txe.js +6 -5
- package/dest/cli/cmds/utils/artifacts.d.ts +26 -0
- package/dest/cli/cmds/utils/artifacts.d.ts.map +1 -0
- package/dest/cli/cmds/utils/artifacts.js +24 -0
- package/dest/cli/cmds/utils/collect_crate_dirs.d.ts +21 -0
- package/dest/cli/cmds/utils/collect_crate_dirs.d.ts.map +1 -0
- package/dest/cli/cmds/utils/collect_crate_dirs.js +114 -0
- package/dest/cli/cmds/utils/needs_recompile.d.ts +10 -0
- package/dest/cli/cmds/utils/needs_recompile.d.ts.map +1 -0
- package/dest/cli/cmds/utils/needs_recompile.js +90 -0
- package/dest/cli/cmds/utils/spawn.d.ts +3 -0
- package/dest/cli/cmds/utils/spawn.d.ts.map +1 -0
- package/dest/cli/cmds/utils/spawn.js +16 -0
- package/dest/cli/cmds/utils/warn_if_aztec_version_mismatch.d.ts +4 -0
- package/dest/cli/cmds/utils/warn_if_aztec_version_mismatch.d.ts.map +1 -0
- package/dest/cli/cmds/utils/warn_if_aztec_version_mismatch.js +61 -0
- package/dest/cli/util.d.ts +10 -6
- package/dest/cli/util.d.ts.map +1 -1
- package/dest/cli/util.js +32 -96
- package/dest/examples/token.js +7 -7
- package/dest/local-network/auth_registry.d.ts +5 -0
- package/dest/local-network/auth_registry.d.ts.map +1 -0
- package/dest/local-network/auth_registry.js +17 -0
- package/dest/local-network/banana_fpc.d.ts +3 -2
- package/dest/local-network/banana_fpc.d.ts.map +1 -1
- package/dest/local-network/banana_fpc.js +12 -8
- package/dest/local-network/local-network.d.ts +12 -32
- package/dest/local-network/local-network.d.ts.map +1 -1
- package/dest/local-network/local-network.js +77 -64
- package/dest/testing/cheat_codes.d.ts +17 -23
- package/dest/testing/cheat_codes.d.ts.map +1 -1
- package/dest/testing/cheat_codes.js +17 -43
- package/dest/testing/epoch_test_settler.d.ts +2 -2
- package/dest/testing/epoch_test_settler.d.ts.map +1 -1
- package/dest/testing/epoch_test_settler.js +6 -26
- package/dest/testing/index.d.ts +3 -2
- package/dest/testing/index.d.ts.map +1 -1
- package/dest/testing/index.js +2 -1
- package/dest/testing/local-network.d.ts +51 -0
- package/dest/testing/local-network.d.ts.map +1 -0
- package/dest/testing/local-network.js +60 -0
- package/dest/testing/token_allowed_setup.d.ts +12 -0
- package/dest/testing/token_allowed_setup.d.ts.map +1 -0
- package/dest/testing/token_allowed_setup.js +24 -0
- package/package.json +35 -34
- package/scripts/add_crate.sh +53 -0
- package/scripts/aztec.sh +15 -5
- package/scripts/init.sh +23 -19
- package/scripts/new.sh +48 -24
- package/scripts/setup_workspace.sh +69 -0
- package/scripts/templates/blank/contract/Nargo.toml +6 -0
- package/scripts/templates/blank/contract/src/main.nr +10 -0
- package/scripts/templates/blank/test/Nargo.toml +7 -0
- package/scripts/templates/blank/test/src/lib.nr +11 -0
- package/scripts/templates/counter/contract/Nargo.toml +7 -0
- package/scripts/templates/counter/contract/src/main.nr +48 -0
- package/scripts/templates/counter/test/Nargo.toml +7 -0
- package/scripts/templates/counter/test/src/lib.nr +32 -0
- package/src/bin/index.ts +9 -3
- package/src/cli/admin_api_key_store.ts +128 -0
- package/src/cli/aztec_start_action.ts +69 -24
- package/src/cli/aztec_start_options.ts +48 -30
- package/src/cli/cli.ts +3 -4
- package/src/cli/cmds/compile.ts +205 -0
- package/src/cli/cmds/profile.ts +26 -0
- package/src/cli/cmds/profile_flamegraph.ts +64 -0
- package/src/cli/cmds/profile_gates.ts +84 -0
- package/src/cli/cmds/profile_utils.ts +58 -0
- package/src/cli/cmds/prover.ts +42 -0
- package/src/cli/cmds/standby.ts +184 -0
- package/src/cli/cmds/start_bot.ts +14 -8
- package/src/cli/cmds/start_node.ts +90 -50
- package/src/cli/cmds/start_prover_agent.ts +5 -8
- package/src/cli/cmds/start_prover_broker.ts +23 -24
- package/src/cli/cmds/start_txe.ts +7 -5
- package/src/cli/cmds/utils/artifacts.ts +49 -0
- package/src/cli/cmds/utils/collect_crate_dirs.ts +118 -0
- package/src/cli/cmds/utils/needs_recompile.ts +98 -0
- package/src/cli/cmds/utils/spawn.ts +16 -0
- package/src/cli/cmds/utils/warn_if_aztec_version_mismatch.ts +76 -0
- package/src/cli/util.ts +33 -100
- package/src/examples/token.ts +17 -7
- package/src/local-network/auth_registry.ts +19 -0
- package/src/local-network/banana_fpc.ts +13 -9
- package/src/local-network/local-network.ts +94 -75
- package/src/testing/cheat_codes.ts +18 -49
- package/src/testing/epoch_test_settler.ts +8 -32
- package/src/testing/index.ts +2 -1
- package/src/testing/local-network.ts +97 -0
- package/src/testing/token_allowed_setup.ts +26 -0
- package/dest/cli/cmds/start_archiver.d.ts +0 -9
- package/dest/cli/cmds/start_archiver.d.ts.map +0 -1
- package/dest/cli/cmds/start_archiver.js +0 -48
- package/dest/cli/cmds/start_prover_node.d.ts +0 -7
- package/dest/cli/cmds/start_prover_node.d.ts.map +0 -1
- package/dest/cli/cmds/start_prover_node.js +0 -108
- package/dest/cli/release_version.d.ts +0 -2
- package/dest/cli/release_version.d.ts.map +0 -1
- package/dest/cli/release_version.js +0 -14
- package/dest/testing/anvil_test_watcher.d.ts +0 -34
- package/dest/testing/anvil_test_watcher.d.ts.map +0 -1
- package/dest/testing/anvil_test_watcher.js +0 -144
- package/scripts/compile.sh +0 -44
- package/scripts/extract_function.js +0 -47
- package/scripts/flamegraph.sh +0 -59
- package/scripts/setup_project.sh +0 -31
- package/src/cli/cmds/start_archiver.ts +0 -50
- package/src/cli/cmds/start_prover_node.ts +0 -124
- package/src/cli/release_version.ts +0 -21
- package/src/testing/anvil_test_watcher.ts +0 -166
|
@@ -1,47 +1,53 @@
|
|
|
1
1
|
#!/usr/bin/env -S node --no-warnings
|
|
2
2
|
import { getInitialTestAccountsData } from '@aztec/accounts/testing';
|
|
3
|
-
import {
|
|
3
|
+
import { createAztecNodeService } from '@aztec/aztec-node';
|
|
4
4
|
import { type AztecNodeConfig, getConfigEnvVars } from '@aztec/aztec-node/config';
|
|
5
5
|
import { Fr } from '@aztec/aztec.js/fields';
|
|
6
6
|
import { createLogger } from '@aztec/aztec.js/log';
|
|
7
7
|
import { type BlobClientInterface, createBlobClient } from '@aztec/blob-client/client';
|
|
8
8
|
import { GENESIS_ARCHIVE_ROOT } from '@aztec/constants';
|
|
9
|
-
import { createEthereumChain } from '@aztec/ethereum/chain';
|
|
10
9
|
import { waitForPublicClient } from '@aztec/ethereum/client';
|
|
11
10
|
import { getL1ContractsConfigEnvVars } from '@aztec/ethereum/config';
|
|
12
11
|
import { NULL_KEY } from '@aztec/ethereum/constants';
|
|
13
12
|
import { deployAztecL1Contracts } from '@aztec/ethereum/deploy-aztec-l1-contracts';
|
|
14
|
-
import {
|
|
13
|
+
import type { L1ContractAddresses } from '@aztec/ethereum/l1-contract-addresses';
|
|
15
14
|
import { SecretValue } from '@aztec/foundation/config';
|
|
16
15
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
17
16
|
import type { LogFn } from '@aztec/foundation/log';
|
|
18
17
|
import { DateProvider, TestDateProvider } from '@aztec/foundation/timer';
|
|
19
18
|
import { getVKTreeRoot } from '@aztec/noir-protocol-circuits-types/vk-tree';
|
|
20
19
|
import { protocolContractsHash } from '@aztec/protocol-contracts';
|
|
21
|
-
import
|
|
20
|
+
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
21
|
+
import type { ProvingJobBroker } from '@aztec/stdlib/interfaces/server';
|
|
22
|
+
import { TxStatus } from '@aztec/stdlib/tx';
|
|
23
|
+
import type { GenesisData } from '@aztec/stdlib/world-state';
|
|
22
24
|
import {
|
|
23
25
|
type TelemetryClient,
|
|
24
26
|
getConfigEnvVars as getTelemetryClientConfig,
|
|
25
27
|
initTelemetryClient,
|
|
26
28
|
} from '@aztec/telemetry-client';
|
|
27
29
|
import { EmbeddedWallet } from '@aztec/wallets/embedded';
|
|
28
|
-
import {
|
|
30
|
+
import { createFundedInitializerlessAccounts } from '@aztec/wallets/testing';
|
|
29
31
|
import { getGenesisValues } from '@aztec/world-state/testing';
|
|
30
32
|
|
|
31
|
-
import {
|
|
33
|
+
import type { Hex } from 'viem';
|
|
32
34
|
import { mnemonicToAccount, privateKeyToAddress } from 'viem/accounts';
|
|
33
35
|
import { foundry } from 'viem/chains';
|
|
34
36
|
|
|
35
37
|
import { createAccountLogs } from '../cli/util.js';
|
|
36
38
|
import { DefaultMnemonic } from '../mnemonic.js';
|
|
37
|
-
import {
|
|
38
|
-
import {
|
|
39
|
+
import { getTokenAllowedSetupFunctions } from '../testing/token_allowed_setup.js';
|
|
40
|
+
import { publishStandardAuthRegistry } from './auth_registry.js';
|
|
39
41
|
import { getBananaFPCAddress, setupBananaFPC } from './banana_fpc.js';
|
|
40
42
|
import { getSponsoredFPCAddress } from './sponsored_fpc.js';
|
|
41
43
|
|
|
42
44
|
const logger = createLogger('local-network');
|
|
43
45
|
|
|
44
|
-
|
|
46
|
+
// The embedded wallet defaults to waiting for PROPOSED, which returns as soon as a tx lands in a
|
|
47
|
+
// proposed L2 block. That is flaky for the serial sandbox setup below: a proposed block can be
|
|
48
|
+
// pruned before its checkpoint is published, dropping a tx we already moved on from ("Tx dropped by
|
|
49
|
+
// P2P node"). Wait for the checkpoint so each setup tx is durably included before the next is sent.
|
|
50
|
+
const setupWaitOpts = { waitForStatus: TxStatus.CHECKPOINTED };
|
|
45
51
|
|
|
46
52
|
/**
|
|
47
53
|
* Function to deploy our L1 contracts to the local network L1
|
|
@@ -55,7 +61,7 @@ export async function deployContractsToL1(
|
|
|
55
61
|
genesisArchiveRoot?: Fr;
|
|
56
62
|
feeJuicePortalInitialBalance?: bigint;
|
|
57
63
|
} = {},
|
|
58
|
-
) {
|
|
64
|
+
): Promise<L1ContractAddresses> {
|
|
59
65
|
await waitForPublicClient(aztecNodeConfig);
|
|
60
66
|
|
|
61
67
|
const l1Contracts = await deployAztecL1Contracts(aztecNodeConfig.l1RpcUrls[0], privateKey, foundry.id, {
|
|
@@ -66,14 +72,14 @@ export async function deployContractsToL1(
|
|
|
66
72
|
genesisArchiveRoot: opts.genesisArchiveRoot ?? new Fr(GENESIS_ARCHIVE_ROOT),
|
|
67
73
|
feeJuicePortalInitialBalance: opts.feeJuicePortalInitialBalance,
|
|
68
74
|
aztecTargetCommitteeSize: 0, // no committee in local network
|
|
69
|
-
|
|
75
|
+
slasherEnabled: false, // no slashing in local network
|
|
70
76
|
realVerifier: false,
|
|
71
77
|
});
|
|
72
78
|
|
|
73
|
-
aztecNodeConfig
|
|
79
|
+
Object.assign(aztecNodeConfig, l1Contracts.l1ContractAddresses);
|
|
74
80
|
aztecNodeConfig.rollupVersion = l1Contracts.rollupVersion;
|
|
75
81
|
|
|
76
|
-
return
|
|
82
|
+
return l1Contracts.l1ContractAddresses;
|
|
77
83
|
}
|
|
78
84
|
|
|
79
85
|
/** Local network settings. */
|
|
@@ -82,6 +88,8 @@ export type LocalNetworkConfig = AztecNodeConfig & {
|
|
|
82
88
|
l1Mnemonic: string;
|
|
83
89
|
/** Whether to deploy test accounts on local network start.*/
|
|
84
90
|
testAccounts: boolean;
|
|
91
|
+
/** Override the default per-address fee juice granted at genesis to funded addresses. */
|
|
92
|
+
initialAccountFeeJuice?: Fr;
|
|
85
93
|
};
|
|
86
94
|
|
|
87
95
|
/**
|
|
@@ -99,18 +107,48 @@ export async function createLocalNetwork(config: Partial<LocalNetworkConfig> = {
|
|
|
99
107
|
logger.warn(`Multiple L1 RPC URLs provided. Local networks will only use the first one: ${l1RpcUrl}`);
|
|
100
108
|
}
|
|
101
109
|
|
|
110
|
+
// The local network deploys a banana FPC with Token contracts, so include Token entries
|
|
111
|
+
// in the setup allowlist so FPC-based fee payments work out of the box.
|
|
112
|
+
const tokenAllowList = await getTokenAllowedSetupFunctions();
|
|
113
|
+
|
|
114
|
+
const envConfig = getConfigEnvVars();
|
|
102
115
|
const aztecNodeConfig: AztecNodeConfig = {
|
|
103
|
-
...
|
|
116
|
+
...envConfig,
|
|
104
117
|
...config,
|
|
118
|
+
skipOrphanProposedBlockPruning: true,
|
|
119
|
+
// The local network builds node config from env without a DATA_DIRECTORY, so the validator's
|
|
120
|
+
// local signing protection runs against an ephemeral store. That is acceptable for this dev
|
|
121
|
+
// network; production validators must persist it and fail-fast when the data directory is unset.
|
|
122
|
+
allowEphemeralSigningProtection: config.allowEphemeralSigningProtection ?? true,
|
|
123
|
+
txPublicSetupAllowListExtend: [...tokenAllowList, ...(config.txPublicSetupAllowListExtend ?? [])],
|
|
124
|
+
// The local network runs against anvil with no committee, so it defaults to the deterministic
|
|
125
|
+
// AutomineSequencer, which owns L1 time control (warps the dateProvider and L1 timestamps to slot
|
|
126
|
+
// boundaries as it builds), replacing the deleted AnvilTestWatcher. This remains true when p2p is
|
|
127
|
+
// enabled for local peer testing; local-network is not a mode for connecting to an existing network.
|
|
128
|
+
useAutomineSequencer: config.useAutomineSequencer ?? true,
|
|
129
|
+
// The AutomineSequencer owns epoch proving in the local network — it writes epoch out hashes to
|
|
130
|
+
// the L1 Outbox and advances the proven tip as checkpoints land, through the same serial queue as
|
|
131
|
+
// its builds — replacing the standalone EpochTestSettler that used to race the build loop.
|
|
132
|
+
automineEnableProveEpoch: config.automineEnableProveEpoch ?? true,
|
|
133
|
+
// Defaults for the local network / sandbox; callers (e.g. the CLI) may override. No real proving
|
|
134
|
+
// happens here — the AutomineSequencer synthetically settles epochs. Short epochs let it write out
|
|
135
|
+
// hashes quickly (so users can consume L2-to-L1 messages without a long wait), with a wider
|
|
136
|
+
// proof-submission window so the synthetic settler has headroom before the rollup would prune an
|
|
137
|
+
// unproven checkpoint.
|
|
138
|
+
realProofs: config.realProofs ?? false,
|
|
139
|
+
aztecEpochDuration: config.aztecEpochDuration ?? 4,
|
|
140
|
+
aztecProofSubmissionEpochs: config.aztecProofSubmissionEpochs ?? 2,
|
|
105
141
|
};
|
|
106
142
|
const hdAccount = mnemonicToAccount(config.l1Mnemonic || DefaultMnemonic);
|
|
107
143
|
if (
|
|
108
|
-
aztecNodeConfig.
|
|
109
|
-
!aztecNodeConfig.
|
|
110
|
-
aztecNodeConfig.
|
|
144
|
+
aztecNodeConfig.sequencerPublisherPrivateKeys == undefined ||
|
|
145
|
+
!aztecNodeConfig.sequencerPublisherPrivateKeys.length ||
|
|
146
|
+
aztecNodeConfig.sequencerPublisherPrivateKeys[0].getValue() === NULL_KEY
|
|
111
147
|
) {
|
|
112
148
|
const privKey = hdAccount.getHdKey().privateKey;
|
|
113
|
-
aztecNodeConfig.
|
|
149
|
+
aztecNodeConfig.sequencerPublisherPrivateKeys = [
|
|
150
|
+
new SecretValue(`0x${Buffer.from(privKey!).toString('hex')}` as const),
|
|
151
|
+
];
|
|
114
152
|
}
|
|
115
153
|
if (!aztecNodeConfig.validatorPrivateKeys?.getValue().length) {
|
|
116
154
|
const privKey = hdAccount.getHdKey().privateKey;
|
|
@@ -123,7 +161,7 @@ export async function createLocalNetwork(config: Partial<LocalNetworkConfig> = {
|
|
|
123
161
|
const initialAccounts = await (async () => {
|
|
124
162
|
if (config.testAccounts === true || config.testAccounts === undefined) {
|
|
125
163
|
if (aztecNodeConfig.p2pEnabled) {
|
|
126
|
-
userLog(`Not setting up test accounts
|
|
164
|
+
userLog(`Not setting up test accounts when p2p is enabled`);
|
|
127
165
|
} else {
|
|
128
166
|
userLog(`Setting up test accounts`);
|
|
129
167
|
return await getInitialTestAccountsData();
|
|
@@ -134,71 +172,46 @@ export async function createLocalNetwork(config: Partial<LocalNetworkConfig> = {
|
|
|
134
172
|
|
|
135
173
|
const bananaFPC = await getBananaFPCAddress(initialAccounts);
|
|
136
174
|
const sponsoredFPC = await getSponsoredFPCAddress();
|
|
137
|
-
const
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
175
|
+
const prefundAddresses = (aztecNodeConfig.prefundAddresses ?? []).map(a => AztecAddress.fromStringUnsafe(a));
|
|
176
|
+
const fundedAddresses = [
|
|
177
|
+
...initialAccounts.map(a => a.address),
|
|
178
|
+
...(initialAccounts.length ? [bananaFPC, sponsoredFPC] : []),
|
|
179
|
+
...prefundAddresses,
|
|
180
|
+
];
|
|
181
|
+
const { genesisArchiveRoot, genesis, fundingNeeded } = await getGenesisValues(
|
|
182
|
+
fundedAddresses,
|
|
183
|
+
config.initialAccountFeeJuice,
|
|
184
|
+
);
|
|
141
185
|
|
|
142
186
|
const dateProvider = new TestDateProvider();
|
|
143
187
|
|
|
144
|
-
let cheatcodes: EthCheatCodes | undefined;
|
|
145
|
-
let rollupAddress: EthAddress | undefined;
|
|
146
|
-
let watcher: AnvilTestWatcher | undefined;
|
|
147
188
|
if (!aztecNodeConfig.p2pEnabled) {
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
{
|
|
152
|
-
genesisArchiveRoot,
|
|
153
|
-
feeJuicePortalInitialBalance: fundingNeeded,
|
|
154
|
-
},
|
|
155
|
-
));
|
|
156
|
-
|
|
157
|
-
const chain =
|
|
158
|
-
aztecNodeConfig.l1RpcUrls.length > 0
|
|
159
|
-
? createEthereumChain([l1RpcUrl], aztecNodeConfig.l1ChainId)
|
|
160
|
-
: { chainInfo: localAnvil };
|
|
161
|
-
|
|
162
|
-
const publicClient = createPublicClient({
|
|
163
|
-
chain: chain.chainInfo,
|
|
164
|
-
transport: fallback([httpViemTransport(l1RpcUrl)]) as any,
|
|
189
|
+
await deployContractsToL1(aztecNodeConfig, aztecNodeConfig.validatorPrivateKeys.getValue()[0], {
|
|
190
|
+
genesisArchiveRoot,
|
|
191
|
+
feeJuicePortalInitialBalance: fundingNeeded,
|
|
165
192
|
});
|
|
166
|
-
|
|
167
|
-
cheatcodes = new EthCheatCodes([l1RpcUrl], dateProvider);
|
|
168
|
-
|
|
169
|
-
watcher = new AnvilTestWatcher(cheatcodes, rollupAddress, publicClient, dateProvider);
|
|
170
|
-
watcher.setisLocalNetwork(true);
|
|
171
|
-
watcher.setIsMarkingAsProven(false); // Do not mark as proven in the watcher. It's marked in the epochTestSettler after the out hash is set.
|
|
172
|
-
|
|
173
|
-
await watcher.start();
|
|
174
193
|
}
|
|
175
194
|
|
|
176
195
|
const telemetry = await initTelemetryClient(getTelemetryClientConfig());
|
|
177
196
|
// Create a local blob client client inside the local network, no http connectivity
|
|
178
197
|
const blobClient = createBlobClient();
|
|
179
|
-
const node = await createAztecNode(aztecNodeConfig, { telemetry, blobClient, dateProvider }, {
|
|
180
|
-
|
|
181
|
-
let epochTestSettler: EpochTestSettler | undefined;
|
|
182
|
-
if (!aztecNodeConfig.p2pEnabled) {
|
|
183
|
-
epochTestSettler = new EpochTestSettler(
|
|
184
|
-
cheatcodes!,
|
|
185
|
-
rollupAddress!,
|
|
186
|
-
node.getBlockSource(),
|
|
187
|
-
logger.createChild('epoch-settler'),
|
|
188
|
-
{ pollingIntervalMs: 200 },
|
|
189
|
-
);
|
|
190
|
-
await epochTestSettler.start();
|
|
191
|
-
}
|
|
198
|
+
const node = await createAztecNode(aztecNodeConfig, { telemetry, blobClient, dateProvider }, { genesis });
|
|
192
199
|
|
|
193
200
|
if (initialAccounts.length) {
|
|
194
|
-
const wallet = await EmbeddedWallet.create(node, {
|
|
201
|
+
const wallet = await EmbeddedWallet.create(node, {
|
|
202
|
+
pxeConfig: { proverEnabled: aztecNodeConfig.realProofs },
|
|
203
|
+
ephemeral: true,
|
|
204
|
+
});
|
|
195
205
|
|
|
196
206
|
userLog('Setting up funded test accounts...');
|
|
197
|
-
const accountManagers = await
|
|
207
|
+
const accountManagers = await createFundedInitializerlessAccounts(wallet, initialAccounts);
|
|
198
208
|
const accLogs = await createAccountLogs(accountManagers, wallet);
|
|
199
209
|
userLog(accLogs.join(''));
|
|
200
210
|
|
|
201
|
-
|
|
211
|
+
userLog('Publishing standard AuthRegistry contract...');
|
|
212
|
+
await publishStandardAuthRegistry(wallet, initialAccounts[0].address, setupWaitOpts);
|
|
213
|
+
|
|
214
|
+
await setupBananaFPC(initialAccounts, wallet, userLog, setupWaitOpts);
|
|
202
215
|
|
|
203
216
|
userLog(`SponsoredFPC: ${await getSponsoredFPCAddress()}`);
|
|
204
217
|
|
|
@@ -208,8 +221,6 @@ export async function createLocalNetwork(config: Partial<LocalNetworkConfig> = {
|
|
|
208
221
|
|
|
209
222
|
const stop = async () => {
|
|
210
223
|
await node.stop();
|
|
211
|
-
await watcher?.stop();
|
|
212
|
-
await epochTestSettler?.stop();
|
|
213
224
|
};
|
|
214
225
|
|
|
215
226
|
return { node, stop };
|
|
@@ -221,16 +232,24 @@ export async function createLocalNetwork(config: Partial<LocalNetworkConfig> = {
|
|
|
221
232
|
*/
|
|
222
233
|
export async function createAztecNode(
|
|
223
234
|
config: Partial<AztecNodeConfig> = {},
|
|
224
|
-
deps: {
|
|
225
|
-
|
|
235
|
+
deps: {
|
|
236
|
+
telemetry?: TelemetryClient;
|
|
237
|
+
blobClient?: BlobClientInterface;
|
|
238
|
+
dateProvider?: DateProvider;
|
|
239
|
+
proverBroker?: ProvingJobBroker;
|
|
240
|
+
} = {},
|
|
241
|
+
options: { genesis?: GenesisData } = {},
|
|
226
242
|
) {
|
|
227
243
|
// TODO(#12272): will clean this up. This is criminal.
|
|
228
|
-
|
|
244
|
+
// Not sure why this was ever done. Will be fixed in A-989, A-991, A-990.
|
|
229
245
|
const aztecNodeConfig: AztecNodeConfig = {
|
|
230
|
-
...
|
|
246
|
+
...getConfigEnvVars(),
|
|
231
247
|
...config,
|
|
232
|
-
l1Contracts: { ...l1Contracts, ...config.l1Contracts },
|
|
233
248
|
};
|
|
234
|
-
const node = await
|
|
249
|
+
const node = await createAztecNodeService(
|
|
250
|
+
aztecNodeConfig,
|
|
251
|
+
{ ...deps, proverNodeDeps: { broker: deps.proverBroker } },
|
|
252
|
+
options,
|
|
253
|
+
);
|
|
235
254
|
return node;
|
|
236
255
|
}
|
|
@@ -1,15 +1,10 @@
|
|
|
1
1
|
import { EthCheatCodes, RollupCheatCodes } from '@aztec/ethereum/test';
|
|
2
|
-
import { BlockNumber } from '@aztec/foundation/branded-types';
|
|
3
|
-
import { retryUntil } from '@aztec/foundation/retry';
|
|
4
2
|
import type { DateProvider } from '@aztec/foundation/timer';
|
|
5
|
-
import type {
|
|
6
|
-
import type { AztecNode } from '@aztec/stdlib/interfaces/client';
|
|
3
|
+
import type { AztecNode, AztecNodeDebug } from '@aztec/stdlib/interfaces/client';
|
|
7
4
|
|
|
8
5
|
/**
|
|
9
|
-
*
|
|
10
|
-
* @deprecated
|
|
11
|
-
* they became unused (we now have better testing tools). If you are introducing a new functionality to the cheat
|
|
12
|
-
* codes, please consider whether it makes sense to just introduce new utils in your tests instead.
|
|
6
|
+
* Wrapper for Aztec Debug API.
|
|
7
|
+
* @deprecated use the AztecNode debug API directly.
|
|
13
8
|
*/
|
|
14
9
|
export class CheatCodes {
|
|
15
10
|
constructor(
|
|
@@ -29,51 +24,25 @@ export class CheatCodes {
|
|
|
29
24
|
}
|
|
30
25
|
|
|
31
26
|
/**
|
|
32
|
-
* Warps the L1 timestamp to
|
|
33
|
-
* the target
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
* @
|
|
37
|
-
* @param node - The Aztec node used to query if a new block has been mined.
|
|
38
|
-
* @param targetTimestamp - The target timestamp to warp to (in seconds)
|
|
27
|
+
* Warps the L1 timestamp to at least `targetTimestamp` and mines an L2 block advancing the L2 timestamp to at least
|
|
28
|
+
* the target. Forwards to the node's debug API, which serializes the warp through the automine sequencer queue.
|
|
29
|
+
* @param node - The Aztec node whose debug API performs the warp. Must run an automine sequencer.
|
|
30
|
+
* @param targetTimestamp - The target timestamp to warp to (in seconds).
|
|
31
|
+
* @deprecated Call `node.warpL2TimeAtLeastTo(targetTimestamp)` on the node debug API directly.
|
|
39
32
|
*/
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
// We warp the L1 timestamp
|
|
44
|
-
await this.eth.warp(targetTimestamp, { resetBlockInterval: true });
|
|
45
|
-
|
|
46
|
-
// Wait until an L2 block is mined
|
|
47
|
-
const sequencer = sequencerClient.getSequencer();
|
|
48
|
-
const minTxsPerBlock = sequencer.getConfig().minTxsPerBlock;
|
|
49
|
-
sequencer.updateConfig({ minTxsPerBlock: 0 });
|
|
50
|
-
|
|
51
|
-
await retryUntil(
|
|
52
|
-
async () => {
|
|
53
|
-
const newL2BlockNumber: BlockNumber = await node.getBlockNumber();
|
|
54
|
-
return newL2BlockNumber > currentL2BlockNumber;
|
|
55
|
-
},
|
|
56
|
-
'new block after warping L2 time',
|
|
57
|
-
36,
|
|
58
|
-
1,
|
|
59
|
-
);
|
|
60
|
-
|
|
61
|
-
// Restore original minTxsPerBlock
|
|
62
|
-
sequencer.updateConfig({ minTxsPerBlock });
|
|
33
|
+
warpL2TimeAtLeastTo(node: AztecNode & AztecNodeDebug, targetTimestamp: bigint | number): Promise<void> {
|
|
34
|
+
return node.warpL2TimeAtLeastTo(Number(targetTimestamp));
|
|
63
35
|
}
|
|
64
36
|
|
|
65
37
|
/**
|
|
66
|
-
* Warps the L1 timestamp forward by
|
|
67
|
-
* least by the duration.
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
* @param
|
|
71
|
-
* @
|
|
72
|
-
* @param duration - The duration to advance time by (in seconds)
|
|
38
|
+
* Warps the L1 timestamp forward by at least `duration` seconds and mines an L2 block advancing the L2 timestamp at
|
|
39
|
+
* least by the duration. Forwards to the node's debug API, which serializes the warp through the automine sequencer
|
|
40
|
+
* queue.
|
|
41
|
+
* @param node - The Aztec node whose debug API performs the warp. Must run an automine sequencer.
|
|
42
|
+
* @param duration - The duration to advance time by (in seconds).
|
|
43
|
+
* @deprecated Call `node.warpL2TimeAtLeastBy(duration)` on the node debug API directly.
|
|
73
44
|
*/
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
const targetTimestamp = BigInt(currentTimestamp) + BigInt(duration);
|
|
77
|
-
await this.warpL2TimeAtLeastTo(sequencerClient, node, targetTimestamp);
|
|
45
|
+
warpL2TimeAtLeastBy(node: AztecNode & AztecNodeDebug, duration: bigint | number): Promise<void> {
|
|
46
|
+
return node.warpL2TimeAtLeastBy(Number(duration));
|
|
78
47
|
}
|
|
79
48
|
}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { Fr } from '@aztec/aztec.js/fields';
|
|
2
1
|
import { type EthCheatCodes, RollupCheatCodes } from '@aztec/ethereum/test';
|
|
3
|
-
import {
|
|
2
|
+
import type { EpochNumber } from '@aztec/foundation/branded-types';
|
|
4
3
|
import type { Logger } from '@aztec/foundation/log';
|
|
4
|
+
import { settleEpochOutbox } from '@aztec/prover-client/test';
|
|
5
5
|
import { EpochMonitor } from '@aztec/prover-node';
|
|
6
6
|
import type { EthAddress, L2BlockSource } from '@aztec/stdlib/block';
|
|
7
|
-
import { computeL2ToL1MembershipWitnessFromMessagesInEpoch } from '@aztec/stdlib/messaging';
|
|
8
7
|
|
|
9
8
|
export class EpochTestSettler {
|
|
10
9
|
private rollupCheatCodes: RollupCheatCodes;
|
|
@@ -31,35 +30,12 @@ export class EpochTestSettler {
|
|
|
31
30
|
}
|
|
32
31
|
|
|
33
32
|
async handleEpochReadyToProve(epoch: EpochNumber): Promise<boolean> {
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
);
|
|
40
|
-
const messagesInEpoch: Fr[][][][] = [];
|
|
41
|
-
let previousSlotNumber = SlotNumber.ZERO;
|
|
42
|
-
let checkpointIndex = -1;
|
|
43
|
-
|
|
44
|
-
for (const block of blocks) {
|
|
45
|
-
const slotNumber = block.header.globalVariables.slotNumber;
|
|
46
|
-
if (slotNumber !== previousSlotNumber) {
|
|
47
|
-
checkpointIndex++;
|
|
48
|
-
messagesInEpoch[checkpointIndex] = [];
|
|
49
|
-
previousSlotNumber = slotNumber;
|
|
50
|
-
}
|
|
51
|
-
messagesInEpoch[checkpointIndex].push(block.body.txEffects.map(txEffect => txEffect.l2ToL1Msgs));
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
const [firstMessage] = messagesInEpoch.flat(3);
|
|
55
|
-
if (firstMessage) {
|
|
56
|
-
const { root: outHash } = computeL2ToL1MembershipWitnessFromMessagesInEpoch(messagesInEpoch, firstMessage);
|
|
57
|
-
await this.rollupCheatCodes.insertOutbox(epoch, outHash.toBigInt());
|
|
58
|
-
} else {
|
|
59
|
-
this.log.info(`No L2 to L1 messages in epoch ${epoch}`);
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
const lastCheckpoint = checkpointedBlocks.at(-1)?.checkpointNumber;
|
|
33
|
+
const lastCheckpoint = await settleEpochOutbox({
|
|
34
|
+
rollupCheatCodes: this.rollupCheatCodes,
|
|
35
|
+
l2BlockSource: this.l2BlockSource,
|
|
36
|
+
epoch,
|
|
37
|
+
log: this.log,
|
|
38
|
+
});
|
|
63
39
|
if (lastCheckpoint !== undefined) {
|
|
64
40
|
await this.rollupCheatCodes.markAsProven(lastCheckpoint);
|
|
65
41
|
} else {
|
package/src/testing/index.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
export { AnvilTestWatcher } from './anvil_test_watcher.js';
|
|
2
1
|
export { EthCheatCodes, RollupCheatCodes } from '@aztec/ethereum/test';
|
|
3
2
|
export { CheatCodes } from './cheat_codes.js';
|
|
4
3
|
export { EpochTestSettler } from './epoch_test_settler.js';
|
|
4
|
+
export { setupLocalNetwork, TEST_FEE_PADDING, type LocalNetwork, type LocalNetworkOptions } from './local-network.js';
|
|
5
|
+
export { getTokenAllowedSetupFunctions } from './token_allowed_setup.js';
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import type { AztecNodeService } from '@aztec/aztec-node';
|
|
2
|
+
import type { AztecNodeConfig } from '@aztec/aztec-node/config';
|
|
3
|
+
import type { Fr } from '@aztec/aztec.js/fields';
|
|
4
|
+
import { startAnvil } from '@aztec/ethereum/test';
|
|
5
|
+
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
6
|
+
|
|
7
|
+
import { foundry } from 'viem/chains';
|
|
8
|
+
|
|
9
|
+
import { createLocalNetwork } from '../local-network/local-network.js';
|
|
10
|
+
|
|
11
|
+
/** A running in-process local network: an inline Aztec node backed by its own anvil L1. */
|
|
12
|
+
export interface LocalNetwork extends AsyncDisposable {
|
|
13
|
+
/** Fully-synced Aztec node, ready to serve client requests. */
|
|
14
|
+
node: AztecNodeService;
|
|
15
|
+
/** RPC URL of the spawned anvil instance. */
|
|
16
|
+
l1RpcUrl: string;
|
|
17
|
+
/** Chain id used on L1 (foundry's default 31337). */
|
|
18
|
+
l1ChainId: number;
|
|
19
|
+
/** Stops every process started by the fixture: node and anvil. Also invoked by `await using`. */
|
|
20
|
+
stop: () => Promise<void>;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/** Options for {@link setupLocalNetwork}. */
|
|
24
|
+
export interface LocalNetworkOptions {
|
|
25
|
+
/**
|
|
26
|
+
* Addresses that should hold fee juice at genesis. Saves each of these the round-trip of bridging
|
|
27
|
+
* + claiming fee juice before they can pay for gas.
|
|
28
|
+
*/
|
|
29
|
+
fundedAddresses?: AztecAddress[];
|
|
30
|
+
/** Override the default per-address genesis fee juice granted to {@link fundedAddresses}. */
|
|
31
|
+
initialAccountFeeJuice?: Fr;
|
|
32
|
+
/** Node config overrides, e.g. `realProofs`, `aztecEpochDuration`, `p2pEnabled`. */
|
|
33
|
+
config?: Partial<AztecNodeConfig>;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Spin up an in-process local network with the given addresses pre-funded.
|
|
38
|
+
*
|
|
39
|
+
* Each call spawns its own anvil on an OS-assigned random port and runs the Aztec node inline via
|
|
40
|
+
* the same {@link createLocalNetwork} codepath that backs `aztec start --local-network` (with the
|
|
41
|
+
* sandbox account/FPC/token setup skipped). Distinct ports let independent suites run in parallel.
|
|
42
|
+
* The caller must `await result.stop()` in its teardown (or hold the result with `await using`).
|
|
43
|
+
*
|
|
44
|
+
* Requires a Foundry toolchain (`anvil`/`forge`), installed via `aztec-up` or `foundryup`. Binaries
|
|
45
|
+
* are located in the standard install directories or on `PATH`; set `$ANVIL_BIN` / `$FORGE_BIN` to
|
|
46
|
+
* pin specific ones.
|
|
47
|
+
*/
|
|
48
|
+
export async function setupLocalNetwork(opts: LocalNetworkOptions = {}): Promise<LocalNetwork> {
|
|
49
|
+
// `--port 0` → anvil binds an ephemeral port that `startAnvil` reads back, so parallel suites
|
|
50
|
+
// never collide on a fixed port.
|
|
51
|
+
const { rpcUrl, stop: stopAnvil } = await startAnvil({ port: 0 });
|
|
52
|
+
|
|
53
|
+
try {
|
|
54
|
+
const { node, stop: stopNode } = await createLocalNetwork(
|
|
55
|
+
{
|
|
56
|
+
...opts.config,
|
|
57
|
+
l1RpcUrls: [rpcUrl],
|
|
58
|
+
testAccounts: false,
|
|
59
|
+
prefundAddresses: (opts.fundedAddresses ?? []).map(a => a.toString()),
|
|
60
|
+
initialAccountFeeJuice: opts.initialAccountFeeJuice,
|
|
61
|
+
},
|
|
62
|
+
() => {},
|
|
63
|
+
);
|
|
64
|
+
|
|
65
|
+
// Stop the node before anvil (its teardown still talks to L1); the finally guarantees anvil is
|
|
66
|
+
// reaped even if node shutdown throws.
|
|
67
|
+
const stop = async () => {
|
|
68
|
+
try {
|
|
69
|
+
await stopNode();
|
|
70
|
+
} finally {
|
|
71
|
+
await stopAnvil();
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
return {
|
|
76
|
+
node,
|
|
77
|
+
l1RpcUrl: rpcUrl,
|
|
78
|
+
l1ChainId: foundry.id,
|
|
79
|
+
stop,
|
|
80
|
+
[Symbol.asyncDispose]: stop,
|
|
81
|
+
};
|
|
82
|
+
} catch (err) {
|
|
83
|
+
await stopAnvil();
|
|
84
|
+
throw err;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Min-fee padding multiplier for test wallets whose txs may mine well after their fee estimate.
|
|
90
|
+
* The automine sequencer builds one block per tx and advances L1 time in big jumps, and proposer
|
|
91
|
+
* pipelining evolves the fee-asset price across the build/publish gap (~20x observed in CI), so the
|
|
92
|
+
* network's congestion base fee can swing sharply between the wallet's fee estimate and the block
|
|
93
|
+
* the tx actually lands in. The default wallet padding isn't enough and trips
|
|
94
|
+
* `maxFeesPerGas.feePerL2Gas must be >= gasFees.feePerL2Gas`. Apply via
|
|
95
|
+
* `wallet.setMinFeePadding(TEST_FEE_PADDING)` on every test wallet that sends txs.
|
|
96
|
+
*/
|
|
97
|
+
export const TEST_FEE_PADDING = 30;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { TokenContractArtifact } from '@aztec/noir-contracts.js/Token';
|
|
2
|
+
import { buildAllowedElement } from '@aztec/p2p/msg_validators';
|
|
3
|
+
import type { ContractArtifact } from '@aztec/stdlib/abi';
|
|
4
|
+
import { getContractClassFromArtifact } from '@aztec/stdlib/contract';
|
|
5
|
+
import type { AllowedElement } from '@aztec/stdlib/interfaces/server';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Returns the allowlist entries needed for FPC-based fee payments, keyed by the contract class of
|
|
9
|
+
* the `artifact` actually deployed as the fee token (defaults to canonical Token). The setup-phase
|
|
10
|
+
* validator matches these entries by class id, so a test deploying the codegen'd TestToken as its
|
|
11
|
+
* fee vehicle must pass `TestTokenContract.artifact` here -- otherwise the FPC fee calls are matched
|
|
12
|
+
* against the wrong class and rejected. Test-only: FPC fee payment with custom tokens won't work on
|
|
13
|
+
* mainnet alpha.
|
|
14
|
+
*/
|
|
15
|
+
export async function getTokenAllowedSetupFunctions(
|
|
16
|
+
artifact: ContractArtifact = TokenContractArtifact,
|
|
17
|
+
): Promise<AllowedElement[]> {
|
|
18
|
+
const tokenClassId = (await getContractClassFromArtifact(artifact)).id;
|
|
19
|
+
const target = { classId: tokenClassId };
|
|
20
|
+
return Promise.all([
|
|
21
|
+
// needed for private transfers via FPC (transfer_to_public enqueues this)
|
|
22
|
+
buildAllowedElement(artifact, target, '_increase_public_balance', { onlySelf: true }),
|
|
23
|
+
// needed for public transfers via FPC (fee_entrypoint_public enqueues this)
|
|
24
|
+
buildAllowedElement(artifact, target, 'transfer_in_public'),
|
|
25
|
+
]);
|
|
26
|
+
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { type ArchiverConfig } from '@aztec/archiver';
|
|
2
|
-
import type { NamespacedApiHandlers } from '@aztec/foundation/json-rpc/server';
|
|
3
|
-
import { type DataStoreConfig } from '@aztec/kv-store/config';
|
|
4
|
-
export type { ArchiverConfig, DataStoreConfig };
|
|
5
|
-
/** Starts a standalone archiver. */
|
|
6
|
-
export declare function startArchiver(options: any, signalHandlers: (() => Promise<void>)[], services: NamespacedApiHandlers): Promise<{
|
|
7
|
-
config: ArchiverConfig & DataStoreConfig;
|
|
8
|
-
}>;
|
|
9
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3RhcnRfYXJjaGl2ZXIuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9jbGkvY21kcy9zdGFydF9hcmNoaXZlci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsS0FBSyxjQUFjLEVBQW9FLE1BQU0saUJBQWlCLENBQUM7QUFJeEgsT0FBTyxLQUFLLEVBQUUscUJBQXFCLEVBQUUsTUFBTSxtQ0FBbUMsQ0FBQztBQUMvRSxPQUFPLEVBQUUsS0FBSyxlQUFlLEVBQXNCLE1BQU0sd0JBQXdCLENBQUM7QUFNbEYsWUFBWSxFQUFFLGNBQWMsRUFBRSxlQUFlLEVBQUUsQ0FBQztBQUVoRCxvQ0FBb0M7QUFDcEMsd0JBQXNCLGFBQWEsQ0FDakMsT0FBTyxFQUFFLEdBQUcsRUFDWixjQUFjLEVBQUUsQ0FBQyxNQUFNLE9BQU8sQ0FBQyxJQUFJLENBQUMsQ0FBQyxFQUFFLEVBQ3ZDLFFBQVEsRUFBRSxxQkFBcUIsR0FDOUIsT0FBTyxDQUFDO0lBQUUsTUFBTSxFQUFFLGNBQWMsR0FBRyxlQUFlLENBQUE7Q0FBRSxDQUFDLENBK0J2RCJ9
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"start_archiver.d.ts","sourceRoot":"","sources":["../../../src/cli/cmds/start_archiver.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAAoE,MAAM,iBAAiB,CAAC;AAIxH,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAC/E,OAAO,EAAE,KAAK,eAAe,EAAsB,MAAM,wBAAwB,CAAC;AAMlF,YAAY,EAAE,cAAc,EAAE,eAAe,EAAE,CAAC;AAEhD,oCAAoC;AACpC,wBAAsB,aAAa,CACjC,OAAO,EAAE,GAAG,EACZ,cAAc,EAAE,CAAC,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC,EAAE,EACvC,QAAQ,EAAE,qBAAqB,GAC9B,OAAO,CAAC;IAAE,MAAM,EAAE,cAAc,GAAG,eAAe,CAAA;CAAE,CAAC,CA+BvD"}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { archiverConfigMappings, createArchiver, getArchiverConfigFromEnv } from '@aztec/archiver';
|
|
2
|
-
import { createLogger } from '@aztec/aztec.js/log';
|
|
3
|
-
import { blobClientConfigMapping, createBlobClient } from '@aztec/blob-client/client';
|
|
4
|
-
import { getL1Config } from '@aztec/cli/config';
|
|
5
|
-
import { dataConfigMappings } from '@aztec/kv-store/config';
|
|
6
|
-
import { ArchiverApiSchema } from '@aztec/stdlib/interfaces/server';
|
|
7
|
-
import { getConfigEnvVars as getTelemetryClientConfig, initTelemetryClient } from '@aztec/telemetry-client';
|
|
8
|
-
import { extractRelevantOptions } from '../util.js';
|
|
9
|
-
/** Starts a standalone archiver. */ export async function startArchiver(options, signalHandlers, services) {
|
|
10
|
-
const envConfig = getArchiverConfigFromEnv();
|
|
11
|
-
const cliOptions = extractRelevantOptions(options, {
|
|
12
|
-
...archiverConfigMappings,
|
|
13
|
-
...dataConfigMappings,
|
|
14
|
-
...blobClientConfigMapping
|
|
15
|
-
}, 'archiver');
|
|
16
|
-
let archiverConfig = {
|
|
17
|
-
...envConfig,
|
|
18
|
-
...cliOptions
|
|
19
|
-
};
|
|
20
|
-
archiverConfig.dataStoreMapSizeKb = archiverConfig.archiverStoreMapSizeKb ?? archiverConfig.dataStoreMapSizeKb;
|
|
21
|
-
if (!archiverConfig.l1Contracts.registryAddress || archiverConfig.l1Contracts.registryAddress.isZero()) {
|
|
22
|
-
throw new Error('L1 registry address is required to start an Archiver');
|
|
23
|
-
}
|
|
24
|
-
const { addresses, config: l1Config } = await getL1Config(archiverConfig.l1Contracts.registryAddress, archiverConfig.l1RpcUrls, archiverConfig.l1ChainId);
|
|
25
|
-
archiverConfig.l1Contracts = addresses;
|
|
26
|
-
archiverConfig = {
|
|
27
|
-
...archiverConfig,
|
|
28
|
-
...l1Config
|
|
29
|
-
};
|
|
30
|
-
const telemetry = await initTelemetryClient(getTelemetryClientConfig());
|
|
31
|
-
const blobClient = createBlobClient(archiverConfig, {
|
|
32
|
-
logger: createLogger('archiver:blob-client:client')
|
|
33
|
-
});
|
|
34
|
-
const archiver = await createArchiver(archiverConfig, {
|
|
35
|
-
telemetry,
|
|
36
|
-
blobClient
|
|
37
|
-
}, {
|
|
38
|
-
blockUntilSync: true
|
|
39
|
-
});
|
|
40
|
-
services.archiver = [
|
|
41
|
-
archiver,
|
|
42
|
-
ArchiverApiSchema
|
|
43
|
-
];
|
|
44
|
-
signalHandlers.push(archiver.stop);
|
|
45
|
-
return {
|
|
46
|
-
config: archiverConfig
|
|
47
|
-
};
|
|
48
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { NamespacedApiHandlers } from '@aztec/foundation/json-rpc/server';
|
|
2
|
-
import type { LogFn } from '@aztec/foundation/log';
|
|
3
|
-
import { type ProverNodeConfig } from '@aztec/prover-node';
|
|
4
|
-
export declare function startProverNode(options: any, signalHandlers: (() => Promise<void>)[], services: NamespacedApiHandlers, userLog: LogFn): Promise<{
|
|
5
|
-
config: ProverNodeConfig;
|
|
6
|
-
}>;
|
|
7
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3RhcnRfcHJvdmVyX25vZGUuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9jbGkvY21kcy9zdGFydF9wcm92ZXJfbm9kZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFLQSxPQUFPLEtBQUssRUFBRSxxQkFBcUIsRUFBRSxNQUFNLG1DQUFtQyxDQUFDO0FBRS9FLE9BQU8sS0FBSyxFQUFFLEtBQUssRUFBRSxNQUFNLHVCQUF1QixDQUFDO0FBRW5ELE9BQU8sRUFDTCxLQUFLLGdCQUFnQixFQUl0QixNQUFNLG9CQUFvQixDQUFDO0FBUzVCLHdCQUFzQixlQUFlLENBQ25DLE9BQU8sRUFBRSxHQUFHLEVBQ1osY0FBYyxFQUFFLENBQUMsTUFBTSxPQUFPLENBQUMsSUFBSSxDQUFDLENBQUMsRUFBRSxFQUN2QyxRQUFRLEVBQUUscUJBQXFCLEVBQy9CLE9BQU8sRUFBRSxLQUFLLEdBQ2IsT0FBTyxDQUFDO0lBQUUsTUFBTSxFQUFFLGdCQUFnQixDQUFBO0NBQUUsQ0FBQyxDQStGdkMifQ==
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"start_prover_node.d.ts","sourceRoot":"","sources":["../../../src/cli/cmds/start_prover_node.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAE/E,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAEnD,OAAO,EACL,KAAK,gBAAgB,EAItB,MAAM,oBAAoB,CAAC;AAS5B,wBAAsB,eAAe,CACnC,OAAO,EAAE,GAAG,EACZ,cAAc,EAAE,CAAC,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC,EAAE,EACvC,QAAQ,EAAE,qBAAqB,EAC/B,OAAO,EAAE,KAAK,GACb,OAAO,CAAC;IAAE,MAAM,EAAE,gBAAgB,CAAA;CAAE,CAAC,CA+FvC"}
|