@aztec/end-to-end 0.75.0-commit.c03ba01a2a4122e43e90d5133ba017e54b90e9d2 → 0.77.0-testnet-ignition.17
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 +2 -0
- package/dest/bench/utils.d.ts +70 -0
- package/dest/bench/utils.d.ts.map +1 -0
- package/dest/bench/utils.js +24 -8
- package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts +46 -0
- package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts.map +1 -0
- package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.js +17 -17
- package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts +47 -0
- package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts.map +1 -0
- package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.js +27 -16
- package/dest/e2e_deploy_contract/deploy_test.d.ts +28 -0
- package/dest/e2e_deploy_contract/deploy_test.d.ts.map +1 -0
- package/dest/e2e_deploy_contract/deploy_test.js +4 -7
- package/dest/e2e_epochs/epochs_test.d.ts +51 -0
- package/dest/e2e_epochs/epochs_test.d.ts.map +1 -0
- package/dest/e2e_epochs/epochs_test.js +155 -0
- package/dest/e2e_fees/fees_test.d.ts +73 -0
- package/dest/e2e_fees/fees_test.d.ts.map +1 -0
- package/dest/e2e_fees/fees_test.js +75 -32
- package/dest/e2e_nested_contract/nested_contract_test.d.ts +26 -0
- package/dest/e2e_nested_contract/nested_contract_test.d.ts.map +1 -0
- package/dest/e2e_nested_contract/nested_contract_test.js +14 -12
- package/dest/e2e_p2p/p2p_network.d.ts +61 -0
- package/dest/e2e_p2p/p2p_network.d.ts.map +1 -0
- package/dest/e2e_p2p/p2p_network.js +54 -30
- package/dest/e2e_p2p/shared.d.ts +10 -0
- package/dest/e2e_p2p/shared.d.ts.map +1 -0
- package/dest/e2e_p2p/shared.js +7 -8
- package/dest/e2e_prover/e2e_prover_test.d.ts +56 -0
- package/dest/e2e_prover/e2e_prover_test.d.ts.map +1 -0
- package/dest/e2e_prover/e2e_prover_test.js +20 -24
- package/dest/e2e_token_contract/token_contract_test.d.ts +29 -0
- package/dest/e2e_token_contract/token_contract_test.d.ts.map +1 -0
- package/dest/e2e_token_contract/token_contract_test.js +4 -7
- package/dest/fixtures/fixtures.d.ts +17 -0
- package/dest/fixtures/fixtures.d.ts.map +1 -0
- package/dest/fixtures/fixtures.js +2 -2
- package/dest/fixtures/get_acvm_config.d.ts +8 -0
- package/dest/fixtures/get_acvm_config.d.ts.map +1 -0
- package/dest/fixtures/get_acvm_config.js +10 -5
- package/dest/fixtures/get_bb_config.d.ts +6 -0
- package/dest/fixtures/get_bb_config.d.ts.map +1 -0
- package/dest/fixtures/get_bb_config.js +9 -4
- package/dest/fixtures/index.d.ts +6 -0
- package/dest/fixtures/index.d.ts.map +1 -0
- package/dest/fixtures/l1_to_l2_messaging.d.ts +13 -0
- package/dest/fixtures/l1_to_l2_messaging.d.ts.map +1 -0
- package/dest/fixtures/l1_to_l2_messaging.js +1 -1
- package/dest/fixtures/logging.d.ts +8 -0
- package/dest/fixtures/logging.d.ts.map +1 -0
- package/dest/fixtures/setup_l1_contracts.d.ts +6 -0
- package/dest/fixtures/setup_l1_contracts.d.ts.map +1 -0
- package/dest/fixtures/setup_l1_contracts.js +6 -4
- package/dest/fixtures/setup_p2p_test.d.ts +22 -0
- package/dest/fixtures/setup_p2p_test.d.ts.map +1 -0
- package/dest/fixtures/setup_p2p_test.js +5 -3
- package/dest/fixtures/snapshot_manager.d.ts +87 -0
- package/dest/fixtures/snapshot_manager.d.ts.map +1 -0
- package/dest/fixtures/snapshot_manager.js +67 -74
- package/dest/fixtures/token_utils.d.ts +6 -0
- package/dest/fixtures/token_utils.d.ts.map +1 -0
- package/dest/fixtures/token_utils.js +1 -1
- package/dest/fixtures/utils.d.ts +155 -0
- package/dest/fixtures/utils.d.ts.map +1 -0
- package/dest/fixtures/utils.js +97 -71
- package/dest/fixtures/with_telemetry_utils.d.ts +3 -0
- package/dest/fixtures/with_telemetry_utils.d.ts.map +1 -0
- package/dest/index.d.ts +2 -0
- package/dest/index.d.ts.map +1 -0
- package/dest/quality_of_service/alert_checker.d.ts +41 -0
- package/dest/quality_of_service/alert_checker.d.ts.map +1 -0
- package/dest/quality_of_service/alert_checker.js +4 -1
- package/dest/sample-dapp/index.js +1 -1
- package/dest/shared/cross_chain_test_harness.d.ts +124 -0
- package/dest/shared/cross_chain_test_harness.d.ts.map +1 -0
- package/dest/shared/cross_chain_test_harness.js +6 -17
- package/dest/shared/gas_portal_test_harness.d.ts +80 -0
- package/dest/shared/gas_portal_test_harness.d.ts.map +1 -0
- package/dest/shared/gas_portal_test_harness.js +11 -4
- package/dest/shared/index.d.ts +2 -0
- package/dest/shared/index.d.ts.map +1 -0
- package/dest/shared/index.js +0 -1
- package/dest/shared/jest_setup.d.ts +2 -0
- package/dest/shared/jest_setup.d.ts.map +1 -0
- package/dest/shared/submit-transactions.d.ts +4 -0
- package/dest/shared/submit-transactions.d.ts.map +1 -0
- package/dest/shared/submit-transactions.js +9 -17
- package/dest/shared/uniswap_l1_l2.d.ts +25 -0
- package/dest/shared/uniswap_l1_l2.d.ts.map +1 -0
- package/dest/shared/uniswap_l1_l2.js +5 -10
- package/dest/simulators/index.d.ts +3 -0
- package/dest/simulators/index.d.ts.map +1 -0
- package/dest/simulators/lending_simulator.d.ts +69 -0
- package/dest/simulators/lending_simulator.d.ts.map +1 -0
- package/dest/simulators/lending_simulator.js +1 -3
- package/dest/simulators/token_simulator.d.ts +29 -0
- package/dest/simulators/token_simulator.d.ts.map +1 -0
- package/dest/spartan/setup_test_wallets.d.ts +20 -0
- package/dest/spartan/setup_test_wallets.d.ts.map +1 -0
- package/dest/spartan/setup_test_wallets.js +72 -38
- package/dest/spartan/utils.d.ts +485 -0
- package/dest/spartan/utils.d.ts.map +1 -0
- package/dest/spartan/utils.js +110 -2
- package/package.json +35 -40
- package/src/bench/utils.ts +30 -13
- package/src/e2e_blacklist_token_contract/blacklist_token_contract_test.ts +40 -30
- package/src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts +34 -18
- package/src/e2e_deploy_contract/deploy_test.ts +6 -11
- package/src/e2e_epochs/epochs_test.ts +217 -0
- package/src/e2e_fees/fees_test.ts +84 -38
- package/src/e2e_nested_contract/nested_contract_test.ts +14 -16
- package/src/e2e_p2p/p2p_network.ts +67 -47
- package/src/e2e_p2p/shared.ts +16 -10
- package/src/e2e_prover/e2e_prover_test.ts +56 -37
- package/src/e2e_token_contract/token_contract_test.ts +10 -11
- package/src/fixtures/fixtures.ts +2 -2
- package/src/fixtures/get_acvm_config.ts +7 -3
- package/src/fixtures/get_bb_config.ts +6 -2
- package/src/fixtures/l1_to_l2_messaging.ts +6 -13
- package/src/fixtures/setup_l1_contracts.ts +8 -7
- package/src/fixtures/setup_p2p_test.ts +8 -6
- package/src/fixtures/snapshot_manager.ts +72 -79
- package/src/fixtures/token_utils.ts +2 -2
- package/src/fixtures/utils.ts +135 -97
- package/src/guides/up_quick_start.sh +10 -5
- package/src/quality_of_service/alert_checker.ts +6 -2
- package/src/sample-dapp/index.mjs +1 -1
- package/src/shared/cross_chain_test_harness.ts +17 -35
- package/src/shared/gas_portal_test_harness.ts +21 -11
- package/src/shared/index.ts +0 -1
- package/src/shared/submit-transactions.ts +16 -20
- package/src/shared/uniswap_l1_l2.ts +35 -26
- package/src/simulators/lending_simulator.ts +5 -6
- package/src/simulators/token_simulator.ts +1 -1
- package/src/spartan/setup_test_wallets.ts +111 -37
- package/src/spartan/utils.ts +88 -3
- package/dest/shared/browser.js +0 -163
- package/src/shared/browser.ts +0 -272
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
/// <reference types="node" resolution-mode="require"/>
|
|
2
|
+
/// <reference types="node" resolution-mode="require"/>
|
|
3
|
+
import { type InitialAccountData } from '@aztec/accounts/testing';
|
|
4
|
+
import { type AztecNodeConfig } from '@aztec/aztec-node';
|
|
5
|
+
import { type AccountWalletWithSecretKey, AnvilTestWatcher, type AztecAddress, type AztecNode, CheatCodes, type ContractMethod, type DeployL1ContractsReturnType, type Logger, type PXE, type Wallet } from '@aztec/aztec.js';
|
|
6
|
+
import type { BBNativePrivateKernelProver } from '@aztec/bb-prover';
|
|
7
|
+
import { type BlobSinkServer } from '@aztec/blob-sink/server';
|
|
8
|
+
import { type DeployL1ContractsArgs, ForwarderContract } from '@aztec/ethereum';
|
|
9
|
+
import { startAnvil } from '@aztec/ethereum/test';
|
|
10
|
+
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
11
|
+
import { Fr } from '@aztec/foundation/fields';
|
|
12
|
+
import { TestDateProvider } from '@aztec/foundation/timer';
|
|
13
|
+
import { type ProverNode } from '@aztec/prover-node';
|
|
14
|
+
import { type PXEService, type PXEServiceConfig } from '@aztec/pxe';
|
|
15
|
+
import type { SequencerClient } from '@aztec/sequencer-client';
|
|
16
|
+
import type { PublicDataTreeLeaf } from '@aztec/stdlib/trees';
|
|
17
|
+
import { type TelemetryClient, type TelemetryClientConfig } from '@aztec/telemetry-client';
|
|
18
|
+
import { type Chain, type HDAccount, type Hex, type PrivateKeyAccount } from 'viem';
|
|
19
|
+
export { deployAndInitializeTokenAndBridgeContracts } from '../shared/cross_chain_test_harness.js';
|
|
20
|
+
export { startAnvil };
|
|
21
|
+
export declare const getPrivateKeyFromIndex: (index: number) => Buffer | null;
|
|
22
|
+
export declare const setupL1Contracts: (l1RpcUrls: string[], account: HDAccount | PrivateKeyAccount, logger: Logger, args?: Partial<DeployL1ContractsArgs>, chain?: Chain) => Promise<DeployL1ContractsReturnType>;
|
|
23
|
+
/**
|
|
24
|
+
* Sets up Private eXecution Environment (PXE).
|
|
25
|
+
* @param aztecNode - An instance of Aztec Node.
|
|
26
|
+
* @param opts - Partial configuration for the PXE service.
|
|
27
|
+
* @param firstPrivKey - The private key of the first account to be created.
|
|
28
|
+
* @param logger - The logger to be used.
|
|
29
|
+
* @param useLogSuffix - Whether to add a randomly generated suffix to the PXE debug logs.
|
|
30
|
+
* @param proofCreator - An optional proof creator to use
|
|
31
|
+
* @returns Private eXecution Environment (PXE), accounts, wallets and logger.
|
|
32
|
+
*/
|
|
33
|
+
export declare function setupPXEService(aztecNode: AztecNode, opts?: Partial<PXEServiceConfig>, logger?: Logger, useLogSuffix?: boolean, proofCreator?: BBNativePrivateKernelProver): Promise<{
|
|
34
|
+
/**
|
|
35
|
+
* The PXE instance.
|
|
36
|
+
*/
|
|
37
|
+
pxe: PXEService;
|
|
38
|
+
/**
|
|
39
|
+
* Logger instance named as the current test.
|
|
40
|
+
*/
|
|
41
|
+
logger: Logger;
|
|
42
|
+
/**
|
|
43
|
+
* Teardown function
|
|
44
|
+
*/
|
|
45
|
+
teardown: () => Promise<void>;
|
|
46
|
+
}>;
|
|
47
|
+
/** Options for the e2e tests setup */
|
|
48
|
+
export type SetupOptions = {
|
|
49
|
+
/** State load */
|
|
50
|
+
stateLoad?: string;
|
|
51
|
+
/** Whether to enable metrics collection, if undefined, metrics collection is disabled */
|
|
52
|
+
metricsPort?: number | undefined;
|
|
53
|
+
/** Previously deployed contracts on L1 */
|
|
54
|
+
deployL1ContractsValues?: DeployL1ContractsReturnType;
|
|
55
|
+
/** Whether to skip deployment of protocol contracts (auth registry, etc) */
|
|
56
|
+
skipProtocolContracts?: boolean;
|
|
57
|
+
/** Initial fee juice for default accounts */
|
|
58
|
+
initialAccountFeeJuice?: Fr;
|
|
59
|
+
/** Number of initial accounts funded with fee juice */
|
|
60
|
+
numberOfInitialFundedAccounts?: number;
|
|
61
|
+
/** Data of the initial funded accounts */
|
|
62
|
+
initialFundedAccounts?: InitialAccountData[];
|
|
63
|
+
/** Salt to use in L1 contract deployment */
|
|
64
|
+
salt?: number;
|
|
65
|
+
/** An initial set of validators */
|
|
66
|
+
initialValidators?: EthAddress[];
|
|
67
|
+
/** Anvil Start time */
|
|
68
|
+
l1StartTime?: number;
|
|
69
|
+
/** The anvil time where we should at the earliest be seeing L2 blocks */
|
|
70
|
+
l2StartTime?: number;
|
|
71
|
+
/** Whether to start a prover node */
|
|
72
|
+
startProverNode?: boolean;
|
|
73
|
+
/** Whether to fund the rewardDistributor */
|
|
74
|
+
fundRewardDistributor?: boolean;
|
|
75
|
+
/** Manual config for the telemetry client */
|
|
76
|
+
telemetryConfig?: Partial<TelemetryClientConfig> & {
|
|
77
|
+
benchmark?: boolean;
|
|
78
|
+
};
|
|
79
|
+
/** Public data that will be inserted in the tree in genesis */
|
|
80
|
+
genesisPublicData?: PublicDataTreeLeaf[];
|
|
81
|
+
} & Partial<AztecNodeConfig>;
|
|
82
|
+
/** Context for an end-to-end test as returned by the `setup` function */
|
|
83
|
+
export type EndToEndContext = {
|
|
84
|
+
/** The Aztec Node service or client a connected to it. */
|
|
85
|
+
aztecNode: AztecNode;
|
|
86
|
+
/** The prover node service (only set if startProverNode is true) */
|
|
87
|
+
proverNode: ProverNode | undefined;
|
|
88
|
+
/** A client to the sequencer service (undefined if connected to remote environment) */
|
|
89
|
+
sequencer: SequencerClient | undefined;
|
|
90
|
+
/** The Private eXecution Environment (PXE). */
|
|
91
|
+
pxe: PXE;
|
|
92
|
+
/** Return values from deployL1Contracts function. */
|
|
93
|
+
deployL1ContractsValues: DeployL1ContractsReturnType;
|
|
94
|
+
/** The Aztec Node configuration. */
|
|
95
|
+
config: AztecNodeConfig;
|
|
96
|
+
/** The data for the initial funded accounts. */
|
|
97
|
+
initialFundedAccounts: InitialAccountData[];
|
|
98
|
+
/** The first wallet to be used. */
|
|
99
|
+
wallet: AccountWalletWithSecretKey;
|
|
100
|
+
/** The wallets to be used. */
|
|
101
|
+
wallets: AccountWalletWithSecretKey[];
|
|
102
|
+
/** Logger instance named as the current test. */
|
|
103
|
+
logger: Logger;
|
|
104
|
+
/** The cheat codes. */
|
|
105
|
+
cheatCodes: CheatCodes;
|
|
106
|
+
/** The anvil test watcher (undefined if connected to remote environment) */
|
|
107
|
+
watcher: AnvilTestWatcher | undefined;
|
|
108
|
+
/** Allows tweaking current system time, used by the epoch cache only (undefined if connected to remote environment) */
|
|
109
|
+
dateProvider: TestDateProvider | undefined;
|
|
110
|
+
/** The blob sink (undefined if connected to remote environment) */
|
|
111
|
+
blobSink: BlobSinkServer | undefined;
|
|
112
|
+
/** Telemetry client */
|
|
113
|
+
telemetryClient: TelemetryClient | undefined;
|
|
114
|
+
/** Function to stop the started services. */
|
|
115
|
+
teardown: () => Promise<void>;
|
|
116
|
+
};
|
|
117
|
+
/**
|
|
118
|
+
* Sets up the environment for the end-to-end tests.
|
|
119
|
+
* @param numberOfAccounts - The number of new accounts to be created once the PXE is initiated.
|
|
120
|
+
* @param opts - Options to pass to the node initialization and to the setup script.
|
|
121
|
+
* @param pxeOpts - Options to pass to the PXE initialization.
|
|
122
|
+
*/
|
|
123
|
+
export declare function setup(numberOfAccounts?: number, opts?: SetupOptions, pxeOpts?: Partial<PXEServiceConfig>, chain?: Chain): Promise<EndToEndContext>;
|
|
124
|
+
/**
|
|
125
|
+
* Registers the contract class used for test accounts and publicly deploys the instances requested.
|
|
126
|
+
* Use this when you need to make a public call to an account contract, such as for requesting a public authwit.
|
|
127
|
+
* @param sender - Wallet to send the deployment tx.
|
|
128
|
+
* @param accountsToDeploy - Which accounts to publicly deploy.
|
|
129
|
+
*/
|
|
130
|
+
export declare function ensureAccountsPubliclyDeployed(sender: Wallet, accountsToDeploy: Wallet[]): Promise<void>;
|
|
131
|
+
/**
|
|
132
|
+
* Sets the timestamp of the next block.
|
|
133
|
+
* @param rpcUrl - rpc url of the blockchain instance to connect to
|
|
134
|
+
* @param timestamp - the timestamp for the next block
|
|
135
|
+
*/
|
|
136
|
+
export declare function setNextBlockTimestamp(rpcUrl: string, timestamp: number): Promise<void>;
|
|
137
|
+
/**
|
|
138
|
+
* Returns a logger instance for the current test.
|
|
139
|
+
* @returns a logger instance for the current test.
|
|
140
|
+
*/
|
|
141
|
+
export declare function getLogger(): Logger;
|
|
142
|
+
export type BalancesFn = ReturnType<typeof getBalancesFn>;
|
|
143
|
+
export declare function getBalancesFn(symbol: string, method: ContractMethod, logger: any): (...addresses: (AztecAddress | {
|
|
144
|
+
address: AztecAddress;
|
|
145
|
+
})[]) => Promise<bigint[]>;
|
|
146
|
+
export declare function expectMapping<K, V>(fn: (...k: K[]) => Promise<V[]>, inputs: K[], expectedOutputs: V[]): Promise<void>;
|
|
147
|
+
export declare function expectMappingDelta<K, V extends number | bigint>(initialValues: V[], fn: (...k: K[]) => Promise<V[]>, inputs: K[], expectedDiffs: V[]): Promise<void>;
|
|
148
|
+
/**
|
|
149
|
+
* Deploy the protocol contracts to a running instance.
|
|
150
|
+
*/
|
|
151
|
+
export declare function setupCanonicalFeeJuice(pxe: PXE): Promise<void>;
|
|
152
|
+
export declare function waitForProvenChain(node: AztecNode, targetBlock?: number, timeoutSec?: number, intervalSec?: number): Promise<void>;
|
|
153
|
+
export declare function createAndSyncProverNode(proverNodePrivateKey: `0x${string}`, aztecNodeConfig: AztecNodeConfig, aztecNode: AztecNode, dataDirectory: string, prefilledPublicData?: PublicDataTreeLeaf[]): Promise<ProverNode>;
|
|
154
|
+
export declare function createForwarderContract(aztecNodeConfig: AztecNodeConfig, privateKey: `0x${string}`, rollupAddress: Hex): Promise<ForwarderContract>;
|
|
155
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/fixtures/utils.ts"],"names":[],"mappings":";;AACA,OAAO,EACL,KAAK,kBAAkB,EAKxB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAAE,KAAK,eAAe,EAAsC,MAAM,mBAAmB,CAAC;AAC7F,OAAO,EACL,KAAK,0BAA0B,EAC/B,gBAAgB,EAChB,KAAK,YAAY,EACjB,KAAK,SAAS,EAEd,UAAU,EACV,KAAK,cAAc,EACnB,KAAK,2BAA2B,EAEhC,KAAK,MAAM,EACX,KAAK,GAAG,EAER,KAAK,MAAM,EAOZ,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AAE,eAAe,EAChC,SAAS,EAAE,SAAS,EACpB,aAAa,EAAE,MAAM,EACrB,mBAAmB,GAAE,kBAAkB,EAAO,uBA+C/C;AAWD,wBAAsB,uBAAuB,CAC3C,eAAe,EAAE,eAAe,EAChC,UAAU,EAAE,KAAK,MAAM,EAAE,EACzB,aAAa,EAAE,GAAG,8BAWnB"}
|
package/dest/fixtures/utils.js
CHANGED
|
@@ -1,32 +1,35 @@
|
|
|
1
1
|
import { SchnorrAccountContractArtifact } from '@aztec/accounts/schnorr';
|
|
2
|
-
import {
|
|
2
|
+
import { deployFundedSchnorrAccounts, generateSchnorrAccounts, getDeployedTestAccounts, getDeployedTestAccountsWallets } from '@aztec/accounts/testing';
|
|
3
3
|
import { createArchiver } from '@aztec/archiver';
|
|
4
4
|
import { AztecNodeService, getConfigEnvVars } from '@aztec/aztec-node';
|
|
5
|
-
import { AnvilTestWatcher, BatchCall, CheatCodes,
|
|
5
|
+
import { AnvilTestWatcher, BatchCall, CheatCodes, FeeJuicePaymentMethod, SignerlessWallet, createAztecNodeClient, createLogger, createPXEClient, deployL1Contracts, makeFetch, waitForPXE } from '@aztec/aztec.js';
|
|
6
6
|
import { deployInstance, registerContractClass } from '@aztec/aztec.js/deployment';
|
|
7
|
-
import { DefaultMultiCallEntrypoint } from '@aztec/aztec.js/entrypoint';
|
|
8
7
|
import { createBlobSinkClient } from '@aztec/blob-sink/client';
|
|
9
8
|
import { createBlobSinkServer } from '@aztec/blob-sink/server';
|
|
10
|
-
import { FEE_JUICE_INITIAL_MINT,
|
|
9
|
+
import { FEE_JUICE_INITIAL_MINT, GENESIS_ARCHIVE_ROOT, GENESIS_BLOCK_HASH } from '@aztec/constants';
|
|
11
10
|
import { ForwarderContract, NULL_KEY, createL1Clients, getL1ContractsConfigEnvVars, isAnvilTestChain, l1Artifacts } from '@aztec/ethereum';
|
|
12
11
|
import { DelayedTxUtils, EthCheatCodesWithState, startAnvil } from '@aztec/ethereum/test';
|
|
13
12
|
import { randomBytes } from '@aztec/foundation/crypto';
|
|
14
13
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
14
|
+
import { Fr } from '@aztec/foundation/fields';
|
|
15
15
|
import { retryUntil } from '@aztec/foundation/retry';
|
|
16
16
|
import { TestDateProvider } from '@aztec/foundation/timer';
|
|
17
17
|
import { FeeJuiceContract } from '@aztec/noir-contracts.js/FeeJuice';
|
|
18
|
-
import { getVKTreeRoot } from '@aztec/noir-protocol-circuits-types/
|
|
18
|
+
import { getVKTreeRoot } from '@aztec/noir-protocol-circuits-types/vk-tree';
|
|
19
19
|
import { ProtocolContractAddress, protocolContractTreeRoot } from '@aztec/protocol-contracts';
|
|
20
20
|
import { createProverNode } from '@aztec/prover-node';
|
|
21
21
|
import { createPXEService, getPXEServiceConfig } from '@aztec/pxe';
|
|
22
|
+
import { getContractClassFromArtifact } from '@aztec/stdlib/contract';
|
|
23
|
+
import { Gas } from '@aztec/stdlib/gas';
|
|
22
24
|
import { getConfigEnvVars as getTelemetryConfig, initTelemetryClient } from '@aztec/telemetry-client';
|
|
23
25
|
import { BenchmarkTelemetryClient } from '@aztec/telemetry-client/bench';
|
|
26
|
+
import { getGenesisValues } from '@aztec/world-state/testing';
|
|
24
27
|
import fs from 'fs/promises';
|
|
25
28
|
import getPort from 'get-port';
|
|
26
29
|
import { tmpdir } from 'os';
|
|
27
30
|
import * as path from 'path';
|
|
28
31
|
import { inspect } from 'util';
|
|
29
|
-
import {
|
|
32
|
+
import { getContract } from 'viem';
|
|
30
33
|
import { mnemonicToAccount, privateKeyToAccount } from 'viem/accounts';
|
|
31
34
|
import { foundry } from 'viem/chains';
|
|
32
35
|
import { MNEMONIC, TEST_PEER_CHECK_INTERVAL_MS } from './fixtures.js';
|
|
@@ -60,14 +63,15 @@ export const getPrivateKeyFromIndex = (index)=>{
|
|
|
60
63
|
const privKeyRaw = hdAccount.getHdKey().privateKey;
|
|
61
64
|
return privKeyRaw === null ? null : Buffer.from(privKeyRaw);
|
|
62
65
|
};
|
|
63
|
-
export const setupL1Contracts = async (
|
|
64
|
-
const l1Data = await deployL1Contracts(
|
|
65
|
-
l2FeeJuiceAddress: ProtocolContractAddress.FeeJuice,
|
|
66
|
-
vkTreeRoot:
|
|
66
|
+
export const setupL1Contracts = async (l1RpcUrls, account, logger, args = {}, chain = foundry)=>{
|
|
67
|
+
const l1Data = await deployL1Contracts(l1RpcUrls, account, chain, logger, {
|
|
68
|
+
l2FeeJuiceAddress: ProtocolContractAddress.FeeJuice.toField(),
|
|
69
|
+
vkTreeRoot: getVKTreeRoot(),
|
|
67
70
|
protocolContractTreeRoot,
|
|
71
|
+
genesisArchiveRoot: args.genesisArchiveRoot ?? new Fr(GENESIS_ARCHIVE_ROOT),
|
|
72
|
+
genesisBlockHash: args.genesisBlockHash ?? new Fr(GENESIS_BLOCK_HASH),
|
|
68
73
|
salt: args.salt,
|
|
69
74
|
initialValidators: args.initialValidators,
|
|
70
|
-
assumeProvenThrough: args.assumeProvenThrough,
|
|
71
75
|
...getL1ContractsConfigEnvVars(),
|
|
72
76
|
...args
|
|
73
77
|
});
|
|
@@ -95,10 +99,15 @@ export const setupL1Contracts = async (l1RpcUrl, account, logger, args = {}, cha
|
|
|
95
99
|
const pxe = await createPXEService(aztecNode, pxeServiceConfig, useLogSuffix, proofCreator);
|
|
96
100
|
const teardown = async ()=>{
|
|
97
101
|
if (!configuredDataDirectory) {
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
+
try {
|
|
103
|
+
await fs.rm(pxeServiceConfig.dataDirectory, {
|
|
104
|
+
recursive: true,
|
|
105
|
+
force: true,
|
|
106
|
+
maxRetries: 3
|
|
107
|
+
});
|
|
108
|
+
} catch (err) {
|
|
109
|
+
logger.warn(`Failed to delete tmp PXE data directory ${pxeServiceConfig.dataDirectory}: ${err}`);
|
|
110
|
+
}
|
|
102
111
|
}
|
|
103
112
|
};
|
|
104
113
|
return {
|
|
@@ -121,7 +130,7 @@ export const setupL1Contracts = async (l1RpcUrl, account, logger, args = {}, cha
|
|
|
121
130
|
logger.verbose(`Creating Aztec Node client to remote host ${aztecNodeUrl}`);
|
|
122
131
|
const aztecNode = createAztecNodeClient(aztecNodeUrl);
|
|
123
132
|
logger.verbose(`Creating PXE client to remote host ${PXE_URL}`);
|
|
124
|
-
const pxeClient = createPXEClient(PXE_URL, makeFetch([
|
|
133
|
+
const pxeClient = createPXEClient(PXE_URL, {}, makeFetch([
|
|
125
134
|
1,
|
|
126
135
|
2,
|
|
127
136
|
3
|
|
@@ -130,30 +139,21 @@ export const setupL1Contracts = async (l1RpcUrl, account, logger, args = {}, cha
|
|
|
130
139
|
logger.verbose('JSON RPC client connected to PXE');
|
|
131
140
|
logger.verbose(`Retrieving contract addresses from ${PXE_URL}`);
|
|
132
141
|
const l1Contracts = (await pxeClient.getNodeInfo()).l1ContractAddresses;
|
|
133
|
-
const walletClient =
|
|
134
|
-
account,
|
|
135
|
-
chain: foundry,
|
|
136
|
-
transport: http(config.l1RpcUrl)
|
|
137
|
-
});
|
|
138
|
-
const publicClient = createPublicClient({
|
|
139
|
-
chain: foundry,
|
|
140
|
-
transport: http(config.l1RpcUrl)
|
|
141
|
-
});
|
|
142
|
+
const { walletClient, publicClient } = createL1Clients(config.l1RpcUrls, account, foundry);
|
|
142
143
|
const deployL1ContractsValues = {
|
|
143
144
|
l1ContractAddresses: l1Contracts,
|
|
144
145
|
walletClient,
|
|
145
146
|
publicClient
|
|
146
147
|
};
|
|
147
|
-
const cheatCodes = await CheatCodes.create(config.
|
|
148
|
+
const cheatCodes = await CheatCodes.create(config.l1RpcUrls, pxeClient);
|
|
148
149
|
const teardown = ()=>Promise.resolve();
|
|
149
|
-
|
|
150
|
-
await setupCanonicalFeeJuice(new SignerlessWallet(pxeClient, new DefaultMultiCallEntrypoint(chainId, protocolVersion)));
|
|
150
|
+
await setupCanonicalFeeJuice(pxeClient);
|
|
151
151
|
logger.verbose('Constructing available wallets from already registered accounts...');
|
|
152
|
+
const initialFundedAccounts = await getDeployedTestAccounts(pxeClient);
|
|
152
153
|
const wallets = await getDeployedTestAccountsWallets(pxeClient);
|
|
153
154
|
if (wallets.length < numberOfAccounts) {
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
wallets.push(...await createAccounts(pxeClient, numNewAccounts));
|
|
155
|
+
throw new Error(`Required ${numberOfAccounts} accounts. Found ${wallets.length}.`);
|
|
156
|
+
// Deploy new accounts if there's a test that requires more funded accounts in the remote environment.
|
|
157
157
|
}
|
|
158
158
|
return {
|
|
159
159
|
aztecNode,
|
|
@@ -163,8 +163,9 @@ export const setupL1Contracts = async (l1RpcUrl, account, logger, args = {}, cha
|
|
|
163
163
|
deployL1ContractsValues,
|
|
164
164
|
accounts: await pxeClient.getRegisteredAccounts(),
|
|
165
165
|
config,
|
|
166
|
+
initialFundedAccounts,
|
|
166
167
|
wallet: wallets[0],
|
|
167
|
-
wallets,
|
|
168
|
+
wallets: wallets.slice(0, numberOfAccounts),
|
|
168
169
|
logger,
|
|
169
170
|
cheatCodes,
|
|
170
171
|
watcher: undefined,
|
|
@@ -180,7 +181,6 @@ export const setupL1Contracts = async (l1RpcUrl, account, logger, args = {}, cha
|
|
|
180
181
|
* @param opts - Options to pass to the node initialization and to the setup script.
|
|
181
182
|
* @param pxeOpts - Options to pass to the PXE initialization.
|
|
182
183
|
*/ export async function setup(numberOfAccounts = 1, opts = {
|
|
183
|
-
assumeProvenThrough: Number.MAX_SAFE_INTEGER,
|
|
184
184
|
customForwarderContractAddress: EthAddress.ZERO
|
|
185
185
|
}, pxeOpts = {}, chain = foundry) {
|
|
186
186
|
const config = {
|
|
@@ -198,16 +198,20 @@ export const setupL1Contracts = async (l1RpcUrl, account, logger, args = {}, cha
|
|
|
198
198
|
config.dataDirectory = directoryToCleanup;
|
|
199
199
|
}
|
|
200
200
|
let anvil;
|
|
201
|
-
if (!config.
|
|
201
|
+
if (!config.l1RpcUrls?.length) {
|
|
202
202
|
if (!isAnvilTestChain(chain.id)) {
|
|
203
|
-
throw new Error(`No
|
|
203
|
+
throw new Error(`No ETHEREUM_HOSTS set but non anvil chain requested`);
|
|
204
204
|
}
|
|
205
205
|
if (PXE_URL) {
|
|
206
|
-
throw new Error(`PXE_URL provided but no
|
|
206
|
+
throw new Error(`PXE_URL provided but no ETHEREUM_HOSTS set. Refusing to run, please set both variables so tests can deploy L1 contracts to the same Anvil instance`);
|
|
207
207
|
}
|
|
208
|
-
const res = await startAnvil(
|
|
208
|
+
const res = await startAnvil({
|
|
209
|
+
l1BlockTime: opts.ethereumSlotDuration
|
|
210
|
+
});
|
|
209
211
|
anvil = res.anvil;
|
|
210
|
-
config.
|
|
212
|
+
config.l1RpcUrls = [
|
|
213
|
+
res.rpcUrl
|
|
214
|
+
];
|
|
211
215
|
}
|
|
212
216
|
// Enable logging metrics to a local file named after the test suite
|
|
213
217
|
if (isMetricsLoggingRequested()) {
|
|
@@ -215,7 +219,7 @@ export const setupL1Contracts = async (l1RpcUrl, account, logger, args = {}, cha
|
|
|
215
219
|
logger.info(`Logging metrics to ${filename}`);
|
|
216
220
|
setupMetricsLogger(filename);
|
|
217
221
|
}
|
|
218
|
-
const ethCheatCodes = new EthCheatCodesWithState(config.
|
|
222
|
+
const ethCheatCodes = new EthCheatCodesWithState(config.l1RpcUrls);
|
|
219
223
|
if (opts.stateLoad) {
|
|
220
224
|
await ethCheatCodes.loadChainState(opts.stateLoad);
|
|
221
225
|
}
|
|
@@ -249,7 +253,13 @@ export const setupL1Contracts = async (l1RpcUrl, account, logger, args = {}, cha
|
|
|
249
253
|
});
|
|
250
254
|
await blobSink.start();
|
|
251
255
|
config.blobSinkUrl = `http://localhost:${blobSinkPort}`;
|
|
252
|
-
const
|
|
256
|
+
const initialFundedAccounts = opts.initialFundedAccounts ?? await generateSchnorrAccounts(opts.numberOfInitialFundedAccounts ?? numberOfAccounts);
|
|
257
|
+
const { genesisBlockHash, genesisArchiveRoot, prefilledPublicData } = await getGenesisValues(initialFundedAccounts.map((a)=>a.address), opts.initialAccountFeeJuice, opts.genesisPublicData);
|
|
258
|
+
const deployL1ContractsValues = opts.deployL1ContractsValues ?? await setupL1Contracts(config.l1RpcUrls, publisherHdAccount, logger, {
|
|
259
|
+
...opts,
|
|
260
|
+
genesisArchiveRoot,
|
|
261
|
+
genesisBlockHash
|
|
262
|
+
}, chain);
|
|
253
263
|
config.l1Contracts = deployL1ContractsValues.l1ContractAddresses;
|
|
254
264
|
if (opts.fundRewardDistributor) {
|
|
255
265
|
// Mints block rewards for 10000 blocks to the rewardDistributor contract
|
|
@@ -280,7 +290,7 @@ export const setupL1Contracts = async (l1RpcUrl, account, logger, args = {}, cha
|
|
|
280
290
|
await ethCheatCodes.warp(opts.l2StartTime);
|
|
281
291
|
}
|
|
282
292
|
const dateProvider = new TestDateProvider();
|
|
283
|
-
const watcher = new AnvilTestWatcher(new EthCheatCodesWithState(config.
|
|
293
|
+
const watcher = new AnvilTestWatcher(new EthCheatCodesWithState(config.l1RpcUrls), deployL1ContractsValues.l1ContractAddresses.rollupAddress, deployL1ContractsValues.publicClient, dateProvider);
|
|
284
294
|
await watcher.start();
|
|
285
295
|
logger.verbose('Creating and synching an aztec node...');
|
|
286
296
|
const acvmConfig = await getACVMConfig(logger);
|
|
@@ -299,6 +309,8 @@ export const setupL1Contracts = async (l1RpcUrl, account, logger, args = {}, cha
|
|
|
299
309
|
const aztecNode = await AztecNodeService.createAndSync(config, {
|
|
300
310
|
dateProvider,
|
|
301
311
|
blobSinkClient
|
|
312
|
+
}, {
|
|
313
|
+
prefilledPublicData
|
|
302
314
|
});
|
|
303
315
|
const sequencer = aztecNode.getSequencer();
|
|
304
316
|
if (sequencer) {
|
|
@@ -316,15 +328,23 @@ export const setupL1Contracts = async (l1RpcUrl, account, logger, args = {}, cha
|
|
|
316
328
|
const { pxe, teardown: pxeTeardown } = await setupPXEService(aztecNode, pxeOpts, logger);
|
|
317
329
|
if (!config.skipProtocolContracts) {
|
|
318
330
|
logger.verbose('Setting up Fee Juice...');
|
|
319
|
-
await setupCanonicalFeeJuice(
|
|
331
|
+
await setupCanonicalFeeJuice(pxe);
|
|
332
|
+
}
|
|
333
|
+
const accountManagers = await deployFundedSchnorrAccounts(pxe, initialFundedAccounts.slice(0, numberOfAccounts));
|
|
334
|
+
const wallets = await Promise.all(accountManagers.map((account)=>account.getWallet()));
|
|
335
|
+
if (initialFundedAccounts.length < numberOfAccounts) {
|
|
336
|
+
// TODO: Create (numberOfAccounts - initialFundedAccounts.length) wallets without funds.
|
|
337
|
+
throw new Error(`Unable to deploy ${numberOfAccounts} accounts. Only ${initialFundedAccounts.length} accounts were funded.`);
|
|
320
338
|
}
|
|
321
|
-
const
|
|
322
|
-
const cheatCodes = await CheatCodes.create(config.l1RpcUrl, pxe);
|
|
339
|
+
const cheatCodes = await CheatCodes.create(config.l1RpcUrls, pxe);
|
|
323
340
|
const teardown = async ()=>{
|
|
324
341
|
await pxeTeardown();
|
|
325
342
|
if (aztecNode instanceof AztecNodeService) {
|
|
326
343
|
await aztecNode?.stop();
|
|
327
344
|
}
|
|
345
|
+
if (proverNode) {
|
|
346
|
+
await proverNode.stop();
|
|
347
|
+
}
|
|
328
348
|
if (acvmConfig?.cleanup) {
|
|
329
349
|
// remove the temp directory created for the acvm
|
|
330
350
|
logger.verbose(`Cleaning up ACVM state`);
|
|
@@ -335,33 +355,39 @@ export const setupL1Contracts = async (l1RpcUrl, account, logger, args = {}, cha
|
|
|
335
355
|
logger.verbose(`Cleaning up BB state`);
|
|
336
356
|
await bbConfig.cleanup();
|
|
337
357
|
}
|
|
338
|
-
await anvil?.stop();
|
|
358
|
+
await anvil?.stop().catch((err)=>getLogger().error(err));
|
|
339
359
|
await watcher.stop();
|
|
340
360
|
await blobSink?.stop();
|
|
341
361
|
if (directoryToCleanup) {
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
362
|
+
try {
|
|
363
|
+
logger.verbose(`Cleaning up data directory at ${directoryToCleanup}`);
|
|
364
|
+
await fs.rm(directoryToCleanup, {
|
|
365
|
+
recursive: true,
|
|
366
|
+
force: true,
|
|
367
|
+
maxRetries: 3
|
|
368
|
+
});
|
|
369
|
+
} catch (err) {
|
|
370
|
+
logger.warn(`Failed to delete data directory at ${directoryToCleanup}: ${err}`);
|
|
371
|
+
}
|
|
347
372
|
}
|
|
348
373
|
};
|
|
349
374
|
return {
|
|
350
375
|
aztecNode,
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
deployL1ContractsValues,
|
|
376
|
+
blobSink,
|
|
377
|
+
cheatCodes,
|
|
354
378
|
config,
|
|
355
|
-
|
|
356
|
-
|
|
379
|
+
dateProvider,
|
|
380
|
+
deployL1ContractsValues,
|
|
381
|
+
initialFundedAccounts,
|
|
357
382
|
logger,
|
|
358
|
-
|
|
383
|
+
proverNode,
|
|
384
|
+
pxe,
|
|
359
385
|
sequencer,
|
|
360
|
-
|
|
361
|
-
dateProvider,
|
|
362
|
-
blobSink,
|
|
386
|
+
teardown,
|
|
363
387
|
telemetryClient: telemetry,
|
|
364
|
-
|
|
388
|
+
wallet: wallets[0],
|
|
389
|
+
wallets,
|
|
390
|
+
watcher
|
|
365
391
|
};
|
|
366
392
|
}
|
|
367
393
|
/**
|
|
@@ -449,9 +475,10 @@ export async function expectMappingDelta(initialValues, fn, inputs, expectedDiff
|
|
|
449
475
|
const wallet = new SignerlessWallet(pxe);
|
|
450
476
|
const feeJuice = await FeeJuiceContract.at(ProtocolContractAddress.FeeJuice, wallet);
|
|
451
477
|
try {
|
|
478
|
+
const paymentMethod = new FeeJuicePaymentMethod(ProtocolContractAddress.FeeJuice);
|
|
452
479
|
await feeJuice.methods.initialize(feeJuicePortalAddress, FEE_JUICE_INITIAL_MINT).send({
|
|
453
480
|
fee: {
|
|
454
|
-
paymentMethod
|
|
481
|
+
paymentMethod,
|
|
455
482
|
gasSettings: {
|
|
456
483
|
teardownGasLimits: Gas.empty()
|
|
457
484
|
}
|
|
@@ -466,11 +493,10 @@ export async function waitForProvenChain(node, targetBlock, timeoutSec = 60, int
|
|
|
466
493
|
targetBlock ??= await node.getBlockNumber();
|
|
467
494
|
await retryUntil(async ()=>await node.getProvenBlockNumber() >= targetBlock, 'proven chain status', timeoutSec, intervalSec);
|
|
468
495
|
}
|
|
469
|
-
export async function createAndSyncProverNode(proverNodePrivateKey, aztecNodeConfig, aztecNode, dataDirectory) {
|
|
496
|
+
export async function createAndSyncProverNode(proverNodePrivateKey, aztecNodeConfig, aztecNode, dataDirectory, prefilledPublicData = []) {
|
|
470
497
|
// Disable stopping the aztec node as the prover coordination test will kill it otherwise
|
|
471
498
|
// This is only required when stopping the prover node for testing
|
|
472
499
|
const aztecNodeWithoutStop = {
|
|
473
|
-
addEpochProofQuote: aztecNode.addEpochProofQuote.bind(aztecNode),
|
|
474
500
|
getTxByHash: aztecNode.getTxByHash.bind(aztecNode),
|
|
475
501
|
getTxsByHash: aztecNode.getTxsByHash.bind(aztecNode),
|
|
476
502
|
stop: ()=>Promise.resolve()
|
|
@@ -489,17 +515,12 @@ export async function createAndSyncProverNode(proverNodePrivateKey, aztecNodeCon
|
|
|
489
515
|
...aztecNodeConfig,
|
|
490
516
|
proverCoordinationNodeUrl: undefined,
|
|
491
517
|
dataDirectory: undefined,
|
|
492
|
-
proverId: new Fr(42),
|
|
493
518
|
realProofs: false,
|
|
494
519
|
proverAgentCount: 2,
|
|
495
520
|
publisherPrivateKey: proverNodePrivateKey,
|
|
496
521
|
proverNodeMaxPendingJobs: 10,
|
|
497
522
|
proverNodeMaxParallelBlocksPerEpoch: 32,
|
|
498
523
|
proverNodePollingIntervalMs: 200,
|
|
499
|
-
quoteProviderBasisPointFee: 100,
|
|
500
|
-
quoteProviderBondAmount: 1000n,
|
|
501
|
-
proverMinimumEscrowAmount: 1000n,
|
|
502
|
-
proverTargetEscrowAmount: 2000n,
|
|
503
524
|
txGatheringTimeoutMs: 60000,
|
|
504
525
|
txGatheringIntervalMs: 1000,
|
|
505
526
|
txGatheringMaxParallelRequests: 100
|
|
@@ -509,19 +530,24 @@ export async function createAndSyncProverNode(proverNodePrivateKey, aztecNodeCon
|
|
|
509
530
|
aztecNodeTxProvider: aztecNodeWithoutStop,
|
|
510
531
|
archiver: archiver,
|
|
511
532
|
l1TxUtils
|
|
533
|
+
}, {
|
|
534
|
+
prefilledPublicData
|
|
535
|
+
});
|
|
536
|
+
getLogger().info(`Created and synced prover node`, {
|
|
537
|
+
publisherAddress: l1TxUtils.walletClient.account.address
|
|
512
538
|
});
|
|
513
|
-
|
|
539
|
+
proverNode.start();
|
|
514
540
|
return proverNode;
|
|
515
541
|
}
|
|
516
542
|
function createDelayedL1TxUtils(aztecNodeConfig, privateKey, logName) {
|
|
517
|
-
const { publicClient, walletClient } = createL1Clients(aztecNodeConfig.
|
|
543
|
+
const { publicClient, walletClient } = createL1Clients(aztecNodeConfig.l1RpcUrls, privateKey, foundry);
|
|
518
544
|
const log = createLogger(logName);
|
|
519
545
|
const l1TxUtils = new DelayedTxUtils(publicClient, walletClient, log, aztecNodeConfig);
|
|
520
546
|
l1TxUtils.enableDelayer(aztecNodeConfig.ethereumSlotDuration);
|
|
521
547
|
return l1TxUtils;
|
|
522
548
|
}
|
|
523
549
|
export async function createForwarderContract(aztecNodeConfig, privateKey, rollupAddress) {
|
|
524
|
-
const { walletClient, publicClient } = createL1Clients(aztecNodeConfig.
|
|
550
|
+
const { walletClient, publicClient } = createL1Clients(aztecNodeConfig.l1RpcUrls, privateKey, foundry);
|
|
525
551
|
const forwarderContract = await ForwarderContract.create(walletClient.account.address, walletClient, publicClient, createLogger('forwarder'), rollupAddress);
|
|
526
552
|
return forwarderContract;
|
|
527
553
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"with_telemetry_utils.d.ts","sourceRoot":"","sources":["../../src/fixtures/with_telemetry_utils.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,eAAe,EAIrB,MAAM,yBAAyB,CAAC;AAGjC,wBAAgB,8BAA8B,CAAC,WAAW,CAAC,EAAE,MAAM,GAAG,eAAe,CAMpF"}
|
package/dest/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { Logger } from '@aztec/aztec.js';
|
|
2
|
+
export interface AlertConfig {
|
|
3
|
+
alert: string;
|
|
4
|
+
expr: string;
|
|
5
|
+
start?: number;
|
|
6
|
+
end?: number;
|
|
7
|
+
step?: number;
|
|
8
|
+
for: string;
|
|
9
|
+
labels: Record<string, string>;
|
|
10
|
+
annotations: Record<string, string>;
|
|
11
|
+
}
|
|
12
|
+
export interface AlertCheckerConfig {
|
|
13
|
+
grafanaEndpoint: string;
|
|
14
|
+
grafanaCredentials: string;
|
|
15
|
+
}
|
|
16
|
+
export declare class AlertChecker {
|
|
17
|
+
private config;
|
|
18
|
+
private logger;
|
|
19
|
+
constructor(logger: Logger, config?: Partial<AlertCheckerConfig>);
|
|
20
|
+
/**
|
|
21
|
+
* Load the alerts config from a file path.
|
|
22
|
+
* @param filePath - The absolute path to the alerts file.
|
|
23
|
+
*/
|
|
24
|
+
private loadAlertsConfig;
|
|
25
|
+
private queryGrafana;
|
|
26
|
+
private checkAlerts;
|
|
27
|
+
/**
|
|
28
|
+
* Run the alert check based on the alerts defined in an array.
|
|
29
|
+
* @param alerts - The alerts to check.
|
|
30
|
+
*/
|
|
31
|
+
runAlertCheck(alerts: AlertConfig[]): Promise<void>;
|
|
32
|
+
/**
|
|
33
|
+
* Run the alert check based on the alerts defined in a yaml file.
|
|
34
|
+
* @param filePath - The absolute path to the alerts file.
|
|
35
|
+
*/
|
|
36
|
+
runAlertCheckFromFilePath(filePath: string): Promise<void>;
|
|
37
|
+
}
|
|
38
|
+
export declare class AlertTriggeredError extends Error {
|
|
39
|
+
name: string;
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=alert_checker.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"alert_checker.d.ts","sourceRoot":"","sources":["../../src/quality_of_service/alert_checker.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAK9C,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC/B,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACrC;AAED,MAAM,WAAW,kBAAkB;IACjC,eAAe,EAAE,MAAM,CAAC;IACxB,kBAAkB,EAAE,MAAM,CAAC;CAC5B;AAQD,qBAAa,YAAY;IACvB,OAAO,CAAC,MAAM,CAAqB;IACnC,OAAO,CAAC,MAAM,CAAS;gBAEX,MAAM,EAAE,MAAM,EAAE,MAAM,GAAE,OAAO,CAAC,kBAAkB,CAAM;IAKpE;;;OAGG;IACH,OAAO,CAAC,gBAAgB;YAMV,YAAY;YAqCZ,WAAW;IAqBzB;;;OAGG;IACU,aAAa,CAAC,MAAM,EAAE,WAAW,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAUhE;;;OAGG;IACU,yBAAyB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAIxE;AAED,qBAAa,mBAAoB,SAAQ,KAAK;IACnC,IAAI,SAAyB;CACvC"}
|
|
@@ -65,7 +65,7 @@ export class AlertChecker {
|
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
67
|
if (alertTriggered) {
|
|
68
|
-
throw new
|
|
68
|
+
throw new AlertTriggeredError('Test failed due to triggered alert');
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
71
|
/**
|
|
@@ -88,3 +88,6 @@ export class AlertChecker {
|
|
|
88
88
|
await this.checkAlerts(alerts);
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
|
+
export class AlertTriggeredError extends Error {
|
|
92
|
+
name = 'AlertTriggeredError';
|
|
93
|
+
}
|
|
@@ -30,7 +30,7 @@ async function mintPrivateFunds(pxe) {
|
|
|
30
30
|
await showPrivateBalances(pxe);
|
|
31
31
|
// We mint tokens to the owner
|
|
32
32
|
const mintAmount = 20n;
|
|
33
|
-
const from = ownerWallet.getAddress(); // we are setting from to owner here because
|
|
33
|
+
const from = ownerWallet.getAddress(); // we are setting from to owner here because we need a sender to calculate the tag
|
|
34
34
|
await token.methods.mint_to_private(from, ownerWallet.getAddress(), mintAmount).send().wait();
|
|
35
35
|
await showPrivateBalances(pxe);
|
|
36
36
|
}
|