@aztec/end-to-end 0.0.0-test.1 → 0.0.1-fake-c83136db25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dest/bench/client_flows/benchmark.d.ts +61 -0
- package/dest/bench/client_flows/benchmark.d.ts.map +1 -0
- package/dest/bench/client_flows/benchmark.js +261 -0
- package/dest/bench/client_flows/client_flows_benchmark.d.ts +73 -0
- package/dest/bench/client_flows/client_flows_benchmark.d.ts.map +1 -0
- package/dest/bench/client_flows/client_flows_benchmark.js +311 -0
- package/dest/bench/client_flows/config.d.ts +14 -0
- package/dest/bench/client_flows/config.d.ts.map +1 -0
- package/dest/bench/client_flows/config.js +106 -0
- package/dest/bench/client_flows/data_extractor.d.ts +2 -0
- package/dest/bench/client_flows/data_extractor.d.ts.map +1 -0
- package/dest/bench/client_flows/data_extractor.js +99 -0
- package/dest/bench/utils.d.ts +10 -36
- package/dest/bench/utils.d.ts.map +1 -1
- package/dest/bench/utils.js +26 -66
- package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts +20 -12
- package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts.map +1 -1
- package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.js +85 -57
- package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts +18 -24
- package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts.map +1 -1
- package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.js +48 -69
- package/dest/e2e_deploy_contract/deploy_test.d.ts +14 -6
- package/dest/e2e_deploy_contract/deploy_test.d.ts.map +1 -1
- package/dest/e2e_deploy_contract/deploy_test.js +13 -19
- package/dest/e2e_epochs/epochs_test.d.ts +58 -17
- package/dest/e2e_epochs/epochs_test.d.ts.map +1 -1
- package/dest/e2e_epochs/epochs_test.js +224 -43
- package/dest/e2e_fees/bridging_race.notest.d.ts +2 -0
- package/dest/e2e_fees/bridging_race.notest.d.ts.map +1 -0
- package/dest/e2e_fees/bridging_race.notest.js +63 -0
- package/dest/e2e_fees/fees_test.d.ts +20 -9
- package/dest/e2e_fees/fees_test.d.ts.map +1 -1
- package/dest/e2e_fees/fees_test.js +98 -107
- package/dest/e2e_l1_publisher/write_json.d.ts +10 -0
- package/dest/e2e_l1_publisher/write_json.d.ts.map +1 -0
- package/dest/e2e_l1_publisher/write_json.js +57 -0
- package/dest/e2e_multi_validator/utils.d.ts +12 -0
- package/dest/e2e_multi_validator/utils.d.ts.map +1 -0
- package/dest/e2e_multi_validator/utils.js +214 -0
- package/dest/e2e_nested_contract/nested_contract_test.d.ts +9 -6
- package/dest/e2e_nested_contract/nested_contract_test.d.ts.map +1 -1
- package/dest/e2e_nested_contract/nested_contract_test.js +22 -19
- package/dest/e2e_p2p/inactivity_slash_test.d.ts +31 -0
- package/dest/e2e_p2p/inactivity_slash_test.d.ts.map +1 -0
- package/dest/e2e_p2p/inactivity_slash_test.js +135 -0
- package/dest/e2e_p2p/p2p_network.d.ts +69 -22
- package/dest/e2e_p2p/p2p_network.d.ts.map +1 -1
- package/dest/e2e_p2p/p2p_network.js +180 -129
- package/dest/e2e_p2p/shared.d.ts +41 -5
- package/dest/e2e_p2p/shared.d.ts.map +1 -1
- package/dest/e2e_p2p/shared.js +163 -19
- package/dest/e2e_token_contract/token_contract_test.d.ts +11 -5
- package/dest/e2e_token_contract/token_contract_test.d.ts.map +1 -1
- package/dest/e2e_token_contract/token_contract_test.js +50 -26
- package/dest/{e2e_prover → fixtures}/e2e_prover_test.d.ts +14 -9
- package/dest/fixtures/e2e_prover_test.d.ts.map +1 -0
- package/dest/{e2e_prover → fixtures}/e2e_prover_test.js +95 -100
- package/dest/fixtures/fixtures.d.ts +5 -6
- package/dest/fixtures/fixtures.d.ts.map +1 -1
- package/dest/fixtures/fixtures.js +4 -3
- package/dest/fixtures/get_acvm_config.d.ts +1 -1
- package/dest/fixtures/get_acvm_config.d.ts.map +1 -1
- package/dest/fixtures/get_acvm_config.js +2 -14
- package/dest/fixtures/get_bb_config.d.ts +1 -1
- package/dest/fixtures/get_bb_config.d.ts.map +1 -1
- package/dest/fixtures/get_bb_config.js +10 -17
- package/dest/fixtures/l1_to_l2_messaging.d.ts +8 -5
- package/dest/fixtures/l1_to_l2_messaging.d.ts.map +1 -1
- package/dest/fixtures/l1_to_l2_messaging.js +44 -18
- package/dest/fixtures/setup_l1_contracts.d.ts +3 -3
- package/dest/fixtures/setup_l1_contracts.d.ts.map +1 -1
- package/dest/fixtures/setup_l1_contracts.js +4 -4
- package/dest/fixtures/setup_p2p_test.d.ts +14 -13
- package/dest/fixtures/setup_p2p_test.d.ts.map +1 -1
- package/dest/fixtures/setup_p2p_test.js +73 -21
- package/dest/fixtures/snapshot_manager.d.ts +15 -7
- package/dest/fixtures/snapshot_manager.d.ts.map +1 -1
- package/dest/fixtures/snapshot_manager.js +147 -121
- package/dest/fixtures/token_utils.d.ts +6 -3
- package/dest/fixtures/token_utils.d.ts.map +1 -1
- package/dest/fixtures/token_utils.js +23 -10
- package/dest/fixtures/utils.d.ts +76 -37
- package/dest/fixtures/utils.d.ts.map +1 -1
- package/dest/fixtures/utils.js +464 -368
- package/dest/fixtures/web3signer.d.ts +5 -0
- package/dest/fixtures/web3signer.d.ts.map +1 -0
- package/dest/fixtures/web3signer.js +53 -0
- package/dest/quality_of_service/alert_checker.d.ts +1 -1
- package/dest/quality_of_service/alert_checker.d.ts.map +1 -1
- package/dest/shared/cross_chain_test_harness.d.ts +41 -25
- package/dest/shared/cross_chain_test_harness.d.ts.map +1 -1
- package/dest/shared/cross_chain_test_harness.js +104 -50
- package/dest/shared/gas_portal_test_harness.d.ts +32 -24
- package/dest/shared/gas_portal_test_harness.d.ts.map +1 -1
- package/dest/shared/gas_portal_test_harness.js +50 -29
- package/dest/shared/jest_setup.js +1 -1
- package/dest/shared/submit-transactions.d.ts +5 -3
- package/dest/shared/submit-transactions.d.ts.map +1 -1
- package/dest/shared/submit-transactions.js +8 -7
- package/dest/shared/uniswap_l1_l2.d.ts +13 -11
- package/dest/shared/uniswap_l1_l2.d.ts.map +1 -1
- package/dest/shared/uniswap_l1_l2.js +138 -108
- package/dest/simulators/lending_simulator.d.ts +6 -6
- package/dest/simulators/lending_simulator.d.ts.map +1 -1
- package/dest/simulators/lending_simulator.js +13 -16
- package/dest/simulators/token_simulator.d.ts +5 -2
- package/dest/simulators/token_simulator.d.ts.map +1 -1
- package/dest/simulators/token_simulator.js +16 -13
- package/dest/spartan/setup_test_wallets.d.ts +23 -10
- package/dest/spartan/setup_test_wallets.d.ts.map +1 -1
- package/dest/spartan/setup_test_wallets.js +167 -58
- package/dest/spartan/utils.d.ts +100 -303
- package/dest/spartan/utils.d.ts.map +1 -1
- package/dest/spartan/utils.js +407 -130
- package/package.json +61 -56
- package/src/bench/client_flows/benchmark.ts +341 -0
- package/src/bench/client_flows/client_flows_benchmark.ts +402 -0
- package/src/bench/client_flows/config.ts +61 -0
- package/src/bench/client_flows/data_extractor.ts +111 -0
- package/src/bench/utils.ts +22 -76
- package/src/e2e_blacklist_token_contract/blacklist_token_contract_test.ts +80 -77
- package/src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts +63 -105
- package/src/e2e_deploy_contract/deploy_test.ts +23 -38
- package/src/e2e_epochs/epochs_test.ts +274 -54
- package/src/e2e_fees/bridging_race.notest.ts +80 -0
- package/src/e2e_fees/fees_test.ts +137 -136
- package/src/e2e_l1_publisher/write_json.ts +76 -0
- package/src/e2e_multi_validator/utils.ts +258 -0
- package/src/e2e_nested_contract/nested_contract_test.ts +27 -18
- package/src/e2e_p2p/inactivity_slash_test.ts +178 -0
- package/src/e2e_p2p/p2p_network.ts +272 -166
- package/src/e2e_p2p/shared.ts +244 -29
- package/src/e2e_token_contract/token_contract_test.ts +43 -39
- package/src/fixtures/dumps/epoch_proof_result.json +1 -1
- package/src/{e2e_prover → fixtures}/e2e_prover_test.ts +101 -145
- package/src/fixtures/fixtures.ts +4 -3
- package/src/fixtures/get_acvm_config.ts +3 -11
- package/src/fixtures/get_bb_config.ts +18 -13
- package/src/fixtures/l1_to_l2_messaging.ts +53 -23
- package/src/fixtures/setup_l1_contracts.ts +6 -7
- package/src/fixtures/setup_p2p_test.ts +112 -38
- package/src/fixtures/snapshot_manager.ts +187 -139
- package/src/fixtures/token_utils.ts +29 -12
- package/src/fixtures/utils.ts +552 -425
- package/src/fixtures/web3signer.ts +63 -0
- package/src/guides/up_quick_start.sh +6 -14
- package/src/quality_of_service/alert_checker.ts +1 -1
- package/src/shared/cross_chain_test_harness.ts +108 -79
- package/src/shared/gas_portal_test_harness.ts +58 -49
- package/src/shared/jest_setup.ts +1 -1
- package/src/shared/submit-transactions.ts +12 -8
- package/src/shared/uniswap_l1_l2.ts +173 -176
- package/src/simulators/lending_simulator.ts +12 -15
- package/src/simulators/token_simulator.ts +21 -13
- package/src/spartan/DEVELOP.md +121 -0
- package/src/spartan/setup_test_wallets.ts +215 -93
- package/src/spartan/utils.ts +458 -130
- package/dest/e2e_prover/e2e_prover_test.d.ts.map +0 -1
- package/dest/sample-dapp/connect.js +0 -12
- package/dest/sample-dapp/contracts.js +0 -10
- package/dest/sample-dapp/deploy.js +0 -35
- package/dest/sample-dapp/index.js +0 -98
- package/src/sample-dapp/connect.mjs +0 -16
- package/src/sample-dapp/contracts.mjs +0 -14
- package/src/sample-dapp/deploy.mjs +0 -40
- package/src/sample-dapp/index.mjs +0 -128
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { InboxAbi, OutboxAbi,
|
|
1
|
+
import { EthAddress } from '@aztec/aztec.js/addresses';
|
|
2
|
+
import { createLogger } from '@aztec/aztec.js/log';
|
|
3
|
+
import { createExtendedL1Client, deployL1Contract } from '@aztec/ethereum';
|
|
4
|
+
import { InboxAbi, OutboxAbi, 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';
|
|
@@ -12,117 +12,96 @@ const { E2E_DATA_PATH: dataPath } = process.env;
|
|
|
12
12
|
export class CrossChainMessagingTest {
|
|
13
13
|
snapshotManager;
|
|
14
14
|
logger;
|
|
15
|
-
wallets = [];
|
|
16
|
-
accounts = [];
|
|
17
15
|
aztecNode;
|
|
18
|
-
pxe;
|
|
19
16
|
aztecNodeConfig;
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
17
|
+
aztecNodeAdmin;
|
|
18
|
+
ctx;
|
|
19
|
+
l1Client;
|
|
20
|
+
wallet;
|
|
21
|
+
ownerAddress;
|
|
22
|
+
user1Address;
|
|
23
|
+
user2Address;
|
|
23
24
|
crossChainTestHarness;
|
|
24
25
|
ethAccount;
|
|
25
|
-
ownerAddress;
|
|
26
26
|
l2Token;
|
|
27
27
|
l2Bridge;
|
|
28
|
-
rollup;
|
|
29
28
|
inbox;
|
|
30
29
|
outbox;
|
|
31
|
-
|
|
32
|
-
|
|
30
|
+
cheatCodes;
|
|
31
|
+
deployL1ContractsValues;
|
|
32
|
+
constructor(testName, opts = {}, deployL1ContractsArgs = {}){
|
|
33
33
|
this.logger = createLogger(`e2e:e2e_cross_chain_messaging:${testName}`);
|
|
34
|
-
this.snapshotManager = createSnapshotManager(`e2e_cross_chain_messaging/${testName}`, dataPath
|
|
34
|
+
this.snapshotManager = createSnapshotManager(`e2e_cross_chain_messaging/${testName}`, dataPath, opts, {
|
|
35
|
+
initialValidators: [],
|
|
36
|
+
...deployL1ContractsArgs
|
|
37
|
+
});
|
|
35
38
|
}
|
|
36
39
|
async assumeProven() {
|
|
37
|
-
await this.
|
|
40
|
+
await this.cheatCodes.rollup.markAsProven();
|
|
38
41
|
}
|
|
39
42
|
async setup() {
|
|
40
|
-
|
|
41
|
-
this.aztecNode = aztecNode;
|
|
42
|
-
this.
|
|
43
|
-
this.aztecNodeConfig = aztecNodeConfig;
|
|
44
|
-
this.
|
|
43
|
+
this.ctx = await this.snapshotManager.setup();
|
|
44
|
+
this.aztecNode = this.ctx.aztecNode;
|
|
45
|
+
this.wallet = this.ctx.wallet;
|
|
46
|
+
this.aztecNodeConfig = this.ctx.aztecNodeConfig;
|
|
47
|
+
this.cheatCodes = this.ctx.cheatCodes;
|
|
48
|
+
this.deployL1ContractsValues = this.ctx.deployL1ContractsValues;
|
|
49
|
+
this.aztecNodeAdmin = this.ctx.aztecNode;
|
|
45
50
|
}
|
|
46
51
|
snapshot = (name, apply, restore = ()=>Promise.resolve())=>this.snapshotManager.snapshot(name, apply, restore);
|
|
47
52
|
async teardown() {
|
|
48
53
|
await this.snapshotManager.teardown();
|
|
49
54
|
}
|
|
50
55
|
async applyBaseSnapshots() {
|
|
51
|
-
// Note that we are using the same `
|
|
56
|
+
// Note that we are using the same `wallet`, `aztecNodeConfig` and `aztecNode` across all snapshots.
|
|
52
57
|
// This is to not have issues with different networks.
|
|
53
|
-
await this.snapshotManager.snapshot('3_accounts', deployAccounts(3, this.logger),
|
|
54
|
-
this.
|
|
55
|
-
this.
|
|
56
|
-
this.wallets.forEach((w, i)=>this.logger.verbose(`Wallet ${i} address: ${w.getAddress()}`));
|
|
57
|
-
this.rollup = getContract({
|
|
58
|
-
address: deployL1ContractsValues.l1ContractAddresses.rollupAddress.toString(),
|
|
59
|
-
abi: RollupAbi,
|
|
60
|
-
client: deployL1ContractsValues.walletClient
|
|
61
|
-
});
|
|
62
|
-
this.user1Wallet = this.wallets[0];
|
|
63
|
-
this.user2Wallet = this.wallets[1];
|
|
64
|
-
this.pxe = pxe;
|
|
58
|
+
await this.snapshotManager.snapshot('3_accounts', deployAccounts(3, this.logger), ({ deployedAccounts }, { wallet, aztecNodeConfig, aztecNode })=>{
|
|
59
|
+
[this.ownerAddress, this.user1Address, this.user2Address] = deployedAccounts.map((a)=>a.address);
|
|
60
|
+
this.wallet = wallet;
|
|
65
61
|
this.aztecNode = aztecNode;
|
|
66
62
|
this.aztecNodeConfig = aztecNodeConfig;
|
|
63
|
+
return Promise.resolve();
|
|
67
64
|
});
|
|
68
65
|
await this.snapshotManager.snapshot('e2e_cross_chain_messaging', async ()=>{
|
|
69
66
|
// Create the token contract state.
|
|
70
67
|
// Move this account thing to addAccounts above?
|
|
71
68
|
this.logger.verbose(`Public deploy accounts...`);
|
|
72
|
-
await publicDeployAccounts(this.
|
|
73
|
-
|
|
74
|
-
|
|
69
|
+
await publicDeployAccounts(this.wallet, [
|
|
70
|
+
this.ownerAddress,
|
|
71
|
+
this.user1Address,
|
|
72
|
+
this.user2Address
|
|
73
|
+
]);
|
|
74
|
+
this.l1Client = createExtendedL1Client(this.aztecNodeConfig.l1RpcUrls, MNEMONIC);
|
|
75
|
+
const underlyingERC20Address = await deployL1Contract(this.l1Client, TestERC20Abi, TestERC20Bytecode, [
|
|
75
76
|
'Underlying',
|
|
76
77
|
'UND',
|
|
77
|
-
|
|
78
|
+
this.l1Client.account.address
|
|
78
79
|
]).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
|
-
], {});
|
|
88
80
|
this.logger.verbose(`Setting up cross chain harness...`);
|
|
89
|
-
this.crossChainTestHarness = await CrossChainTestHarness.new(this.aztecNode, this.
|
|
81
|
+
this.crossChainTestHarness = await CrossChainTestHarness.new(this.aztecNode, this.l1Client, this.wallet, this.ownerAddress, this.logger, underlyingERC20Address);
|
|
90
82
|
this.logger.verbose(`L2 token deployed to: ${this.crossChainTestHarness.l2Token.address}`);
|
|
91
|
-
return this.toCrossChainContext();
|
|
83
|
+
return this.crossChainTestHarness.toCrossChainContext();
|
|
92
84
|
}, async (crossChainContext)=>{
|
|
93
|
-
this.l2Token = await TokenContract.at(crossChainContext.l2Token, this.
|
|
94
|
-
this.l2Bridge = await TokenBridgeContract.at(crossChainContext.l2Bridge, this.
|
|
85
|
+
this.l2Token = await TokenContract.at(crossChainContext.l2Token, this.wallet);
|
|
86
|
+
this.l2Bridge = await TokenBridgeContract.at(crossChainContext.l2Bridge, this.wallet);
|
|
95
87
|
// There is an issue with the reviver so we are getting strings sometimes. Working around it here.
|
|
96
88
|
this.ethAccount = EthAddress.fromString(crossChainContext.ethAccount.toString());
|
|
97
|
-
this.ownerAddress = AztecAddress.fromString(crossChainContext.ownerAddress.toString());
|
|
98
89
|
const tokenPortalAddress = EthAddress.fromString(crossChainContext.tokenPortal.toString());
|
|
99
|
-
const
|
|
90
|
+
const l1Client = createExtendedL1Client(this.aztecNodeConfig.l1RpcUrls, MNEMONIC);
|
|
100
91
|
const inbox = getContract({
|
|
101
92
|
address: this.aztecNodeConfig.l1Contracts.inboxAddress.toString(),
|
|
102
93
|
abi: InboxAbi,
|
|
103
|
-
client:
|
|
94
|
+
client: l1Client
|
|
104
95
|
});
|
|
105
96
|
const outbox = getContract({
|
|
106
97
|
address: this.aztecNodeConfig.l1Contracts.outboxAddress.toString(),
|
|
107
98
|
abi: OutboxAbi,
|
|
108
|
-
client:
|
|
99
|
+
client: l1Client
|
|
109
100
|
});
|
|
110
|
-
this.crossChainTestHarness = new CrossChainTestHarness(this.aztecNode, this.
|
|
111
|
-
this.
|
|
101
|
+
this.crossChainTestHarness = new CrossChainTestHarness(this.aztecNode, this.logger, this.l2Token, this.l2Bridge, this.ethAccount, tokenPortalAddress, crossChainContext.underlying, l1Client, this.aztecNodeConfig.l1Contracts, this.wallet, this.ownerAddress);
|
|
102
|
+
this.l1Client = l1Client;
|
|
112
103
|
this.inbox = inbox;
|
|
113
104
|
this.outbox = outbox;
|
|
114
105
|
});
|
|
115
106
|
}
|
|
116
|
-
toCrossChainContext() {
|
|
117
|
-
return {
|
|
118
|
-
l2Token: this.crossChainTestHarness.l2Token.address,
|
|
119
|
-
l2Bridge: this.crossChainTestHarness.l2Bridge.address,
|
|
120
|
-
tokenPortal: this.crossChainTestHarness.tokenPortalAddress,
|
|
121
|
-
underlying: this.crossChainTestHarness.underlyingERC20Address,
|
|
122
|
-
ethAccount: this.crossChainTestHarness.ethAccount,
|
|
123
|
-
ownerAddress: this.crossChainTestHarness.ownerAddress,
|
|
124
|
-
inbox: this.crossChainTestHarness.l1ContractAddresses.inboxAddress,
|
|
125
|
-
outbox: this.crossChainTestHarness.l1ContractAddresses.outboxAddress
|
|
126
|
-
};
|
|
127
|
-
}
|
|
128
107
|
}
|
|
@@ -1,12 +1,21 @@
|
|
|
1
|
-
import
|
|
2
|
-
import type {
|
|
1
|
+
import type { ContractArtifact } from '@aztec/aztec.js/abi';
|
|
2
|
+
import type { AztecAddress } from '@aztec/aztec.js/addresses';
|
|
3
|
+
import { type ContractBase } from '@aztec/aztec.js/contracts';
|
|
4
|
+
import { Fr } from '@aztec/aztec.js/fields';
|
|
5
|
+
import type { PublicKeys } from '@aztec/aztec.js/keys';
|
|
6
|
+
import { type Logger } from '@aztec/aztec.js/log';
|
|
7
|
+
import type { AztecNode } from '@aztec/aztec.js/node';
|
|
8
|
+
import type { Wallet } from '@aztec/aztec.js/wallet';
|
|
9
|
+
import type { StatefulTestContract } from '@aztec/noir-test-contracts.js/StatefulTest';
|
|
10
|
+
import type { AztecNodeAdmin } from '@aztec/stdlib/interfaces/client';
|
|
11
|
+
import type { TestWallet } from '@aztec/test-wallet/server';
|
|
3
12
|
export declare class DeployTest {
|
|
4
13
|
private snapshotManager;
|
|
5
|
-
private wallets;
|
|
6
14
|
logger: Logger;
|
|
7
|
-
|
|
8
|
-
|
|
15
|
+
wallet: TestWallet;
|
|
16
|
+
defaultAccountAddress: AztecAddress;
|
|
9
17
|
aztecNode: AztecNode;
|
|
18
|
+
aztecNodeAdmin: AztecNodeAdmin;
|
|
10
19
|
constructor(testName: string);
|
|
11
20
|
setup(): Promise<this>;
|
|
12
21
|
teardown(): Promise<void>;
|
|
@@ -18,7 +27,6 @@ export declare class DeployTest {
|
|
|
18
27
|
constructorName?: string;
|
|
19
28
|
deployer?: AztecAddress;
|
|
20
29
|
}): Promise<T>;
|
|
21
|
-
registerRandomAccount(): Promise<AztecAddress>;
|
|
22
30
|
}
|
|
23
31
|
export type StatefulContractCtorArgs = Parameters<StatefulTestContract['methods']['constructor']>;
|
|
24
32
|
export type ContractArtifactClass<T extends ContractBase> = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deploy_test.d.ts","sourceRoot":"","sources":["../../src/e2e_deploy_contract/deploy_test.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"deploy_test.d.ts","sourceRoot":"","sources":["../../src/e2e_deploy_contract/deploy_test.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EAAE,KAAK,YAAY,EAA8C,MAAM,2BAA2B,CAAC;AAC1G,OAAO,EAAE,EAAE,EAAE,MAAM,wBAAwB,CAAC;AAC5C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,KAAK,MAAM,EAAgB,MAAM,qBAAqB,CAAC;AAChE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,4CAA4C,CAAC;AACvF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAM5D,qBAAa,UAAU;IACrB,OAAO,CAAC,eAAe,CAAmB;IACnC,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAG,UAAU,CAAC;IACpB,qBAAqB,EAAG,YAAY,CAAC;IACrC,SAAS,EAAG,SAAS,CAAC;IACtB,cAAc,EAAG,cAAc,CAAC;gBAE3B,QAAQ,EAAE,MAAM;IAKtB,KAAK;IAQL,QAAQ;YAIA,2BAA2B;IAOnC,gBAAgB,CAAC,CAAC,SAAS,YAAY,EAC3C,MAAM,EAAE,MAAM,EACd,gBAAgB,EAAE,qBAAqB,CAAC,CAAC,CAAC,EAC1C,IAAI,GAAE;QACJ,IAAI,CAAC,EAAE,EAAE,CAAC;QACV,UAAU,CAAC,EAAE,UAAU,CAAC;QACxB,QAAQ,CAAC,EAAE,GAAG,EAAE,CAAC;QACjB,eAAe,CAAC,EAAE,MAAM,CAAC;QACzB,QAAQ,CAAC,EAAE,YAAY,CAAC;KACpB,GACL,OAAO,CAAC,CAAC,CAAC;CAYd;AAED,MAAM,MAAM,wBAAwB,GAAG,UAAU,CAAC,oBAAoB,CAAC,SAAS,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC;AAElG,MAAM,MAAM,qBAAqB,CAAC,CAAC,SAAS,YAAY,IAAI;IAC1D,EAAE,CAAC,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;IACtD,QAAQ,EAAE,gBAAgB,CAAC;CAC5B,CAAC"}
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Fr
|
|
1
|
+
import { getContractInstanceFromInstantiationParams } from '@aztec/aztec.js/contracts';
|
|
2
|
+
import { Fr } from '@aztec/aztec.js/fields';
|
|
3
|
+
import { createLogger } from '@aztec/aztec.js/log';
|
|
3
4
|
import { createSnapshotManager, deployAccounts } from '../fixtures/snapshot_manager.js';
|
|
4
5
|
const { E2E_DATA_PATH: dataPath } = process.env;
|
|
5
6
|
export class DeployTest {
|
|
6
7
|
snapshotManager;
|
|
7
|
-
wallets = [];
|
|
8
8
|
logger;
|
|
9
|
-
pxe;
|
|
10
9
|
wallet;
|
|
10
|
+
defaultAccountAddress;
|
|
11
11
|
aztecNode;
|
|
12
|
+
aztecNodeAdmin;
|
|
12
13
|
constructor(testName){
|
|
13
14
|
this.logger = createLogger(`e2e:e2e_deploy_contract:${testName}`);
|
|
14
15
|
this.snapshotManager = createSnapshotManager(`e2e_deploy_contract/${testName}`, dataPath);
|
|
@@ -16,36 +17,29 @@ export class DeployTest {
|
|
|
16
17
|
async setup() {
|
|
17
18
|
await this.applyInitialAccountSnapshot();
|
|
18
19
|
const context = await this.snapshotManager.setup();
|
|
19
|
-
({
|
|
20
|
+
({ aztecNode: this.aztecNode, wallet: this.wallet } = context);
|
|
21
|
+
this.aztecNodeAdmin = context.aztecNode;
|
|
20
22
|
return this;
|
|
21
23
|
}
|
|
22
24
|
async teardown() {
|
|
23
25
|
await this.snapshotManager.teardown();
|
|
24
26
|
}
|
|
25
27
|
async applyInitialAccountSnapshot() {
|
|
26
|
-
await this.snapshotManager.snapshot('initial_account', deployAccounts(1, this.logger),
|
|
27
|
-
this.
|
|
28
|
-
|
|
29
|
-
this.wallet = this.wallets[0];
|
|
28
|
+
await this.snapshotManager.snapshot('initial_account', deployAccounts(1, this.logger), ({ deployedAccounts })=>{
|
|
29
|
+
this.defaultAccountAddress = deployedAccounts[0].address;
|
|
30
|
+
return Promise.resolve();
|
|
30
31
|
});
|
|
31
32
|
}
|
|
32
33
|
async registerContract(wallet, contractArtifact, opts = {}) {
|
|
33
34
|
const { salt, publicKeys, initArgs, constructorName, deployer } = opts;
|
|
34
|
-
const instance = await
|
|
35
|
+
const instance = await getContractInstanceFromInstantiationParams(contractArtifact.artifact, {
|
|
35
36
|
constructorArgs: initArgs ?? [],
|
|
36
37
|
constructorArtifact: constructorName,
|
|
37
|
-
salt,
|
|
38
|
+
salt: salt ?? Fr.random(),
|
|
38
39
|
publicKeys,
|
|
39
40
|
deployer
|
|
40
41
|
});
|
|
41
|
-
await wallet.registerContract(
|
|
42
|
-
artifact: contractArtifact.artifact,
|
|
43
|
-
instance
|
|
44
|
-
});
|
|
42
|
+
await wallet.registerContract(instance, contractArtifact.artifact);
|
|
45
43
|
return contractArtifact.at(instance.address, wallet);
|
|
46
44
|
}
|
|
47
|
-
async registerRandomAccount() {
|
|
48
|
-
const completeAddress = await this.pxe.registerAccount(Fr.random(), Fr.random());
|
|
49
|
-
return completeAddress.address;
|
|
50
|
-
}
|
|
51
45
|
}
|
|
@@ -1,20 +1,31 @@
|
|
|
1
|
-
import { AztecNodeService } from '@aztec/aztec-node';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { type AztecNodeConfig, AztecNodeService } from '@aztec/aztec-node';
|
|
2
|
+
import { Fr } from '@aztec/aztec.js/fields';
|
|
3
|
+
import type { Logger } from '@aztec/aztec.js/log';
|
|
4
|
+
import type { Wallet } from '@aztec/aztec.js/wallet';
|
|
5
|
+
import { EpochCache } from '@aztec/epoch-cache';
|
|
6
|
+
import { type ExtendedViemWalletClient } from '@aztec/ethereum';
|
|
4
7
|
import { RollupContract } from '@aztec/ethereum/contracts';
|
|
5
|
-
import { type Delayer } from '@aztec/ethereum/test';
|
|
6
|
-
import {
|
|
7
|
-
import type
|
|
8
|
-
import type
|
|
9
|
-
import type
|
|
8
|
+
import { ChainMonitor, type Delayer } from '@aztec/ethereum/test';
|
|
9
|
+
import { SpamContract } from '@aztec/noir-test-contracts.js/Spam';
|
|
10
|
+
import { ProverNode, type ProverNodeConfig } from '@aztec/prover-node';
|
|
11
|
+
import { type SequencerClient, type SequencerEvents } from '@aztec/sequencer-client';
|
|
12
|
+
import { EthAddress, type L2BlockNumber } from '@aztec/stdlib/block';
|
|
13
|
+
import { type L1RollupConstants } from '@aztec/stdlib/epoch-helpers';
|
|
10
14
|
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
15
|
export declare const WORLD_STATE_BLOCK_HISTORY = 2;
|
|
15
16
|
export declare const WORLD_STATE_BLOCK_CHECK_INTERVAL = 50;
|
|
16
17
|
export declare const ARCHIVER_POLL_INTERVAL = 50;
|
|
17
|
-
export
|
|
18
|
+
export declare const DEFAULT_L1_BLOCK_TIME: number;
|
|
19
|
+
export type EpochsTestOpts = Partial<SetupOptions> & {
|
|
20
|
+
numberOfAccounts?: number;
|
|
21
|
+
};
|
|
22
|
+
export type TrackedSequencerEvent = {
|
|
23
|
+
[K in keyof SequencerEvents]: Parameters<SequencerEvents[K]>[0] & {
|
|
24
|
+
type: K;
|
|
25
|
+
sequencerIndex: number;
|
|
26
|
+
validator: EthAddress;
|
|
27
|
+
};
|
|
28
|
+
}[keyof SequencerEvents];
|
|
18
29
|
/**
|
|
19
30
|
* Tests building of epochs using fast block times and short epochs.
|
|
20
31
|
* Spawns an aztec node and a prover node with fake proofs.
|
|
@@ -22,30 +33,60 @@ export type EpochsTestOpts = Partial<Pick<SetupOptions, 'startProverNode'>>;
|
|
|
22
33
|
*/
|
|
23
34
|
export declare class EpochsTestContext {
|
|
24
35
|
context: EndToEndContext;
|
|
25
|
-
l1Client:
|
|
36
|
+
l1Client: ExtendedViemWalletClient;
|
|
26
37
|
rollup: RollupContract;
|
|
27
38
|
constants: L1RollupConstants;
|
|
28
39
|
logger: Logger;
|
|
29
40
|
monitor: ChainMonitor;
|
|
41
|
+
epochCache: EpochCache;
|
|
30
42
|
proverDelayer: Delayer;
|
|
31
43
|
sequencerDelayer: Delayer;
|
|
32
44
|
proverNodes: ProverNode[];
|
|
33
45
|
nodes: AztecNodeService[];
|
|
46
|
+
epochDuration: number;
|
|
47
|
+
L1_BLOCK_TIME_IN_S: number;
|
|
48
|
+
L2_SLOT_DURATION_IN_S: number;
|
|
34
49
|
static setup(opts?: EpochsTestOpts): Promise<EpochsTestContext>;
|
|
50
|
+
static getSlotDurations(opts?: EpochsTestOpts): {
|
|
51
|
+
ethereumSlotDuration: number;
|
|
52
|
+
aztecSlotDuration: number;
|
|
53
|
+
aztecEpochDuration: number;
|
|
54
|
+
aztecProofSubmissionEpochs: number;
|
|
55
|
+
};
|
|
35
56
|
setup(opts?: EpochsTestOpts): Promise<void>;
|
|
36
57
|
teardown(): Promise<void>;
|
|
37
|
-
createProverNode(
|
|
38
|
-
|
|
58
|
+
createProverNode(opts?: {
|
|
59
|
+
dontStart?: boolean;
|
|
60
|
+
} & Partial<ProverNodeConfig>): Promise<ProverNode>;
|
|
61
|
+
createNonValidatorNode(opts?: Partial<AztecNodeConfig>): Promise<AztecNodeService>;
|
|
62
|
+
createValidatorNode(privateKeys: `0x${string}`[], opts?: Partial<AztecNodeConfig> & {
|
|
63
|
+
txDelayerMaxInclusionTimeIntoSlot?: number;
|
|
64
|
+
dontStartSequencer?: boolean;
|
|
65
|
+
}): Promise<AztecNodeService>;
|
|
66
|
+
private createNode;
|
|
39
67
|
private getNextPrivateKey;
|
|
40
68
|
/** Waits until the epoch begins (ie until the immediately previous L1 block is mined). */
|
|
41
69
|
waitUntilEpochStarts(epoch: number): Promise<bigint>;
|
|
42
70
|
/** Waits until the given L2 block number is mined. */
|
|
43
71
|
waitUntilL2BlockNumber(target: number, timeout?: number): Promise<void>;
|
|
44
72
|
/** Waits until the given L2 block number is marked as proven. */
|
|
45
|
-
waitUntilProvenL2BlockNumber(t: number, timeout?: number): Promise<
|
|
73
|
+
waitUntilProvenL2BlockNumber(t: number, timeout?: number): Promise<number>;
|
|
74
|
+
/** Waits until the last slot of the proof submission window for a given epoch. */
|
|
75
|
+
waitUntilLastSlotOfProofSubmissionWindow(epochNumber: number | bigint): Promise<void>;
|
|
46
76
|
/** Waits for the aztec node to sync to the target block number. */
|
|
47
|
-
waitForNodeToSync(blockNumber: number, type: '
|
|
77
|
+
waitForNodeToSync(blockNumber: number, type: 'proven' | 'finalized' | 'historic'): Promise<void>;
|
|
78
|
+
/** Registers the SpamContract on the given wallet. */
|
|
79
|
+
registerSpamContract(wallet: Wallet, salt?: Fr): Promise<SpamContract>;
|
|
80
|
+
/** Creates an L1 client using a fresh account with funds from anvil, with a tx delayer already set up. */
|
|
81
|
+
createL1Client(): Promise<{
|
|
82
|
+
client: ExtendedViemWalletClient;
|
|
83
|
+
delayer: Delayer;
|
|
84
|
+
}>;
|
|
48
85
|
/** Verifies whether the given block number is found on the aztec node. */
|
|
49
86
|
verifyHistoricBlock(blockNumber: L2BlockNumber, expectedSuccess: boolean): Promise<void>;
|
|
87
|
+
watchSequencerEvents(sequencers: SequencerClient[], getMetadata?: (i: number) => Record<string, any>): {
|
|
88
|
+
failEvents: TrackedSequencerEvent[];
|
|
89
|
+
stateChanges: TrackedSequencerEvent[];
|
|
90
|
+
};
|
|
50
91
|
}
|
|
51
92
|
//# sourceMappingURL=epochs_test.d.ts.map
|
|
@@ -1 +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;
|
|
1
|
+
{"version":3,"file":"epochs_test.d.ts","sourceRoot":"","sources":["../../src/e2e_epochs/epochs_test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,eAAe,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAG3E,OAAO,EAAE,EAAE,EAAE,MAAM,wBAAwB,CAAC;AAC5C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAElD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAA4B,KAAK,wBAAwB,EAA0B,MAAM,iBAAiB,CAAC;AAClH,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAE,YAAY,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