@aztec/aztec 4.0.0-nightly.20250907 → 4.0.0-nightly.20260107
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dest/bin/index.d.ts +1 -1
- package/dest/bin/index.js +11 -10
- 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 +9 -25
- package/dest/cli/aztec_start_options.d.ts +1 -1
- package/dest/cli/aztec_start_options.d.ts.map +1 -1
- package/dest/cli/aztec_start_options.js +22 -39
- package/dest/cli/cli.d.ts +1 -1
- package/dest/cli/cli.d.ts.map +1 -1
- package/dest/cli/cli.js +46 -1
- package/dest/cli/cmds/start_archiver.d.ts +1 -1
- package/dest/cli/cmds/start_archiver.d.ts.map +1 -1
- package/dest/cli/cmds/start_archiver.js +9 -9
- package/dest/cli/cmds/start_bot.d.ts +4 -7
- package/dest/cli/cmds/start_bot.d.ts.map +1 -1
- package/dest/cli/cmds/start_bot.js +25 -14
- package/dest/cli/cmds/start_node.d.ts +1 -1
- package/dest/cli/cmds/start_node.d.ts.map +1 -1
- package/dest/cli/cmds/start_node.js +13 -21
- package/dest/cli/cmds/start_p2p_bootstrap.d.ts +1 -1
- package/dest/cli/cmds/start_p2p_bootstrap.js +1 -1
- 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 +11 -2
- 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 +8 -3
- package/dest/cli/cmds/start_prover_node.d.ts +1 -1
- package/dest/cli/cmds/start_prover_node.d.ts.map +1 -1
- package/dest/cli/cmds/start_prover_node.js +16 -7
- package/dest/cli/cmds/start_txe.d.ts +1 -1
- package/dest/cli/index.d.ts +1 -1
- package/dest/cli/preload_crs.d.ts +1 -1
- package/dest/cli/release_version.d.ts +1 -1
- package/dest/cli/util.d.ts +12 -10
- package/dest/cli/util.d.ts.map +1 -1
- package/dest/cli/util.js +7 -7
- package/dest/cli/versioning.d.ts +1 -1
- package/dest/cli/versioning.js +3 -3
- package/dest/examples/token.d.ts +1 -1
- package/dest/examples/token.js +18 -16
- package/dest/examples/util.d.ts +3 -3
- package/dest/examples/util.d.ts.map +1 -1
- package/dest/examples/util.js +1 -1
- package/dest/index.d.ts +2 -2
- package/dest/index.d.ts.map +1 -1
- package/dest/index.js +1 -1
- package/dest/local-network/banana_fpc.d.ts +10 -0
- package/dest/local-network/banana_fpc.d.ts.map +1 -0
- package/dest/{sandbox → local-network}/banana_fpc.js +15 -19
- package/dest/local-network/index.d.ts +4 -0
- package/dest/local-network/index.d.ts.map +1 -0
- package/dest/local-network/index.js +3 -0
- package/dest/local-network/local-network.d.ts +72 -0
- package/dest/local-network/local-network.d.ts.map +1 -0
- package/dest/{sandbox/sandbox.js → local-network/local-network.js} +43 -57
- package/dest/local-network/sponsored_fpc.d.ts +5 -0
- package/dest/local-network/sponsored_fpc.d.ts.map +1 -0
- package/dest/{sandbox → local-network}/sponsored_fpc.js +7 -8
- package/dest/mnemonic.d.ts +1 -1
- package/dest/splash.d.ts +1 -1
- package/dest/testing/anvil_test_watcher.d.ts +4 -4
- package/dest/testing/anvil_test_watcher.d.ts.map +1 -1
- package/dest/testing/anvil_test_watcher.js +19 -18
- package/dest/testing/cheat_codes.d.ts +7 -10
- package/dest/testing/cheat_codes.d.ts.map +1 -1
- package/dest/testing/cheat_codes.js +9 -10
- package/dest/testing/index.d.ts +1 -2
- package/dest/testing/index.d.ts.map +1 -1
- package/dest/testing/index.js +0 -1
- package/package.json +39 -37
- package/src/bin/index.ts +12 -10
- package/src/cli/aztec_start_action.ts +9 -22
- package/src/cli/aztec_start_options.ts +23 -40
- package/src/cli/cli.ts +46 -1
- package/src/cli/cmds/start_archiver.ts +9 -9
- package/src/cli/cmds/start_bot.ts +36 -13
- package/src/cli/cmds/start_node.ts +16 -17
- package/src/cli/cmds/start_p2p_bootstrap.ts +1 -1
- package/src/cli/cmds/start_prover_agent.ts +7 -2
- package/src/cli/cmds/start_prover_broker.ts +17 -3
- package/src/cli/cmds/start_prover_node.ts +13 -8
- package/src/cli/util.ts +12 -10
- package/src/cli/versioning.ts +3 -3
- package/src/examples/token.ts +20 -17
- package/src/examples/util.ts +2 -2
- package/src/index.ts +5 -5
- package/src/{sandbox → local-network}/banana_fpc.ts +16 -21
- package/src/local-network/index.ts +7 -0
- package/src/{sandbox/sandbox.ts → local-network/local-network.ts} +68 -99
- package/src/local-network/sponsored_fpc.ts +26 -0
- package/src/testing/anvil_test_watcher.ts +18 -19
- package/src/testing/cheat_codes.ts +13 -13
- package/src/testing/index.ts +0 -1
- package/dest/cli/chain_l2_config.d.ts +0 -31
- package/dest/cli/chain_l2_config.d.ts.map +0 -1
- package/dest/cli/chain_l2_config.js +0 -261
- package/dest/cli/cmds/start_blob_sink.d.ts +0 -3
- package/dest/cli/cmds/start_blob_sink.d.ts.map +0 -1
- package/dest/cli/cmds/start_blob_sink.js +0 -33
- package/dest/cli/cmds/start_pxe.d.ts +0 -16
- package/dest/cli/cmds/start_pxe.d.ts.map +0 -1
- package/dest/cli/cmds/start_pxe.js +0 -31
- package/dest/cli/get_l1_config.d.ts +0 -7
- package/dest/cli/get_l1_config.d.ts.map +0 -1
- package/dest/cli/get_l1_config.js +0 -13
- package/dest/sandbox/banana_fpc.d.ts +0 -11
- package/dest/sandbox/banana_fpc.d.ts.map +0 -1
- package/dest/sandbox/index.d.ts +0 -4
- package/dest/sandbox/index.d.ts.map +0 -1
- package/dest/sandbox/index.js +0 -3
- package/dest/sandbox/sandbox.d.ts +0 -83
- package/dest/sandbox/sandbox.d.ts.map +0 -1
- package/dest/sandbox/sponsored_fpc.d.ts +0 -4
- package/dest/sandbox/sponsored_fpc.d.ts.map +0 -1
- package/dest/testing/aztec_cheat_codes.d.ts +0 -59
- package/dest/testing/aztec_cheat_codes.d.ts.map +0 -1
- package/dest/testing/aztec_cheat_codes.js +0 -62
- package/src/cli/chain_l2_config.ts +0 -341
- package/src/cli/cmds/start_blob_sink.ts +0 -57
- package/src/cli/cmds/start_pxe.ts +0 -49
- package/src/cli/get_l1_config.ts +0 -19
- package/src/sandbox/index.ts +0 -4
- package/src/sandbox/sponsored_fpc.ts +0 -27
- package/src/testing/aztec_cheat_codes.ts +0 -77
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env -S node --no-warnings
|
|
2
|
-
import { type AztecNodeConfig, AztecNodeService } from '@aztec/aztec-node';
|
|
3
|
-
import { EthAddress } from '@aztec/aztec.js';
|
|
4
|
-
import { type BlobSinkClientInterface } from '@aztec/blob-sink/client';
|
|
5
|
-
import { Fr } from '@aztec/foundation/fields';
|
|
6
|
-
import { type LogFn } from '@aztec/foundation/log';
|
|
7
|
-
import { DateProvider } from '@aztec/foundation/timer';
|
|
8
|
-
import { type PXEServiceConfig } from '@aztec/pxe/server';
|
|
9
|
-
import type { AztecNode } from '@aztec/stdlib/interfaces/client';
|
|
10
|
-
import type { PublicDataTreeLeaf } from '@aztec/stdlib/trees';
|
|
11
|
-
import { type TelemetryClient } from '@aztec/telemetry-client';
|
|
12
|
-
import { type HDAccount, type PrivateKeyAccount } from 'viem';
|
|
13
|
-
/**
|
|
14
|
-
* Function to deploy our L1 contracts to the sandbox L1
|
|
15
|
-
* @param aztecNodeConfig - The Aztec Node Config
|
|
16
|
-
* @param hdAccount - Account for publishing L1 contracts
|
|
17
|
-
*/
|
|
18
|
-
export declare function deployContractsToL1(aztecNodeConfig: AztecNodeConfig, hdAccount: HDAccount | PrivateKeyAccount, contractDeployLogger?: import("@aztec/aztec.js").Logger, opts?: {
|
|
19
|
-
assumeProvenThroughBlockNumber?: number;
|
|
20
|
-
salt?: number;
|
|
21
|
-
genesisArchiveRoot?: Fr;
|
|
22
|
-
feeJuicePortalInitialBalance?: bigint;
|
|
23
|
-
}): Promise<{
|
|
24
|
-
rollupAddress: EthAddress;
|
|
25
|
-
registryAddress: EthAddress;
|
|
26
|
-
inboxAddress: EthAddress;
|
|
27
|
-
outboxAddress: EthAddress;
|
|
28
|
-
feeJuiceAddress: EthAddress;
|
|
29
|
-
feeJuicePortalAddress: EthAddress;
|
|
30
|
-
coinIssuerAddress: EthAddress;
|
|
31
|
-
rewardDistributorAddress: EthAddress;
|
|
32
|
-
governanceProposerAddress: EthAddress;
|
|
33
|
-
governanceAddress: EthAddress;
|
|
34
|
-
stakingAssetAddress: EthAddress;
|
|
35
|
-
} & {
|
|
36
|
-
slashFactoryAddress?: EthAddress | undefined;
|
|
37
|
-
feeAssetHandlerAddress?: EthAddress | undefined;
|
|
38
|
-
stakingAssetHandlerAddress?: EthAddress | undefined;
|
|
39
|
-
zkPassportVerifierAddress?: EthAddress | undefined;
|
|
40
|
-
gseAddress?: EthAddress | undefined;
|
|
41
|
-
} & {
|
|
42
|
-
rollupAddress: EthAddress;
|
|
43
|
-
} & {
|
|
44
|
-
rollupAddress: EthAddress;
|
|
45
|
-
}>;
|
|
46
|
-
/** Sandbox settings. */
|
|
47
|
-
export type SandboxConfig = AztecNodeConfig & {
|
|
48
|
-
/** Mnemonic used to derive the L1 deployer private key.*/
|
|
49
|
-
l1Mnemonic: string;
|
|
50
|
-
/** Salt used to deploy L1 contracts.*/
|
|
51
|
-
deployAztecContractsSalt: string;
|
|
52
|
-
/** Whether to expose PXE service on sandbox start.*/
|
|
53
|
-
noPXE: boolean;
|
|
54
|
-
/** Whether to deploy test accounts on sandbox start.*/
|
|
55
|
-
testAccounts: boolean;
|
|
56
|
-
};
|
|
57
|
-
/**
|
|
58
|
-
* Create and start a new Aztec Node and PXE. Deploys L1 contracts.
|
|
59
|
-
* Does not start any HTTP services nor populate any initial accounts.
|
|
60
|
-
* @param config - Optional Sandbox settings.
|
|
61
|
-
*/
|
|
62
|
-
export declare function createSandbox(config: Partial<SandboxConfig> | undefined, userLog: LogFn): Promise<{
|
|
63
|
-
node: AztecNodeService;
|
|
64
|
-
pxe: import("@aztec/pxe/server").PXEService;
|
|
65
|
-
stop: () => Promise<void>;
|
|
66
|
-
}>;
|
|
67
|
-
/**
|
|
68
|
-
* Create and start a new Aztec RPC HTTP Server
|
|
69
|
-
* @param config - Optional Aztec node settings.
|
|
70
|
-
*/
|
|
71
|
-
export declare function createAztecNode(config?: Partial<AztecNodeConfig>, deps?: {
|
|
72
|
-
telemetry?: TelemetryClient;
|
|
73
|
-
blobSinkClient?: BlobSinkClientInterface;
|
|
74
|
-
dateProvider?: DateProvider;
|
|
75
|
-
}, options?: {
|
|
76
|
-
prefilledPublicData?: PublicDataTreeLeaf[];
|
|
77
|
-
}): Promise<AztecNodeService>;
|
|
78
|
-
/**
|
|
79
|
-
* Create and start a new Aztec PXE HTTP Server
|
|
80
|
-
* @param config - Optional PXE settings.
|
|
81
|
-
*/
|
|
82
|
-
export declare function createAztecPXE(node: AztecNode, config?: Partial<PXEServiceConfig>): Promise<import("@aztec/pxe/server").PXEService>;
|
|
83
|
-
//# sourceMappingURL=sandbox.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sandbox.d.ts","sourceRoot":"","sources":["../../src/sandbox/sandbox.ts"],"names":[],"mappings":";AAGA,OAAO,EAAE,KAAK,eAAe,EAAE,gBAAgB,EAAoB,MAAM,mBAAmB,CAAC;AAC7F,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,KAAK,uBAAuB,EAAwB,MAAM,yBAAyB,CAAC;AAa7F,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAC9C,OAAO,EAAE,KAAK,KAAK,EAAgB,MAAM,uBAAuB,CAAC;AACjE,OAAO,EAAE,YAAY,EAAoB,MAAM,yBAAyB,CAAC;AAGzE,OAAO,EAAE,KAAK,gBAAgB,EAAyC,MAAM,mBAAmB,CAAC;AACjG,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,EACL,KAAK,eAAe,EAGrB,MAAM,yBAAyB,CAAC;AAGjC,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,iBAAiB,EAA2D,MAAM,MAAM,CAAC;AAcvH;;;;GAIG;AACH,wBAAsB,mBAAmB,CACvC,eAAe,EAAE,eAAe,EAChC,SAAS,EAAE,SAAS,GAAG,iBAAiB,EACxC,oBAAoB,mCAAS,EAC7B,IAAI,GAAE;IACJ,8BAA8B,CAAC,EAAE,MAAM,CAAC;IACxC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,kBAAkB,CAAC,EAAE,EAAE,CAAC;IACxB,4BAA4B,CAAC,EAAE,MAAM,CAAC;CAClC;;;;;;;;;;;;;;;;;;;;;;GAkCP;AAED,wBAAwB;AACxB,MAAM,MAAM,aAAa,GAAG,eAAe,GAAG;IAC5C,0DAA0D;IAC1D,UAAU,EAAE,MAAM,CAAC;IACnB,uCAAuC;IACvC,wBAAwB,EAAE,MAAM,CAAC;IACjC,qDAAqD;IACrD,KAAK,EAAE,OAAO,CAAC;IACf,uDAAuD;IACvD,YAAY,EAAE,OAAO,CAAC;CACvB,CAAC;AAEF;;;;GAIG;AACH,wBAAsB,aAAa,CAAC,MAAM,EAAE,OAAO,CAAC,aAAa,CAAC,YAAK,EAAE,OAAO,EAAE,KAAK;;;;GA4GtF;AAED;;;GAGG;AACH,wBAAsB,eAAe,CACnC,MAAM,GAAE,OAAO,CAAC,eAAe,CAAM,EACrC,IAAI,GAAE;IAAE,SAAS,CAAC,EAAE,eAAe,CAAC;IAAC,cAAc,CAAC,EAAE,uBAAuB,CAAC;IAAC,YAAY,CAAC,EAAE,YAAY,CAAA;CAAO,EACjH,OAAO,GAAE;IAAE,mBAAmB,CAAC,EAAE,kBAAkB,EAAE,CAAA;CAAO,6BAW7D;AAED;;;GAGG;AACH,wBAAsB,cAAc,CAAC,IAAI,EAAE,SAAS,EAAE,MAAM,GAAE,OAAO,CAAC,gBAAgB,CAAM,mDAI3F"}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { type PXE } from '@aztec/aztec.js';
|
|
2
|
-
export declare function getSponsoredFPCAddress(): Promise<import("@aztec/aztec.js").AztecAddress>;
|
|
3
|
-
export declare function getDeployedSponsoredFPCAddress(pxe: PXE): Promise<import("@aztec/aztec.js").AztecAddress>;
|
|
4
|
-
//# sourceMappingURL=sponsored_fpc.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sponsored_fpc.d.ts","sourceRoot":"","sources":["../../src/sandbox/sponsored_fpc.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,GAAG,EAET,MAAM,iBAAiB,CAAC;AAUzB,wBAAsB,sBAAsB,oDAE3C;AAED,wBAAsB,8BAA8B,CAAC,GAAG,EAAE,GAAG,mDAO5D"}
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import { Fr } from '@aztec/foundation/fields';
|
|
2
|
-
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
3
|
-
import type { PXE } from '@aztec/stdlib/interfaces/client';
|
|
4
|
-
import type { Note } from '@aztec/stdlib/note';
|
|
5
|
-
/**
|
|
6
|
-
* A class that provides utility functions for interacting with the aztec chain.
|
|
7
|
-
*/
|
|
8
|
-
export declare class AztecCheatCodes {
|
|
9
|
-
/**
|
|
10
|
-
* The PXE Service to use for interacting with the chain
|
|
11
|
-
*/
|
|
12
|
-
pxe: PXE;
|
|
13
|
-
/**
|
|
14
|
-
* The logger to use for the aztec cheatcodes
|
|
15
|
-
*/
|
|
16
|
-
logger: import("@aztec/foundation/log").Logger;
|
|
17
|
-
constructor(
|
|
18
|
-
/**
|
|
19
|
-
* The PXE Service to use for interacting with the chain
|
|
20
|
-
*/
|
|
21
|
-
pxe: PXE,
|
|
22
|
-
/**
|
|
23
|
-
* The logger to use for the aztec cheatcodes
|
|
24
|
-
*/
|
|
25
|
-
logger?: import("@aztec/foundation/log").Logger);
|
|
26
|
-
/**
|
|
27
|
-
* Computes the slot value for a given map and key.
|
|
28
|
-
* @param mapSlot - The slot of the map (specified in Aztec.nr contract)
|
|
29
|
-
* @param key - The key to lookup in the map
|
|
30
|
-
* @returns The storage slot of the value in the map
|
|
31
|
-
*/
|
|
32
|
-
computeSlotInMap(mapSlot: Fr | bigint, key: Fr | bigint | AztecAddress): Promise<Fr>;
|
|
33
|
-
/**
|
|
34
|
-
* Get the current blocknumber
|
|
35
|
-
* @returns The current block number
|
|
36
|
-
*/
|
|
37
|
-
blockNumber(): Promise<number>;
|
|
38
|
-
/**
|
|
39
|
-
* Get the current timestamp
|
|
40
|
-
* @returns The current timestamp
|
|
41
|
-
*/
|
|
42
|
-
timestamp(): Promise<number>;
|
|
43
|
-
/**
|
|
44
|
-
* Loads the value stored at the given slot in the public storage of the given contract.
|
|
45
|
-
* @param who - The address of the contract
|
|
46
|
-
* @param slot - The storage slot to lookup
|
|
47
|
-
* @returns The value stored at the given slot
|
|
48
|
-
*/
|
|
49
|
-
loadPublic(who: AztecAddress, slot: Fr | bigint): Promise<Fr>;
|
|
50
|
-
/**
|
|
51
|
-
* Loads the value stored at the given slot in the private storage of the given contract.
|
|
52
|
-
* @param contract - The address of the contract
|
|
53
|
-
* @param recipient - The address whose public key was used to encrypt the note
|
|
54
|
-
* @param slot - The storage slot to lookup
|
|
55
|
-
* @returns The notes stored at the given slot
|
|
56
|
-
*/
|
|
57
|
-
loadPrivate(recipient: AztecAddress, contract: AztecAddress, slot: Fr | bigint): Promise<Note[]>;
|
|
58
|
-
}
|
|
59
|
-
//# sourceMappingURL=aztec_cheat_codes.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"aztec_cheat_codes.d.ts","sourceRoot":"","sources":["../../src/testing/aztec_cheat_codes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAE9C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAEhE,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,iCAAiC,CAAC;AAC3D,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAE/C;;GAEG;AACH,qBAAa,eAAe;IAExB;;OAEG;IACI,GAAG,EAAE,GAAG;IACf;;OAEG;IACI,MAAM;;IAPb;;OAEG;IACI,GAAG,EAAE,GAAG;IACf;;OAEG;IACI,MAAM,yCAAsC;IAGrD;;;;;OAKG;IACI,gBAAgB,CAAC,OAAO,EAAE,EAAE,GAAG,MAAM,EAAE,GAAG,EAAE,EAAE,GAAG,MAAM,GAAG,YAAY,GAAG,OAAO,CAAC,EAAE,CAAC;IAK3F;;;OAGG;IACU,WAAW,IAAI,OAAO,CAAC,MAAM,CAAC;IAI3C;;;OAGG;IACU,SAAS,IAAI,OAAO,CAAC,MAAM,CAAC;IAKzC;;;;;OAKG;IACU,UAAU,CAAC,GAAG,EAAE,YAAY,EAAE,IAAI,EAAE,EAAE,GAAG,MAAM,GAAG,OAAO,CAAC,EAAE,CAAC;IAK1E;;;;;;OAMG;IACU,WAAW,CAAC,SAAS,EAAE,YAAY,EAAE,QAAQ,EAAE,YAAY,EAAE,IAAI,EAAE,EAAE,GAAG,MAAM,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC;CAQ9G"}
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import { Fr } from '@aztec/foundation/fields';
|
|
2
|
-
import { createLogger } from '@aztec/foundation/log';
|
|
3
|
-
import { deriveStorageSlotInMap } from '@aztec/stdlib/hash';
|
|
4
|
-
/**
|
|
5
|
-
* A class that provides utility functions for interacting with the aztec chain.
|
|
6
|
-
*/ export class AztecCheatCodes {
|
|
7
|
-
pxe;
|
|
8
|
-
logger;
|
|
9
|
-
constructor(/**
|
|
10
|
-
* The PXE Service to use for interacting with the chain
|
|
11
|
-
*/ pxe, /**
|
|
12
|
-
* The logger to use for the aztec cheatcodes
|
|
13
|
-
*/ logger = createLogger('aztecjs:cheat_codes')){
|
|
14
|
-
this.pxe = pxe;
|
|
15
|
-
this.logger = logger;
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* Computes the slot value for a given map and key.
|
|
19
|
-
* @param mapSlot - The slot of the map (specified in Aztec.nr contract)
|
|
20
|
-
* @param key - The key to lookup in the map
|
|
21
|
-
* @returns The storage slot of the value in the map
|
|
22
|
-
*/ computeSlotInMap(mapSlot, key) {
|
|
23
|
-
const keyFr = typeof key === 'bigint' ? new Fr(key) : key.toField();
|
|
24
|
-
return deriveStorageSlotInMap(mapSlot, keyFr);
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Get the current blocknumber
|
|
28
|
-
* @returns The current block number
|
|
29
|
-
*/ async blockNumber() {
|
|
30
|
-
return await this.pxe.getBlockNumber();
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* Get the current timestamp
|
|
34
|
-
* @returns The current timestamp
|
|
35
|
-
*/ async timestamp() {
|
|
36
|
-
const res = await this.pxe.getBlock(await this.blockNumber());
|
|
37
|
-
return Number(res?.header.globalVariables.timestamp ?? 0);
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* Loads the value stored at the given slot in the public storage of the given contract.
|
|
41
|
-
* @param who - The address of the contract
|
|
42
|
-
* @param slot - The storage slot to lookup
|
|
43
|
-
* @returns The value stored at the given slot
|
|
44
|
-
*/ async loadPublic(who, slot) {
|
|
45
|
-
const storageValue = await this.pxe.getPublicStorageAt(who, new Fr(slot));
|
|
46
|
-
return storageValue;
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* Loads the value stored at the given slot in the private storage of the given contract.
|
|
50
|
-
* @param contract - The address of the contract
|
|
51
|
-
* @param recipient - The address whose public key was used to encrypt the note
|
|
52
|
-
* @param slot - The storage slot to lookup
|
|
53
|
-
* @returns The notes stored at the given slot
|
|
54
|
-
*/ async loadPrivate(recipient, contract, slot) {
|
|
55
|
-
const extendedNotes = await this.pxe.getNotes({
|
|
56
|
-
recipient,
|
|
57
|
-
contractAddress: contract,
|
|
58
|
-
storageSlot: new Fr(slot)
|
|
59
|
-
});
|
|
60
|
-
return extendedNotes.map((extendedNote)=>extendedNote.note);
|
|
61
|
-
}
|
|
62
|
-
}
|
|
@@ -1,341 +0,0 @@
|
|
|
1
|
-
import { EthAddress } from '@aztec/aztec.js';
|
|
2
|
-
import { DefaultL1ContractsConfig, type L1ContractsConfig } from '@aztec/ethereum';
|
|
3
|
-
import type { EnvVar, NetworkNames } from '@aztec/foundation/config';
|
|
4
|
-
import type { SharedNodeConfig } from '@aztec/node-lib/config';
|
|
5
|
-
import type { SlasherConfig } from '@aztec/stdlib/interfaces/server';
|
|
6
|
-
|
|
7
|
-
import { mkdir, readFile, stat, writeFile } from 'fs/promises';
|
|
8
|
-
import path, { dirname, join } from 'path';
|
|
9
|
-
|
|
10
|
-
import publicIncludeMetrics from '../../public_include_metric_prefixes.json' with { type: 'json' };
|
|
11
|
-
|
|
12
|
-
export type L2ChainConfig = L1ContractsConfig &
|
|
13
|
-
Omit<SlasherConfig, 'slashValidatorsNever' | 'slashValidatorsAlways'> & {
|
|
14
|
-
l1ChainId: number;
|
|
15
|
-
testAccounts: boolean;
|
|
16
|
-
sponsoredFPC: boolean;
|
|
17
|
-
p2pEnabled: boolean;
|
|
18
|
-
p2pBootstrapNodes: string[];
|
|
19
|
-
registryAddress: string;
|
|
20
|
-
slashFactoryAddress: string;
|
|
21
|
-
feeAssetHandlerAddress: string;
|
|
22
|
-
seqMinTxsPerBlock: number;
|
|
23
|
-
seqMaxTxsPerBlock: number;
|
|
24
|
-
realProofs: boolean;
|
|
25
|
-
snapshotsUrl: string;
|
|
26
|
-
autoUpdate: SharedNodeConfig['autoUpdate'];
|
|
27
|
-
autoUpdateUrl?: string;
|
|
28
|
-
maxTxPoolSize: number;
|
|
29
|
-
publicIncludeMetrics?: string[];
|
|
30
|
-
publicMetricsCollectorUrl?: string;
|
|
31
|
-
publicMetricsCollectFrom?: string[];
|
|
32
|
-
|
|
33
|
-
// Control whether sentinel is enabled or not. Needed for slashing
|
|
34
|
-
sentinelEnabled: boolean;
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
export const testnetIgnitionL2ChainConfig: L2ChainConfig = {
|
|
38
|
-
l1ChainId: 11155111,
|
|
39
|
-
testAccounts: true,
|
|
40
|
-
sponsoredFPC: false,
|
|
41
|
-
p2pEnabled: true,
|
|
42
|
-
p2pBootstrapNodes: [],
|
|
43
|
-
registryAddress: '0x12b3ebc176a1646b911391eab3760764f2e05fe3',
|
|
44
|
-
slashFactoryAddress: '',
|
|
45
|
-
feeAssetHandlerAddress: '',
|
|
46
|
-
seqMinTxsPerBlock: 0,
|
|
47
|
-
seqMaxTxsPerBlock: 0,
|
|
48
|
-
realProofs: true,
|
|
49
|
-
snapshotsUrl: 'https://storage.googleapis.com/aztec-testnet/snapshots/',
|
|
50
|
-
autoUpdate: 'disabled',
|
|
51
|
-
autoUpdateUrl: undefined,
|
|
52
|
-
maxTxPoolSize: 100_000_000, // 100MB
|
|
53
|
-
|
|
54
|
-
...DefaultL1ContractsConfig,
|
|
55
|
-
|
|
56
|
-
/** How many seconds an L1 slot lasts. */
|
|
57
|
-
ethereumSlotDuration: 12,
|
|
58
|
-
/** How many seconds an L2 slots lasts (must be multiple of ethereum slot duration). */
|
|
59
|
-
aztecSlotDuration: 36,
|
|
60
|
-
/** How many L2 slots an epoch lasts. */
|
|
61
|
-
aztecEpochDuration: 32,
|
|
62
|
-
/** The target validator committee size. */
|
|
63
|
-
aztecTargetCommitteeSize: 48,
|
|
64
|
-
/** The number of epochs after an epoch ends that proofs are still accepted. */
|
|
65
|
-
aztecProofSubmissionEpochs: 1,
|
|
66
|
-
/** The mana target for the rollup */
|
|
67
|
-
manaTarget: 0n,
|
|
68
|
-
/** The proving cost per mana */
|
|
69
|
-
provingCostPerMana: 0n,
|
|
70
|
-
|
|
71
|
-
slasherFlavor: 'none',
|
|
72
|
-
slashAmountSmall: 0n,
|
|
73
|
-
slashAmountMedium: 0n,
|
|
74
|
-
slashAmountLarge: 0n,
|
|
75
|
-
slashMinPenaltyPercentage: 0.5,
|
|
76
|
-
slashMaxPenaltyPercentage: 200,
|
|
77
|
-
slashInactivityTargetPercentage: 0,
|
|
78
|
-
slashInactivityConsecutiveEpochThreshold: 1,
|
|
79
|
-
slashInactivityPenalty: 0n,
|
|
80
|
-
slashPrunePenalty: 0n,
|
|
81
|
-
slashDataWithholdingPenalty: 0n,
|
|
82
|
-
slashProposeInvalidAttestationsPenalty: 0n,
|
|
83
|
-
slashAttestDescendantOfInvalidPenalty: 0n,
|
|
84
|
-
slashBroadcastedInvalidBlockPenalty: 0n,
|
|
85
|
-
slashMaxPayloadSize: 50,
|
|
86
|
-
slashGracePeriodL2Slots: 0,
|
|
87
|
-
slashUnknownPenalty: 0n,
|
|
88
|
-
slashOffenseExpirationRounds: 10,
|
|
89
|
-
sentinelEnabled: false,
|
|
90
|
-
};
|
|
91
|
-
|
|
92
|
-
export const alphaTestnetL2ChainConfig: L2ChainConfig = {
|
|
93
|
-
l1ChainId: 11155111,
|
|
94
|
-
testAccounts: false,
|
|
95
|
-
sponsoredFPC: true,
|
|
96
|
-
p2pEnabled: true,
|
|
97
|
-
p2pBootstrapNodes: [],
|
|
98
|
-
registryAddress: '0xec4156431d0f3df66d4e24ba3d30dcb4c85fa309',
|
|
99
|
-
slashFactoryAddress: '0x8b1566249dc8fb47234037538ce491f9500480b1',
|
|
100
|
-
feeAssetHandlerAddress: '0x4f0376b8bcbdf72ddb38c38f48317c00e9c9aec3',
|
|
101
|
-
seqMinTxsPerBlock: 0,
|
|
102
|
-
seqMaxTxsPerBlock: 20,
|
|
103
|
-
realProofs: true,
|
|
104
|
-
snapshotsUrl: 'https://storage.googleapis.com/aztec-testnet/snapshots/',
|
|
105
|
-
autoUpdate: 'config-and-version',
|
|
106
|
-
autoUpdateUrl: 'https://storage.googleapis.com/aztec-testnet/auto-update/alpha-testnet.json',
|
|
107
|
-
maxTxPoolSize: 100_000_000, // 100MB
|
|
108
|
-
publicIncludeMetrics,
|
|
109
|
-
publicMetricsCollectorUrl: 'https://telemetry.alpha-testnet.aztec-labs.com/v1/metrics',
|
|
110
|
-
publicMetricsCollectFrom: ['sequencer'],
|
|
111
|
-
|
|
112
|
-
// Deployment stuff
|
|
113
|
-
/** How many seconds an L1 slot lasts. */
|
|
114
|
-
ethereumSlotDuration: 12,
|
|
115
|
-
/** How many seconds an L2 slots lasts (must be multiple of ethereum slot duration). */
|
|
116
|
-
aztecSlotDuration: 36,
|
|
117
|
-
/** How many L2 slots an epoch lasts. */
|
|
118
|
-
aztecEpochDuration: 32,
|
|
119
|
-
/** The target validator committee size. */
|
|
120
|
-
aztecTargetCommitteeSize: 48,
|
|
121
|
-
/** The number of epochs after an epoch ends that proofs are still accepted. */
|
|
122
|
-
aztecProofSubmissionEpochs: 1,
|
|
123
|
-
/** The deposit amount for a validator */
|
|
124
|
-
activationThreshold: DefaultL1ContractsConfig.activationThreshold,
|
|
125
|
-
/** The minimum stake for a validator. */
|
|
126
|
-
ejectionThreshold: DefaultL1ContractsConfig.ejectionThreshold,
|
|
127
|
-
/** The slashing round size */
|
|
128
|
-
slashingRoundSizeInEpochs: 4,
|
|
129
|
-
/** Governance proposing round size */
|
|
130
|
-
governanceProposerRoundSize: 300,
|
|
131
|
-
/** The mana target for the rollup */
|
|
132
|
-
manaTarget: DefaultL1ContractsConfig.manaTarget,
|
|
133
|
-
/** The proving cost per mana */
|
|
134
|
-
provingCostPerMana: DefaultL1ContractsConfig.provingCostPerMana,
|
|
135
|
-
/** Exit delay for stakers */
|
|
136
|
-
exitDelaySeconds: DefaultL1ContractsConfig.exitDelaySeconds,
|
|
137
|
-
/** Tally-style slashing */
|
|
138
|
-
slasherFlavor: 'tally',
|
|
139
|
-
/** Allow one round for vetoing */
|
|
140
|
-
slashingExecutionDelayInRounds: 1,
|
|
141
|
-
/** How long for a slash payload to be executed */
|
|
142
|
-
slashingLifetimeInRounds: 4,
|
|
143
|
-
/** Allow 2 rounds to discover faults */
|
|
144
|
-
slashingOffsetInRounds: 2,
|
|
145
|
-
/** No slash vetoer */
|
|
146
|
-
slashingVetoer: EthAddress.ZERO,
|
|
147
|
-
/** Use default slash amounts */
|
|
148
|
-
slashAmountSmall: DefaultL1ContractsConfig.slashAmountSmall,
|
|
149
|
-
slashAmountMedium: DefaultL1ContractsConfig.slashAmountMedium,
|
|
150
|
-
slashAmountLarge: DefaultL1ContractsConfig.slashAmountLarge,
|
|
151
|
-
|
|
152
|
-
// Slashing stuff
|
|
153
|
-
slashMinPenaltyPercentage: 0.5,
|
|
154
|
-
slashMaxPenaltyPercentage: 2.0,
|
|
155
|
-
slashInactivityTargetPercentage: 0.7,
|
|
156
|
-
slashInactivityConsecutiveEpochThreshold: 1,
|
|
157
|
-
slashInactivityPenalty: DefaultL1ContractsConfig.slashAmountSmall,
|
|
158
|
-
slashPrunePenalty: DefaultL1ContractsConfig.slashAmountSmall,
|
|
159
|
-
slashDataWithholdingPenalty: DefaultL1ContractsConfig.slashAmountSmall,
|
|
160
|
-
slashProposeInvalidAttestationsPenalty: DefaultL1ContractsConfig.slashAmountLarge,
|
|
161
|
-
slashAttestDescendantOfInvalidPenalty: DefaultL1ContractsConfig.slashAmountLarge,
|
|
162
|
-
slashUnknownPenalty: DefaultL1ContractsConfig.slashAmountSmall,
|
|
163
|
-
slashBroadcastedInvalidBlockPenalty: DefaultL1ContractsConfig.slashAmountMedium,
|
|
164
|
-
slashMaxPayloadSize: 50,
|
|
165
|
-
slashGracePeriodL2Slots: 32 * 2, // Two epochs from genesis
|
|
166
|
-
slashOffenseExpirationRounds: 8,
|
|
167
|
-
sentinelEnabled: true,
|
|
168
|
-
};
|
|
169
|
-
|
|
170
|
-
const BOOTNODE_CACHE_DURATION_MS = 60 * 60 * 1000; // 1 hour;
|
|
171
|
-
|
|
172
|
-
export async function getBootnodes(networkName: NetworkNames, cacheDir?: string) {
|
|
173
|
-
const cacheFile = cacheDir ? join(cacheDir, networkName, 'bootnodes.json') : undefined;
|
|
174
|
-
try {
|
|
175
|
-
if (cacheFile) {
|
|
176
|
-
const info = await stat(cacheFile);
|
|
177
|
-
if (info.mtimeMs + BOOTNODE_CACHE_DURATION_MS > Date.now()) {
|
|
178
|
-
return JSON.parse(await readFile(cacheFile, 'utf-8'))['bootnodes'];
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
} catch {
|
|
182
|
-
// no-op. Get the remote-file
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
const url = `http://static.aztec.network/${networkName}/bootnodes.json`;
|
|
186
|
-
const response = await fetch(url);
|
|
187
|
-
if (!response.ok) {
|
|
188
|
-
throw new Error(
|
|
189
|
-
`Failed to fetch basic contract addresses from ${url}. Check you are using a correct network name.`,
|
|
190
|
-
);
|
|
191
|
-
}
|
|
192
|
-
const json = await response.json();
|
|
193
|
-
|
|
194
|
-
try {
|
|
195
|
-
if (cacheFile) {
|
|
196
|
-
await mkdir(dirname(cacheFile), { recursive: true });
|
|
197
|
-
await writeFile(cacheFile, JSON.stringify(json), 'utf-8');
|
|
198
|
-
}
|
|
199
|
-
} catch {
|
|
200
|
-
// no-op
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
return json['bootnodes'];
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
export async function getL2ChainConfig(
|
|
207
|
-
networkName: NetworkNames,
|
|
208
|
-
cacheDir?: string,
|
|
209
|
-
): Promise<L2ChainConfig | undefined> {
|
|
210
|
-
if (networkName === 'testnet-ignition') {
|
|
211
|
-
const config = { ...testnetIgnitionL2ChainConfig };
|
|
212
|
-
config.p2pBootstrapNodes = await getBootnodes(networkName, cacheDir);
|
|
213
|
-
return config;
|
|
214
|
-
} else if (networkName === 'alpha-testnet' || networkName === 'testnet') {
|
|
215
|
-
const config = { ...alphaTestnetL2ChainConfig };
|
|
216
|
-
config.p2pBootstrapNodes = await getBootnodes('alpha-testnet', cacheDir);
|
|
217
|
-
return config;
|
|
218
|
-
}
|
|
219
|
-
return undefined;
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
function enrichVar(envVar: EnvVar, value: string | undefined) {
|
|
223
|
-
// Don't override
|
|
224
|
-
if (process.env[envVar] || value === undefined) {
|
|
225
|
-
return;
|
|
226
|
-
}
|
|
227
|
-
process.env[envVar] = value;
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
function enrichEthAddressVar(envVar: EnvVar, value: string) {
|
|
231
|
-
// EthAddress doesn't like being given empty strings
|
|
232
|
-
if (value === '') {
|
|
233
|
-
enrichVar(envVar, EthAddress.ZERO.toString());
|
|
234
|
-
return;
|
|
235
|
-
}
|
|
236
|
-
enrichVar(envVar, value);
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
function getDefaultDataDir(networkName: NetworkNames): string {
|
|
240
|
-
let prefix: string;
|
|
241
|
-
if (networkName === 'testnet-ignition') {
|
|
242
|
-
prefix = 'testnet-ignition';
|
|
243
|
-
} else if (networkName === 'alpha-testnet' || networkName === 'testnet') {
|
|
244
|
-
prefix = 'alpha-testnet';
|
|
245
|
-
} else {
|
|
246
|
-
prefix = networkName;
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
return path.join(process.env.HOME || '~', '.aztec', prefix, 'data');
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
export async function enrichEnvironmentWithChainConfig(networkName: NetworkNames) {
|
|
253
|
-
if (networkName === 'local') {
|
|
254
|
-
return;
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
enrichVar('DATA_DIRECTORY', getDefaultDataDir(networkName));
|
|
258
|
-
const cacheDir = process.env.DATA_DIRECTORY ? join(process.env.DATA_DIRECTORY, 'cache') : undefined;
|
|
259
|
-
const config = await getL2ChainConfig(networkName, cacheDir);
|
|
260
|
-
|
|
261
|
-
if (!config) {
|
|
262
|
-
throw new Error(`Unknown network name: ${networkName}`);
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
enrichVar('BOOTSTRAP_NODES', config.p2pBootstrapNodes.join(','));
|
|
266
|
-
enrichVar('TEST_ACCOUNTS', config.testAccounts.toString());
|
|
267
|
-
enrichVar('SPONSORED_FPC', config.sponsoredFPC.toString());
|
|
268
|
-
enrichVar('P2P_ENABLED', config.p2pEnabled.toString());
|
|
269
|
-
enrichVar('L1_CHAIN_ID', config.l1ChainId.toString());
|
|
270
|
-
enrichVar('SEQ_MIN_TX_PER_BLOCK', config.seqMinTxsPerBlock.toString());
|
|
271
|
-
enrichVar('SEQ_MAX_TX_PER_BLOCK', config.seqMaxTxsPerBlock.toString());
|
|
272
|
-
enrichVar('PROVER_REAL_PROOFS', config.realProofs.toString());
|
|
273
|
-
enrichVar('PXE_PROVER_ENABLED', config.realProofs.toString());
|
|
274
|
-
enrichVar('SYNC_SNAPSHOTS_URL', config.snapshotsUrl);
|
|
275
|
-
enrichVar('P2P_MAX_TX_POOL_SIZE', config.maxTxPoolSize.toString());
|
|
276
|
-
|
|
277
|
-
if (config.autoUpdate) {
|
|
278
|
-
enrichVar('AUTO_UPDATE', config.autoUpdate?.toString());
|
|
279
|
-
}
|
|
280
|
-
|
|
281
|
-
if (config.autoUpdateUrl) {
|
|
282
|
-
enrichVar('AUTO_UPDATE_URL', config.autoUpdateUrl);
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
if (config.publicIncludeMetrics) {
|
|
286
|
-
enrichVar('PUBLIC_OTEL_INCLUDE_METRICS', config.publicIncludeMetrics.join(','));
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
if (config.publicMetricsCollectorUrl) {
|
|
290
|
-
enrichVar('PUBLIC_OTEL_EXPORTER_OTLP_METRICS_ENDPOINT', config.publicMetricsCollectorUrl);
|
|
291
|
-
}
|
|
292
|
-
|
|
293
|
-
if (config.publicMetricsCollectFrom) {
|
|
294
|
-
enrichVar('PUBLIC_OTEL_COLLECT_FROM', config.publicMetricsCollectFrom.join(','));
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
enrichEthAddressVar('REGISTRY_CONTRACT_ADDRESS', config.registryAddress);
|
|
298
|
-
enrichEthAddressVar('SLASH_FACTORY_CONTRACT_ADDRESS', config.slashFactoryAddress);
|
|
299
|
-
enrichEthAddressVar('FEE_ASSET_HANDLER_CONTRACT_ADDRESS', config.feeAssetHandlerAddress);
|
|
300
|
-
|
|
301
|
-
// Deployment stuff
|
|
302
|
-
enrichVar('ETHEREUM_SLOT_DURATION', config.ethereumSlotDuration.toString());
|
|
303
|
-
enrichVar('AZTEC_SLOT_DURATION', config.aztecSlotDuration.toString());
|
|
304
|
-
enrichVar('AZTEC_EPOCH_DURATION', config.aztecEpochDuration.toString());
|
|
305
|
-
enrichVar('AZTEC_TARGET_COMMITTEE_SIZE', config.aztecTargetCommitteeSize.toString());
|
|
306
|
-
enrichVar('AZTEC_PROOF_SUBMISSION_EPOCHS', config.aztecProofSubmissionEpochs.toString());
|
|
307
|
-
enrichVar('AZTEC_ACTIVATION_THRESHOLD', config.activationThreshold.toString());
|
|
308
|
-
enrichVar('AZTEC_EJECTION_THRESHOLD', config.ejectionThreshold.toString());
|
|
309
|
-
enrichVar('AZTEC_SLASHING_QUORUM', config.slashingQuorum?.toString());
|
|
310
|
-
enrichVar('AZTEC_SLASHING_ROUND_SIZE_IN_EPOCHS', config.slashingRoundSizeInEpochs.toString());
|
|
311
|
-
enrichVar('AZTEC_GOVERNANCE_PROPOSER_QUORUM', config.governanceProposerQuorum?.toString());
|
|
312
|
-
enrichVar('AZTEC_GOVERNANCE_PROPOSER_ROUND_SIZE', config.governanceProposerRoundSize.toString());
|
|
313
|
-
enrichVar('AZTEC_MANA_TARGET', config.manaTarget.toString());
|
|
314
|
-
enrichVar('AZTEC_PROVING_COST_PER_MANA', config.provingCostPerMana.toString());
|
|
315
|
-
enrichVar('AZTEC_SLASH_AMOUNT_SMALL', config.slashAmountSmall.toString());
|
|
316
|
-
enrichVar('AZTEC_SLASH_AMOUNT_MEDIUM', config.slashAmountMedium.toString());
|
|
317
|
-
enrichVar('AZTEC_SLASH_AMOUNT_LARGE', config.slashAmountLarge.toString());
|
|
318
|
-
enrichVar('AZTEC_SLASHING_LIFETIME_IN_ROUNDS', config.slashingLifetimeInRounds.toString());
|
|
319
|
-
enrichVar('AZTEC_SLASHING_EXECUTION_DELAY_IN_ROUNDS', config.slashingExecutionDelayInRounds.toString());
|
|
320
|
-
enrichVar('AZTEC_SLASHING_OFFSET_IN_ROUNDS', config.slashingOffsetInRounds.toString());
|
|
321
|
-
enrichVar('AZTEC_SLASHER_FLAVOR', config.slasherFlavor);
|
|
322
|
-
enrichVar('AZTEC_EXIT_DELAY_SECONDS', config.exitDelaySeconds.toString());
|
|
323
|
-
enrichEthAddressVar('AZTEC_SLASHING_VETOER', config.slashingVetoer.toString());
|
|
324
|
-
|
|
325
|
-
// Slashing
|
|
326
|
-
enrichVar('SLASH_MIN_PENALTY_PERCENTAGE', config.slashMinPenaltyPercentage.toString());
|
|
327
|
-
enrichVar('SLASH_MAX_PENALTY_PERCENTAGE', config.slashMaxPenaltyPercentage.toString());
|
|
328
|
-
enrichVar('SLASH_PRUNE_PENALTY', config.slashPrunePenalty.toString());
|
|
329
|
-
enrichVar('SLASH_DATA_WITHHOLDING_PENALTY', config.slashDataWithholdingPenalty.toString());
|
|
330
|
-
enrichVar('SLASH_INACTIVITY_TARGET_PERCENTAGE', config.slashInactivityTargetPercentage.toString());
|
|
331
|
-
enrichVar('SLASH_INACTIVITY_CONSECUTIVE_EPOCH_THRESHOLD', config.slashInactivityConsecutiveEpochThreshold.toString());
|
|
332
|
-
enrichVar('SLASH_INACTIVITY_PENALTY', config.slashInactivityPenalty.toString());
|
|
333
|
-
enrichVar('SLASH_PROPOSE_INVALID_ATTESTATIONS_PENALTY', config.slashProposeInvalidAttestationsPenalty.toString());
|
|
334
|
-
enrichVar('SLASH_ATTEST_DESCENDANT_OF_INVALID_PENALTY', config.slashAttestDescendantOfInvalidPenalty.toString());
|
|
335
|
-
enrichVar('SLASH_UNKNOWN_PENALTY', config.slashUnknownPenalty.toString());
|
|
336
|
-
enrichVar('SLASH_INVALID_BLOCK_PENALTY', config.slashBroadcastedInvalidBlockPenalty.toString());
|
|
337
|
-
enrichVar('SLASH_OFFENSE_EXPIRATION_ROUNDS', config.slashOffenseExpirationRounds.toString());
|
|
338
|
-
enrichVar('SLASH_MAX_PAYLOAD_SIZE', config.slashMaxPayloadSize.toString());
|
|
339
|
-
|
|
340
|
-
enrichVar('SENTINEL_ENABLED', config.sentinelEnabled.toString());
|
|
341
|
-
}
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
type BlobSinkConfig,
|
|
3
|
-
blobSinkConfigMappings,
|
|
4
|
-
createBlobSinkServer,
|
|
5
|
-
getBlobSinkConfigFromEnv,
|
|
6
|
-
} from '@aztec/blob-sink/server';
|
|
7
|
-
import type { LogFn } from '@aztec/foundation/log';
|
|
8
|
-
import { getConfigEnvVars as getTelemetryClientConfig, initTelemetryClient } from '@aztec/telemetry-client';
|
|
9
|
-
|
|
10
|
-
import { getL1Config } from '../get_l1_config.js';
|
|
11
|
-
import { extractRelevantOptions } from '../util.js';
|
|
12
|
-
|
|
13
|
-
export async function startBlobSink(options: any, signalHandlers: (() => Promise<void>)[], userLog: LogFn) {
|
|
14
|
-
if (options.prover || options.node || options.sequencer || options.pxe || options.p2pBootstrap || options.txe) {
|
|
15
|
-
userLog(
|
|
16
|
-
`Starting a blob sink with --node, --sequencer, --pxe, --p2p-bootstrap, --prover or --txe is not supported.`,
|
|
17
|
-
);
|
|
18
|
-
process.exit(1);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
let blobSinkConfig: BlobSinkConfig = {
|
|
22
|
-
...getBlobSinkConfigFromEnv(), // get default config from env
|
|
23
|
-
...extractRelevantOptions<BlobSinkConfig>(options, blobSinkConfigMappings, 'blobSink'), // override with command line options
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
if (!blobSinkConfig.l1Contracts?.registryAddress || blobSinkConfig.l1Contracts.registryAddress.isZero()) {
|
|
27
|
-
throw new Error('REGISTRY_CONTRACT_ADDRESS not set');
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
if (!blobSinkConfig.l1RpcUrls || blobSinkConfig.l1RpcUrls.length === 0) {
|
|
31
|
-
throw new Error('ETHEREUM_HOSTS not set');
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
if (typeof blobSinkConfig.l1ChainId !== 'number') {
|
|
35
|
-
throw new Error('L1_CHAIN_ID');
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
const telemetry = initTelemetryClient(getTelemetryClientConfig());
|
|
39
|
-
|
|
40
|
-
const { config: chainConfig, addresses } = await getL1Config(
|
|
41
|
-
blobSinkConfig.l1Contracts.registryAddress,
|
|
42
|
-
blobSinkConfig.l1RpcUrls,
|
|
43
|
-
blobSinkConfig.l1ChainId,
|
|
44
|
-
blobSinkConfig.rollupVersion,
|
|
45
|
-
);
|
|
46
|
-
|
|
47
|
-
blobSinkConfig = {
|
|
48
|
-
...blobSinkConfig,
|
|
49
|
-
l1Contracts: addresses,
|
|
50
|
-
...chainConfig,
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
const blobSink = await createBlobSinkServer(blobSinkConfig, telemetry);
|
|
54
|
-
signalHandlers.push(blobSink.stop.bind(blobSink));
|
|
55
|
-
|
|
56
|
-
await blobSink.start();
|
|
57
|
-
}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import type { NamespacedApiHandlers } from '@aztec/foundation/json-rpc/server';
|
|
2
|
-
import type { LogFn } from '@aztec/foundation/log';
|
|
3
|
-
import {
|
|
4
|
-
type CliPXEOptions,
|
|
5
|
-
type PXEService,
|
|
6
|
-
type PXEServiceConfig,
|
|
7
|
-
allPxeConfigMappings,
|
|
8
|
-
createPXEService,
|
|
9
|
-
} from '@aztec/pxe/server';
|
|
10
|
-
import { type AztecNode, PXESchema, createAztecNodeClient } from '@aztec/stdlib/interfaces/client';
|
|
11
|
-
import { makeTracedFetch } from '@aztec/telemetry-client';
|
|
12
|
-
|
|
13
|
-
import { extractRelevantOptions } from '../util.js';
|
|
14
|
-
import { getVersions } from '../versioning.js';
|
|
15
|
-
|
|
16
|
-
export type { PXEServiceConfig, CliPXEOptions };
|
|
17
|
-
|
|
18
|
-
export async function startPXE(
|
|
19
|
-
options: any,
|
|
20
|
-
signalHandlers: (() => Promise<void>)[],
|
|
21
|
-
services: NamespacedApiHandlers,
|
|
22
|
-
userLog: LogFn,
|
|
23
|
-
): Promise<{ pxe: PXEService; config: PXEServiceConfig & CliPXEOptions }> {
|
|
24
|
-
return await addPXE(options, signalHandlers, services, userLog, {});
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export async function addPXE(
|
|
28
|
-
options: any,
|
|
29
|
-
_signalHandlers: (() => Promise<void>)[],
|
|
30
|
-
services: NamespacedApiHandlers,
|
|
31
|
-
userLog: LogFn,
|
|
32
|
-
deps: { node?: AztecNode } = {},
|
|
33
|
-
): Promise<{ pxe: PXEService; config: PXEServiceConfig & CliPXEOptions }> {
|
|
34
|
-
const pxeConfig = extractRelevantOptions<PXEServiceConfig & CliPXEOptions>(options, allPxeConfigMappings, 'pxe');
|
|
35
|
-
const nodeUrl = pxeConfig.nodeUrl;
|
|
36
|
-
|
|
37
|
-
if (!nodeUrl && !deps.node) {
|
|
38
|
-
userLog('Aztec Node URL (nodeUrl | AZTEC_NODE_URL) option is required to start PXE without --node option');
|
|
39
|
-
process.exit(1);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
const node = deps.node ?? createAztecNodeClient(nodeUrl!, getVersions(pxeConfig), makeTracedFetch([1, 2, 3], true));
|
|
43
|
-
const pxe = await createPXEService(node, pxeConfig as PXEServiceConfig);
|
|
44
|
-
|
|
45
|
-
// Add PXE to services list
|
|
46
|
-
services.pxe = [pxe, PXESchema];
|
|
47
|
-
|
|
48
|
-
return { pxe, config: pxeConfig };
|
|
49
|
-
}
|