@aztec-labs/aztec 6.0.0-nightly.20260829
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 +57 -0
- package/dest/bin/index.d.ts +3 -0
- package/dest/bin/index.d.ts.map +1 -0
- package/dest/bin/index.js +61 -0
- 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 +3 -0
- package/dest/cli/aztec_start_action.d.ts.map +1 -0
- package/dest/cli/aztec_start_action.js +153 -0
- package/dest/cli/aztec_start_options.d.ts +17 -0
- package/dest/cli/aztec_start_options.d.ts.map +1 -0
- package/dest/cli/aztec_start_options.js +290 -0
- package/dest/cli/cli.d.ts +9 -0
- package/dest/cli/cli.d.ts.map +1 -0
- package/dest/cli/cli.js +37 -0
- 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/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/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 +8 -0
- package/dest/cli/cmds/start_bot.d.ts.map +1 -0
- package/dest/cli/cmds/start_bot.js +53 -0
- package/dest/cli/cmds/start_node.d.ts +8 -0
- package/dest/cli/cmds/start_node.d.ts.map +1 -0
- package/dest/cli/cmds/start_node.js +150 -0
- package/dest/cli/cmds/start_p2p_bootstrap.d.ts +6 -0
- package/dest/cli/cmds/start_p2p_bootstrap.d.ts.map +1 -0
- package/dest/cli/cmds/start_p2p_bootstrap.js +30 -0
- package/dest/cli/cmds/start_prover_agent.d.ts +4 -0
- package/dest/cli/cmds/start_prover_agent.d.ts.map +1 -0
- package/dest/cli/cmds/start_prover_agent.js +58 -0
- package/dest/cli/cmds/start_prover_broker.d.ts +9 -0
- package/dest/cli/cmds/start_prover_broker.d.ts.map +1 -0
- package/dest/cli/cmds/start_prover_broker.js +46 -0
- package/dest/cli/cmds/start_txe.d.ts +3 -0
- package/dest/cli/cmds/start_txe.d.ts.map +1 -0
- package/dest/cli/cmds/start_txe.js +12 -0
- 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/index.d.ts +2 -0
- package/dest/cli/index.d.ts.map +1 -0
- package/dest/cli/index.js +1 -0
- 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/util.d.ts +71 -0
- package/dest/cli/util.d.ts.map +1 -0
- package/dest/cli/util.js +261 -0
- package/dest/cli/versioning.d.ts +4 -0
- package/dest/cli/versioning.d.ts.map +1 -0
- package/dest/cli/versioning.js +9 -0
- package/dest/examples/token.d.ts +2 -0
- package/dest/examples/token.d.ts.map +1 -0
- package/dest/examples/token.js +59 -0
- package/dest/examples/util.d.ts +19 -0
- package/dest/examples/util.d.ts.map +1 -0
- package/dest/examples/util.js +30 -0
- package/dest/index.d.ts +2 -0
- package/dest/index.d.ts.map +1 -0
- package/dest/index.js +1 -0
- 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 +11 -0
- package/dest/local-network/banana_fpc.d.ts.map +1 -0
- package/dest/local-network/banana_fpc.js +81 -0
- 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 +51 -0
- package/dest/local-network/local-network.d.ts.map +1 -0
- package/dest/local-network/local-network.js +205 -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 +2 -0
- package/dest/mnemonic.d.ts.map +1 -0
- package/dest/mnemonic.js +1 -0
- package/dest/splash.d.ts +3 -0
- package/dest/splash.d.ts.map +1 -0
- package/dest/splash.js +2 -0
- package/dest/testing/cheat_codes.d.ts +37 -0
- package/dest/testing/cheat_codes.d.ts.map +1 -0
- package/dest/testing/cheat_codes.js +36 -0
- package/dest/testing/epoch_test_settler.d.ts +19 -0
- package/dest/testing/epoch_test_settler.d.ts.map +1 -0
- package/dest/testing/epoch_test_settler.js +42 -0
- package/dest/testing/index.d.ts +6 -0
- package/dest/testing/index.d.ts.map +1 -0
- package/dest/testing/index.js +5 -0
- 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 +125 -0
- package/scripts/add_crate.sh +53 -0
- package/scripts/aztec.sh +73 -0
- package/scripts/init.sh +39 -0
- package/scripts/new.sh +83 -0
- 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 +73 -0
- package/src/cli/admin_api_key_store.ts +127 -0
- package/src/cli/aztec_start_action.ts +173 -0
- package/src/cli/aztec_start_options.ts +333 -0
- package/src/cli/cli.ts +55 -0
- package/src/cli/cmds/compile.ts +205 -0
- package/src/cli/cmds/migrate_ha_db.ts +42 -0
- package/src/cli/cmds/profile.ts +25 -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 +41 -0
- package/src/cli/cmds/standby.ts +183 -0
- package/src/cli/cmds/start_bot.ts +78 -0
- package/src/cli/cmds/start_node.ts +199 -0
- package/src/cli/cmds/start_p2p_bootstrap.ts +37 -0
- package/src/cli/cmds/start_prover_agent.ts +77 -0
- package/src/cli/cmds/start_prover_broker.ts +69 -0
- package/src/cli/cmds/start_txe.ts +17 -0
- 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 +75 -0
- package/src/cli/index.ts +1 -0
- package/src/cli/preload_crs.ts +7 -0
- package/src/cli/util.ts +310 -0
- package/src/cli/versioning.ts +13 -0
- package/src/examples/token.ts +77 -0
- package/src/examples/util.ts +42 -0
- package/src/index.ts +6 -0
- package/src/local-network/auth_registry.ts +19 -0
- package/src/local-network/banana_fpc.ts +89 -0
- package/src/local-network/index.ts +7 -0
- package/src/local-network/local-network.ts +254 -0
- package/src/local-network/sponsored_fpc.ts +26 -0
- package/src/mnemonic.ts +1 -0
- package/src/splash.ts +10 -0
- package/src/testing/cheat_codes.ts +48 -0
- package/src/testing/epoch_test_settler.ts +47 -0
- package/src/testing/index.ts +5 -0
- package/src/testing/local-network.ts +96 -0
- package/src/testing/token_allowed_setup.ts +26 -0
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
#!/usr/bin/env -S node --no-warnings
|
|
2
|
+
import { type AztecNodeConfig } from '@aztec-labs/aztec-node/config';
|
|
3
|
+
import { Fr } from '@aztec-labs/aztec.js/fields';
|
|
4
|
+
import { type BlobClientInterface } from '@aztec-labs/blob-client/client';
|
|
5
|
+
import type { L1ContractAddresses } from '@aztec-labs/ethereum/l1-contract-addresses';
|
|
6
|
+
import type { LogFn } from '@aztec-labs/foundation/log';
|
|
7
|
+
import { DateProvider } from '@aztec-labs/foundation/timer';
|
|
8
|
+
import type { ProvingJobBroker } from '@aztec-labs/stdlib/interfaces/server';
|
|
9
|
+
import type { GenesisData } from '@aztec-labs/stdlib/world-state';
|
|
10
|
+
import { type TelemetryClient } from '@aztec-labs/telemetry-client';
|
|
11
|
+
import type { Hex } from 'viem';
|
|
12
|
+
/**
|
|
13
|
+
* Function to deploy our L1 contracts to the local network L1
|
|
14
|
+
* @param aztecNodeConfig - The Aztec Node Config
|
|
15
|
+
* @param hdAccount - Account for publishing L1 contracts
|
|
16
|
+
*/
|
|
17
|
+
export declare function deployContractsToL1(aztecNodeConfig: AztecNodeConfig, privateKey: Hex, opts?: {
|
|
18
|
+
genesisArchiveRoot?: Fr;
|
|
19
|
+
feeJuicePortalInitialBalance?: bigint;
|
|
20
|
+
}): Promise<L1ContractAddresses>;
|
|
21
|
+
/** Local network settings. */
|
|
22
|
+
export type LocalNetworkConfig = AztecNodeConfig & {
|
|
23
|
+
/** Mnemonic used to derive the L1 deployer private key.*/
|
|
24
|
+
l1Mnemonic: string;
|
|
25
|
+
/** Whether to deploy test accounts on local network start.*/
|
|
26
|
+
testAccounts: boolean;
|
|
27
|
+
/** Override the default per-address fee juice granted at genesis to funded addresses. */
|
|
28
|
+
initialAccountFeeJuice?: Fr;
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* Create and start a new Aztec Node and PXE. Deploys L1 contracts.
|
|
32
|
+
* Does not start any HTTP services nor populate any initial accounts.
|
|
33
|
+
* @param config - Optional local network settings.
|
|
34
|
+
*/
|
|
35
|
+
export declare function createLocalNetwork(config: Partial<LocalNetworkConfig> | undefined, userLog: LogFn): Promise<{
|
|
36
|
+
node: import("@aztec-labs/aztec-node").AztecNodeService;
|
|
37
|
+
stop: () => Promise<void>;
|
|
38
|
+
}>;
|
|
39
|
+
/**
|
|
40
|
+
* Create and start a new Aztec RPC HTTP Server
|
|
41
|
+
* @param config - Optional Aztec node settings.
|
|
42
|
+
*/
|
|
43
|
+
export declare function createAztecNode(config?: Partial<AztecNodeConfig>, deps?: {
|
|
44
|
+
telemetry?: TelemetryClient;
|
|
45
|
+
blobClient?: BlobClientInterface;
|
|
46
|
+
dateProvider?: DateProvider;
|
|
47
|
+
proverBroker?: ProvingJobBroker;
|
|
48
|
+
}, options?: {
|
|
49
|
+
genesis?: GenesisData;
|
|
50
|
+
}): Promise<import("@aztec-labs/aztec-node").AztecNodeService>;
|
|
51
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibG9jYWwtbmV0d29yay5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2xvY2FsLW5ldHdvcmsvbG9jYWwtbmV0d29yay50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBR0EsT0FBTyxFQUFFLEtBQUssZUFBZSxFQUFvQixNQUFNLCtCQUErQixDQUFDO0FBQ3ZGLE9BQU8sRUFBRSxFQUFFLEVBQUUsTUFBTSw2QkFBNkIsQ0FBQztBQUVqRCxPQUFPLEVBQUUsS0FBSyxtQkFBbUIsRUFBb0IsTUFBTSxnQ0FBZ0MsQ0FBQztBQU01RixPQUFPLEtBQUssRUFBRSxtQkFBbUIsRUFBRSxNQUFNLDRDQUE0QyxDQUFDO0FBR3RGLE9BQU8sS0FBSyxFQUFFLEtBQUssRUFBRSxNQUFNLDRCQUE0QixDQUFDO0FBQ3hELE9BQU8sRUFBRSxZQUFZLEVBQW9CLE1BQU0sOEJBQThCLENBQUM7QUFJOUUsT0FBTyxLQUFLLEVBQUUsZ0JBQWdCLEVBQUUsTUFBTSxzQ0FBc0MsQ0FBQztBQUU3RSxPQUFPLEtBQUssRUFBRSxXQUFXLEVBQUUsTUFBTSxnQ0FBZ0MsQ0FBQztBQUNsRSxPQUFPLEVBQ0wsS0FBSyxlQUFlLEVBR3JCLE1BQU0sOEJBQThCLENBQUM7QUFJdEMsT0FBTyxLQUFLLEV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MAAM,GAAE,OAAO,CAAC,eAAe,CAAM,EACrC,IAAI,GAAE;IACJ,SAAS,CAAC,EAAE,eAAe,CAAC;IAC5B,UAAU,CAAC,EAAE,mBAAmB,CAAC;IACjC,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,YAAY,CAAC,EAAE,gBAAgB,CAAC;CAC5B,EACN,OAAO,GAAE;IAAE,OAAO,CAAC,EAAE,WAAW,CAAA;CAAO,8DAcxC"}
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
#!/usr/bin/env -S node --no-warnings
|
|
2
|
+
import { getInitialTestAccountsData } from '@aztec-labs/accounts/testing';
|
|
3
|
+
import { createAztecNodeService } from '@aztec-labs/aztec-node';
|
|
4
|
+
import { getConfigEnvVars } from '@aztec-labs/aztec-node/config';
|
|
5
|
+
import { Fr } from '@aztec-labs/aztec.js/fields';
|
|
6
|
+
import { createLogger } from '@aztec-labs/aztec.js/log';
|
|
7
|
+
import { createBlobClient } from '@aztec-labs/blob-client/client';
|
|
8
|
+
import { GENESIS_ARCHIVE_ROOT } from '@aztec-labs/constants';
|
|
9
|
+
import { waitForPublicClient } from '@aztec-labs/ethereum/client';
|
|
10
|
+
import { getL1ContractsConfigEnvVars } from '@aztec-labs/ethereum/config';
|
|
11
|
+
import { NULL_KEY } from '@aztec-labs/ethereum/constants';
|
|
12
|
+
import { deployAztecL1Contracts } from '@aztec-labs/ethereum/deploy-aztec-l1-contracts';
|
|
13
|
+
import { SecretValue } from '@aztec-labs/foundation/config';
|
|
14
|
+
import { EthAddress } from '@aztec-labs/foundation/eth-address';
|
|
15
|
+
import { TestDateProvider } from '@aztec-labs/foundation/timer';
|
|
16
|
+
import { getVKTreeRoot } from '@aztec-labs/noir-protocol-circuits-types/vk-tree';
|
|
17
|
+
import { protocolContractsHash } from '@aztec-labs/protocol-contracts';
|
|
18
|
+
import { AztecAddress } from '@aztec-labs/stdlib/aztec-address';
|
|
19
|
+
import { TxStatus } from '@aztec-labs/stdlib/tx';
|
|
20
|
+
import { getConfigEnvVars as getTelemetryClientConfig, initTelemetryClient } from '@aztec-labs/telemetry-client';
|
|
21
|
+
import { EmbeddedWallet } from '@aztec-labs/wallets/embedded';
|
|
22
|
+
import { createFundedInitializerlessAccounts } from '@aztec-labs/wallets/testing';
|
|
23
|
+
import { getGenesisValues } from '@aztec-labs/world-state/testing';
|
|
24
|
+
import { mnemonicToAccount, privateKeyToAddress } from 'viem/accounts';
|
|
25
|
+
import { foundry } from 'viem/chains';
|
|
26
|
+
import { createAccountLogs } from '../cli/util.js';
|
|
27
|
+
import { DefaultMnemonic } from '../mnemonic.js';
|
|
28
|
+
import { getTokenAllowedSetupFunctions } from '../testing/token_allowed_setup.js';
|
|
29
|
+
import { publishStandardAuthRegistry } from './auth_registry.js';
|
|
30
|
+
import { getBananaFPCAddress, setupBananaFPC } from './banana_fpc.js';
|
|
31
|
+
import { getSponsoredFPCAddress } from './sponsored_fpc.js';
|
|
32
|
+
const logger = createLogger('local-network');
|
|
33
|
+
// The embedded wallet defaults to waiting for PROPOSED, which returns as soon as a tx lands in a
|
|
34
|
+
// proposed L2 block. That is flaky for the serial sandbox setup below: a proposed block can be
|
|
35
|
+
// pruned before its checkpoint is published, dropping a tx we already moved on from ("Tx dropped by
|
|
36
|
+
// P2P node"). Wait for the checkpoint so each setup tx is durably included before the next is sent.
|
|
37
|
+
const setupWaitOpts = {
|
|
38
|
+
waitForStatus: TxStatus.CHECKPOINTED
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* Function to deploy our L1 contracts to the local network L1
|
|
42
|
+
* @param aztecNodeConfig - The Aztec Node Config
|
|
43
|
+
* @param hdAccount - Account for publishing L1 contracts
|
|
44
|
+
*/ export async function deployContractsToL1(aztecNodeConfig, privateKey, opts = {}) {
|
|
45
|
+
await waitForPublicClient(aztecNodeConfig);
|
|
46
|
+
const l1Contracts = await deployAztecL1Contracts(aztecNodeConfig.l1RpcUrls[0], privateKey, foundry.id, {
|
|
47
|
+
...getL1ContractsConfigEnvVars(),
|
|
48
|
+
...aztecNodeConfig,
|
|
49
|
+
vkTreeRoot: getVKTreeRoot(),
|
|
50
|
+
protocolContractsHash,
|
|
51
|
+
genesisArchiveRoot: opts.genesisArchiveRoot ?? new Fr(GENESIS_ARCHIVE_ROOT),
|
|
52
|
+
feeJuicePortalInitialBalance: opts.feeJuicePortalInitialBalance,
|
|
53
|
+
aztecTargetCommitteeSize: 0,
|
|
54
|
+
slasherEnabled: false,
|
|
55
|
+
realVerifier: false
|
|
56
|
+
});
|
|
57
|
+
Object.assign(aztecNodeConfig, l1Contracts.l1ContractAddresses);
|
|
58
|
+
aztecNodeConfig.rollupVersion = l1Contracts.rollupVersion;
|
|
59
|
+
return l1Contracts.l1ContractAddresses;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Create and start a new Aztec Node and PXE. Deploys L1 contracts.
|
|
63
|
+
* Does not start any HTTP services nor populate any initial accounts.
|
|
64
|
+
* @param config - Optional local network settings.
|
|
65
|
+
*/ export async function createLocalNetwork(config = {}, userLog) {
|
|
66
|
+
// local network is meant for test envs. We should only need one l1RpcUrl
|
|
67
|
+
const l1RpcUrl = config.l1RpcUrls?.[0];
|
|
68
|
+
if (!l1RpcUrl) {
|
|
69
|
+
throw new Error('An L1 RPC URL is required');
|
|
70
|
+
}
|
|
71
|
+
if ((config.l1RpcUrls?.length || 0) > 1) {
|
|
72
|
+
logger.warn(`Multiple L1 RPC URLs provided. Local networks will only use the first one: ${l1RpcUrl}`);
|
|
73
|
+
}
|
|
74
|
+
// The local network deploys a banana FPC with Token contracts, so include Token entries
|
|
75
|
+
// in the setup allowlist so FPC-based fee payments work out of the box.
|
|
76
|
+
const tokenAllowList = await getTokenAllowedSetupFunctions();
|
|
77
|
+
const envConfig = getConfigEnvVars();
|
|
78
|
+
const aztecNodeConfig = {
|
|
79
|
+
...envConfig,
|
|
80
|
+
...config,
|
|
81
|
+
skipOrphanProposedBlockPruning: true,
|
|
82
|
+
// The local network builds node config from env without a DATA_DIRECTORY, so the validator's
|
|
83
|
+
// local signing protection runs against an ephemeral store. That is acceptable for this dev
|
|
84
|
+
// network; production validators must persist it and fail-fast when the data directory is unset.
|
|
85
|
+
allowEphemeralSigningProtection: config.allowEphemeralSigningProtection ?? true,
|
|
86
|
+
txPublicSetupAllowListExtend: [
|
|
87
|
+
...tokenAllowList,
|
|
88
|
+
...config.txPublicSetupAllowListExtend ?? []
|
|
89
|
+
],
|
|
90
|
+
// The local network runs against anvil with no committee, so it defaults to the deterministic
|
|
91
|
+
// AutomineSequencer, which owns L1 time control (warps the dateProvider and L1 timestamps to slot
|
|
92
|
+
// boundaries as it builds), replacing the deleted AnvilTestWatcher. This remains true when p2p is
|
|
93
|
+
// enabled for local peer testing; local-network is not a mode for connecting to an existing network.
|
|
94
|
+
useAutomineSequencer: config.useAutomineSequencer ?? true,
|
|
95
|
+
// The AutomineSequencer owns epoch proving in the local network — it writes epoch out hashes to
|
|
96
|
+
// the L1 Outbox and advances the proven tip as checkpoints land, through the same serial queue as
|
|
97
|
+
// its builds — replacing the standalone EpochTestSettler that used to race the build loop.
|
|
98
|
+
automineEnableProveEpoch: config.automineEnableProveEpoch ?? true,
|
|
99
|
+
// Defaults for the local network / sandbox; callers (e.g. the CLI) may override. No real proving
|
|
100
|
+
// happens here — the AutomineSequencer synthetically settles epochs. Short epochs let it write out
|
|
101
|
+
// hashes quickly (so users can consume L2-to-L1 messages without a long wait), with a wider
|
|
102
|
+
// proof-submission window so the synthetic settler has headroom before the rollup would prune an
|
|
103
|
+
// unproven checkpoint.
|
|
104
|
+
realProofs: config.realProofs ?? false,
|
|
105
|
+
aztecEpochDuration: config.aztecEpochDuration ?? 4,
|
|
106
|
+
aztecProofSubmissionEpochs: config.aztecProofSubmissionEpochs ?? 2
|
|
107
|
+
};
|
|
108
|
+
const hdAccount = mnemonicToAccount(config.l1Mnemonic || DefaultMnemonic);
|
|
109
|
+
if (aztecNodeConfig.sequencerPublisherPrivateKeys == undefined || !aztecNodeConfig.sequencerPublisherPrivateKeys.length || aztecNodeConfig.sequencerPublisherPrivateKeys[0].getValue() === NULL_KEY) {
|
|
110
|
+
const privKey = hdAccount.getHdKey().privateKey;
|
|
111
|
+
aztecNodeConfig.sequencerPublisherPrivateKeys = [
|
|
112
|
+
new SecretValue(`0x${Buffer.from(privKey).toString('hex')}`)
|
|
113
|
+
];
|
|
114
|
+
}
|
|
115
|
+
if (!aztecNodeConfig.validatorPrivateKeys?.getValue().length) {
|
|
116
|
+
const privKey = hdAccount.getHdKey().privateKey;
|
|
117
|
+
aztecNodeConfig.validatorPrivateKeys = new SecretValue([
|
|
118
|
+
`0x${Buffer.from(privKey).toString('hex')}`
|
|
119
|
+
]);
|
|
120
|
+
}
|
|
121
|
+
aztecNodeConfig.coinbase = EthAddress.fromString(privateKeyToAddress(aztecNodeConfig.validatorPrivateKeys.getValue()[0]));
|
|
122
|
+
const initialAccounts = await (async ()=>{
|
|
123
|
+
if (config.testAccounts === true || config.testAccounts === undefined) {
|
|
124
|
+
if (aztecNodeConfig.p2pEnabled) {
|
|
125
|
+
userLog(`Not setting up test accounts when p2p is enabled`);
|
|
126
|
+
} else {
|
|
127
|
+
userLog(`Setting up test accounts`);
|
|
128
|
+
return await getInitialTestAccountsData();
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
return [];
|
|
132
|
+
})();
|
|
133
|
+
const bananaFPC = await getBananaFPCAddress(initialAccounts);
|
|
134
|
+
const sponsoredFPC = await getSponsoredFPCAddress();
|
|
135
|
+
const prefundAddresses = (aztecNodeConfig.prefundAddresses ?? []).map((a)=>AztecAddress.fromStringUnsafe(a));
|
|
136
|
+
const fundedAddresses = [
|
|
137
|
+
...initialAccounts.map((a)=>a.address),
|
|
138
|
+
...initialAccounts.length ? [
|
|
139
|
+
bananaFPC,
|
|
140
|
+
sponsoredFPC
|
|
141
|
+
] : [],
|
|
142
|
+
...prefundAddresses
|
|
143
|
+
];
|
|
144
|
+
const { genesisArchiveRoot, genesis, fundingNeeded } = await getGenesisValues(fundedAddresses, config.initialAccountFeeJuice);
|
|
145
|
+
const dateProvider = new TestDateProvider();
|
|
146
|
+
if (!aztecNodeConfig.p2pEnabled) {
|
|
147
|
+
await deployContractsToL1(aztecNodeConfig, aztecNodeConfig.validatorPrivateKeys.getValue()[0], {
|
|
148
|
+
genesisArchiveRoot,
|
|
149
|
+
feeJuicePortalInitialBalance: fundingNeeded
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
const telemetry = await initTelemetryClient(getTelemetryClientConfig());
|
|
153
|
+
// Create a local blob client client inside the local network, no http connectivity
|
|
154
|
+
const blobClient = createBlobClient();
|
|
155
|
+
const node = await createAztecNode(aztecNodeConfig, {
|
|
156
|
+
telemetry,
|
|
157
|
+
blobClient,
|
|
158
|
+
dateProvider
|
|
159
|
+
}, {
|
|
160
|
+
genesis
|
|
161
|
+
});
|
|
162
|
+
if (initialAccounts.length) {
|
|
163
|
+
const wallet = await EmbeddedWallet.create(node, {
|
|
164
|
+
pxeConfig: {
|
|
165
|
+
proverEnabled: aztecNodeConfig.realProofs
|
|
166
|
+
},
|
|
167
|
+
ephemeral: true
|
|
168
|
+
});
|
|
169
|
+
userLog('Setting up funded test accounts...');
|
|
170
|
+
const accountManagers = await createFundedInitializerlessAccounts(wallet, initialAccounts);
|
|
171
|
+
const accLogs = await createAccountLogs(accountManagers, wallet);
|
|
172
|
+
userLog(accLogs.join(''));
|
|
173
|
+
userLog('Publishing standard AuthRegistry contract...');
|
|
174
|
+
await publishStandardAuthRegistry(wallet, initialAccounts[0].address, setupWaitOpts);
|
|
175
|
+
await setupBananaFPC(initialAccounts, wallet, userLog, setupWaitOpts);
|
|
176
|
+
userLog(`SponsoredFPC: ${await getSponsoredFPCAddress()}`);
|
|
177
|
+
// We no longer need the wallet once we've setup the accounts so we stop the underlying PXE job queue
|
|
178
|
+
await wallet.stop();
|
|
179
|
+
}
|
|
180
|
+
const stop = async ()=>{
|
|
181
|
+
await node.stop();
|
|
182
|
+
};
|
|
183
|
+
return {
|
|
184
|
+
node,
|
|
185
|
+
stop
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* Create and start a new Aztec RPC HTTP Server
|
|
190
|
+
* @param config - Optional Aztec node settings.
|
|
191
|
+
*/ export async function createAztecNode(config = {}, deps = {}, options = {}) {
|
|
192
|
+
// TODO(#12272): will clean this up. This is criminal.
|
|
193
|
+
// Not sure why this was ever done. Will be fixed in A-989, A-991, A-990.
|
|
194
|
+
const aztecNodeConfig = {
|
|
195
|
+
...getConfigEnvVars(),
|
|
196
|
+
...config
|
|
197
|
+
};
|
|
198
|
+
const node = await createAztecNodeService(aztecNodeConfig, {
|
|
199
|
+
...deps,
|
|
200
|
+
proverNodeDeps: {
|
|
201
|
+
broker: deps.proverBroker
|
|
202
|
+
}
|
|
203
|
+
}, options);
|
|
204
|
+
return node;
|
|
205
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { AztecAddress } from '@aztec-labs/aztec.js/addresses';
|
|
2
|
+
import type { Wallet } from '@aztec-labs/aztec.js/wallet';
|
|
3
|
+
export declare function getSponsoredFPCAddress(): Promise<AztecAddress>;
|
|
4
|
+
export declare function registerDeployedSponsoredFPCInWalletAndGetAddress(wallet: Wallet): Promise<AztecAddress>;
|
|
5
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3BvbnNvcmVkX2ZwYy5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2xvY2FsLW5ldHdvcmsvc3BvbnNvcmVkX2ZwYy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEtBQUssRUFBRSxZQUFZLEVBQUUsTUFBTSxnQ0FBZ0MsQ0FBQztBQU1uRSxPQUFPLEtBQUssRUFBRSxNQUFNLEVBQUUsTUFBTSw2QkFBNkIsQ0FBQztBQVUxRCx3QkFBc0Isc0JBQXNCLElBQUksT0FBTyxDQUFDLFlBQVksQ0FBQyxDQUVwRTtBQUVELHdCQUFzQixpREFBaUQsQ0FBQyxNQUFNLEVBQUUsTUFBTSxHQUFHLE9BQU8sQ0FBQyxZQUFZLENBQUMsQ0FLN0cifQ==
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sponsored_fpc.d.ts","sourceRoot":"","sources":["../../src/local-network/sponsored_fpc.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAMnE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,6BAA6B,CAAC;AAU1D,wBAAsB,sBAAsB,IAAI,OAAO,CAAC,YAAY,CAAC,CAEpE;AAED,wBAAsB,iDAAiD,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC,CAK7G"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { getContractInstanceFromInstantiationParams } from '@aztec-labs/aztec.js/contracts';
|
|
2
|
+
import { Fr } from '@aztec-labs/aztec.js/fields';
|
|
3
|
+
import { SPONSORED_FPC_SALT } from '@aztec-labs/constants';
|
|
4
|
+
import { SponsoredFPCContract } from '@aztec-labs/noir-contracts.js/SponsoredFPC';
|
|
5
|
+
async function getSponsoredFPCInstance() {
|
|
6
|
+
return await getContractInstanceFromInstantiationParams(SponsoredFPCContract.artifact, {
|
|
7
|
+
salt: new Fr(SPONSORED_FPC_SALT)
|
|
8
|
+
});
|
|
9
|
+
}
|
|
10
|
+
export async function getSponsoredFPCAddress() {
|
|
11
|
+
return (await getSponsoredFPCInstance()).address;
|
|
12
|
+
}
|
|
13
|
+
export async function registerDeployedSponsoredFPCInWalletAndGetAddress(wallet) {
|
|
14
|
+
const fpc = await getSponsoredFPCInstance();
|
|
15
|
+
// The following is no-op if the contract is already registered
|
|
16
|
+
await wallet.registerContract(fpc, SponsoredFPCContract.artifact);
|
|
17
|
+
return fpc.address;
|
|
18
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export declare const DefaultMnemonic = "test test test test test test test test test test test junk";
|
|
2
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibW5lbW9uaWMuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3NyYy9tbmVtb25pYy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxlQUFPLE1BQU0sZUFBZSxnRUFBZ0UsQ0FBQyJ9
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mnemonic.d.ts","sourceRoot":"","sources":["../src/mnemonic.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,eAAe,gEAAgE,CAAC"}
|
package/dest/mnemonic.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const DefaultMnemonic = 'test test test test test test test test test test test junk';
|
package/dest/splash.d.ts
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export declare const splash: string;
|
|
2
|
+
export declare const github = "https://github.com/AztecProtocol";
|
|
3
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3BsYXNoLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvc3BsYXNoLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLGVBQU8sTUFBTSxNQUFNLEVBQUUsTUFPa0IsQ0FBQztBQUV4QyxlQUFPLE1BQU0sTUFBTSxxQ0FBcUMsQ0FBQyJ9
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"splash.d.ts","sourceRoot":"","sources":["../src/splash.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,MAAM,EAAE,MAOkB,CAAC;AAExC,eAAO,MAAM,MAAM,qCAAqC,CAAC"}
|
package/dest/splash.js
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { EthCheatCodes, RollupCheatCodes } from '@aztec-labs/ethereum/test';
|
|
2
|
+
import type { DateProvider } from '@aztec-labs/foundation/timer';
|
|
3
|
+
import type { AztecNode, AztecNodeDebug } from '@aztec-labs/stdlib/interfaces/client';
|
|
4
|
+
/**
|
|
5
|
+
* Wrapper for Aztec Debug API.
|
|
6
|
+
* @deprecated use the AztecNode debug API directly.
|
|
7
|
+
*/
|
|
8
|
+
export declare class CheatCodes {
|
|
9
|
+
/** Cheat codes for L1.*/
|
|
10
|
+
eth: EthCheatCodes;
|
|
11
|
+
/** Cheat codes for the Aztec Rollup contract on L1. */
|
|
12
|
+
rollup: RollupCheatCodes;
|
|
13
|
+
constructor(
|
|
14
|
+
/** Cheat codes for L1.*/
|
|
15
|
+
eth: EthCheatCodes,
|
|
16
|
+
/** Cheat codes for the Aztec Rollup contract on L1. */
|
|
17
|
+
rollup: RollupCheatCodes);
|
|
18
|
+
static create(rpcUrls: string[], node: AztecNode, dateProvider: DateProvider): Promise<CheatCodes>;
|
|
19
|
+
/**
|
|
20
|
+
* Warps the L1 timestamp to at least `targetTimestamp` and mines an L2 block advancing the L2 timestamp to at least
|
|
21
|
+
* the target. Forwards to the node's debug API, which serializes the warp through the automine sequencer queue.
|
|
22
|
+
* @param node - The Aztec node whose debug API performs the warp. Must run an automine sequencer.
|
|
23
|
+
* @param targetTimestamp - The target timestamp to warp to (in seconds).
|
|
24
|
+
* @deprecated Call `node.warpL2TimeAtLeastTo(targetTimestamp)` on the node debug API directly.
|
|
25
|
+
*/
|
|
26
|
+
warpL2TimeAtLeastTo(node: AztecNode & AztecNodeDebug, targetTimestamp: bigint | number): Promise<void>;
|
|
27
|
+
/**
|
|
28
|
+
* Warps the L1 timestamp forward by at least `duration` seconds and mines an L2 block advancing the L2 timestamp at
|
|
29
|
+
* least by the duration. Forwards to the node's debug API, which serializes the warp through the automine sequencer
|
|
30
|
+
* queue.
|
|
31
|
+
* @param node - The Aztec node whose debug API performs the warp. Must run an automine sequencer.
|
|
32
|
+
* @param duration - The duration to advance time by (in seconds).
|
|
33
|
+
* @deprecated Call `node.warpL2TimeAtLeastBy(duration)` on the node debug API directly.
|
|
34
|
+
*/
|
|
35
|
+
warpL2TimeAtLeastBy(node: AztecNode & AztecNodeDebug, duration: bigint | number): Promise<void>;
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2hlYXRfY29kZXMuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy90ZXN0aW5nL2NoZWF0X2NvZGVzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxhQUFhLEVBQUUsZ0JBQWdCLEVBQUUsTUFBTSwyQkFBMkIsQ0FBQztBQUM1RSxPQUFPLEtBQUssRUFBRSxZQUFZLEVBQUUsTUFBTSw4QkFBOEIsQ0FBQztBQUNqRSxPQUFPLEtBQUssRUFBRSxTQUFTLEVBQUUsY0FBYyxFQUFFLE1BQU0sc0NBQXNDLENBQUM7QUFFdEY7OztHQUdHO0FBQ0gscUJBQWEsVUFBVTtJQUVuQix5QkFBeUI7SUFDbEIsR0FBRyxFQUFFLGFBQWE7SUFDekIsdURBQXVEO0lBQ2hELE1BQU0sRUFBRSxnQkFBZ0I7SUFKakM7SUFDRSx5QkFBeUI7SUFDbEIsR0FBRyxFQUFFLGFBQWE7SUFDekIsdURBQXVEO0lBQ2hELE1BQU0sRUFBRSxnQkFBZ0IsRUFDN0I7SUFFSixPQUFhLE1BQU0sQ0FBQyxPQUFPLEVBQUUsTUFBTSxFQUFFLEVBQUUsSUFBSSxFQUFFLFNBQVMsRUFBRSxZQUFZLEVBQUUsWUFBWSxHQUFHLE9BQU8sQ0FBQyxVQUFVLENBQUMsQ0FPdkc7SUFFRDs7Ozs7O09BTUc7SUFDSCxtQkFBbUIsQ0FBQyxJQUFJL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CAAC,IAAI,CAAC,CAE9F;CACF"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { EthCheatCodes, RollupCheatCodes } from '@aztec-labs/ethereum/test';
|
|
2
|
+
/**
|
|
3
|
+
* Wrapper for Aztec Debug API.
|
|
4
|
+
* @deprecated use the AztecNode debug API directly.
|
|
5
|
+
*/ export class CheatCodes {
|
|
6
|
+
eth;
|
|
7
|
+
rollup;
|
|
8
|
+
constructor(/** Cheat codes for L1.*/ eth, /** Cheat codes for the Aztec Rollup contract on L1. */ rollup){
|
|
9
|
+
this.eth = eth;
|
|
10
|
+
this.rollup = rollup;
|
|
11
|
+
}
|
|
12
|
+
static async create(rpcUrls, node, dateProvider) {
|
|
13
|
+
const ethCheatCodes = new EthCheatCodes(rpcUrls, dateProvider);
|
|
14
|
+
const rollupCheatCodes = new RollupCheatCodes(ethCheatCodes, await node.getNodeInfo().then((n)=>n.l1ContractAddresses));
|
|
15
|
+
return new CheatCodes(ethCheatCodes, rollupCheatCodes);
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Warps the L1 timestamp to at least `targetTimestamp` and mines an L2 block advancing the L2 timestamp to at least
|
|
19
|
+
* the target. Forwards to the node's debug API, which serializes the warp through the automine sequencer queue.
|
|
20
|
+
* @param node - The Aztec node whose debug API performs the warp. Must run an automine sequencer.
|
|
21
|
+
* @param targetTimestamp - The target timestamp to warp to (in seconds).
|
|
22
|
+
* @deprecated Call `node.warpL2TimeAtLeastTo(targetTimestamp)` on the node debug API directly.
|
|
23
|
+
*/ warpL2TimeAtLeastTo(node, targetTimestamp) {
|
|
24
|
+
return node.warpL2TimeAtLeastTo(Number(targetTimestamp));
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Warps the L1 timestamp forward by at least `duration` seconds and mines an L2 block advancing the L2 timestamp at
|
|
28
|
+
* least by the duration. Forwards to the node's debug API, which serializes the warp through the automine sequencer
|
|
29
|
+
* queue.
|
|
30
|
+
* @param node - The Aztec node whose debug API performs the warp. Must run an automine sequencer.
|
|
31
|
+
* @param duration - The duration to advance time by (in seconds).
|
|
32
|
+
* @deprecated Call `node.warpL2TimeAtLeastBy(duration)` on the node debug API directly.
|
|
33
|
+
*/ warpL2TimeAtLeastBy(node, duration) {
|
|
34
|
+
return node.warpL2TimeAtLeastBy(Number(duration));
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type EthCheatCodes } from '@aztec-labs/ethereum/test';
|
|
2
|
+
import type { EpochNumber } from '@aztec-labs/foundation/branded-types';
|
|
3
|
+
import type { Logger } from '@aztec-labs/foundation/log';
|
|
4
|
+
import type { EthAddress, L2BlockSource } from '@aztec-labs/stdlib/block';
|
|
5
|
+
export declare class EpochTestSettler {
|
|
6
|
+
private l2BlockSource;
|
|
7
|
+
private log;
|
|
8
|
+
private options;
|
|
9
|
+
private rollupCheatCodes;
|
|
10
|
+
private epochMonitor?;
|
|
11
|
+
constructor(cheatcodes: EthCheatCodes, rollupAddress: EthAddress, l2BlockSource: L2BlockSource, log: Logger, options: {
|
|
12
|
+
pollingIntervalMs: number;
|
|
13
|
+
provingDelayMs?: number;
|
|
14
|
+
});
|
|
15
|
+
start(): Promise<void>;
|
|
16
|
+
stop(): Promise<void>;
|
|
17
|
+
handleEpochReadyToProve(epoch: EpochNumber): Promise<boolean>;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZXBvY2hfdGVzdF9zZXR0bGVyLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvdGVzdGluZy9lcG9jaF90ZXN0X3NldHRsZXIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLEtBQUssYUFBYSxFQUFvQixNQUFNLDJCQUEyQixDQUFDO0FBQ2pGLE9BQU8sS0FBSyxFQUFFLFdBQVcsRUFB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Aa,gBAAgB;IAOzB,OAAO,CAAC,aAAa;IACrB,OAAO,CAAC,GAAG;IACX,OAAO,CAAC,OAAO;IARjB,OAAO,CAAC,gBAAgB,CAAmB;IAC3C,OAAO,CAAC,YAAY,CAAC,CAAe;IAEpC,YACE,UAAU,EAAE,aAAa,EACzB,aAAa,EAAE,UAAU,EACjB,aAAa,EAAE,aAAa,EAC5B,GAAG,EAAE,MAAM,EACX,OAAO,EAAE;QAAE,iBAAiB,EAAE,MAAM,CAAC;QAAC,cAAc,CAAC,EAAE,MAAM,CAAA;KAAE,EAGxE;IAEK,KAAK,kBAIV;IAEK,IAAI,kBAET;IAEK,uBAAuB,CAAC,KAAK,EAAE,WAAW,GAAG,OAAO,CAAC,OAAO,CAAC,CAclE;CACF"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { RollupCheatCodes } from '@aztec-labs/ethereum/test';
|
|
2
|
+
import { settleEpochOutbox } from '@aztec-labs/prover-client/test';
|
|
3
|
+
import { EpochMonitor } from '@aztec-labs/prover-node';
|
|
4
|
+
export class EpochTestSettler {
|
|
5
|
+
l2BlockSource;
|
|
6
|
+
log;
|
|
7
|
+
options;
|
|
8
|
+
rollupCheatCodes;
|
|
9
|
+
epochMonitor;
|
|
10
|
+
constructor(cheatcodes, rollupAddress, l2BlockSource, log, options){
|
|
11
|
+
this.l2BlockSource = l2BlockSource;
|
|
12
|
+
this.log = log;
|
|
13
|
+
this.options = options;
|
|
14
|
+
this.rollupCheatCodes = new RollupCheatCodes(cheatcodes, {
|
|
15
|
+
rollupAddress
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
async start() {
|
|
19
|
+
const { epochDuration } = await this.rollupCheatCodes.getConfig();
|
|
20
|
+
this.epochMonitor = new EpochMonitor(this.l2BlockSource, {
|
|
21
|
+
epochDuration: Number(epochDuration)
|
|
22
|
+
}, this.options);
|
|
23
|
+
this.epochMonitor.start(this);
|
|
24
|
+
}
|
|
25
|
+
async stop() {
|
|
26
|
+
await this.epochMonitor?.stop();
|
|
27
|
+
}
|
|
28
|
+
async handleEpochReadyToProve(epoch) {
|
|
29
|
+
const lastCheckpoint = await settleEpochOutbox({
|
|
30
|
+
rollupCheatCodes: this.rollupCheatCodes,
|
|
31
|
+
l2BlockSource: this.l2BlockSource,
|
|
32
|
+
epoch,
|
|
33
|
+
log: this.log
|
|
34
|
+
});
|
|
35
|
+
if (lastCheckpoint !== undefined) {
|
|
36
|
+
await this.rollupCheatCodes.markAsProven(lastCheckpoint);
|
|
37
|
+
} else {
|
|
38
|
+
this.log.warn(`No checkpoint found for epoch ${epoch}`);
|
|
39
|
+
}
|
|
40
|
+
return true;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { EthCheatCodes, RollupCheatCodes } from '@aztec-labs/ethereum/test';
|
|
2
|
+
export { CheatCodes } from './cheat_codes.js';
|
|
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';
|
|
6
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy90ZXN0aW5nL2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxhQUFhLEVBQUUsZ0JBQWdCLEVBQUUsTUFBTSwyQkFBMkIsQ0FBQztBQUM1RSxPQUFPLEVBQUUsVUFBVSxFQUFFLE1BQU0sa0JBQWtCLENBQUM7QUFDOUMsT0FBTyxFQUFFLGdCQUFnQixFQUFFLE1BQU0seUJBQXlCLENBQUM7QUFDM0QsT0FBTyxFQUFFLGlCQUFpQixFQUFFLGdCQUFnQixFQUFFLEtBQUssWUFBWSxFQUFFLEtBQUssbUJBQW1CLEVBQUUsTUFBTSxvQkFBb0IsQ0FBQztBQUN0SCxPQUFPLEVBQUUsNkJBQTZCLEVBQUUsTUFBTSwwQkFBMEIsQ0FBQyJ9
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/testing/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC5E,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,KAAK,YAAY,EAAE,KAAK,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AACtH,OAAO,EAAE,6BAA6B,EAAE,MAAM,0BAA0B,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { EthCheatCodes, RollupCheatCodes } from '@aztec-labs/ethereum/test';
|
|
2
|
+
export { CheatCodes } from './cheat_codes.js';
|
|
3
|
+
export { EpochTestSettler } from './epoch_test_settler.js';
|
|
4
|
+
export { setupLocalNetwork, TEST_FEE_PADDING } from './local-network.js';
|
|
5
|
+
export { getTokenAllowedSetupFunctions } from './token_allowed_setup.js';
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { AztecNodeService } from '@aztec-labs/aztec-node';
|
|
2
|
+
import type { AztecNodeConfig } from '@aztec-labs/aztec-node/config';
|
|
3
|
+
import type { Fr } from '@aztec-labs/aztec.js/fields';
|
|
4
|
+
import type { AztecAddress } from '@aztec-labs/stdlib/aztec-address';
|
|
5
|
+
/** A running in-process local network: an inline Aztec node backed by its own anvil L1. */
|
|
6
|
+
export interface LocalNetwork extends AsyncDisposable {
|
|
7
|
+
/** Fully-synced Aztec node, ready to serve client requests. */
|
|
8
|
+
node: AztecNodeService;
|
|
9
|
+
/** RPC URL of the spawned anvil instance. */
|
|
10
|
+
l1RpcUrl: string;
|
|
11
|
+
/** Chain id used on L1 (foundry's default 31337). */
|
|
12
|
+
l1ChainId: number;
|
|
13
|
+
/** Stops every process started by the fixture: node and anvil. Also invoked by `await using`. */
|
|
14
|
+
stop: () => Promise<void>;
|
|
15
|
+
}
|
|
16
|
+
/** Options for {@link setupLocalNetwork}. */
|
|
17
|
+
export interface LocalNetworkOptions {
|
|
18
|
+
/**
|
|
19
|
+
* Addresses that should hold fee juice at genesis. Saves each of these the round-trip of bridging
|
|
20
|
+
* + claiming fee juice before they can pay for gas.
|
|
21
|
+
*/
|
|
22
|
+
fundedAddresses?: AztecAddress[];
|
|
23
|
+
/** Override the default per-address genesis fee juice granted to {@link fundedAddresses}. */
|
|
24
|
+
initialAccountFeeJuice?: Fr;
|
|
25
|
+
/** Node config overrides, e.g. `realProofs`, `aztecEpochDuration`, `p2pEnabled`. */
|
|
26
|
+
config?: Partial<AztecNodeConfig>;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Spin up an in-process local network with the given addresses pre-funded.
|
|
30
|
+
*
|
|
31
|
+
* Each call spawns its own anvil on an OS-assigned random port and runs the Aztec node inline via
|
|
32
|
+
* the same {@link createLocalNetwork} codepath that backs `aztec start --local-network` (with the
|
|
33
|
+
* sandbox account/FPC/token setup skipped). Distinct ports let independent suites run in parallel.
|
|
34
|
+
* The caller must `await result.stop()` in its teardown (or hold the result with `await using`).
|
|
35
|
+
*
|
|
36
|
+
* Requires a Foundry toolchain (`anvil`/`forge`), installed via `aztec-up` or `foundryup`. Binaries
|
|
37
|
+
* are located in the standard install directories or on `PATH`; set `$ANVIL_BIN` / `$FORGE_BIN` to
|
|
38
|
+
* pin specific ones.
|
|
39
|
+
*/
|
|
40
|
+
export declare function setupLocalNetwork(opts?: LocalNetworkOptions): Promise<LocalNetwork>;
|
|
41
|
+
/**
|
|
42
|
+
* Min-fee padding multiplier for test wallets whose txs may mine well after their fee estimate.
|
|
43
|
+
* The automine sequencer builds one block per tx and advances L1 time in big jumps, and proposer
|
|
44
|
+
* pipelining evolves the fee-asset price across the build/publish gap (~20x observed in CI), so the
|
|
45
|
+
* network's congestion base fee can swing sharply between the wallet's fee estimate and the block
|
|
46
|
+
* the tx actually lands in. The default wallet padding isn't enough and trips
|
|
47
|
+
* `maxFeesPerGas.feePerL2Gas must be >= gasFees.feePerL2Gas`. Apply via
|
|
48
|
+
* `wallet.setMinFeePadding(TEST_FEE_PADDING)` on every test wallet that sends txs.
|
|
49
|
+
*/
|
|
50
|
+
export declare const TEST_FEE_PADDING = 30;
|
|
51
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibG9jYWwtbmV0d29yay5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL3Rlc3RpbmcvbG9jYWwtbmV0d29yay50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEtBQUssRUFBRSxnQkFBZ0IsRUFBRSxNQUFNLHdCQUF3QixDQUFDO0FBQy9ELE9BQU8sS0FBSyxFQUFFLGVBQWUsRUFBRSxNQUFNLCtCQUErQixDQUFDO0FBQ3JFLE9BQU8sS0FBSyxFQUFFLEVBQUUsRUFBRSxNQUFNLDZCQUE2QixDQUFDO0FBRXRELE9BQU8sS0FBSyxFQUFFLFlBQVksRUFBRSxNQUFNLGtDQUFrQyxDQUFDO0FBS3JFLDJGQUEyRjtBQUMzRixNQUFNLFdBQVcsWUFBYSxTQUFRLGVBQWU7SUFDbkQsK0RBQStEO0lBQy9ELElBQUksRUFBRSxnQkFBZ0IsQ0FBQztJQUN2Qiw2Q0FBNkM7SUFDN0MsUUFBUSxFQUFFLE1BQU0sQ0FBQztJQUNqQixxREFBcUQ7SUFDckQsU0FBUyxFQUFFLE1BQU0sQ0FBQztJQUNsQixpR0FBaUc7SUFDakcsSUFBSSxFQUFFLE1BQU0s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mB;IAClC;;;OAGG;IACH,eAAe,CAAC,EAAE,YAAY,EAAE,CAAC;IACjC,6FAA6F;IAC7F,sBAAsB,CAAC,EAAE,EAAE,CAAC;IAC5B,oFAAoF;IACpF,MAAM,CAAC,EAAE,OAAO,CAAC,eAAe,CAAC,CAAC;CACnC;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,iBAAiB,CAAC,IAAI,GAAE,mBAAwB,GAAG,OAAO,CAAC,YAAY,CAAC,CAsC7F;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,gBAAgB,KAAK,CAAC"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { startAnvil } from '@aztec-labs/ethereum/test';
|
|
2
|
+
import { foundry } from 'viem/chains';
|
|
3
|
+
import { createLocalNetwork } from '../local-network/local-network.js';
|
|
4
|
+
/**
|
|
5
|
+
* Spin up an in-process local network with the given addresses pre-funded.
|
|
6
|
+
*
|
|
7
|
+
* Each call spawns its own anvil on an OS-assigned random port and runs the Aztec node inline via
|
|
8
|
+
* the same {@link createLocalNetwork} codepath that backs `aztec start --local-network` (with the
|
|
9
|
+
* sandbox account/FPC/token setup skipped). Distinct ports let independent suites run in parallel.
|
|
10
|
+
* The caller must `await result.stop()` in its teardown (or hold the result with `await using`).
|
|
11
|
+
*
|
|
12
|
+
* Requires a Foundry toolchain (`anvil`/`forge`), installed via `aztec-up` or `foundryup`. Binaries
|
|
13
|
+
* are located in the standard install directories or on `PATH`; set `$ANVIL_BIN` / `$FORGE_BIN` to
|
|
14
|
+
* pin specific ones.
|
|
15
|
+
*/ export async function setupLocalNetwork(opts = {}) {
|
|
16
|
+
// `--port 0` → anvil binds an ephemeral port that `startAnvil` reads back, so parallel suites
|
|
17
|
+
// never collide on a fixed port.
|
|
18
|
+
const { rpcUrl, stop: stopAnvil } = await startAnvil({
|
|
19
|
+
port: 0
|
|
20
|
+
});
|
|
21
|
+
try {
|
|
22
|
+
const { node, stop: stopNode } = await createLocalNetwork({
|
|
23
|
+
...opts.config,
|
|
24
|
+
l1RpcUrls: [
|
|
25
|
+
rpcUrl
|
|
26
|
+
],
|
|
27
|
+
testAccounts: false,
|
|
28
|
+
prefundAddresses: (opts.fundedAddresses ?? []).map((a)=>a.toString()),
|
|
29
|
+
initialAccountFeeJuice: opts.initialAccountFeeJuice
|
|
30
|
+
}, ()=>{});
|
|
31
|
+
// Stop the node before anvil (its teardown still talks to L1); the finally guarantees anvil is
|
|
32
|
+
// reaped even if node shutdown throws.
|
|
33
|
+
const stop = async ()=>{
|
|
34
|
+
try {
|
|
35
|
+
await stopNode();
|
|
36
|
+
} finally{
|
|
37
|
+
await stopAnvil();
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
return {
|
|
41
|
+
node,
|
|
42
|
+
l1RpcUrl: rpcUrl,
|
|
43
|
+
l1ChainId: foundry.id,
|
|
44
|
+
stop,
|
|
45
|
+
[Symbol.asyncDispose]: stop
|
|
46
|
+
};
|
|
47
|
+
} catch (err) {
|
|
48
|
+
await stopAnvil();
|
|
49
|
+
throw err;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Min-fee padding multiplier for test wallets whose txs may mine well after their fee estimate.
|
|
54
|
+
* The automine sequencer builds one block per tx and advances L1 time in big jumps, and proposer
|
|
55
|
+
* pipelining evolves the fee-asset price across the build/publish gap (~20x observed in CI), so the
|
|
56
|
+
* network's congestion base fee can swing sharply between the wallet's fee estimate and the block
|
|
57
|
+
* the tx actually lands in. The default wallet padding isn't enough and trips
|
|
58
|
+
* `maxFeesPerGas.feePerL2Gas must be >= gasFees.feePerL2Gas`. Apply via
|
|
59
|
+
* `wallet.setMinFeePadding(TEST_FEE_PADDING)` on every test wallet that sends txs.
|
|
60
|
+
*/ export const TEST_FEE_PADDING = 30;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ContractArtifact } from '@aztec-labs/stdlib/abi';
|
|
2
|
+
import type { AllowedElement } from '@aztec-labs/stdlib/interfaces/server';
|
|
3
|
+
/**
|
|
4
|
+
* Returns the allowlist entries needed for FPC-based fee payments, keyed by the contract class of
|
|
5
|
+
* the `artifact` actually deployed as the fee token (defaults to canonical Token). The setup-phase
|
|
6
|
+
* validator matches these entries by class id, so a test deploying the codegen'd TestToken as its
|
|
7
|
+
* fee vehicle must pass `TestTokenContract.artifact` here -- otherwise the FPC fee calls are matched
|
|
8
|
+
* against the wrong class and rejected. Test-only: FPC fee payment with custom tokens won't work on
|
|
9
|
+
* mainnet alpha.
|
|
10
|
+
*/
|
|
11
|
+
export declare function getTokenAllowedSetupFunctions(artifact?: ContractArtifact): Promise<AllowedElement[]>;
|
|
12
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidG9rZW5fYWxsb3dlZF9zZXR1cC5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL3Rlc3RpbmcvdG9rZW5fYWxsb3dlZF9zZXR1cC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFFQSxPQUFPLEtBQUssRUFBRSxnQkFBZ0IsRUFBRSxNQUFNLHdCQUF3QixDQUFDO0FBRS9ELE9BQU8sS0FBSyxFQUFFLGNBQWMsRUFBRSxNQUFNLHNDQUFzQyxDQUFDO0FBRTNFOzs7Ozs7O0dBT0c7QUFDSCx3QkFBc0IsNkJBQTZCLENBQ2pELFFBQVEsR0FBRSxnQkFBd0MsR0FDakQsT0FBTyxDQUFDLGNBQWMsRUFBRSxDQUFDLENBUzNCIn0=
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"token_allowed_setup.d.ts","sourceRoot":"","sources":["../../src/testing/token_allowed_setup.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE/D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sCAAsC,CAAC;AAE3E;;;;;;;GAOG;AACH,wBAAsB,6BAA6B,CACjD,QAAQ,GAAE,gBAAwC,GACjD,OAAO,CAAC,cAAc,EAAE,CAAC,CAS3B"}
|