@aztec/end-to-end 0.75.0-commit.c03ba01a2a4122e43e90d5133ba017e54b90e9d2 → 0.77.0-testnet-ignition.21
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 +415 -0
- package/dest/spartan/utils.d.ts.map +1 -0
- package/dest/spartan/utils.js +169 -43
- 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 +161 -54
- package/dest/shared/browser.js +0 -163
- package/src/shared/browser.ts +0 -272
package/README.md
CHANGED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { type AztecNode, BatchCall, type SentTx, type WaitOpts } from '@aztec/aztec.js';
|
|
2
|
+
import { BenchmarkingContract } from '@aztec/noir-contracts.js/Benchmarking';
|
|
3
|
+
import { type PXEService } from '@aztec/pxe';
|
|
4
|
+
import type { MetricsType } from '@aztec/telemetry-client';
|
|
5
|
+
import type { BenchmarkTelemetryClient } from '@aztec/telemetry-client/bench';
|
|
6
|
+
import { type EndToEndContext, type SetupOptions } from '../fixtures/utils.js';
|
|
7
|
+
/**
|
|
8
|
+
* Setup for benchmarks. Initializes a remote node with a single account and deploys a benchmark contract.
|
|
9
|
+
*/
|
|
10
|
+
export declare function benchmarkSetup(opts: Partial<SetupOptions> & {
|
|
11
|
+
/** What metrics to export */ metrics: (MetricsType | MetricFilter)[];
|
|
12
|
+
/** Where to output the benchmark data (defaults to BENCH_OUTPUT or bench.json) */
|
|
13
|
+
benchOutput?: string;
|
|
14
|
+
}): Promise<{
|
|
15
|
+
telemetry: BenchmarkTelemetryClient;
|
|
16
|
+
context: EndToEndContext;
|
|
17
|
+
contract: BenchmarkingContract;
|
|
18
|
+
sequencer: import("@aztec/sequencer-client").SequencerClient;
|
|
19
|
+
}>;
|
|
20
|
+
type MetricFilter = {
|
|
21
|
+
source: MetricsType;
|
|
22
|
+
transform: (value: number) => number;
|
|
23
|
+
name: string;
|
|
24
|
+
unit?: string;
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* Creates and returns a directory with the current job name and a random number.
|
|
28
|
+
* @param index - Index to merge into the dir path.
|
|
29
|
+
* @returns A path to a created dir.
|
|
30
|
+
*/
|
|
31
|
+
export declare function makeDataDirectory(index: number): string;
|
|
32
|
+
/**
|
|
33
|
+
* Returns the size in disk of a folder.
|
|
34
|
+
* @param path - Path to the folder.
|
|
35
|
+
* @returns Size in bytes.
|
|
36
|
+
*/
|
|
37
|
+
export declare function getFolderSize(path: string): number;
|
|
38
|
+
/**
|
|
39
|
+
* Returns a call to the benchmark contract. Each call has a private execution (account entrypoint),
|
|
40
|
+
* a nested private call (create_note), a public call (increment_balance), and a nested public
|
|
41
|
+
* call (broadcast). These include emitting one private note and one public log, two storage
|
|
42
|
+
* reads and one write.
|
|
43
|
+
* @param index - Index of the call within a block.
|
|
44
|
+
* @param context - End to end context.
|
|
45
|
+
* @param contract - Benchmarking contract.
|
|
46
|
+
* @param heavyPublicCompute - Whether the transactions include heavy public compute (like a big sha256).
|
|
47
|
+
* @returns A BatchCall instance.
|
|
48
|
+
*/
|
|
49
|
+
export declare function makeCall(index: number, context: EndToEndContext, contract: BenchmarkingContract, heavyPublicCompute: boolean): Promise<BatchCall>;
|
|
50
|
+
/**
|
|
51
|
+
* Assembles and sends multiple transactions simultaneously to the node in context.
|
|
52
|
+
* Each tx is the result of calling makeCall.
|
|
53
|
+
* @param txCount - How many txs to send
|
|
54
|
+
* @param context - End to end context.
|
|
55
|
+
* @param contract - Target contract.
|
|
56
|
+
* @param heavyPublicCompute - Whether the transactions include heavy public compute (like a big sha256).
|
|
57
|
+
* @returns Array of sent txs.
|
|
58
|
+
*/
|
|
59
|
+
export declare function sendTxs(txCount: number, context: EndToEndContext, contract: BenchmarkingContract, heavyPublicCompute?: boolean): Promise<SentTx[]>;
|
|
60
|
+
export declare function waitTxs(txs: SentTx[], context: EndToEndContext, txWaitOpts?: WaitOpts): Promise<void>;
|
|
61
|
+
/**
|
|
62
|
+
* Creates a new PXE
|
|
63
|
+
* @param node - Node to connect the pxe to.
|
|
64
|
+
* @param contract - Benchmark contract to add to the pxe.
|
|
65
|
+
* @param startingBlock - First l2 block to process.
|
|
66
|
+
* @returns The new PXE.
|
|
67
|
+
*/
|
|
68
|
+
export declare function createNewPXE(node: AztecNode, contract: BenchmarkingContract, startingBlock?: number): Promise<PXEService>;
|
|
69
|
+
export {};
|
|
70
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/bench/utils.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,SAAS,EAAE,SAAS,EAAwB,KAAK,MAAM,EAAE,KAAK,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAG9G,OAAO,EAAE,oBAAoB,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,OAAO,EAAE,eAAe,EAAE,UAAU,CAAC,EAAE,QAAQ,iBAI3F;AAED;;;;;;GAMG;AACH,wBAAsB,YAAY,CAChC,IAAI,EAAE,SAAS,EACf,QAAQ,EAAE,oBAAoB,EAC9B,aAAa,GAAE,MAA6B,GAC3C,OAAO,CAAC,UAAU,CAAC,CAerB"}
|
package/dest/bench/utils.js
CHANGED
|
@@ -106,14 +106,21 @@ function getMetricValues(points) {
|
|
|
106
106
|
* @param index - Index of the call within a block.
|
|
107
107
|
* @param context - End to end context.
|
|
108
108
|
* @param contract - Benchmarking contract.
|
|
109
|
+
* @param heavyPublicCompute - Whether the transactions include heavy public compute (like a big sha256).
|
|
109
110
|
* @returns A BatchCall instance.
|
|
110
|
-
*/ export async function makeCall(index, context, contract) {
|
|
111
|
+
*/ export async function makeCall(index, context, contract, heavyPublicCompute) {
|
|
111
112
|
const owner = context.wallet.getAddress();
|
|
112
113
|
const sender = owner;
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
114
|
+
if (heavyPublicCompute) {
|
|
115
|
+
return new BatchCall(context.wallet, [
|
|
116
|
+
await contract.methods.sha256_hash_2048(randomBytesAsBigInts(2048)).request()
|
|
117
|
+
]);
|
|
118
|
+
} else {
|
|
119
|
+
return new BatchCall(context.wallet, [
|
|
120
|
+
await contract.methods.create_note(owner, sender, index + 1).request(),
|
|
121
|
+
await contract.methods.increment_balance(owner, index + 1).request()
|
|
122
|
+
]);
|
|
123
|
+
}
|
|
117
124
|
}
|
|
118
125
|
/**
|
|
119
126
|
* Assembles and sends multiple transactions simultaneously to the node in context.
|
|
@@ -121,9 +128,10 @@ function getMetricValues(points) {
|
|
|
121
128
|
* @param txCount - How many txs to send
|
|
122
129
|
* @param context - End to end context.
|
|
123
130
|
* @param contract - Target contract.
|
|
131
|
+
* @param heavyPublicCompute - Whether the transactions include heavy public compute (like a big sha256).
|
|
124
132
|
* @returns Array of sent txs.
|
|
125
|
-
*/ export async function sendTxs(txCount, context, contract) {
|
|
126
|
-
const calls = await timesParallel(txCount, (index)=>makeCall(index, context, contract));
|
|
133
|
+
*/ export async function sendTxs(txCount, context, contract, heavyPublicCompute = false) {
|
|
134
|
+
const calls = await timesParallel(txCount, (index)=>makeCall(index, context, contract, heavyPublicCompute));
|
|
127
135
|
context.logger.info(`Creating ${txCount} txs`);
|
|
128
136
|
const provenTxs = await Promise.all(calls.map((call)=>call.prove({
|
|
129
137
|
skipPublicSimulation: true
|
|
@@ -144,14 +152,22 @@ export async function waitTxs(txs, context, txWaitOpts) {
|
|
|
144
152
|
* @returns The new PXE.
|
|
145
153
|
*/ export async function createNewPXE(node, contract, startingBlock = INITIAL_L2_BLOCK_NUM) {
|
|
146
154
|
const l1Contracts = await node.getL1ContractAddresses();
|
|
155
|
+
const { l1ChainId, protocolVersion } = await node.getNodeInfo();
|
|
147
156
|
const pxeConfig = {
|
|
148
157
|
l2StartingBlock: startingBlock,
|
|
149
158
|
l2BlockPollingIntervalMS: 100,
|
|
150
159
|
dataDirectory: undefined,
|
|
151
160
|
dataStoreMapSizeKB: 1024 * 1024,
|
|
152
|
-
l1Contracts
|
|
161
|
+
l1Contracts,
|
|
162
|
+
l1ChainId,
|
|
163
|
+
version: protocolVersion
|
|
153
164
|
};
|
|
154
165
|
const pxe = await createPXEService(node, pxeConfig);
|
|
155
166
|
await pxe.registerContract(contract);
|
|
156
167
|
return pxe;
|
|
157
168
|
}
|
|
169
|
+
function randomBytesAsBigInts(length) {
|
|
170
|
+
return [
|
|
171
|
+
...Array(length)
|
|
172
|
+
].map((_)=>BigInt(Math.floor(Math.random() * 255)));
|
|
173
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { type AccountWallet, type CompleteAddress, Fr, type Logger, type TxHash } from '@aztec/aztec.js';
|
|
2
|
+
import { DocsExampleContract } from '@aztec/noir-contracts.js/DocsExample';
|
|
3
|
+
import { TokenBlacklistContract } from '@aztec/noir-contracts.js/TokenBlacklist';
|
|
4
|
+
import { type SubsystemsContext } from '../fixtures/snapshot_manager.js';
|
|
5
|
+
import { TokenSimulator } from '../simulators/token_simulator.js';
|
|
6
|
+
export declare class Role {
|
|
7
|
+
private isAdmin;
|
|
8
|
+
private isMinter;
|
|
9
|
+
private isBlacklisted;
|
|
10
|
+
withAdmin(): this;
|
|
11
|
+
withMinter(): this;
|
|
12
|
+
withBlacklisted(): this;
|
|
13
|
+
toNoirStruct(): {
|
|
14
|
+
is_admin: boolean;
|
|
15
|
+
is_minter: boolean;
|
|
16
|
+
is_blacklisted: boolean;
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
export declare class BlacklistTokenContractTest {
|
|
20
|
+
#private;
|
|
21
|
+
static DELAY: number;
|
|
22
|
+
private snapshotManager;
|
|
23
|
+
logger: Logger;
|
|
24
|
+
wallets: AccountWallet[];
|
|
25
|
+
accounts: CompleteAddress[];
|
|
26
|
+
asset: TokenBlacklistContract;
|
|
27
|
+
tokenSim: TokenSimulator;
|
|
28
|
+
badAccount: DocsExampleContract;
|
|
29
|
+
admin: AccountWallet;
|
|
30
|
+
other: AccountWallet;
|
|
31
|
+
blacklisted: AccountWallet;
|
|
32
|
+
constructor(testName: string);
|
|
33
|
+
mineBlocks(amount?: number): Promise<void>;
|
|
34
|
+
/**
|
|
35
|
+
* Adds two state shifts to snapshot manager.
|
|
36
|
+
* 1. Add 3 accounts.
|
|
37
|
+
* 2. Publicly deploy accounts, deploy token contract and a "bad account".
|
|
38
|
+
*/
|
|
39
|
+
applyBaseSnapshots(): Promise<void>;
|
|
40
|
+
setup(): Promise<void>;
|
|
41
|
+
snapshot: <T>(name: string, apply: (context: SubsystemsContext) => Promise<T>, restore?: (snapshotData: T, context: SubsystemsContext) => Promise<void>) => Promise<void>;
|
|
42
|
+
teardown(): Promise<void>;
|
|
43
|
+
addPendingShieldNoteToPXE(contract: TokenBlacklistContract, wallet: AccountWallet, amount: bigint, secretHash: Fr, txHash: TxHash): Promise<void>;
|
|
44
|
+
applyMintSnapshot(): Promise<void>;
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=blacklist_token_contract_test.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"blacklist_token_contract_test.d.ts","sourceRoot":"","sources":["../../src/e2e_blacklist_token_contract/blacklist_token_contract_test.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,aAAa,EAClB,KAAK,eAAe,EACpB,EAAE,EACF,KAAK,MAAM,EACX,KAAK,MAAM,EAGZ,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAE,mBAAmB,EAAE,MAAM,sCAAsC,CAAC;AAE3E,OAAO,EAAE,sBAAsB,EAAE,MAAM,yCAAyC,CAAC;AAIjF,OAAO,EAEL,KAAK,iBAAiB,EAIvB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAIlE,qBAAa,IAAI;IACf,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,aAAa,CAAS;IAE9B,SAAS;IAKT,UAAU;IAKV,eAAe;IAKf,YAAY;;;;;CAKb;AAED,qBAAa,0BAA0B;;IAGrC,MAAM,CAAC,KAAK,SAAK;IAEjB,OAAO,CAAC,eAAe,CAAmB;IAC1C,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,aAAa,EAAE,CAAM;IAC9B,QAAQ,EAAE,eAAe,EAAE,CAAM;IACjC,KAAK,EAAG,sBAAsB,CAAC;IAC/B,QAAQ,EAAG,cAAc,CAAC;IAC1B,UAAU,EAAG,mBAAmB,CAAC;IAEjC,KAAK,EAAG,aAAa,CAAC;IACtB,KAAK,EAAG,aAAa,CAAC;IACtB,WAAW,EAAG,aAAa,CAAC;gBAEhB,QAAQ,EAAE,MAAM;IAKtB,UAAU,CAAC,MAAM,GAAE,MAAyC;IAMlE;;;;OAIG;IACG,kBAAkB;IA0DlB,KAAK;IAIX,QAAQ,YACA,MAAM,SACL,CAAC,OAAO,EAAE,iBAAiB,KAAK,QAAQ,CAAC,CAAC,YACxC,CAAC,YAAY,EAAE,CAAC,EAAE,OAAO,EAAE,iBAAiB,KAAK,QAAQ,IAAI,CAAC,KACtE,QAAQ,IAAI,CAAC,CAAwD;IAElE,QAAQ;IAQR,yBAAyB,CAC7B,QAAQ,EAAE,sBAAsB,EAChC,MAAM,EAAE,aAAa,EACrB,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,EAAE,EACd,MAAM,EAAE,MAAM;IAgBV,iBAAiB;CAmExB"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { getSchnorrWallet } from '@aztec/accounts/schnorr';
|
|
2
|
+
import { Fr, computeSecretHash, createLogger } from '@aztec/aztec.js';
|
|
3
|
+
import { MAX_NOTE_HASHES_PER_TX } from '@aztec/constants';
|
|
3
4
|
import { DocsExampleContract } from '@aztec/noir-contracts.js/DocsExample';
|
|
4
5
|
import { TokenBlacklistContract } from '@aztec/noir-contracts.js/TokenBlacklist';
|
|
5
6
|
import { jest } from '@jest/globals';
|
|
6
|
-
import {
|
|
7
|
+
import { createSnapshotManager, deployAccounts, publicDeployAccounts } from '../fixtures/snapshot_manager.js';
|
|
7
8
|
import { TokenSimulator } from '../simulators/token_simulator.js';
|
|
8
9
|
const { E2E_DATA_PATH: dataPath } = process.env;
|
|
9
10
|
export class Role {
|
|
@@ -62,11 +63,8 @@ export class BlacklistTokenContractTest {
|
|
|
62
63
|
*/ async applyBaseSnapshots() {
|
|
63
64
|
// Adding a timeout of 2 minutes in here such that it is propagated to the underlying tests
|
|
64
65
|
jest.setTimeout(120_000);
|
|
65
|
-
await this.snapshotManager.snapshot('3_accounts',
|
|
66
|
-
this.wallets = await Promise.all(
|
|
67
|
-
const account = await getSchnorrAccount(pxe, ak[0], ak[1], 1);
|
|
68
|
-
return account.getWallet();
|
|
69
|
-
}));
|
|
66
|
+
await this.snapshotManager.snapshot('3_accounts', deployAccounts(3, this.logger), async ({ deployedAccounts }, { pxe })=>{
|
|
67
|
+
this.wallets = await Promise.all(deployedAccounts.map((a)=>getSchnorrWallet(pxe, a.address, a.signingKey)));
|
|
70
68
|
this.admin = this.wallets[0];
|
|
71
69
|
this.other = this.wallets[1];
|
|
72
70
|
this.blacklisted = this.wallets[2];
|
|
@@ -105,17 +103,19 @@ export class BlacklistTokenContractTest {
|
|
|
105
103
|
async teardown() {
|
|
106
104
|
await this.snapshotManager.teardown();
|
|
107
105
|
}
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
106
|
+
#toBoundedVec(arr, maxLen) {
|
|
107
|
+
return {
|
|
108
|
+
len: arr.length,
|
|
109
|
+
storage: arr.concat(new Array(maxLen - arr.length).fill(new Fr(0)))
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
async addPendingShieldNoteToPXE(contract, wallet, amount, secretHash, txHash) {
|
|
113
|
+
const txEffects = await wallet.getTxEffect(txHash);
|
|
114
|
+
await contract.methods.deliver_transparent_note(contract.address, amount, secretHash, txHash.hash, this.#toBoundedVec(txEffects.data.noteHashes, MAX_NOTE_HASHES_PER_TX), txEffects.data.nullifiers[0], wallet.getAddress()).simulate();
|
|
115
115
|
}
|
|
116
116
|
async applyMintSnapshot() {
|
|
117
117
|
await this.snapshotManager.snapshot('mint', async ()=>{
|
|
118
|
-
const { asset, accounts } = this;
|
|
118
|
+
const { asset, accounts, wallets } = this;
|
|
119
119
|
const amount = 10000n;
|
|
120
120
|
const adminMinterRole = new Role().withAdmin().withMinter();
|
|
121
121
|
await this.asset.withWallet(this.admin).methods.update_roles(this.admin.getAddress(), adminMinterRole.toNoirStruct()).send().wait();
|
|
@@ -129,7 +129,7 @@ export class BlacklistTokenContractTest {
|
|
|
129
129
|
const secret = Fr.random();
|
|
130
130
|
const secretHash = await computeSecretHash(secret);
|
|
131
131
|
const receipt = await asset.methods.mint_private(amount, secretHash).send().wait();
|
|
132
|
-
await this.addPendingShieldNoteToPXE(0, amount, secretHash, receipt.txHash);
|
|
132
|
+
await this.addPendingShieldNoteToPXE(asset, wallets[0], amount, secretHash, receipt.txHash);
|
|
133
133
|
const txClaim = asset.methods.redeem_shield(accounts[0].address, amount, secret).send();
|
|
134
134
|
await txClaim.wait({
|
|
135
135
|
debug: true
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { AztecNodeConfig } from '@aztec/aztec-node';
|
|
2
|
+
import { type AccountWallet, AztecAddress, type AztecNode, CheatCodes, type CompleteAddress, EthAddress, type Logger, type PXE } from '@aztec/aztec.js';
|
|
3
|
+
import { type ViemPublicClient } from '@aztec/ethereum';
|
|
4
|
+
import { TokenContract } from '@aztec/noir-contracts.js/Token';
|
|
5
|
+
import { TokenBridgeContract } from '@aztec/noir-contracts.js/TokenBridge';
|
|
6
|
+
import { type SubsystemsContext } from '../fixtures/snapshot_manager.js';
|
|
7
|
+
import { CrossChainTestHarness } from '../shared/cross_chain_test_harness.js';
|
|
8
|
+
export declare class CrossChainMessagingTest {
|
|
9
|
+
private snapshotManager;
|
|
10
|
+
logger: Logger;
|
|
11
|
+
wallets: AccountWallet[];
|
|
12
|
+
accounts: CompleteAddress[];
|
|
13
|
+
aztecNode: AztecNode;
|
|
14
|
+
pxe: PXE;
|
|
15
|
+
aztecNodeConfig: AztecNodeConfig;
|
|
16
|
+
publicClient: ViemPublicClient | undefined;
|
|
17
|
+
user1Wallet: AccountWallet;
|
|
18
|
+
user2Wallet: AccountWallet;
|
|
19
|
+
crossChainTestHarness: CrossChainTestHarness;
|
|
20
|
+
ethAccount: EthAddress;
|
|
21
|
+
ownerAddress: AztecAddress;
|
|
22
|
+
l2Token: TokenContract;
|
|
23
|
+
l2Bridge: TokenBridgeContract;
|
|
24
|
+
rollup: any;
|
|
25
|
+
inbox: any;
|
|
26
|
+
outbox: any;
|
|
27
|
+
cheatcodes: CheatCodes;
|
|
28
|
+
constructor(testName: string);
|
|
29
|
+
assumeProven(): Promise<void>;
|
|
30
|
+
setup(): Promise<void>;
|
|
31
|
+
snapshot: <T>(name: string, apply: (context: SubsystemsContext) => Promise<T>, restore?: (snapshotData: T, context: SubsystemsContext) => Promise<void>) => Promise<void>;
|
|
32
|
+
teardown(): Promise<void>;
|
|
33
|
+
applyBaseSnapshots(): Promise<void>;
|
|
34
|
+
toCrossChainContext(): CrossChainContext;
|
|
35
|
+
}
|
|
36
|
+
type CrossChainContext = {
|
|
37
|
+
l2Token: AztecAddress;
|
|
38
|
+
l2Bridge: AztecAddress;
|
|
39
|
+
tokenPortal: EthAddress;
|
|
40
|
+
underlying: EthAddress;
|
|
41
|
+
ethAccount: EthAddress;
|
|
42
|
+
ownerAddress: AztecAddress;
|
|
43
|
+
inbox: EthAddress;
|
|
44
|
+
outbox: EthAddress;
|
|
45
|
+
};
|
|
46
|
+
export {};
|
|
47
|
+
//# sourceMappingURL=cross_chain_messaging_test.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cross_chain_messaging_test.d.ts","sourceRoot":"","sources":["../../src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,EACL,KAAK,aAAa,EAClB,YAAY,EACZ,KAAK,SAAS,EACd,UAAU,EACV,KAAK,eAAe,EACpB,UAAU,EACV,KAAK,MAAM,EACX,KAAK,GAAG,EAET,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,KAAK,gBAAgB,EAAqC,MAAM,iBAAiB,CAAC;AAE3F,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAC/D,OAAO,EAAE,mBAAmB,EAAE,MAAM,sCAAsC,CAAC;AAK3E,OAAO,EAEL,KAAK,iBAAiB,EAIvB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,qBAAqB,EAAE,MA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CAAC;CACpB,CAAC"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { AztecAddress, EthAddress, createLogger } from '@aztec/aztec.js';
|
|
3
|
-
import { createL1Clients } from '@aztec/ethereum';
|
|
4
|
-
import { InboxAbi, OutboxAbi, RollupAbi } from '@aztec/l1-artifacts';
|
|
1
|
+
import { getSchnorrWallet } from '@aztec/accounts/schnorr';
|
|
2
|
+
import { AztecAddress, CheatCodes, EthAddress, createLogger } from '@aztec/aztec.js';
|
|
3
|
+
import { createL1Clients, deployL1Contract } from '@aztec/ethereum';
|
|
4
|
+
import { InboxAbi, OutboxAbi, RollupAbi, TestERC20Abi, TestERC20Bytecode } from '@aztec/l1-artifacts';
|
|
5
5
|
import { TokenContract } from '@aztec/noir-contracts.js/Token';
|
|
6
6
|
import { TokenBridgeContract } from '@aztec/noir-contracts.js/TokenBridge';
|
|
7
7
|
import { getContract } from 'viem';
|
|
8
8
|
import { MNEMONIC } from '../fixtures/fixtures.js';
|
|
9
|
-
import {
|
|
9
|
+
import { createSnapshotManager, deployAccounts, publicDeployAccounts } from '../fixtures/snapshot_manager.js';
|
|
10
10
|
import { CrossChainTestHarness } from '../shared/cross_chain_test_harness.js';
|
|
11
11
|
const { E2E_DATA_PATH: dataPath } = process.env;
|
|
12
12
|
export class CrossChainMessagingTest {
|
|
@@ -28,20 +28,20 @@ export class CrossChainMessagingTest {
|
|
|
28
28
|
rollup;
|
|
29
29
|
inbox;
|
|
30
30
|
outbox;
|
|
31
|
+
cheatcodes;
|
|
31
32
|
constructor(testName){
|
|
32
33
|
this.logger = createLogger(`e2e:e2e_cross_chain_messaging:${testName}`);
|
|
33
34
|
this.snapshotManager = createSnapshotManager(`e2e_cross_chain_messaging/${testName}`, dataPath);
|
|
34
35
|
}
|
|
35
36
|
async assumeProven() {
|
|
36
|
-
await this.rollup.
|
|
37
|
-
await this.rollup.read.getPendingBlockNumber()
|
|
38
|
-
]);
|
|
37
|
+
await this.cheatcodes.rollup.markAsProven(await this.rollup.read.getPendingBlockNumber());
|
|
39
38
|
}
|
|
40
39
|
async setup() {
|
|
41
40
|
const { aztecNode, pxe, aztecNodeConfig } = await this.snapshotManager.setup();
|
|
42
41
|
this.aztecNode = aztecNode;
|
|
43
42
|
this.pxe = pxe;
|
|
44
43
|
this.aztecNodeConfig = aztecNodeConfig;
|
|
44
|
+
this.cheatcodes = await CheatCodes.create(this.aztecNodeConfig.l1RpcUrls, this.pxe);
|
|
45
45
|
}
|
|
46
46
|
snapshot = (name, apply, restore = ()=>Promise.resolve())=>this.snapshotManager.snapshot(name, apply, restore);
|
|
47
47
|
async teardown() {
|
|
@@ -50,11 +50,8 @@ export class CrossChainMessagingTest {
|
|
|
50
50
|
async applyBaseSnapshots() {
|
|
51
51
|
// Note that we are using the same `pxe`, `aztecNodeConfig` and `aztecNode` across all snapshots.
|
|
52
52
|
// This is to not have issues with different networks.
|
|
53
|
-
await this.snapshotManager.snapshot('3_accounts',
|
|
54
|
-
this.wallets = await Promise.all(
|
|
55
|
-
const account = await getSchnorrAccount(pxe, ak[0], ak[1], 1);
|
|
56
|
-
return account.getWallet();
|
|
57
|
-
}));
|
|
53
|
+
await this.snapshotManager.snapshot('3_accounts', deployAccounts(3, this.logger), async ({ deployedAccounts }, { pxe, aztecNodeConfig, aztecNode, deployL1ContractsValues })=>{
|
|
54
|
+
this.wallets = await Promise.all(deployedAccounts.map((a)=>getSchnorrWallet(pxe, a.address, a.signingKey)));
|
|
58
55
|
this.accounts = this.wallets.map((w)=>w.getCompleteAddress());
|
|
59
56
|
this.wallets.forEach((w, i)=>this.logger.verbose(`Wallet ${i} address: ${w.getAddress()}`));
|
|
60
57
|
this.rollup = getContract({
|
|
@@ -73,9 +70,23 @@ export class CrossChainMessagingTest {
|
|
|
73
70
|
// Move this account thing to addAccounts above?
|
|
74
71
|
this.logger.verbose(`Public deploy accounts...`);
|
|
75
72
|
await publicDeployAccounts(this.wallets[0], this.accounts.slice(0, 3));
|
|
76
|
-
const { publicClient, walletClient } = createL1Clients(this.aztecNodeConfig.
|
|
73
|
+
const { publicClient, walletClient } = createL1Clients(this.aztecNodeConfig.l1RpcUrls, MNEMONIC);
|
|
74
|
+
const underlyingERC20Address = await deployL1Contract(walletClient, publicClient, TestERC20Abi, TestERC20Bytecode, [
|
|
75
|
+
'Underlying',
|
|
76
|
+
'UND',
|
|
77
|
+
walletClient.account.address
|
|
78
|
+
]).then(({ address })=>address);
|
|
79
|
+
const underlyingERC20 = getContract({
|
|
80
|
+
address: underlyingERC20Address.toString(),
|
|
81
|
+
abi: TestERC20Abi,
|
|
82
|
+
client: walletClient
|
|
83
|
+
});
|
|
84
|
+
// allow anyone to mint
|
|
85
|
+
await underlyingERC20.write.setFreeForAll([
|
|
86
|
+
true
|
|
87
|
+
], {});
|
|
77
88
|
this.logger.verbose(`Setting up cross chain harness...`);
|
|
78
|
-
this.crossChainTestHarness = await CrossChainTestHarness.new(this.aztecNode, this.pxe, publicClient, walletClient, this.wallets[0], this.logger);
|
|
89
|
+
this.crossChainTestHarness = await CrossChainTestHarness.new(this.aztecNode, this.pxe, publicClient, walletClient, this.wallets[0], this.logger, underlyingERC20Address);
|
|
79
90
|
this.logger.verbose(`L2 token deployed to: ${this.crossChainTestHarness.l2Token.address}`);
|
|
80
91
|
return this.toCrossChainContext();
|
|
81
92
|
}, async (crossChainContext)=>{
|
|
@@ -85,7 +96,7 @@ export class CrossChainMessagingTest {
|
|
|
85
96
|
this.ethAccount = EthAddress.fromString(crossChainContext.ethAccount.toString());
|
|
86
97
|
this.ownerAddress = AztecAddress.fromString(crossChainContext.ownerAddress.toString());
|
|
87
98
|
const tokenPortalAddress = EthAddress.fromString(crossChainContext.tokenPortal.toString());
|
|
88
|
-
const { publicClient, walletClient } = createL1Clients(this.aztecNodeConfig.
|
|
99
|
+
const { publicClient, walletClient } = createL1Clients(this.aztecNodeConfig.l1RpcUrls, MNEMONIC);
|
|
89
100
|
const inbox = getContract({
|
|
90
101
|
address: this.aztecNodeConfig.l1Contracts.inboxAddress.toString(),
|
|
91
102
|
abi: InboxAbi,
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { type AccountWallet, type AztecAddress, type AztecNode, type ContractArtifact, type ContractBase, Fr, type Logger, type PXE, type PublicKeys, type Wallet } from '@aztec/aztec.js';
|
|
2
|
+
import type { StatefulTestContract } from '@aztec/noir-contracts.js/StatefulTest';
|
|
3
|
+
export declare class DeployTest {
|
|
4
|
+
private snapshotManager;
|
|
5
|
+
private wallets;
|
|
6
|
+
logger: Logger;
|
|
7
|
+
pxe: PXE;
|
|
8
|
+
wallet: AccountWallet;
|
|
9
|
+
aztecNode: AztecNode;
|
|
10
|
+
constructor(testName: string);
|
|
11
|
+
setup(): Promise<this>;
|
|
12
|
+
teardown(): Promise<void>;
|
|
13
|
+
private applyInitialAccountSnapshot;
|
|
14
|
+
registerContract<T extends ContractBase>(wallet: Wallet, contractArtifact: ContractArtifactClass<T>, opts?: {
|
|
15
|
+
salt?: Fr;
|
|
16
|
+
publicKeys?: PublicKeys;
|
|
17
|
+
initArgs?: any[];
|
|
18
|
+
constructorName?: string;
|
|
19
|
+
deployer?: AztecAddress;
|
|
20
|
+
}): Promise<T>;
|
|
21
|
+
registerRandomAccount(): Promise<AztecAddress>;
|
|
22
|
+
}
|
|
23
|
+
export type StatefulContractCtorArgs = Parameters<StatefulTestContract['methods']['constructor']>;
|
|
24
|
+
export type ContractArtifactClass<T extends ContractBase> = {
|
|
25
|
+
at(address: AztecAddress, wallet: Wallet): Promise<T>;
|
|
26
|
+
artifact: ContractArtifact;
|
|
27
|
+
};
|
|
28
|
+
//# sourceMappingURL=deploy_test.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deploy_test.d.ts","sourceRoot":"","sources":["../../src/e2e_deploy_contract/deploy_test.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,aAAa,EAClB,KAAK,YAAY,EACjB,KAAK,SAAS,EACd,KAAK,gB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rWallet } from '@aztec/accounts/schnorr';
|
|
2
2
|
import { Fr, createLogger, getContractInstanceFromDeployParams } from '@aztec/aztec.js';
|
|
3
|
-
import {
|
|
3
|
+
import { createSnapshotManager, deployAccounts } from '../fixtures/snapshot_manager.js';
|
|
4
4
|
const { E2E_DATA_PATH: dataPath } = process.env;
|
|
5
5
|
export class DeployTest {
|
|
6
6
|
snapshotManager;
|
|
@@ -23,11 +23,8 @@ export class DeployTest {
|
|
|
23
23
|
await this.snapshotManager.teardown();
|
|
24
24
|
}
|
|
25
25
|
async applyInitialAccountSnapshot() {
|
|
26
|
-
await this.snapshotManager.snapshot('initial_account',
|
|
27
|
-
this.wallets = await Promise.all(
|
|
28
|
-
const account = await getSchnorrAccount(pxe, ak[0], ak[1], 1);
|
|
29
|
-
return account.getWallet();
|
|
30
|
-
}));
|
|
26
|
+
await this.snapshotManager.snapshot('initial_account', deployAccounts(1, this.logger), async ({ deployedAccounts }, { pxe })=>{
|
|
27
|
+
this.wallets = await Promise.all(deployedAccounts.map((a)=>getSchnorrWallet(pxe, a.address, a.signingKey)));
|
|
31
28
|
this.wallets.forEach((w, i)=>this.logger.verbose(`Wallet ${i} address: ${w.getAddress()}`));
|
|
32
29
|
this.wallet = this.wallets[0];
|
|
33
30
|
});
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { AztecNodeService } from '@aztec/aztec-node';
|
|
2
|
+
import { type Logger } from '@aztec/aztec.js';
|
|
3
|
+
import { ChainMonitor } from '@aztec/aztec.js/ethereum';
|
|
4
|
+
import { RollupContract } from '@aztec/ethereum/contracts';
|
|
5
|
+
import { type Delayer } from '@aztec/ethereum/test';
|
|
6
|
+
import { ProverNode } from '@aztec/prover-node';
|
|
7
|
+
import type { L2BlockNumber } from '@aztec/stdlib/block';
|
|
8
|
+
import type { L1RollupConstants } from '@aztec/stdlib/epoch-helpers';
|
|
9
|
+
import type { PublicClient } from 'viem';
|
|
10
|
+
import { type EndToEndContext, type SetupOptions } from '../fixtures/utils.js';
|
|
11
|
+
export declare const L1_BLOCK_TIME_IN_S: number;
|
|
12
|
+
export declare const EPOCH_DURATION_IN_L2_SLOTS = 4;
|
|
13
|
+
export declare const L2_SLOT_DURATION_IN_L1_SLOTS = 2;
|
|
14
|
+
export declare const WORLD_STATE_BLOCK_HISTORY = 2;
|
|
15
|
+
export declare const WORLD_STATE_BLOCK_CHECK_INTERVAL = 50;
|
|
16
|
+
export declare const ARCHIVER_POLL_INTERVAL = 50;
|
|
17
|
+
export type EpochsTestOpts = Partial<Pick<SetupOptions, 'startProverNode'>>;
|
|
18
|
+
/**
|
|
19
|
+
* Tests building of epochs using fast block times and short epochs.
|
|
20
|
+
* Spawns an aztec node and a prover node with fake proofs.
|
|
21
|
+
* Sequencer is allowed to build empty blocks.
|
|
22
|
+
*/
|
|
23
|
+
export declare class EpochsTestContext {
|
|
24
|
+
context: EndToEndContext;
|
|
25
|
+
l1Client: PublicClient;
|
|
26
|
+
rollup: RollupContract;
|
|
27
|
+
constants: L1RollupConstants;
|
|
28
|
+
logger: Logger;
|
|
29
|
+
monitor: ChainMonitor;
|
|
30
|
+
proverDelayer: Delayer;
|
|
31
|
+
sequencerDelayer: Delayer;
|
|
32
|
+
proverNodes: ProverNode[];
|
|
33
|
+
nodes: AztecNodeService[];
|
|
34
|
+
static setup(opts?: EpochsTestOpts): Promise<EpochsTestContext>;
|
|
35
|
+
setup(opts?: EpochsTestOpts): Promise<void>;
|
|
36
|
+
teardown(): Promise<void>;
|
|
37
|
+
createProverNode(): Promise<ProverNode>;
|
|
38
|
+
createNonValidatorNode(): Promise<AztecNodeService>;
|
|
39
|
+
private getNextPrivateKey;
|
|
40
|
+
/** Waits until the epoch begins (ie until the immediately previous L1 block is mined). */
|
|
41
|
+
waitUntilEpochStarts(epoch: number): Promise<bigint>;
|
|
42
|
+
/** Waits until the given L2 block number is mined. */
|
|
43
|
+
waitUntilL2BlockNumber(target: number, timeout?: number): Promise<void>;
|
|
44
|
+
/** Waits until the given L2 block number is marked as proven. */
|
|
45
|
+
waitUntilProvenL2BlockNumber(t: number, timeout?: number): Promise<void>;
|
|
46
|
+
/** Waits for the aztec node to sync to the target block number. */
|
|
47
|
+
waitForNodeToSync(blockNumber: number, type: 'finalised' | 'historic'): Promise<void>;
|
|
48
|
+
/** Verifies whether the given block number is found on the aztec node. */
|
|
49
|
+
verifyHistoricBlock(blockNumber: L2BlockNumber, expectedSuccess: boolean): Promise<void>;
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=epochs_test.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"epochs_test.d.ts","sourceRoot":"","sources":["../../src/e2e_epochs/epochs_test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAM,KAAK,MAAM,EAAgD,MAAM,iBAAiB,CAAC;AAChG,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAkB,KAAK,OAAO,EAAwB,MAAM,sBAAsB,CAAC;AAG1F,OAAO,EAAE,UAAU,EAAuB,MAAM,oBAAoB,CAAC;AAIrE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAIrE,OAAO,KAAK,EAAO,YAAY,EAAE,MAAM,MAAM,CAAC;AAE9C,OAAO,EACL,KAAK,eAAe,EACpB,KAAK,YAAY,EAIlB,MAAM,sBAAsB,CAAC;AAG9B,eAAO,MAAM,kBAAkB,QAAsE,CAAC;AACtG,eAAO,MAAM,0BAA0B,IAAI,CAAC;AAC5C,eAAO,MAAM,4BAA4B,IAAI,CAAC;AAC9C,eAAO,MAAM,yBAAyB,IAAI,CAAC;AAC3C,eAAO,MAAM,gCAAgC,KAAK,CAAC;AACnD,eAAO,MAAM,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