@aztec/end-to-end 0.0.1-commit.b655e406 → 0.0.1-commit.d1f2d6c
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 +3 -2
- package/dest/bench/client_flows/benchmark.d.ts.map +1 -1
- package/dest/bench/client_flows/benchmark.js +21 -1
- package/dest/bench/client_flows/client_flows_benchmark.d.ts +21 -15
- package/dest/bench/client_flows/client_flows_benchmark.d.ts.map +1 -1
- package/dest/bench/client_flows/client_flows_benchmark.js +129 -119
- package/dest/bench/client_flows/config.d.ts +1 -1
- package/dest/bench/client_flows/data_extractor.d.ts +1 -1
- package/dest/bench/client_flows/data_extractor.js +7 -27
- package/dest/bench/utils.d.ts +8 -7
- package/dest/bench/utils.d.ts.map +1 -1
- package/dest/bench/utils.js +27 -18
- package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts +6 -7
- 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 +96 -112
- package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts +19 -13
- 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 +91 -70
- package/dest/e2e_deploy_contract/deploy_test.d.ts +5 -4
- package/dest/e2e_deploy_contract/deploy_test.d.ts.map +1 -1
- package/dest/e2e_deploy_contract/deploy_test.js +18 -13
- package/dest/e2e_epochs/epochs_test.d.ts +11 -9
- package/dest/e2e_epochs/epochs_test.d.ts.map +1 -1
- package/dest/e2e_epochs/epochs_test.js +22 -16
- package/dest/e2e_fees/bridging_race.notest.d.ts +1 -1
- package/dest/e2e_fees/bridging_race.notest.js +5 -7
- package/dest/e2e_fees/fees_test.d.ts +20 -16
- package/dest/e2e_fees/fees_test.d.ts.map +1 -1
- package/dest/e2e_fees/fees_test.js +127 -139
- package/dest/e2e_l1_publisher/write_json.d.ts +2 -2
- package/dest/e2e_l1_publisher/write_json.d.ts.map +1 -1
- package/dest/e2e_l1_publisher/write_json.js +23 -18
- package/dest/e2e_multi_validator/utils.d.ts +1 -1
- package/dest/e2e_multi_validator/utils.js +1 -1
- package/dest/e2e_nested_contract/nested_contract_test.d.ts +6 -9
- package/dest/e2e_nested_contract/nested_contract_test.d.ts.map +1 -1
- package/dest/e2e_nested_contract/nested_contract_test.js +31 -38
- package/dest/e2e_p2p/inactivity_slash_test.d.ts +3 -3
- package/dest/e2e_p2p/inactivity_slash_test.d.ts.map +1 -1
- package/dest/e2e_p2p/inactivity_slash_test.js +7 -6
- package/dest/e2e_p2p/p2p_network.d.ts +225 -18
- package/dest/e2e_p2p/p2p_network.d.ts.map +1 -1
- package/dest/e2e_p2p/p2p_network.js +119 -109
- package/dest/e2e_p2p/shared.d.ts +11 -11
- package/dest/e2e_p2p/shared.d.ts.map +1 -1
- package/dest/e2e_p2p/shared.js +13 -19
- package/dest/e2e_token_contract/token_contract_test.d.ts +16 -9
- package/dest/e2e_token_contract/token_contract_test.d.ts.map +1 -1
- package/dest/e2e_token_contract/token_contract_test.js +89 -91
- package/dest/fixtures/e2e_prover_test.d.ts +12 -18
- package/dest/fixtures/e2e_prover_test.d.ts.map +1 -1
- package/dest/fixtures/e2e_prover_test.js +100 -108
- package/dest/fixtures/fixtures.d.ts +2 -3
- package/dest/fixtures/fixtures.d.ts.map +1 -1
- package/dest/fixtures/fixtures.js +2 -3
- package/dest/fixtures/get_acvm_config.d.ts +1 -1
- package/dest/fixtures/get_acvm_config.js +1 -1
- package/dest/fixtures/get_bb_config.d.ts +1 -1
- package/dest/fixtures/get_bb_config.d.ts.map +1 -1
- package/dest/fixtures/index.d.ts +1 -1
- package/dest/fixtures/l1_to_l2_messaging.d.ts +4 -3
- package/dest/fixtures/l1_to_l2_messaging.d.ts.map +1 -1
- package/dest/fixtures/l1_to_l2_messaging.js +2 -2
- package/dest/fixtures/logging.d.ts +1 -1
- package/dest/fixtures/setup.d.ts +216 -0
- package/dest/fixtures/setup.d.ts.map +1 -0
- package/dest/fixtures/setup.js +684 -0
- package/dest/fixtures/setup_p2p_test.d.ts +4 -4
- package/dest/fixtures/setup_p2p_test.d.ts.map +1 -1
- package/dest/fixtures/setup_p2p_test.js +18 -10
- package/dest/fixtures/token_utils.d.ts +5 -2
- package/dest/fixtures/token_utils.d.ts.map +1 -1
- package/dest/fixtures/token_utils.js +13 -7
- package/dest/fixtures/utils.d.ts +5 -192
- package/dest/fixtures/utils.d.ts.map +1 -1
- package/dest/fixtures/utils.js +4 -648
- package/dest/fixtures/web3signer.d.ts +1 -1
- package/dest/fixtures/web3signer.js +1 -1
- package/dest/fixtures/with_telemetry_utils.d.ts +2 -2
- package/dest/fixtures/with_telemetry_utils.d.ts.map +1 -1
- package/dest/fixtures/with_telemetry_utils.js +2 -2
- package/dest/index.d.ts +1 -1
- package/dest/quality_of_service/grafana_client.d.ts +41 -0
- package/dest/quality_of_service/grafana_client.d.ts.map +1 -0
- package/dest/quality_of_service/{alert_checker.js → grafana_client.js} +1 -1
- package/dest/quality_of_service/prometheus_client.d.ts +38 -0
- package/dest/quality_of_service/prometheus_client.d.ts.map +1 -0
- package/dest/quality_of_service/prometheus_client.js +67 -0
- package/dest/shared/cross_chain_test_harness.d.ts +7 -6
- package/dest/shared/cross_chain_test_harness.d.ts.map +1 -1
- package/dest/shared/cross_chain_test_harness.js +14 -14
- package/dest/shared/gas_portal_test_harness.d.ts +2 -2
- package/dest/shared/gas_portal_test_harness.d.ts.map +1 -1
- package/dest/shared/gas_portal_test_harness.js +2 -2
- package/dest/shared/index.d.ts +2 -2
- package/dest/shared/index.d.ts.map +1 -1
- package/dest/shared/jest_setup.d.ts +1 -1
- package/dest/shared/submit-transactions.d.ts +3 -3
- package/dest/shared/submit-transactions.d.ts.map +1 -1
- package/dest/shared/submit-transactions.js +9 -11
- package/dest/shared/uniswap_l1_l2.d.ts +3 -27
- package/dest/shared/uniswap_l1_l2.d.ts.map +1 -1
- package/dest/shared/uniswap_l1_l2.js +55 -35
- package/dest/simulators/index.d.ts +1 -1
- package/dest/simulators/lending_simulator.d.ts +2 -2
- package/dest/simulators/lending_simulator.d.ts.map +1 -1
- package/dest/simulators/lending_simulator.js +6 -4
- package/dest/simulators/token_simulator.d.ts +1 -1
- package/dest/simulators/token_simulator.d.ts.map +1 -1
- package/dest/spartan/setup_test_wallets.d.ts +8 -5
- package/dest/spartan/setup_test_wallets.d.ts.map +1 -1
- package/dest/spartan/setup_test_wallets.js +85 -23
- package/dest/spartan/tx_metrics.d.ts +54 -0
- package/dest/spartan/tx_metrics.d.ts.map +1 -0
- package/dest/spartan/tx_metrics.js +272 -0
- package/dest/spartan/utils/bot.d.ts +27 -0
- package/dest/spartan/utils/bot.d.ts.map +1 -0
- package/dest/spartan/utils/bot.js +141 -0
- package/dest/spartan/utils/chaos.d.ts +79 -0
- package/dest/spartan/utils/chaos.d.ts.map +1 -0
- package/dest/spartan/utils/chaos.js +142 -0
- package/dest/spartan/utils/clients.d.ts +39 -0
- package/dest/spartan/utils/clients.d.ts.map +1 -0
- package/dest/spartan/utils/clients.js +90 -0
- package/dest/spartan/utils/config.d.ts +36 -0
- package/dest/spartan/utils/config.d.ts.map +1 -0
- package/dest/spartan/utils/config.js +20 -0
- package/dest/spartan/utils/health.d.ts +63 -0
- package/dest/spartan/utils/health.d.ts.map +1 -0
- package/dest/spartan/utils/health.js +202 -0
- package/dest/spartan/utils/helm.d.ts +15 -0
- package/dest/spartan/utils/helm.d.ts.map +1 -0
- package/dest/spartan/utils/helm.js +47 -0
- package/dest/spartan/utils/index.d.ts +9 -0
- package/dest/spartan/utils/index.d.ts.map +1 -0
- package/dest/spartan/utils/index.js +18 -0
- package/dest/spartan/utils/k8s.d.ts +98 -0
- package/dest/spartan/utils/k8s.d.ts.map +1 -0
- package/dest/spartan/utils/k8s.js +257 -0
- package/dest/spartan/utils/nodes.d.ts +31 -0
- package/dest/spartan/utils/nodes.d.ts.map +1 -0
- package/dest/spartan/utils/nodes.js +290 -0
- package/dest/spartan/utils/scripts.d.ts +16 -0
- package/dest/spartan/utils/scripts.d.ts.map +1 -0
- package/dest/spartan/utils/scripts.js +66 -0
- package/dest/spartan/utils.d.ts +2 -218
- package/dest/spartan/utils.d.ts.map +1 -1
- package/dest/spartan/utils.js +1 -749
- package/package.json +43 -40
- package/src/bench/client_flows/benchmark.ts +24 -2
- package/src/bench/client_flows/client_flows_benchmark.ts +152 -170
- package/src/bench/client_flows/data_extractor.ts +6 -28
- package/src/bench/utils.ts +30 -20
- package/src/e2e_blacklist_token_contract/blacklist_token_contract_test.ts +104 -142
- package/src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts +140 -124
- package/src/e2e_deploy_contract/deploy_test.ts +22 -15
- package/src/e2e_epochs/epochs_test.ts +67 -48
- package/src/e2e_fees/bridging_race.notest.ts +5 -11
- package/src/e2e_fees/fees_test.ts +180 -219
- package/src/e2e_l1_publisher/write_json.ts +25 -19
- package/src/e2e_multi_validator/utils.ts +1 -1
- package/src/e2e_nested_contract/nested_contract_test.ts +33 -55
- package/src/e2e_p2p/inactivity_slash_test.ts +10 -9
- package/src/e2e_p2p/p2p_network.ts +180 -180
- package/src/e2e_p2p/shared.ts +25 -27
- package/src/e2e_token_contract/token_contract_test.ts +103 -118
- package/src/fixtures/e2e_prover_test.ts +111 -149
- package/src/fixtures/fixtures.ts +2 -5
- package/src/fixtures/get_acvm_config.ts +1 -1
- package/src/fixtures/l1_to_l2_messaging.ts +4 -2
- package/src/fixtures/setup.ts +1006 -0
- package/src/fixtures/setup_p2p_test.ts +23 -9
- package/src/fixtures/token_utils.ts +8 -7
- package/src/fixtures/utils.ts +27 -947
- package/src/fixtures/web3signer.ts +1 -1
- package/src/fixtures/with_telemetry_utils.ts +2 -2
- package/src/guides/up_quick_start.sh +1 -1
- package/src/quality_of_service/{alert_checker.ts → grafana_client.ts} +1 -1
- package/src/quality_of_service/prometheus_client.ts +113 -0
- package/src/shared/cross_chain_test_harness.ts +19 -36
- package/src/shared/gas_portal_test_harness.ts +3 -3
- package/src/shared/index.ts +1 -1
- package/src/shared/submit-transactions.ts +9 -15
- package/src/shared/uniswap_l1_l2.ts +65 -86
- package/src/simulators/lending_simulator.ts +7 -5
- package/src/spartan/DEVELOP.md +7 -0
- package/src/spartan/setup_test_wallets.ts +119 -28
- package/src/spartan/tx_metrics.ts +250 -0
- package/src/spartan/utils/bot.ts +185 -0
- package/src/spartan/utils/chaos.ts +253 -0
- package/src/spartan/utils/clients.ts +100 -0
- package/src/spartan/utils/config.ts +26 -0
- package/src/spartan/utils/health.ts +255 -0
- package/src/spartan/utils/helm.ts +84 -0
- package/src/spartan/utils/index.ts +62 -0
- package/src/spartan/utils/k8s.ts +375 -0
- package/src/spartan/utils/nodes.ts +323 -0
- package/src/spartan/utils/scripts.ts +63 -0
- package/src/spartan/utils.ts +1 -942
- package/dest/fixtures/setup_l1_contracts.d.ts +0 -6
- package/dest/fixtures/setup_l1_contracts.d.ts.map +0 -1
- package/dest/fixtures/setup_l1_contracts.js +0 -17
- package/dest/fixtures/snapshot_manager.d.ts +0 -95
- package/dest/fixtures/snapshot_manager.d.ts.map +0 -1
- package/dest/fixtures/snapshot_manager.js +0 -505
- package/dest/quality_of_service/alert_checker.d.ts +0 -41
- package/dest/quality_of_service/alert_checker.d.ts.map +0 -1
- package/src/fixtures/setup_l1_contracts.ts +0 -26
- package/src/fixtures/snapshot_manager.ts +0 -665
|
@@ -2,16 +2,17 @@ import { createLogger } from '@aztec/aztec.js/log';
|
|
|
2
2
|
import { TokenContract } from '@aztec/noir-contracts.js/Token';
|
|
3
3
|
import { InvalidAccountContract } from '@aztec/noir-test-contracts.js/InvalidAccount';
|
|
4
4
|
import { jest } from '@jest/globals';
|
|
5
|
-
import {
|
|
5
|
+
import { deployAccounts, publicDeployAccounts, setup, teardown } from '../fixtures/setup.js';
|
|
6
6
|
import { mintTokensToPrivate } from '../fixtures/token_utils.js';
|
|
7
7
|
import { TokenSimulator } from '../simulators/token_simulator.js';
|
|
8
|
-
const {
|
|
8
|
+
const { METRICS_PORT: metricsPort } = process.env;
|
|
9
9
|
export class TokenContractTest {
|
|
10
10
|
static TOKEN_NAME = 'USDC';
|
|
11
11
|
static TOKEN_SYMBOL = 'USD';
|
|
12
12
|
static TOKEN_DECIMALS = 18n;
|
|
13
|
-
|
|
13
|
+
context;
|
|
14
14
|
logger;
|
|
15
|
+
metricsPort;
|
|
15
16
|
asset;
|
|
16
17
|
tokenSim;
|
|
17
18
|
node;
|
|
@@ -20,107 +21,104 @@ export class TokenContractTest {
|
|
|
20
21
|
adminAddress;
|
|
21
22
|
account1Address;
|
|
22
23
|
account2Address;
|
|
24
|
+
shouldApplyBaseSetup = false;
|
|
25
|
+
shouldApplyMint = false;
|
|
23
26
|
constructor(testName){
|
|
24
27
|
this.logger = createLogger(`e2e:e2e_token_contract:${testName}`);
|
|
25
|
-
this.
|
|
26
|
-
|
|
27
|
-
|
|
28
|
+
this.metricsPort = metricsPort ? parseInt(metricsPort) : undefined;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Registers that base setup should be applied during setup().
|
|
32
|
+
* Call this before setup() to deploy 3 accounts, publicly deploy accounts, token contract and a "bad account".
|
|
33
|
+
*/ applyBaseSnapshots() {
|
|
34
|
+
this.shouldApplyBaseSetup = true;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Registers that mint should be applied during setup().
|
|
38
|
+
* Call this before setup() to mint tokens to the admin account.
|
|
39
|
+
*/ applyMintSnapshot() {
|
|
40
|
+
this.shouldApplyMint = true;
|
|
28
41
|
}
|
|
29
42
|
/**
|
|
30
|
-
*
|
|
31
|
-
|
|
32
|
-
* 2. Publicly deploy accounts, deploy token contract and a "bad account".
|
|
33
|
-
*/ async applyBaseSnapshots() {
|
|
43
|
+
* Applies base setup: deploys 3 accounts, publicly deploys accounts, token contract and a "bad account".
|
|
44
|
+
*/ async applyBaseSetup() {
|
|
34
45
|
// Adding a timeout of 2 minutes in here such that it is propagated to the underlying tests
|
|
35
46
|
jest.setTimeout(120_000);
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
this.wallet
|
|
39
|
-
|
|
40
|
-
return Promise.resolve();
|
|
47
|
+
this.logger.info('Applying base setup - deploying 3 accounts');
|
|
48
|
+
const { deployedAccounts } = await deployAccounts(3, this.logger)({
|
|
49
|
+
wallet: this.context.wallet,
|
|
50
|
+
initialFundedAccounts: this.context.initialFundedAccounts
|
|
41
51
|
});
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
this.logger.verbose(`Token deployed to ${asset.address}`);
|
|
55
|
-
this.logger.verbose(`Deploying bad account...`);
|
|
56
|
-
this.badAccount = await InvalidAccountContract.deploy(this.wallet).send({
|
|
57
|
-
from: this.adminAddress
|
|
58
|
-
}).deployed();
|
|
59
|
-
this.logger.verbose(`Deployed to ${this.badAccount.address}.`);
|
|
60
|
-
return {
|
|
61
|
-
tokenContractAddress: asset.address,
|
|
62
|
-
badAccountAddress: this.badAccount.address
|
|
63
|
-
};
|
|
64
|
-
}, async ({ tokenContractAddress, badAccountAddress })=>{
|
|
65
|
-
// Restore the token contract state.
|
|
66
|
-
this.asset = await TokenContract.at(tokenContractAddress, this.wallet);
|
|
67
|
-
this.logger.verbose(`Token contract address: ${this.asset.address}`);
|
|
68
|
-
this.tokenSim = new TokenSimulator(this.asset, this.wallet, this.adminAddress, this.logger, [
|
|
69
|
-
this.adminAddress,
|
|
70
|
-
this.account1Address
|
|
71
|
-
]);
|
|
72
|
-
this.badAccount = await InvalidAccountContract.at(badAccountAddress, this.wallet);
|
|
73
|
-
this.logger.verbose(`Bad account address: ${this.badAccount.address}`);
|
|
74
|
-
expect(await this.asset.methods.get_admin().simulate({
|
|
75
|
-
from: this.adminAddress
|
|
76
|
-
})).toBe(this.adminAddress.toBigInt());
|
|
52
|
+
this.node = this.context.aztecNodeService;
|
|
53
|
+
this.wallet = this.context.wallet;
|
|
54
|
+
[this.adminAddress, this.account1Address, this.account2Address] = deployedAccounts.map((acc)=>acc.address);
|
|
55
|
+
this.logger.info('Applying base setup - deploying token contract');
|
|
56
|
+
this.logger.verbose(`Public deploy accounts...`);
|
|
57
|
+
await publicDeployAccounts(this.wallet, [
|
|
58
|
+
this.adminAddress,
|
|
59
|
+
this.account1Address
|
|
60
|
+
]);
|
|
61
|
+
this.logger.verbose(`Deploying TokenContract...`);
|
|
62
|
+
this.asset = await TokenContract.deploy(this.wallet, this.adminAddress, TokenContractTest.TOKEN_NAME, TokenContractTest.TOKEN_SYMBOL, TokenContractTest.TOKEN_DECIMALS).send({
|
|
63
|
+
from: this.adminAddress
|
|
77
64
|
});
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
65
|
+
this.logger.verbose(`Token deployed to ${this.asset.address}`);
|
|
66
|
+
this.logger.verbose(`Deploying bad account...`);
|
|
67
|
+
this.badAccount = await InvalidAccountContract.deploy(this.wallet).send({
|
|
68
|
+
from: this.adminAddress
|
|
69
|
+
});
|
|
70
|
+
this.logger.verbose(`Deployed to ${this.badAccount.address}.`);
|
|
71
|
+
this.tokenSim = new TokenSimulator(this.asset, this.wallet, this.adminAddress, this.logger, [
|
|
72
|
+
this.adminAddress,
|
|
73
|
+
this.account1Address
|
|
74
|
+
]);
|
|
75
|
+
expect(await this.asset.methods.get_admin().simulate({
|
|
76
|
+
from: this.adminAddress
|
|
77
|
+
})).toBe(this.adminAddress.toBigInt());
|
|
82
78
|
}
|
|
83
79
|
async setup() {
|
|
84
|
-
await
|
|
80
|
+
this.context = await setup(0, {
|
|
81
|
+
metricsPort: this.metricsPort,
|
|
82
|
+
fundSponsoredFPC: true,
|
|
83
|
+
skipAccountDeployment: true
|
|
84
|
+
});
|
|
85
|
+
if (this.shouldApplyBaseSetup) {
|
|
86
|
+
await this.applyBaseSetup();
|
|
87
|
+
}
|
|
88
|
+
if (this.shouldApplyMint) {
|
|
89
|
+
await this.applyMint();
|
|
90
|
+
}
|
|
85
91
|
}
|
|
86
|
-
snapshot = (name, apply, restore = ()=>Promise.resolve())=>this.snapshotManager.snapshot(name, apply, restore);
|
|
87
92
|
async teardown() {
|
|
88
|
-
await this.
|
|
93
|
+
await teardown(this.context);
|
|
89
94
|
}
|
|
90
|
-
async
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
from: adminAddress
|
|
115
|
-
});
|
|
116
|
-
this.logger.verbose(`Private balance of wallet 0: ${privateBalance}`);
|
|
117
|
-
expect(privateBalance).toEqual(tokenSim.balanceOfPrivate(adminAddress));
|
|
118
|
-
const totalSupply = await asset.methods.total_supply().simulate({
|
|
119
|
-
from: adminAddress
|
|
120
|
-
});
|
|
121
|
-
this.logger.verbose(`Total supply: ${totalSupply}`);
|
|
122
|
-
expect(totalSupply).toEqual(tokenSim.totalSupply);
|
|
123
|
-
return Promise.resolve();
|
|
95
|
+
async applyMint() {
|
|
96
|
+
this.logger.info('Applying mint setup');
|
|
97
|
+
const { asset, adminAddress, tokenSim } = this;
|
|
98
|
+
const amount = 10000n;
|
|
99
|
+
this.logger.verbose(`Minting ${amount} publicly...`);
|
|
100
|
+
await asset.methods.mint_to_public(adminAddress, amount).send({
|
|
101
|
+
from: adminAddress
|
|
102
|
+
});
|
|
103
|
+
tokenSim.mintPublic(adminAddress, amount);
|
|
104
|
+
const publicBalance = await asset.methods.balance_of_public(adminAddress).simulate({
|
|
105
|
+
from: adminAddress
|
|
106
|
+
});
|
|
107
|
+
this.logger.verbose(`Public balance of wallet 0: ${publicBalance}`);
|
|
108
|
+
expect(publicBalance).toEqual(this.tokenSim.balanceOfPublic(adminAddress));
|
|
109
|
+
this.logger.verbose(`Minting ${amount} privately...`);
|
|
110
|
+
await mintTokensToPrivate(asset, adminAddress, adminAddress, amount);
|
|
111
|
+
tokenSim.mintPrivate(adminAddress, amount);
|
|
112
|
+
const privateBalance = await asset.methods.balance_of_private(adminAddress).simulate({
|
|
113
|
+
from: adminAddress
|
|
114
|
+
});
|
|
115
|
+
this.logger.verbose(`Private balance of wallet 0: ${privateBalance}`);
|
|
116
|
+
expect(privateBalance).toEqual(tokenSim.balanceOfPrivate(adminAddress));
|
|
117
|
+
const totalSupply = await asset.methods.total_supply().simulate({
|
|
118
|
+
from: adminAddress
|
|
124
119
|
});
|
|
120
|
+
this.logger.verbose(`Total supply: ${totalSupply}`);
|
|
121
|
+
expect(totalSupply).toEqual(tokenSim.totalSupply);
|
|
122
|
+
this.logger.verbose(`Minting complete.`);
|
|
125
123
|
}
|
|
126
124
|
}
|
|
@@ -4,13 +4,13 @@ import { type Logger } from '@aztec/aztec.js/log';
|
|
|
4
4
|
import type { AztecNode } from '@aztec/aztec.js/node';
|
|
5
5
|
import { CheatCodes } from '@aztec/aztec/testing';
|
|
6
6
|
import { type ClientProtocolCircuitVerifier } from '@aztec/bb-prover';
|
|
7
|
-
import type {
|
|
8
|
-
import type { DeployL1ContractsReturnType } from '@aztec/ethereum';
|
|
7
|
+
import type { DeployAztecL1ContractsReturnType } from '@aztec/ethereum/deploy-aztec-l1-contracts';
|
|
9
8
|
import { TokenContract } from '@aztec/noir-contracts.js/Token';
|
|
9
|
+
import type { ContractInstanceWithAddress } from '@aztec/stdlib/contract';
|
|
10
10
|
import type { AztecNodeAdmin } from '@aztec/stdlib/interfaces/client';
|
|
11
11
|
import { TestWallet } from '@aztec/test-wallet/server';
|
|
12
12
|
import { TokenSimulator } from '../simulators/token_simulator.js';
|
|
13
|
-
import { type
|
|
13
|
+
import { type EndToEndContext } from './setup.js';
|
|
14
14
|
/**
|
|
15
15
|
* Largely taken from the e2e_token_contract test file. We deploy 2 accounts and a token contract.
|
|
16
16
|
* However, we then setup a second PXE with a full prover instance.
|
|
@@ -18,44 +18,38 @@ import { type SubsystemsContext } from './snapshot_manager.js';
|
|
|
18
18
|
* We then prove and verify transactions created via this full prover PXE.
|
|
19
19
|
*/
|
|
20
20
|
export declare class FullProverTest {
|
|
21
|
-
private minNumberOfTxsPerBlock;
|
|
22
|
-
private realProofs;
|
|
23
21
|
static TOKEN_NAME: string;
|
|
24
22
|
static TOKEN_SYMBOL: string;
|
|
25
23
|
static TOKEN_DECIMALS: bigint;
|
|
26
|
-
private snapshotManager;
|
|
27
24
|
logger: Logger;
|
|
28
25
|
wallet: TestWallet;
|
|
29
26
|
provenWallet: TestWallet;
|
|
30
27
|
accounts: AztecAddress[];
|
|
31
28
|
deployedAccounts: InitialAccountData[];
|
|
32
29
|
fakeProofsAsset: TokenContract;
|
|
30
|
+
fakeProofsAssetInstance: ContractInstanceWithAddress;
|
|
33
31
|
tokenSim: TokenSimulator;
|
|
34
32
|
aztecNode: AztecNode;
|
|
35
33
|
aztecNodeAdmin: AztecNodeAdmin;
|
|
36
34
|
cheatCodes: CheatCodes;
|
|
37
|
-
blobSink: BlobSinkServer;
|
|
38
35
|
private provenComponents;
|
|
39
36
|
private bbConfigCleanup?;
|
|
40
37
|
private acvmConfigCleanup?;
|
|
41
38
|
circuitProofVerifier?: ClientProtocolCircuitVerifier;
|
|
42
39
|
provenAsset: TokenContract;
|
|
43
|
-
|
|
40
|
+
context: EndToEndContext;
|
|
44
41
|
private proverNode;
|
|
45
42
|
private simulatedProverNode;
|
|
46
|
-
l1Contracts:
|
|
43
|
+
l1Contracts: DeployAztecL1ContractsReturnType;
|
|
47
44
|
proverAddress: EthAddress;
|
|
45
|
+
private minNumberOfTxsPerBlock;
|
|
46
|
+
private coinbase;
|
|
47
|
+
private realProofs;
|
|
48
48
|
constructor(testName: string, minNumberOfTxsPerBlock: number, coinbase: EthAddress, realProofs?: boolean);
|
|
49
|
-
|
|
50
|
-
* Adds two state shifts to snapshot manager.
|
|
51
|
-
* 1. Add 2 accounts.
|
|
52
|
-
* 2. Publicly deploy accounts, deploy token contract
|
|
53
|
-
*/
|
|
54
|
-
applyBaseSnapshots(): Promise<void>;
|
|
49
|
+
private applyBaseSetup;
|
|
55
50
|
setup(): Promise<this>;
|
|
56
51
|
private mintFeeJuice;
|
|
57
|
-
snapshot: <T>(name: string, apply: (context: SubsystemsContext) => Promise<T>, restore?: (snapshotData: T, context: SubsystemsContext) => Promise<void>) => Promise<void>;
|
|
58
52
|
teardown(): Promise<void>;
|
|
59
|
-
|
|
53
|
+
private applyMint;
|
|
60
54
|
}
|
|
61
|
-
//# sourceMappingURL=
|
|
55
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZTJlX3Byb3Zlcl90ZXN0LmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvZml4dHVyZXMvZTJlX3Byb3Zlcl90ZXN0LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sS0FBSyxFQUFFLGtCQUFrQixFQUFFLE1BQU0seUJBQXlCLENBQUM7QUFFbEUsT0FBTyxFQUFFLFlBQVksRUFBRSxVQUFVLEVBQUUsTUFBTSwyQkFBMkIsQ0FBQztBQUNyRSxPQUFPLEVBQUUsS0FBSyxNQUFNLEVBQWdCLE1BQU0scUJBQXFCLENBQUM7QUFDaEUsT0FBTyxLQUFLLEVBQUUsU0FBUyxFQUFFLE1BQU0sc0JBQXNCLENBQUM7QUFDdEQsT0FBTyxFQUFFLFVBQVUsRUFBRSxNQUFNLHNCQUFzQixDQUFDO0FBQ2xELE9BQU8sRUFFTCxLQUFLLDZCQUE2QixFQUdu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2B,CAAC;IACtD,QAAQ,EAAG,cAAc,CAAC;IAC1B,SAAS,EAAG,SAAS,CAAC;IACtB,cAAc,EAAG,cAAc,CAAC;IAChC,UAAU,EAAG,UAAU,CAAC;IACxB,OAAO,CAAC,gBAAgB,CAAqB;IAC7C,OAAO,CAAC,eAAe,CAAC,CAAsB;IAC9C,OAAO,CAAC,iBAAiB,CAAC,CAAsB;IAChD,oBAAoB,CAAC,EAAE,6BAA6B,CAAC;IACrD,WAAW,EAAG,aAAa,CAAC;IAC5B,OAAO,EAAG,eAAe,CAAC;IAC1B,OAAO,CAAC,UAAU,CAAc;IAChC,OAAO,CAAC,mBAAmB,CAAc;IAClC,WAAW,EAAG,gCAAgC,CAAC;IAC/C,aAAa,EAAG,UAAU,CAAC;IAClC,OAAO,CAAC,sBAAsB,CAAS;IACvC,OAAO,CAAC,QAAQ,CAAa;IAC7B,OAAO,CAAC,UAAU,CAAU;IAE5B,YAAY,QAAQ,EAAE,MAAM,EAAE,sBAAsB,EAAE,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAE,UAAU,UAAO,EAKpG;YAKa,cAAc;IAqCtB,KAAK,kBAgJV;YAEa,YAAY;IASpB,QAAQ,kBAcb;YAEa,SAAS;CAkCxB"}
|
|
@@ -2,7 +2,8 @@ import { createArchiver } from '@aztec/archiver';
|
|
|
2
2
|
import { EthAddress } from '@aztec/aztec.js/addresses';
|
|
3
3
|
import { createLogger } from '@aztec/aztec.js/log';
|
|
4
4
|
import { BBCircuitVerifier, QueuedIVCVerifier, TestCircuitVerifier } from '@aztec/bb-prover';
|
|
5
|
-
import {
|
|
5
|
+
import { BackendType, Barretenberg } from '@aztec/bb.js';
|
|
6
|
+
import { createBlobClientWithFileStores } from '@aztec/blob-client/client';
|
|
6
7
|
import { Buffer32 } from '@aztec/foundation/buffer';
|
|
7
8
|
import { SecretValue } from '@aztec/foundation/config';
|
|
8
9
|
import { FeeAssetHandlerAbi } from '@aztec/l1-artifacts';
|
|
@@ -14,33 +15,28 @@ import { privateKeyToAddress } from 'viem/accounts';
|
|
|
14
15
|
import { TokenSimulator } from '../simulators/token_simulator.js';
|
|
15
16
|
import { getACVMConfig } from './get_acvm_config.js';
|
|
16
17
|
import { getBBConfig } from './get_bb_config.js';
|
|
17
|
-
import {
|
|
18
|
-
import { getPrivateKeyFromIndex, getSponsoredFPCAddress, setupPXEAndGetWallet } from './utils.js';
|
|
19
|
-
const { E2E_DATA_PATH: dataPath } = process.env;
|
|
18
|
+
import { deployAccounts, getPrivateKeyFromIndex, getSponsoredFPCAddress, publicDeployAccounts, setup, setupPXEAndGetWallet, teardown } from './setup.js';
|
|
20
19
|
/**
|
|
21
20
|
* Largely taken from the e2e_token_contract test file. We deploy 2 accounts and a token contract.
|
|
22
21
|
* However, we then setup a second PXE with a full prover instance.
|
|
23
22
|
* We configure this instance with all of the accounts and contracts.
|
|
24
23
|
* We then prove and verify transactions created via this full prover PXE.
|
|
25
24
|
*/ export class FullProverTest {
|
|
26
|
-
minNumberOfTxsPerBlock;
|
|
27
|
-
realProofs;
|
|
28
25
|
static TOKEN_NAME = 'USDC';
|
|
29
26
|
static TOKEN_SYMBOL = 'USD';
|
|
30
27
|
static TOKEN_DECIMALS = 18n;
|
|
31
|
-
snapshotManager;
|
|
32
28
|
logger;
|
|
33
29
|
wallet;
|
|
34
30
|
provenWallet;
|
|
35
|
-
accounts;
|
|
31
|
+
accounts = [];
|
|
36
32
|
deployedAccounts;
|
|
37
33
|
fakeProofsAsset;
|
|
34
|
+
fakeProofsAssetInstance;
|
|
38
35
|
tokenSim;
|
|
39
36
|
aztecNode;
|
|
40
37
|
aztecNodeAdmin;
|
|
41
38
|
cheatCodes;
|
|
42
|
-
|
|
43
|
-
provenComponents;
|
|
39
|
+
provenComponents = [];
|
|
44
40
|
bbConfigCleanup;
|
|
45
41
|
acvmConfigCleanup;
|
|
46
42
|
circuitProofVerifier;
|
|
@@ -50,65 +46,67 @@ const { E2E_DATA_PATH: dataPath } = process.env;
|
|
|
50
46
|
simulatedProverNode;
|
|
51
47
|
l1Contracts;
|
|
52
48
|
proverAddress;
|
|
49
|
+
minNumberOfTxsPerBlock;
|
|
50
|
+
coinbase;
|
|
51
|
+
realProofs;
|
|
53
52
|
constructor(testName, minNumberOfTxsPerBlock, coinbase, realProofs = true){
|
|
53
|
+
this.logger = createLogger(`e2e:full_prover_test:${testName}`);
|
|
54
54
|
this.minNumberOfTxsPerBlock = minNumberOfTxsPerBlock;
|
|
55
|
+
this.coinbase = coinbase;
|
|
55
56
|
this.realProofs = realProofs;
|
|
56
|
-
this.accounts = [];
|
|
57
|
-
this.provenComponents = [];
|
|
58
|
-
this.snapshot = (name, apply, restore = ()=>Promise.resolve())=>this.snapshotManager.snapshot(name, apply, restore);
|
|
59
|
-
this.logger = createLogger(`e2e:full_prover_test:${testName}`);
|
|
60
|
-
this.snapshotManager = createSnapshotManager(`full_prover_integration/${testName}`, dataPath, {
|
|
61
|
-
startProverNode: true,
|
|
62
|
-
fundRewardDistributor: true,
|
|
63
|
-
coinbase
|
|
64
|
-
}, {
|
|
65
|
-
realVerifier: realProofs
|
|
66
|
-
});
|
|
67
57
|
}
|
|
68
58
|
/**
|
|
69
|
-
*
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
this.
|
|
75
|
-
this.accounts = deployedAccounts.map((a)=>a.address);
|
|
76
|
-
this.wallet = wallet;
|
|
77
|
-
return Promise.resolve();
|
|
59
|
+
* Applies base setup: deploys 2 accounts and token contract.
|
|
60
|
+
*/ async applyBaseSetup() {
|
|
61
|
+
this.logger.info('Applying base setup: deploying accounts');
|
|
62
|
+
const { deployedAccounts } = await deployAccounts(2, this.logger)({
|
|
63
|
+
wallet: this.context.wallet,
|
|
64
|
+
initialFundedAccounts: this.context.initialFundedAccounts
|
|
78
65
|
});
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
tokenContractAddress: asset.address
|
|
91
|
-
};
|
|
92
|
-
}, async ({ tokenContractAddress })=>{
|
|
93
|
-
// Restore the token contract state.
|
|
94
|
-
this.fakeProofsAsset = await TokenContract.at(tokenContractAddress, this.wallet);
|
|
95
|
-
this.logger.verbose(`Token contract address: ${this.fakeProofsAsset.address}`);
|
|
96
|
-
this.tokenSim = new TokenSimulator(this.fakeProofsAsset, this.wallet, this.accounts[0], this.logger, this.accounts);
|
|
97
|
-
expect(await this.fakeProofsAsset.methods.get_admin().simulate({
|
|
98
|
-
from: this.accounts[0]
|
|
99
|
-
})).toBe(this.accounts[0].toBigInt());
|
|
66
|
+
this.deployedAccounts = deployedAccounts;
|
|
67
|
+
this.accounts = deployedAccounts.map((a)=>a.address);
|
|
68
|
+
this.wallet = this.context.wallet;
|
|
69
|
+
this.logger.info('Applying base setup: publicly deploying accounts');
|
|
70
|
+
await publicDeployAccounts(this.wallet, this.accounts.slice(0, 2));
|
|
71
|
+
this.logger.info('Applying base setup: deploying token contract');
|
|
72
|
+
const { contract: asset, instance } = await TokenContract.deploy(this.wallet, this.accounts[0], FullProverTest.TOKEN_NAME, FullProverTest.TOKEN_SYMBOL, FullProverTest.TOKEN_DECIMALS).send({
|
|
73
|
+
from: this.accounts[0],
|
|
74
|
+
wait: {
|
|
75
|
+
returnReceipt: true
|
|
76
|
+
}
|
|
100
77
|
});
|
|
78
|
+
this.logger.verbose(`Token deployed to ${asset.address}`);
|
|
79
|
+
this.fakeProofsAsset = asset;
|
|
80
|
+
this.fakeProofsAssetInstance = instance;
|
|
81
|
+
this.logger.verbose(`Token contract address: ${this.fakeProofsAsset.address}`);
|
|
82
|
+
this.tokenSim = new TokenSimulator(this.fakeProofsAsset, this.wallet, this.accounts[0], this.logger, this.accounts);
|
|
83
|
+
expect(await this.fakeProofsAsset.methods.get_admin().simulate({
|
|
84
|
+
from: this.accounts[0]
|
|
85
|
+
})).toBe(this.accounts[0].toBigInt());
|
|
101
86
|
}
|
|
102
87
|
async setup() {
|
|
103
|
-
this.
|
|
88
|
+
this.logger.info('Setting up subsystems from fresh');
|
|
89
|
+
this.context = await setup(0, {
|
|
90
|
+
startProverNode: true,
|
|
91
|
+
coinbase: this.coinbase,
|
|
92
|
+
fundSponsoredFPC: true,
|
|
93
|
+
skipAccountDeployment: true,
|
|
94
|
+
l1ContractsArgs: {
|
|
95
|
+
realVerifier: this.realProofs
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
await this.applyBaseSetup();
|
|
99
|
+
await this.applyMint();
|
|
100
|
+
this.logger.info(`Enabling proving`, {
|
|
101
|
+
realProofs: this.realProofs
|
|
102
|
+
});
|
|
104
103
|
// We don't wish to mark as proven automatically, so we set the flag to false
|
|
105
104
|
this.context.watcher.setIsMarkingAsProven(false);
|
|
106
105
|
this.simulatedProverNode = this.context.proverNode;
|
|
107
|
-
({ aztecNode: this.aztecNode, deployL1ContractsValues: this.l1Contracts, cheatCodes: this.cheatCodes
|
|
108
|
-
this.aztecNodeAdmin = this.context.
|
|
109
|
-
const
|
|
110
|
-
|
|
111
|
-
});
|
|
106
|
+
({ aztecNode: this.aztecNode, deployL1ContractsValues: this.l1Contracts, cheatCodes: this.cheatCodes } = this.context);
|
|
107
|
+
this.aztecNodeAdmin = this.context.aztecNodeService;
|
|
108
|
+
const config = this.context.aztecNodeConfig;
|
|
109
|
+
const blobClient = await createBlobClientWithFileStores(config, this.logger);
|
|
112
110
|
// Configure a full prover PXE
|
|
113
111
|
let acvmConfig;
|
|
114
112
|
let bbConfig;
|
|
@@ -122,9 +120,9 @@ const { E2E_DATA_PATH: dataPath } = process.env;
|
|
|
122
120
|
}
|
|
123
121
|
this.acvmConfigCleanup = acvmConfig.cleanup;
|
|
124
122
|
this.bbConfigCleanup = bbConfig.cleanup;
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
}
|
|
123
|
+
await Barretenberg.initSingleton({
|
|
124
|
+
backend: BackendType.NativeUnixSocket
|
|
125
|
+
});
|
|
128
126
|
const verifier = await BBCircuitVerifier.new(bbConfig);
|
|
129
127
|
this.circuitProofVerifier = new QueuedIVCVerifier(bbConfig, verifier);
|
|
130
128
|
this.logger.debug(`Configuring the node for real proofs...`);
|
|
@@ -145,17 +143,15 @@ const { E2E_DATA_PATH: dataPath } = process.env;
|
|
|
145
143
|
await this.context.cheatCodes.rollup.markAsProven();
|
|
146
144
|
this.logger.verbose(`Main setup completed, initializing full prover PXE, Node, and Prover Node`);
|
|
147
145
|
const { wallet: provenWallet, teardown: provenTeardown } = await setupPXEAndGetWallet(this.aztecNode, {
|
|
148
|
-
proverEnabled: this.realProofs
|
|
149
|
-
bbBinaryPath: bbConfig?.bbBinaryPath,
|
|
150
|
-
bbWorkingDirectory: bbConfig?.bbWorkingDirectory
|
|
146
|
+
proverEnabled: this.realProofs
|
|
151
147
|
}, undefined, true);
|
|
152
148
|
this.logger.debug(`Contract address ${this.fakeProofsAsset.address}`);
|
|
153
|
-
await provenWallet.registerContract(this.
|
|
149
|
+
await provenWallet.registerContract(this.fakeProofsAssetInstance, TokenContract.artifact);
|
|
154
150
|
for(let i = 0; i < 2; i++){
|
|
155
151
|
await provenWallet.createSchnorrAccount(this.deployedAccounts[i].secret, this.deployedAccounts[i].salt);
|
|
156
152
|
await this.wallet.createSchnorrAccount(this.deployedAccounts[i].secret, this.deployedAccounts[i].salt);
|
|
157
153
|
}
|
|
158
|
-
const asset =
|
|
154
|
+
const asset = TokenContract.at(this.fakeProofsAsset.address, provenWallet);
|
|
159
155
|
this.provenComponents.push({
|
|
160
156
|
wallet: provenWallet,
|
|
161
157
|
teardown: provenTeardown
|
|
@@ -172,7 +168,8 @@ const { E2E_DATA_PATH: dataPath } = process.env;
|
|
|
172
168
|
...this.context.aztecNodeConfig,
|
|
173
169
|
dataDirectory: undefined
|
|
174
170
|
}, {
|
|
175
|
-
|
|
171
|
+
blobClient,
|
|
172
|
+
dateProvider: this.context.dateProvider
|
|
176
173
|
}, {
|
|
177
174
|
blockUntilSync: true
|
|
178
175
|
});
|
|
@@ -207,13 +204,14 @@ const { E2E_DATA_PATH: dataPath } = process.env;
|
|
|
207
204
|
const { prefilledPublicData } = await getGenesisValues(this.context.initialFundedAccounts.map((a)=>a.address).concat(sponsoredFPCAddress));
|
|
208
205
|
this.proverNode = await createProverNode(proverConfig, {
|
|
209
206
|
aztecNodeTxProvider: this.aztecNode,
|
|
210
|
-
archiver: archiver
|
|
211
|
-
blobSinkClient
|
|
207
|
+
archiver: archiver
|
|
212
208
|
}, {
|
|
213
209
|
prefilledPublicData
|
|
214
210
|
});
|
|
215
211
|
await this.proverNode.start();
|
|
216
|
-
this.logger.warn(`Proofs are now enabled
|
|
212
|
+
this.logger.warn(`Proofs are now enabled`, {
|
|
213
|
+
realProofs: this.realProofs
|
|
214
|
+
});
|
|
217
215
|
return this;
|
|
218
216
|
}
|
|
219
217
|
async mintFeeJuice(recipient) {
|
|
@@ -232,55 +230,49 @@ const { E2E_DATA_PATH: dataPath } = process.env;
|
|
|
232
230
|
hash
|
|
233
231
|
});
|
|
234
232
|
}
|
|
235
|
-
snapshot;
|
|
236
233
|
async teardown() {
|
|
237
|
-
await this.snapshotManager.teardown();
|
|
238
234
|
// Cleanup related to the full prover PXEs
|
|
239
235
|
for(let i = 0; i < this.provenComponents.length; i++){
|
|
240
236
|
await this.provenComponents[i].teardown();
|
|
241
237
|
}
|
|
242
238
|
// clean up the full prover node
|
|
243
239
|
await this.proverNode.stop();
|
|
240
|
+
await Barretenberg.destroySingleton();
|
|
244
241
|
await this.bbConfigCleanup?.();
|
|
245
242
|
await this.acvmConfigCleanup?.();
|
|
243
|
+
await teardown(this.context);
|
|
246
244
|
}
|
|
247
|
-
async
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
this.logger.verbose(`Private balance of wallet 0: ${privateBalance}`);
|
|
277
|
-
expect(privateBalance).toEqual(tokenSim.balanceOfPrivate(address));
|
|
278
|
-
const totalSupply = await asset.methods.total_supply().simulate({
|
|
279
|
-
from: address
|
|
280
|
-
});
|
|
281
|
-
this.logger.verbose(`Total supply: ${totalSupply}`);
|
|
282
|
-
expect(totalSupply).toEqual(tokenSim.totalSupply);
|
|
283
|
-
return Promise.resolve();
|
|
245
|
+
async applyMint() {
|
|
246
|
+
this.logger.info('Applying mint setup');
|
|
247
|
+
const { fakeProofsAsset: asset, accounts } = this;
|
|
248
|
+
const privateAmount = 10000n;
|
|
249
|
+
const publicAmount = 10000n;
|
|
250
|
+
this.logger.verbose(`Minting ${privateAmount + publicAmount} publicly...`);
|
|
251
|
+
await asset.methods.mint_to_public(accounts[0], privateAmount + publicAmount).send({
|
|
252
|
+
from: accounts[0]
|
|
253
|
+
});
|
|
254
|
+
this.logger.verbose(`Transferring ${privateAmount} to private...`);
|
|
255
|
+
await asset.methods.transfer_to_private(accounts[0], privateAmount).send({
|
|
256
|
+
from: accounts[0]
|
|
257
|
+
});
|
|
258
|
+
this.logger.info(`Minting complete`);
|
|
259
|
+
const { fakeProofsAsset, accounts: [address], tokenSim } = this;
|
|
260
|
+
tokenSim.mintPublic(address, publicAmount);
|
|
261
|
+
const publicBalance = await fakeProofsAsset.methods.balance_of_public(address).simulate({
|
|
262
|
+
from: address
|
|
263
|
+
});
|
|
264
|
+
this.logger.verbose(`Public balance of wallet 0: ${publicBalance}`);
|
|
265
|
+
expect(publicBalance).toEqual(this.tokenSim.balanceOfPublic(address));
|
|
266
|
+
tokenSim.mintPrivate(address, publicAmount);
|
|
267
|
+
const privateBalance = await fakeProofsAsset.methods.balance_of_private(address).simulate({
|
|
268
|
+
from: address
|
|
269
|
+
});
|
|
270
|
+
this.logger.verbose(`Private balance of wallet 0: ${privateBalance}`);
|
|
271
|
+
expect(privateBalance).toEqual(tokenSim.balanceOfPrivate(address));
|
|
272
|
+
const totalSupply = await fakeProofsAsset.methods.total_supply().simulate({
|
|
273
|
+
from: address
|
|
284
274
|
});
|
|
275
|
+
this.logger.verbose(`Total supply: ${totalSupply}`);
|
|
276
|
+
expect(totalSupply).toEqual(tokenSim.totalSupply);
|
|
285
277
|
}
|
|
286
278
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export declare const METRICS_PORT = 4318;
|
|
2
2
|
export declare const shouldCollectMetrics: () => 4318 | undefined;
|
|
3
3
|
export declare const TEST_PEER_CHECK_INTERVAL_MS = 1000;
|
|
4
|
-
export declare const
|
|
4
|
+
export declare const TEST_MAX_PENDING_TX_POOL_COUNT = 10000;
|
|
5
5
|
export declare const MNEMONIC = "test test test test test test test test test test test junk";
|
|
6
6
|
export declare const privateKey: Buffer<ArrayBuffer>;
|
|
7
7
|
export declare const privateKey2: Buffer<ArrayBuffer>;
|
|
@@ -12,5 +12,4 @@ export declare const DUPLICATE_NULLIFIER_ERROR: RegExp;
|
|
|
12
12
|
export declare const NO_L1_TO_L2_MSG_ERROR: RegExp;
|
|
13
13
|
export declare const STATIC_CALL_STATE_MODIFICATION_ERROR: RegExp;
|
|
14
14
|
export declare const STATIC_CONTEXT_ASSERTION_ERROR: RegExp;
|
|
15
|
-
|
|
16
|
-
//# sourceMappingURL=fixtures.d.ts.map
|
|
15
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZml4dHVyZXMuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9maXh0dXJlcy9maXh0dXJlcy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxlQUFPLE1BQU0sWUFBWSxPQUFPLENBQUM7QUFFakMsZUFBTyxNQUFNLG9CQUFvQix3QkFLaEMsQ0FBQztBQUVGLGVBQU8sTUFBTSwyQkFBMkIsT0FBTyxDQUFDO0FBQ2hELGVBQU8sTUFBTSw4QkFBOEIsUUFBUyxDQUFDO0FBRXJELGVBQU8sTUFBTSxRQUFRLGdFQUFnRSxDQUFDO0FBQ3RGLGVBQU8sTUFBTSxVQUFVLHFCQUF5RixDQUFDO0FBQ2pILGVBQU8sTUFBTSxXQUFXLHFCQUF5RixDQUFDO0FBR2xILGVBQU8sTUFBTSxvQkFBb0Isd0RBQXdELENBQUM7QUFDMUYsZUFBTyxNQUFNLG1CQUFtQixtREFBbUQsQ0FBQztBQUNwRixlQUFPLE1BQU0scUJBQXFCLCtFQUErRSxDQUFDO0FBRWxILGVBQU8sTUFBTSx5QkFBeUIsUUFBZ0MsQ0FBQztBQUN2RSxlQUFPLE1BQU0scUJBQXFCLFFBQ3dFLENBQUM7QUFDM0csZUFBTyxNQUFNLG9DQUFvQyxRQUEwQyxDQUFDO0FBQzVGLGVBQU8sTUFBTSw4QkFBOEIsUUFBa0UsQ0FBQyJ9
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fixtures.d.ts","sourceRoot":"","sources":["../../src/fixtures/fixtures.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,YAAY,OAAO,CAAC;AAEjC,eAAO,MAAM,oBAAoB,wBAKhC,CAAC;AAEF,eAAO,MAAM,2BAA2B,OAAO,CAAC;AAChD,eAAO,MAAM,
|
|
1
|
+
{"version":3,"file":"fixtures.d.ts","sourceRoot":"","sources":["../../src/fixtures/fixtures.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,YAAY,OAAO,CAAC;AAEjC,eAAO,MAAM,oBAAoB,wBAKhC,CAAC;AAEF,eAAO,MAAM,2BAA2B,OAAO,CAAC;AAChD,eAAO,MAAM,8BAA8B,QAAS,CAAC;AAErD,eAAO,MAAM,QAAQ,gEAAgE,CAAC;AACtF,eAAO,MAAM,UAAU,qBAAyF,CAAC;AACjH,eAAO,MAAM,WAAW,qBAAyF,CAAC;AAGlH,eAAO,MAAM,oBAAoB,wDAAwD,CAAC;AAC1F,eAAO,MAAM,mBAAmB,mDAAmD,CAAC;AACpF,eAAO,MAAM,qBAAqB,+EAA+E,CAAC;AAElH,eAAO,MAAM,yBAAyB,QAAgC,CAAC;AACvE,eAAO,MAAM,qBAAqB,QACwE,CAAC;AAC3G,eAAO,MAAM,oCAAoC,QAA0C,CAAC;AAC5F,eAAO,MAAM,8BAA8B,QAAkE,CAAC"}
|