@aztec/end-to-end 2.1.0-rc.9 → 3.0.0-devnet.2
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/client_flows_benchmark.d.ts +16 -12
- package/dest/bench/client_flows/client_flows_benchmark.d.ts.map +1 -1
- package/dest/bench/client_flows/client_flows_benchmark.js +54 -58
- package/dest/bench/utils.d.ts +2 -11
- package/dest/bench/utils.d.ts.map +1 -1
- package/dest/bench/utils.js +10 -34
- package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts +7 -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 +42 -42
- package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts +10 -8
- 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 +31 -33
- package/dest/e2e_deploy_contract/deploy_test.d.ts +10 -4
- package/dest/e2e_deploy_contract/deploy_test.d.ts.map +1 -1
- package/dest/e2e_deploy_contract/deploy_test.js +9 -18
- package/dest/e2e_epochs/epochs_test.d.ts +3 -1
- package/dest/e2e_epochs/epochs_test.d.ts.map +1 -1
- package/dest/e2e_epochs/epochs_test.js +10 -9
- package/dest/e2e_fees/bridging_race.notest.js +12 -9
- package/dest/e2e_fees/fees_test.d.ts +5 -5
- package/dest/e2e_fees/fees_test.d.ts.map +1 -1
- package/dest/e2e_fees/fees_test.js +23 -31
- package/dest/e2e_l1_publisher/write_json.d.ts +3 -1
- package/dest/e2e_l1_publisher/write_json.d.ts.map +1 -1
- package/dest/e2e_l1_publisher/write_json.js +5 -5
- package/dest/e2e_multi_validator/utils.d.ts +1 -1
- package/dest/e2e_multi_validator/utils.d.ts.map +1 -1
- package/dest/e2e_nested_contract/nested_contract_test.d.ts +6 -3
- package/dest/e2e_nested_contract/nested_contract_test.d.ts.map +1 -1
- package/dest/e2e_nested_contract/nested_contract_test.js +7 -9
- package/dest/e2e_p2p/inactivity_slash_test.d.ts +2 -2
- package/dest/e2e_p2p/inactivity_slash_test.d.ts.map +1 -1
- package/dest/e2e_p2p/inactivity_slash_test.js +5 -2
- package/dest/e2e_p2p/p2p_network.d.ts +16 -4
- package/dest/e2e_p2p/p2p_network.d.ts.map +1 -1
- package/dest/e2e_p2p/p2p_network.js +32 -10
- package/dest/e2e_p2p/shared.d.ts +11 -13
- package/dest/e2e_p2p/shared.d.ts.map +1 -1
- package/dest/e2e_p2p/shared.js +49 -45
- package/dest/e2e_token_contract/token_contract_test.d.ts +5 -4
- package/dest/e2e_token_contract/token_contract_test.d.ts.map +1 -1
- package/dest/e2e_token_contract/token_contract_test.js +14 -17
- package/dest/fixtures/e2e_prover_test.d.ts +8 -6
- package/dest/fixtures/e2e_prover_test.d.ts.map +1 -1
- package/dest/fixtures/e2e_prover_test.js +40 -50
- 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_bb_config.d.ts +1 -1
- package/dest/fixtures/get_bb_config.d.ts.map +1 -1
- package/dest/fixtures/get_bb_config.js +2 -2
- package/dest/fixtures/setup_l1_contracts.d.ts +1 -1
- package/dest/fixtures/setup_l1_contracts.d.ts.map +1 -1
- package/dest/fixtures/setup_l1_contracts.js +2 -2
- package/dest/fixtures/setup_p2p_test.d.ts +0 -7
- package/dest/fixtures/setup_p2p_test.d.ts.map +1 -1
- package/dest/fixtures/snapshot_manager.d.ts +10 -7
- package/dest/fixtures/snapshot_manager.d.ts.map +1 -1
- package/dest/fixtures/snapshot_manager.js +44 -34
- package/dest/fixtures/token_utils.d.ts +6 -4
- package/dest/fixtures/token_utils.d.ts.map +1 -1
- package/dest/fixtures/token_utils.js +11 -15
- package/dest/fixtures/utils.d.ts +23 -27
- package/dest/fixtures/utils.d.ts.map +1 -1
- package/dest/fixtures/utils.js +76 -101
- package/dest/fixtures/web3signer.d.ts +1 -1
- package/dest/fixtures/web3signer.d.ts.map +1 -1
- package/dest/fixtures/web3signer.js +16 -5
- 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 +16 -10
- package/dest/shared/cross_chain_test_harness.d.ts.map +1 -1
- package/dest/shared/cross_chain_test_harness.js +13 -15
- package/dest/shared/gas_portal_test_harness.d.ts +9 -6
- package/dest/shared/gas_portal_test_harness.d.ts.map +1 -1
- package/dest/shared/gas_portal_test_harness.js +10 -7
- 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 +9 -6
- package/dest/shared/uniswap_l1_l2.d.ts.map +1 -1
- package/dest/shared/uniswap_l1_l2.js +29 -45
- package/dest/simulators/lending_simulator.d.ts +2 -1
- package/dest/simulators/lending_simulator.d.ts.map +1 -1
- package/dest/simulators/lending_simulator.js +3 -2
- package/dest/simulators/token_simulator.d.ts +3 -1
- package/dest/simulators/token_simulator.d.ts.map +1 -1
- package/dest/simulators/token_simulator.js +2 -2
- package/dest/spartan/setup_test_wallets.d.ts +19 -13
- package/dest/spartan/setup_test_wallets.d.ts.map +1 -1
- package/dest/spartan/setup_test_wallets.js +108 -85
- package/dest/spartan/utils.d.ts +44 -0
- package/dest/spartan/utils.d.ts.map +1 -1
- package/dest/spartan/utils.js +212 -20
- package/package.json +38 -37
- package/src/bench/client_flows/benchmark.ts +6 -6
- package/src/bench/client_flows/client_flows_benchmark.ts +62 -82
- package/src/bench/client_flows/data_extractor.ts +1 -1
- package/src/bench/utils.ts +9 -37
- package/src/e2e_blacklist_token_contract/blacklist_token_contract_test.ts +46 -63
- package/src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts +33 -47
- package/src/e2e_deploy_contract/deploy_test.ts +17 -35
- package/src/e2e_epochs/epochs_test.ts +12 -14
- package/src/e2e_fees/bridging_race.notest.ts +14 -9
- package/src/e2e_fees/fees_test.ts +26 -38
- package/src/e2e_l1_publisher/write_json.ts +8 -6
- package/src/e2e_multi_validator/utils.ts +1 -1
- package/src/e2e_nested_contract/nested_contract_test.ts +11 -10
- package/src/e2e_p2p/inactivity_slash_test.ts +7 -3
- package/src/e2e_p2p/p2p_network.ts +105 -67
- package/src/e2e_p2p/shared.ts +50 -55
- package/src/e2e_token_contract/token_contract_test.ts +17 -17
- package/src/fixtures/e2e_prover_test.ts +51 -88
- package/src/fixtures/get_acvm_config.ts +1 -1
- package/src/fixtures/get_bb_config.ts +3 -2
- package/src/fixtures/setup_l1_contracts.ts +3 -3
- package/src/fixtures/setup_p2p_test.ts +0 -8
- package/src/fixtures/snapshot_manager.ts +61 -61
- package/src/fixtures/token_utils.ts +13 -21
- package/src/fixtures/utils.ts +87 -138
- package/src/fixtures/web3signer.ts +22 -5
- package/src/guides/up_quick_start.sh +2 -10
- package/src/quality_of_service/alert_checker.ts +1 -1
- package/src/shared/cross_chain_test_harness.ts +18 -29
- package/src/shared/gas_portal_test_harness.ts +12 -19
- package/src/shared/jest_setup.ts +1 -1
- package/src/shared/submit-transactions.ts +12 -8
- package/src/shared/uniswap_l1_l2.ts +61 -67
- package/src/simulators/lending_simulator.ts +3 -2
- package/src/simulators/token_simulator.ts +5 -2
- package/src/spartan/DEVELOP.md +8 -3
- package/src/spartan/setup_test_wallets.ts +133 -126
- package/src/spartan/utils.ts +268 -18
package/dest/e2e_p2p/shared.js
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Fr
|
|
1
|
+
import { getContractInstanceFromInstantiationParams } from '@aztec/aztec.js/contracts';
|
|
2
|
+
import { Fr } from '@aztec/aztec.js/fields';
|
|
3
|
+
import { TxStatus } from '@aztec/aztec.js/tx';
|
|
3
4
|
import { timesAsync, unique } from '@aztec/foundation/collection';
|
|
5
|
+
import { retryUntil } from '@aztec/foundation/retry';
|
|
4
6
|
import { pluralize } from '@aztec/foundation/string';
|
|
5
7
|
import { TestContract, TestContractArtifact } from '@aztec/noir-test-contracts.js/Test';
|
|
6
|
-
import {
|
|
8
|
+
import { getPXEConfig, getPXEConfig as getRpcConfig } from '@aztec/pxe/server';
|
|
7
9
|
import { getRoundForOffense } from '@aztec/slasher';
|
|
10
|
+
import { TestWallet, proveInteraction } from '@aztec/test-wallet/server';
|
|
8
11
|
import { submitTxsTo } from '../shared/submit-transactions.js';
|
|
9
12
|
// submits a set of transactions to the provided Private eXecution Environment (PXE)
|
|
10
13
|
export const submitComplexTxsTo = async (logger, from, spamContract, numTxs, opts = {})=>{
|
|
@@ -27,51 +30,42 @@ export const submitComplexTxsTo = async (logger, from, spamContract, numTxs, opt
|
|
|
27
30
|
}
|
|
28
31
|
return txs;
|
|
29
32
|
};
|
|
30
|
-
// creates
|
|
31
|
-
export const
|
|
33
|
+
// creates a wallet and submit a given number of transactions through it.
|
|
34
|
+
export const submitTransactions = async (logger, node, numTxs, fundedAccount)=>{
|
|
32
35
|
const rpcConfig = getRpcConfig();
|
|
33
36
|
rpcConfig.proverEnabled = false;
|
|
34
|
-
const
|
|
37
|
+
const wallet = await TestWallet.create(node, {
|
|
38
|
+
...getPXEConfig(),
|
|
39
|
+
proverEnabled: false
|
|
40
|
+
}, {
|
|
35
41
|
useLogSuffix: true
|
|
36
42
|
});
|
|
37
|
-
const
|
|
38
|
-
|
|
39
|
-
const wallet = await account.getWallet();
|
|
40
|
-
const txs = await submitTxsTo(pxeService, numTxs, wallet, logger);
|
|
41
|
-
return {
|
|
42
|
-
txs,
|
|
43
|
-
pxeService,
|
|
44
|
-
node
|
|
45
|
-
};
|
|
43
|
+
const fundedAccountManager = await wallet.createSchnorrAccount(fundedAccount.secret, fundedAccount.salt);
|
|
44
|
+
return submitTxsTo(wallet, fundedAccountManager.address, numTxs, logger);
|
|
46
45
|
};
|
|
47
|
-
export async function
|
|
46
|
+
export async function prepareTransactions(logger, node, numTxs, fundedAccount) {
|
|
48
47
|
const rpcConfig = getRpcConfig();
|
|
49
48
|
rpcConfig.proverEnabled = false;
|
|
50
|
-
const
|
|
49
|
+
const wallet = await TestWallet.create(node, {
|
|
50
|
+
...getPXEConfig(),
|
|
51
|
+
proverEnabled: false
|
|
52
|
+
}, {
|
|
51
53
|
useLogSuffix: true
|
|
52
54
|
});
|
|
53
|
-
const
|
|
54
|
-
await
|
|
55
|
-
|
|
56
|
-
const testContractInstance = await getContractInstanceFromInstantiationParams(TestContractArtifact, {});
|
|
57
|
-
await wallet.registerContract({
|
|
58
|
-
instance: testContractInstance,
|
|
59
|
-
artifact: TestContractArtifact
|
|
55
|
+
const fundedAccountManager = await wallet.createSchnorrAccount(fundedAccount.secret, fundedAccount.salt);
|
|
56
|
+
const testContractInstance = await getContractInstanceFromInstantiationParams(TestContractArtifact, {
|
|
57
|
+
salt: Fr.random()
|
|
60
58
|
});
|
|
59
|
+
await wallet.registerContract(testContractInstance, TestContractArtifact);
|
|
61
60
|
const contract = await TestContract.at(testContractInstance.address, wallet);
|
|
62
|
-
|
|
63
|
-
const tx = await contract.methods.emit_nullifier(Fr.random())
|
|
64
|
-
from:
|
|
61
|
+
return timesAsync(numTxs, async ()=>{
|
|
62
|
+
const tx = await proveInteraction(wallet, contract.methods.emit_nullifier(Fr.random()), {
|
|
63
|
+
from: fundedAccountManager.address
|
|
65
64
|
});
|
|
66
65
|
const txHash = tx.getTxHash();
|
|
67
66
|
logger.info(`Tx prepared with hash ${txHash}`);
|
|
68
67
|
return tx;
|
|
69
68
|
});
|
|
70
|
-
return {
|
|
71
|
-
txs,
|
|
72
|
-
pxeService: pxe,
|
|
73
|
-
node
|
|
74
|
-
};
|
|
75
69
|
}
|
|
76
70
|
export function awaitProposalExecution(slashingProposer, timeoutSeconds, logger) {
|
|
77
71
|
return new Promise((resolve, reject)=>{
|
|
@@ -108,7 +102,7 @@ export async function awaitCommitteeExists({ rollup, logger }) {
|
|
|
108
102
|
}, 'non-empty committee', 60);
|
|
109
103
|
return committee;
|
|
110
104
|
}
|
|
111
|
-
export async function awaitOffenseDetected({ logger, nodeAdmin, slashingRoundSize, epochDuration, waitUntilOffenseCount }) {
|
|
105
|
+
export async function awaitOffenseDetected({ logger, nodeAdmin, slashingRoundSize, epochDuration, waitUntilOffenseCount, timeoutSeconds = 120 }) {
|
|
112
106
|
const targetOffenseCount = waitUntilOffenseCount ?? 1;
|
|
113
107
|
logger.warn(`Waiting for ${pluralize('offense', targetOffenseCount)} to be detected`);
|
|
114
108
|
const offenses = await retryUntil(async ()=>{
|
|
@@ -116,27 +110,28 @@ export async function awaitOffenseDetected({ logger, nodeAdmin, slashingRoundSiz
|
|
|
116
110
|
if (offenses.length >= targetOffenseCount) {
|
|
117
111
|
return offenses;
|
|
118
112
|
}
|
|
119
|
-
}, 'non-empty offenses',
|
|
113
|
+
}, 'non-empty offenses', timeoutSeconds);
|
|
120
114
|
logger.info(`Hit ${offenses.length} offenses on rounds ${unique(offenses.map((o)=>getRoundForOffense(o, {
|
|
121
115
|
slashingRoundSize,
|
|
122
116
|
epochDuration
|
|
123
|
-
})))}`,
|
|
117
|
+
})))}`, {
|
|
118
|
+
offenses
|
|
119
|
+
});
|
|
124
120
|
return offenses;
|
|
125
121
|
}
|
|
126
122
|
/**
|
|
127
123
|
* Await the committee to be slashed out of the validator set.
|
|
128
124
|
* Currently assumes that the committee is the same size as the validator set.
|
|
129
|
-
*/ export async function awaitCommitteeKicked({ rollup, cheatCodes, committee, slashFactory, slashingProposer, slashingRoundSize, aztecSlotDuration, logger,
|
|
125
|
+
*/ export async function awaitCommitteeKicked({ rollup, cheatCodes, committee, slashFactory, slashingProposer, slashingRoundSize, aztecSlotDuration, aztecEpochDuration, logger, offenseEpoch }) {
|
|
130
126
|
if (!slashingProposer) {
|
|
131
127
|
throw new Error('No slashing proposer configured. Cannot test slashing.');
|
|
132
128
|
}
|
|
133
|
-
logger.info(`Advancing epochs so we start slashing`);
|
|
134
129
|
await cheatCodes.debugRollup();
|
|
135
|
-
await cheatCodes.advanceToEpoch(await cheatCodes.getEpoch() + await rollup.getLagInEpochs() + 1n, {
|
|
136
|
-
updateDateProvider: dateProvider
|
|
137
|
-
});
|
|
138
|
-
// Await for the slash payload to be created if empire (no payload is created on tally until execution time)
|
|
139
130
|
if (slashingProposer.type === 'empire') {
|
|
131
|
+
// Await for the slash payload to be created if empire (no payload is created on tally until execution time)
|
|
132
|
+
const targetEpoch = await cheatCodes.getEpoch() + await rollup.getLagInEpochs() + 1n;
|
|
133
|
+
logger.info(`Advancing to epoch ${targetEpoch} so we start slashing`);
|
|
134
|
+
await cheatCodes.advanceToEpoch(targetEpoch);
|
|
140
135
|
const slashPayloadEvents = await retryUntil(async ()=>{
|
|
141
136
|
const events = await slashFactory.getSlashPayloadCreatedEvents();
|
|
142
137
|
return events.length > 0 ? events : undefined;
|
|
@@ -144,6 +139,17 @@ export async function awaitOffenseDetected({ logger, nodeAdmin, slashingRoundSiz
|
|
|
144
139
|
expect(slashPayloadEvents.length).toBe(1);
|
|
145
140
|
// The uniqueness check is needed since a validator may be slashed more than once on the same round (eg because they let two epochs be pruned)
|
|
146
141
|
expect(unique(slashPayloadEvents[0].slashes.map((slash)=>slash.validator.toString()))).toHaveLength(committee.length);
|
|
142
|
+
} else {
|
|
143
|
+
// Use the slash offset to ensure we are in the right epoch for tally
|
|
144
|
+
const slashOffsetInRounds = await slashingProposer.getSlashOffsetInRounds();
|
|
145
|
+
const slashingRoundSizeInEpochs = slashingRoundSize / aztecEpochDuration;
|
|
146
|
+
const slashingOffsetInEpochs = Number(slashOffsetInRounds) * slashingRoundSizeInEpochs;
|
|
147
|
+
const firstEpochInOffenseRound = offenseEpoch - offenseEpoch % slashingRoundSizeInEpochs;
|
|
148
|
+
const targetEpoch = firstEpochInOffenseRound + slashingOffsetInEpochs;
|
|
149
|
+
logger.info(`Advancing to epoch ${targetEpoch} so we start slashing`);
|
|
150
|
+
await cheatCodes.advanceToEpoch(targetEpoch, {
|
|
151
|
+
offset: -aztecSlotDuration / 2
|
|
152
|
+
});
|
|
147
153
|
}
|
|
148
154
|
const attestersPre = await rollup.getAttesters();
|
|
149
155
|
expect(attestersPre.length).toBe(committee.length);
|
|
@@ -151,7 +157,7 @@ export async function awaitOffenseDetected({ logger, nodeAdmin, slashingRoundSiz
|
|
|
151
157
|
const attesterInfo = await rollup.getAttesterView(attester);
|
|
152
158
|
expect(attesterInfo.status).toEqual(1); // Validating
|
|
153
159
|
}
|
|
154
|
-
const timeout = slashingRoundSize * 2 * aztecSlotDuration;
|
|
160
|
+
const timeout = slashingRoundSize * 2 * aztecSlotDuration + 30;
|
|
155
161
|
logger.info(`Waiting for slash to be executed (timeout ${timeout}s)`);
|
|
156
162
|
await awaitProposalExecution(slashingProposer, timeout, logger);
|
|
157
163
|
// The attesters should still form the committee but they should be reduced to the "living" status
|
|
@@ -166,9 +172,7 @@ export async function awaitOffenseDetected({ logger, nodeAdmin, slashingRoundSiz
|
|
|
166
172
|
}
|
|
167
173
|
logger.info(`Advancing to check current committee`);
|
|
168
174
|
await cheatCodes.debugRollup();
|
|
169
|
-
await cheatCodes.advanceToEpoch(await cheatCodes.getEpoch() + await rollup.getLagInEpochs() + 1n
|
|
170
|
-
updateDateProvider: dateProvider
|
|
171
|
-
});
|
|
175
|
+
await cheatCodes.advanceToEpoch(await cheatCodes.getEpoch() + await rollup.getLagInEpochs() + 1n);
|
|
172
176
|
await cheatCodes.debugRollup();
|
|
173
177
|
const committeeNextEpoch = await rollup.getCurrentEpochCommittee();
|
|
174
178
|
// The committee should be undefined, since the validator set is empty
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AztecAddress } from '@aztec/aztec.js/addresses';
|
|
2
|
+
import { type Logger } from '@aztec/aztec.js/log';
|
|
3
|
+
import type { AztecNode } from '@aztec/aztec.js/node';
|
|
2
4
|
import { TokenContract } from '@aztec/noir-contracts.js/Token';
|
|
3
5
|
import { InvalidAccountContract } from '@aztec/noir-test-contracts.js/InvalidAccount';
|
|
6
|
+
import type { TestWallet } from '@aztec/test-wallet/server';
|
|
4
7
|
import { type SubsystemsContext } from '../fixtures/snapshot_manager.js';
|
|
5
8
|
import { TokenSimulator } from '../simulators/token_simulator.js';
|
|
6
9
|
export declare class TokenContractTest {
|
|
@@ -13,11 +16,9 @@ export declare class TokenContractTest {
|
|
|
13
16
|
tokenSim: TokenSimulator;
|
|
14
17
|
node: AztecNode;
|
|
15
18
|
badAccount: InvalidAccountContract;
|
|
16
|
-
|
|
19
|
+
wallet: TestWallet;
|
|
17
20
|
adminAddress: AztecAddress;
|
|
18
|
-
account1: AccountWallet;
|
|
19
21
|
account1Address: AztecAddress;
|
|
20
|
-
account2: AccountWallet;
|
|
21
22
|
account2Address: AztecAddress;
|
|
22
23
|
constructor(testName: string);
|
|
23
24
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"token_contract_test.d.ts","sourceRoot":"","sources":["../../src/e2e_token_contract/token_contract_test.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"token_contract_test.d.ts","sourceRoot":"","sources":["../../src/e2e_token_contract/token_contract_test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,KAAK,MAAM,EAAgB,MAAM,qBAAqB,CAAC;AAChE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAC/D,OAAO,EAAE,sBAAsB,EAAE,MAAM,8CAA8C,CAAC;AACtF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAI5D,OAAO,EAEL,KAAK,iBAAiB,EAIvB,MAAM,iCAAiC,CAAC;AAEzC,OAAO,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAIlE,qBAAa,iBAAiB;IAC5B,MAAM,CAAC,UAAU,SAAU;IAC3B,MAAM,CAAC,YAAY,SAAS;IAC5B,MAAM,CAAC,cAAc,SAAO;IAC5B,OAAO,CAAC,eAAe,CAAmB;IAC1C,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAG,aAAa,CAAC;IACtB,QAAQ,EAAG,cAAc,CAAC;IAC1B,IAAI,EAAG,SAAS,CAAC;IAEjB,UAAU,EAAG,sBAAsB,CAAC;IACpC,MAAM,EAAG,UAAU,CAAC;IACpB,YAAY,EAAG,YAAY,CAAC;IAC5B,eAAe,EAAG,YAAY,CAAC;IAC/B,eAAe,EAAG,YAAY,CAAC;gBAEnB,QAAQ,EAAE,MAAM;IAO5B;;;;OAIG;IACG,kBAAkB;IAkElB,KAAK;IAIX,QAAQ,GAAI,CAAC,EACX,MAAM,MAAM,EACZ,OAAO,CAAC,OAAO,EAAE,iBAAiB,KAAK,OAAO,CAAC,CAAC,CAAC,EACjD,UAAS,CAAC,YAAY,EAAE,CAAC,EAAE,OAAO,EAAE,iBAAiB,KAAK,OAAO,CAAC,IAAI,CAA2B,KAChG,OAAO,CAAC,IAAI,CAAC,CAAwD;IAElE,QAAQ;IAIR,iBAAiB;CAqCxB"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { createLogger } from '@aztec/aztec.js';
|
|
1
|
+
import { createLogger } from '@aztec/aztec.js/log';
|
|
3
2
|
import { TokenContract } from '@aztec/noir-contracts.js/Token';
|
|
4
3
|
import { InvalidAccountContract } from '@aztec/noir-test-contracts.js/InvalidAccount';
|
|
5
4
|
import { jest } from '@jest/globals';
|
|
@@ -17,11 +16,9 @@ export class TokenContractTest {
|
|
|
17
16
|
tokenSim;
|
|
18
17
|
node;
|
|
19
18
|
badAccount;
|
|
20
|
-
|
|
19
|
+
wallet;
|
|
21
20
|
adminAddress;
|
|
22
|
-
account1;
|
|
23
21
|
account1Address;
|
|
24
|
-
account2;
|
|
25
22
|
account2Address;
|
|
26
23
|
constructor(testName){
|
|
27
24
|
this.logger = createLogger(`e2e:e2e_token_contract:${testName}`);
|
|
@@ -36,27 +33,27 @@ export class TokenContractTest {
|
|
|
36
33
|
*/ async applyBaseSnapshots() {
|
|
37
34
|
// Adding a timeout of 2 minutes in here such that it is propagated to the underlying tests
|
|
38
35
|
jest.setTimeout(120_000);
|
|
39
|
-
await this.snapshotManager.snapshot('3_accounts', deployAccounts(3, this.logger),
|
|
36
|
+
await this.snapshotManager.snapshot('3_accounts', deployAccounts(3, this.logger), ({ deployedAccounts }, { wallet, aztecNode })=>{
|
|
40
37
|
this.node = aztecNode;
|
|
41
|
-
|
|
42
|
-
[this.
|
|
43
|
-
|
|
38
|
+
this.wallet = wallet;
|
|
39
|
+
[this.adminAddress, this.account1Address, this.account2Address] = deployedAccounts.map((acc)=>acc.address);
|
|
40
|
+
return Promise.resolve();
|
|
44
41
|
});
|
|
45
42
|
await this.snapshotManager.snapshot('e2e_token_contract', async ()=>{
|
|
46
43
|
// Create the token contract state.
|
|
47
44
|
// Move this account thing to addAccounts above?
|
|
48
45
|
this.logger.verbose(`Public deploy accounts...`);
|
|
49
|
-
await publicDeployAccounts(this.
|
|
46
|
+
await publicDeployAccounts(this.wallet, [
|
|
50
47
|
this.adminAddress,
|
|
51
48
|
this.account1Address
|
|
52
49
|
]);
|
|
53
50
|
this.logger.verbose(`Deploying TokenContract...`);
|
|
54
|
-
const asset = await TokenContract.deploy(this.
|
|
51
|
+
const asset = await TokenContract.deploy(this.wallet, this.adminAddress, TokenContractTest.TOKEN_NAME, TokenContractTest.TOKEN_SYMBOL, TokenContractTest.TOKEN_DECIMALS).send({
|
|
55
52
|
from: this.adminAddress
|
|
56
53
|
}).deployed();
|
|
57
54
|
this.logger.verbose(`Token deployed to ${asset.address}`);
|
|
58
55
|
this.logger.verbose(`Deploying bad account...`);
|
|
59
|
-
this.badAccount = await InvalidAccountContract.deploy(this.
|
|
56
|
+
this.badAccount = await InvalidAccountContract.deploy(this.wallet).send({
|
|
60
57
|
from: this.adminAddress
|
|
61
58
|
}).deployed();
|
|
62
59
|
this.logger.verbose(`Deployed to ${this.badAccount.address}.`);
|
|
@@ -66,13 +63,13 @@ export class TokenContractTest {
|
|
|
66
63
|
};
|
|
67
64
|
}, async ({ tokenContractAddress, badAccountAddress })=>{
|
|
68
65
|
// Restore the token contract state.
|
|
69
|
-
this.asset = await TokenContract.at(tokenContractAddress, this.
|
|
66
|
+
this.asset = await TokenContract.at(tokenContractAddress, this.wallet);
|
|
70
67
|
this.logger.verbose(`Token contract address: ${this.asset.address}`);
|
|
71
|
-
this.tokenSim = new TokenSimulator(this.asset, this.
|
|
68
|
+
this.tokenSim = new TokenSimulator(this.asset, this.wallet, this.adminAddress, this.logger, [
|
|
72
69
|
this.adminAddress,
|
|
73
70
|
this.account1Address
|
|
74
71
|
]);
|
|
75
|
-
this.badAccount = await InvalidAccountContract.at(badAccountAddress, this.
|
|
72
|
+
this.badAccount = await InvalidAccountContract.at(badAccountAddress, this.wallet);
|
|
76
73
|
this.logger.verbose(`Bad account address: ${this.badAccount.address}`);
|
|
77
74
|
expect(await this.asset.methods.get_admin().simulate({
|
|
78
75
|
from: this.adminAddress
|
|
@@ -92,14 +89,14 @@ export class TokenContractTest {
|
|
|
92
89
|
}
|
|
93
90
|
async applyMintSnapshot() {
|
|
94
91
|
await this.snapshotManager.snapshot('mint', async ()=>{
|
|
95
|
-
const { asset,
|
|
92
|
+
const { asset, adminAddress } = this;
|
|
96
93
|
const amount = 10000n;
|
|
97
94
|
this.logger.verbose(`Minting ${amount} publicly...`);
|
|
98
95
|
await asset.methods.mint_to_public(adminAddress, amount).send({
|
|
99
96
|
from: adminAddress
|
|
100
97
|
}).wait();
|
|
101
98
|
this.logger.verbose(`Minting ${amount} privately...`);
|
|
102
|
-
await mintTokensToPrivate(asset, adminAddress,
|
|
99
|
+
await mintTokensToPrivate(asset, adminAddress, adminAddress, amount);
|
|
103
100
|
this.logger.verbose(`Minting complete.`);
|
|
104
101
|
return {
|
|
105
102
|
amount
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import type { InitialAccountData } from '@aztec/accounts/testing';
|
|
2
|
-
import {
|
|
2
|
+
import { AztecAddress, EthAddress } from '@aztec/aztec.js/addresses';
|
|
3
|
+
import { type Logger } from '@aztec/aztec.js/log';
|
|
4
|
+
import type { AztecNode } from '@aztec/aztec.js/node';
|
|
3
5
|
import { CheatCodes } from '@aztec/aztec/testing';
|
|
4
6
|
import { type ClientProtocolCircuitVerifier } from '@aztec/bb-prover';
|
|
5
7
|
import type { BlobSinkServer } from '@aztec/blob-sink/server';
|
|
6
8
|
import type { DeployL1ContractsReturnType } from '@aztec/ethereum';
|
|
7
9
|
import { TokenContract } from '@aztec/noir-contracts.js/Token';
|
|
8
|
-
import type { PXEService } from '@aztec/pxe/server';
|
|
9
10
|
import type { AztecNodeAdmin } from '@aztec/stdlib/interfaces/client';
|
|
11
|
+
import { TestWallet } from '@aztec/test-wallet/server';
|
|
10
12
|
import { TokenSimulator } from '../simulators/token_simulator.js';
|
|
11
13
|
import { type SubsystemsContext } from './snapshot_manager.js';
|
|
12
14
|
/**
|
|
@@ -23,21 +25,21 @@ export declare class FullProverTest {
|
|
|
23
25
|
static TOKEN_DECIMALS: bigint;
|
|
24
26
|
private snapshotManager;
|
|
25
27
|
logger: Logger;
|
|
28
|
+
wallet: TestWallet;
|
|
29
|
+
provenWallet: TestWallet;
|
|
30
|
+
accounts: AztecAddress[];
|
|
26
31
|
deployedAccounts: InitialAccountData[];
|
|
27
|
-
wallets: AccountWalletWithSecretKey[];
|
|
28
|
-
accounts: CompleteAddress[];
|
|
29
32
|
fakeProofsAsset: TokenContract;
|
|
30
33
|
tokenSim: TokenSimulator;
|
|
31
34
|
aztecNode: AztecNode;
|
|
32
35
|
aztecNodeAdmin: AztecNodeAdmin;
|
|
33
|
-
pxe: PXEService;
|
|
34
36
|
cheatCodes: CheatCodes;
|
|
35
37
|
blobSink: BlobSinkServer;
|
|
36
38
|
private provenComponents;
|
|
37
39
|
private bbConfigCleanup?;
|
|
38
40
|
private acvmConfigCleanup?;
|
|
39
41
|
circuitProofVerifier?: ClientProtocolCircuitVerifier;
|
|
40
|
-
|
|
42
|
+
provenAsset: TokenContract;
|
|
41
43
|
private context;
|
|
42
44
|
private proverNode;
|
|
43
45
|
private simulatedProverNode;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"e2e_prover_test.d.ts","sourceRoot":"","sources":["../../src/fixtures/e2e_prover_test.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"e2e_prover_test.d.ts","sourceRoot":"","sources":["../../src/fixtures/e2e_prover_test.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAElE,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACrE,OAAO,EAAE,KAAK,MAAM,EAAgB,MAAM,qBAAqB,CAAC;AAChE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAEL,KAAK,6BAA6B,EAGnC,MAAM,kBAAkB,CAAC;AAE1B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,iBAAiB,CAAC;AAInE,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAE/D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAMvD,OAAO,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAGlE,OAAO,EAEL,KAAK,iBAAiB,EAIvB,MAAM,uBAAuB,CAAC;AAU/B;;;;;GAKG;AAEH,qBAAa,cAAc;IA6BvB,OAAO,CAAC,sBAAsB;IAE9B,OAAO,CAAC,UAAU;IA9BpB,MAAM,CAAC,UAAU,SAAU;IAC3B,MAAM,CAAC,YAAY,SAAS;IAC5B,MAAM,CAAC,cAAc,SAAO;IAC5B,OAAO,CAAC,eAAe,CAAmB;IAC1C,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAG,UAAU,CAAC;IACpB,YAAY,EAAG,UAAU,CAAC;IAC1B,QAAQ,EAAE,YAAY,EAAE,CAAM;IAC9B,gBAAgB,EAAG,kBAAkB,EAAE,CAAC;IACxC,eAAe,EAAG,aAAa,CAAC;IAChC,QAAQ,EAAG,cAAc,CAAC;IAC1B,SAAS,EAAG,SAAS,CAAC;IACtB,cAAc,EAAG,cAAc,CAAC;IAChC,UAAU,EAAG,UAAU,CAAC;IACxB,QAAQ,EAAG,cAAc,CAAC;IAC1B,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,CAAC,OAAO,CAAqB;IACpC,OAAO,CAAC,UAAU,CAAc;IAChC,OAAO,CAAC,mBAAmB,CAAc;IAClC,WAAW,EAAG,2BAA2B,CAAC;IAC1C,aAAa,EAAG,UAAU,CAAC;gBAGhC,QAAQ,EAAE,MAAM,EACR,sBAAsB,EAAE,MAAM,EACtC,QAAQ,EAAE,UAAU,EACZ,UAAU,UAAO;IAa3B;;;;OAIG;IACG,kBAAkB;IAsDlB,KAAK;YA6IG,YAAY;IAS1B,QAAQ,GAAI,CAAC,EACX,MAAM,MAAM,EACZ,OAAO,CAAC,OAAO,EAAE,iBAAiB,KAAK,OAAO,CAAC,CAAC,CAAC,EACjD,UAAS,CAAC,YAAY,EAAE,CAAC,EAAE,OAAO,EAAE,iBAAiB,KAAK,OAAO,CAAC,IAAI,CAA2B,KAChG,OAAO,CAAC,IAAI,CAAC,CAAwD;IAElE,QAAQ;IAeR,iBAAiB;CA8CxB"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { SchnorrAccountContractArtifact, getSchnorrAccount, getSchnorrWalletWithSecretKey } from '@aztec/accounts/schnorr';
|
|
2
1
|
import { createArchiver } from '@aztec/archiver';
|
|
3
|
-
import { EthAddress
|
|
2
|
+
import { EthAddress } from '@aztec/aztec.js/addresses';
|
|
3
|
+
import { createLogger } from '@aztec/aztec.js/log';
|
|
4
4
|
import { BBCircuitVerifier, QueuedIVCVerifier, TestCircuitVerifier } from '@aztec/bb-prover';
|
|
5
5
|
import { createBlobSinkClient } from '@aztec/blob-sink/client';
|
|
6
6
|
import { Buffer32 } from '@aztec/foundation/buffer';
|
|
@@ -15,7 +15,7 @@ import { TokenSimulator } from '../simulators/token_simulator.js';
|
|
|
15
15
|
import { getACVMConfig } from './get_acvm_config.js';
|
|
16
16
|
import { getBBConfig } from './get_bb_config.js';
|
|
17
17
|
import { createSnapshotManager, deployAccounts, publicDeployAccounts } from './snapshot_manager.js';
|
|
18
|
-
import { getPrivateKeyFromIndex, getSponsoredFPCAddress,
|
|
18
|
+
import { getPrivateKeyFromIndex, getSponsoredFPCAddress, setupPXEAndGetWallet } from './utils.js';
|
|
19
19
|
const { E2E_DATA_PATH: dataPath } = process.env;
|
|
20
20
|
/**
|
|
21
21
|
* Largely taken from the e2e_token_contract test file. We deploy 2 accounts and a token contract.
|
|
@@ -30,21 +30,21 @@ const { E2E_DATA_PATH: dataPath } = process.env;
|
|
|
30
30
|
static TOKEN_DECIMALS = 18n;
|
|
31
31
|
snapshotManager;
|
|
32
32
|
logger;
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
wallet;
|
|
34
|
+
provenWallet;
|
|
35
35
|
accounts;
|
|
36
|
+
deployedAccounts;
|
|
36
37
|
fakeProofsAsset;
|
|
37
38
|
tokenSim;
|
|
38
39
|
aztecNode;
|
|
39
40
|
aztecNodeAdmin;
|
|
40
|
-
pxe;
|
|
41
41
|
cheatCodes;
|
|
42
42
|
blobSink;
|
|
43
43
|
provenComponents;
|
|
44
44
|
bbConfigCleanup;
|
|
45
45
|
acvmConfigCleanup;
|
|
46
46
|
circuitProofVerifier;
|
|
47
|
-
|
|
47
|
+
provenAsset;
|
|
48
48
|
context;
|
|
49
49
|
proverNode;
|
|
50
50
|
simulatedProverNode;
|
|
@@ -53,11 +53,8 @@ const { E2E_DATA_PATH: dataPath } = process.env;
|
|
|
53
53
|
constructor(testName, minNumberOfTxsPerBlock, coinbase, realProofs = true){
|
|
54
54
|
this.minNumberOfTxsPerBlock = minNumberOfTxsPerBlock;
|
|
55
55
|
this.realProofs = realProofs;
|
|
56
|
-
this.deployedAccounts = [];
|
|
57
|
-
this.wallets = [];
|
|
58
56
|
this.accounts = [];
|
|
59
57
|
this.provenComponents = [];
|
|
60
|
-
this.provenAssets = [];
|
|
61
58
|
this.snapshot = (name, apply, restore = ()=>Promise.resolve())=>this.snapshotManager.snapshot(name, apply, restore);
|
|
62
59
|
this.logger = createLogger(`e2e:full_prover_test:${testName}`);
|
|
63
60
|
this.snapshotManager = createSnapshotManager(`full_prover_integration/${testName}`, dataPath, {
|
|
@@ -73,20 +70,20 @@ const { E2E_DATA_PATH: dataPath } = process.env;
|
|
|
73
70
|
* 1. Add 2 accounts.
|
|
74
71
|
* 2. Publicly deploy accounts, deploy token contract
|
|
75
72
|
*/ async applyBaseSnapshots() {
|
|
76
|
-
await this.snapshotManager.snapshot('2_accounts', deployAccounts(2, this.logger),
|
|
73
|
+
await this.snapshotManager.snapshot('2_accounts', deployAccounts(2, this.logger), ({ deployedAccounts }, { wallet })=>{
|
|
77
74
|
this.deployedAccounts = deployedAccounts;
|
|
78
|
-
this.
|
|
79
|
-
this.
|
|
80
|
-
|
|
75
|
+
this.accounts = deployedAccounts.map((a)=>a.address);
|
|
76
|
+
this.wallet = wallet;
|
|
77
|
+
return Promise.resolve();
|
|
81
78
|
});
|
|
82
79
|
await this.snapshotManager.snapshot('client_prover_integration', async ()=>{
|
|
83
80
|
// Create the token contract state.
|
|
84
81
|
// Move this account thing to addAccounts above?
|
|
85
82
|
this.logger.verbose(`Public deploy accounts...`);
|
|
86
|
-
await publicDeployAccounts(this.
|
|
83
|
+
await publicDeployAccounts(this.wallet, this.accounts.slice(0, 2));
|
|
87
84
|
this.logger.verbose(`Deploying TokenContract...`);
|
|
88
|
-
const asset = await TokenContract.deploy(this.
|
|
89
|
-
from: this.
|
|
85
|
+
const asset = await TokenContract.deploy(this.wallet, this.accounts[0], FullProverTest.TOKEN_NAME, FullProverTest.TOKEN_SYMBOL, FullProverTest.TOKEN_DECIMALS).send({
|
|
86
|
+
from: this.accounts[0]
|
|
90
87
|
}).deployed();
|
|
91
88
|
this.logger.verbose(`Token deployed to ${asset.address}`);
|
|
92
89
|
return {
|
|
@@ -94,12 +91,12 @@ const { E2E_DATA_PATH: dataPath } = process.env;
|
|
|
94
91
|
};
|
|
95
92
|
}, async ({ tokenContractAddress })=>{
|
|
96
93
|
// Restore the token contract state.
|
|
97
|
-
this.fakeProofsAsset = await TokenContract.at(tokenContractAddress, this.
|
|
94
|
+
this.fakeProofsAsset = await TokenContract.at(tokenContractAddress, this.wallet);
|
|
98
95
|
this.logger.verbose(`Token contract address: ${this.fakeProofsAsset.address}`);
|
|
99
|
-
this.tokenSim = new TokenSimulator(this.fakeProofsAsset, this.
|
|
96
|
+
this.tokenSim = new TokenSimulator(this.fakeProofsAsset, this.wallet, this.accounts[0], this.logger, this.accounts);
|
|
100
97
|
expect(await this.fakeProofsAsset.methods.get_admin().simulate({
|
|
101
|
-
from: this.accounts[0]
|
|
102
|
-
})).toBe(this.accounts[0].
|
|
98
|
+
from: this.accounts[0]
|
|
99
|
+
})).toBe(this.accounts[0].toBigInt());
|
|
103
100
|
});
|
|
104
101
|
}
|
|
105
102
|
async setup() {
|
|
@@ -107,7 +104,7 @@ const { E2E_DATA_PATH: dataPath } = process.env;
|
|
|
107
104
|
// We don't wish to mark as proven automatically, so we set the flag to false
|
|
108
105
|
this.context.watcher.setIsMarkingAsProven(false);
|
|
109
106
|
this.simulatedProverNode = this.context.proverNode;
|
|
110
|
-
({
|
|
107
|
+
({ aztecNode: this.aztecNode, deployL1ContractsValues: this.l1Contracts, cheatCodes: this.cheatCodes, blobSink: this.blobSink } = this.context);
|
|
111
108
|
this.aztecNodeAdmin = this.context.aztecNode;
|
|
112
109
|
const blobSinkClient = createBlobSinkClient({
|
|
113
110
|
blobSinkUrl: `http://localhost:${this.blobSink.port}`
|
|
@@ -147,31 +144,24 @@ const { E2E_DATA_PATH: dataPath } = process.env;
|
|
|
147
144
|
this.logger.verbose(`Marking current block as proven`);
|
|
148
145
|
await this.context.cheatCodes.rollup.markAsProven();
|
|
149
146
|
this.logger.verbose(`Main setup completed, initializing full prover PXE, Node, and Prover Node`);
|
|
147
|
+
const { wallet: provenWallet, teardown: provenTeardown } = await setupPXEAndGetWallet(this.aztecNode, {
|
|
148
|
+
proverEnabled: this.realProofs,
|
|
149
|
+
bbBinaryPath: bbConfig?.bbBinaryPath,
|
|
150
|
+
bbWorkingDirectory: bbConfig?.bbWorkingDirectory
|
|
151
|
+
}, undefined, true);
|
|
152
|
+
this.logger.debug(`Contract address ${this.fakeProofsAsset.address}`);
|
|
153
|
+
await provenWallet.registerContract(this.fakeProofsAsset);
|
|
150
154
|
for(let i = 0; i < 2; i++){
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
bbBinaryPath: bbConfig?.bbBinaryPath,
|
|
154
|
-
bbWorkingDirectory: bbConfig?.bbWorkingDirectory
|
|
155
|
-
}, undefined, true);
|
|
156
|
-
this.logger.debug(`Contract address ${this.fakeProofsAsset.address}`);
|
|
157
|
-
await result.pxe.registerContract(this.fakeProofsAsset);
|
|
158
|
-
for(let i = 0; i < 2; i++){
|
|
159
|
-
await result.pxe.registerAccount(this.deployedAccounts[i].secret, this.wallets[i].getCompleteAddress().partialAddress);
|
|
160
|
-
await this.pxe.registerAccount(this.deployedAccounts[i].secret, this.wallets[i].getCompleteAddress().partialAddress);
|
|
161
|
-
}
|
|
162
|
-
const account = await getSchnorrAccount(result.pxe, this.deployedAccounts[0].secret, this.deployedAccounts[0].signingKey, this.deployedAccounts[0].salt);
|
|
163
|
-
await result.pxe.registerContract({
|
|
164
|
-
instance: account.getInstance(),
|
|
165
|
-
artifact: SchnorrAccountContractArtifact
|
|
166
|
-
});
|
|
167
|
-
const provenWallet = await account.getWallet();
|
|
168
|
-
const asset = await TokenContract.at(this.fakeProofsAsset.address, provenWallet);
|
|
169
|
-
this.provenComponents.push({
|
|
170
|
-
pxe: result.pxe,
|
|
171
|
-
teardown: result.teardown
|
|
172
|
-
});
|
|
173
|
-
this.provenAssets.push(asset);
|
|
155
|
+
await provenWallet.createSchnorrAccount(this.deployedAccounts[i].secret, this.deployedAccounts[i].salt);
|
|
156
|
+
await this.wallet.createSchnorrAccount(this.deployedAccounts[i].secret, this.deployedAccounts[i].salt);
|
|
174
157
|
}
|
|
158
|
+
const asset = await TokenContract.at(this.fakeProofsAsset.address, provenWallet);
|
|
159
|
+
this.provenComponents.push({
|
|
160
|
+
wallet: provenWallet,
|
|
161
|
+
teardown: provenTeardown
|
|
162
|
+
});
|
|
163
|
+
this.provenAsset = asset;
|
|
164
|
+
this.provenWallet = provenWallet;
|
|
175
165
|
this.logger.info(`Full prover PXE started`);
|
|
176
166
|
// Shutdown the current, simulated prover node
|
|
177
167
|
this.logger.verbose('Shutting down simulated prover node');
|
|
@@ -260,19 +250,19 @@ const { E2E_DATA_PATH: dataPath } = process.env;
|
|
|
260
250
|
const privateAmount = 10000n;
|
|
261
251
|
const publicAmount = 10000n;
|
|
262
252
|
this.logger.verbose(`Minting ${privateAmount + publicAmount} publicly...`);
|
|
263
|
-
await asset.methods.mint_to_public(accounts[0]
|
|
264
|
-
from: accounts[0]
|
|
253
|
+
await asset.methods.mint_to_public(accounts[0], privateAmount + publicAmount).send({
|
|
254
|
+
from: accounts[0]
|
|
265
255
|
}).wait();
|
|
266
256
|
this.logger.verbose(`Transferring ${privateAmount} to private...`);
|
|
267
|
-
await asset.methods.transfer_to_private(accounts[0]
|
|
268
|
-
from: accounts[0]
|
|
257
|
+
await asset.methods.transfer_to_private(accounts[0], privateAmount).send({
|
|
258
|
+
from: accounts[0]
|
|
269
259
|
}).wait();
|
|
270
260
|
this.logger.verbose(`Minting complete.`);
|
|
271
261
|
return {
|
|
272
262
|
amount: publicAmount
|
|
273
263
|
};
|
|
274
264
|
}, async ({ amount })=>{
|
|
275
|
-
const { fakeProofsAsset: asset, accounts: [
|
|
265
|
+
const { fakeProofsAsset: asset, accounts: [address], tokenSim } = this;
|
|
276
266
|
tokenSim.mintPublic(address, amount);
|
|
277
267
|
const publicBalance = await asset.methods.balance_of_public(address).simulate({
|
|
278
268
|
from: address
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Logger } from '@aztec/aztec.js';
|
|
1
|
+
import type { Logger } from '@aztec/aztec.js/log';
|
|
2
2
|
export { deployAndInitializeTokenAndBridgeContracts } from '../shared/cross_chain_test_harness.js';
|
|
3
3
|
export declare function getACVMConfig(logger: Logger): Promise<{
|
|
4
4
|
acvmWorkingDirectory: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get_acvm_config.d.ts","sourceRoot":"","sources":["../../src/fixtures/get_acvm_config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"get_acvm_config.d.ts","sourceRoot":"","sources":["../../src/fixtures/get_acvm_config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAOlD,OAAO,EAAE,0CAA0C,EAAE,MAAM,uCAAuC,CAAC;AAWnG,wBAAsB,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CACxD;IACE,oBAAoB,EAAE,MAAM,CAAC;IAC7B,cAAc,EAAE,MAAM,CAAC;IACvB,OAAO,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC9B,GACD,SAAS,CACZ,CAyBA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get_bb_config.d.ts","sourceRoot":"","sources":["../../src/fixtures/get_bb_config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"get_bb_config.d.ts","sourceRoot":"","sources":["../../src/fixtures/get_bb_config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAkBjD,eAAO,MAAM,WAAW,GACtB,QAAQ,MAAM,KACb,OAAO,CAAC,CAAC,QAAQ,GAAG;IAAE,OAAO,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;CAAE,CAAC,GAAG,SAAS,CAqCnE,CAAC"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { fileURLToPath } from '@aztec/aztec.js';
|
|
2
1
|
import { tryRmDir } from '@aztec/foundation/fs';
|
|
3
2
|
import fs from 'node:fs/promises';
|
|
4
3
|
import { tmpdir } from 'node:os';
|
|
5
4
|
import path from 'path';
|
|
5
|
+
import { fileURLToPath } from 'url';
|
|
6
6
|
const { BB_RELEASE_DIR = 'barretenberg/cpp/build/bin', BB_BINARY_PATH, BB_SKIP_CLEANUP = '', TEMP_DIR = tmpdir(), BB_WORKING_DIRECTORY = '', BB_NUM_IVC_VERIFIERS = '1', BB_IVC_CONCURRENCY = '1' } = process.env;
|
|
7
7
|
export const getBBConfig = async (logger)=>{
|
|
8
8
|
try {
|
|
9
|
-
const bbBinaryPath = BB_BINARY_PATH ?? path.resolve(path.dirname(fileURLToPath(import.meta.url)), '../../../../', BB_RELEASE_DIR, 'bb');
|
|
9
|
+
const bbBinaryPath = BB_BINARY_PATH ?? path.resolve(path.dirname(fileURLToPath(import.meta.url)), '../../../../', BB_RELEASE_DIR, 'bb-avm');
|
|
10
10
|
await fs.access(bbBinaryPath, fs.constants.R_OK);
|
|
11
11
|
let bbWorkingDirectory;
|
|
12
12
|
let directoryToCleanup;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Logger } from '@aztec/aztec.js';
|
|
1
|
+
import type { Logger } from '@aztec/aztec.js/log';
|
|
2
2
|
import { type DeployL1ContractsArgs, type L1ContractsConfig } from '@aztec/ethereum';
|
|
3
3
|
import type { HDAccount, PrivateKeyAccount } from 'viem';
|
|
4
4
|
export { deployAndInitializeTokenAndBridgeContracts } from '../shared/cross_chain_test_harness.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setup_l1_contracts.d.ts","sourceRoot":"","sources":["../../src/fixtures/setup_l1_contracts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"setup_l1_contracts.d.ts","sourceRoot":"","sources":["../../src/fixtures/setup_l1_contracts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,KAAK,qBAAqB,EAAE,KAAK,iBAAiB,EAAqB,MAAM,iBAAiB,CAAC;AAIxG,OAAO,KAAK,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,MAAM,CAAC;AAGzD,OAAO,EAAE,0CAA0C,EAAE,MAAM,uCAAuC,CAAC;AAEnG,eAAO,MAAM,gBAAgB,GAC3B,UAAU,MAAM,EAChB,SAAS,SAAS,GAAG,iBAAiB,EACtC,QAAQ,MAAM,EACd,MAAM,IAAI,CAAC,qBAAqB,EAAE,oBAAoB,GAAG,mBAAmB,CAAC,GAAG,iBAAiB,mEAWlG,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { deployL1Contracts } from '@aztec/ethereum';
|
|
2
2
|
import { getVKTreeRoot } from '@aztec/noir-protocol-circuits-types/vk-tree';
|
|
3
|
-
import {
|
|
3
|
+
import { protocolContractsHash } from '@aztec/protocol-contracts';
|
|
4
4
|
import { foundry } from 'viem/chains';
|
|
5
5
|
export { deployAndInitializeTokenAndBridgeContracts } from '../shared/cross_chain_test_harness.js';
|
|
6
6
|
export const setupL1Contracts = async (l1RpcUrl, account, logger, args)=>{
|
|
@@ -8,7 +8,7 @@ export const setupL1Contracts = async (l1RpcUrl, account, logger, args)=>{
|
|
|
8
8
|
l1RpcUrl
|
|
9
9
|
], account, foundry, logger, {
|
|
10
10
|
vkTreeRoot: getVKTreeRoot(),
|
|
11
|
-
|
|
11
|
+
protocolContractsHash,
|
|
12
12
|
salt: undefined,
|
|
13
13
|
realVerifier: false,
|
|
14
14
|
...args
|
|
@@ -2,18 +2,11 @@
|
|
|
2
2
|
* Test fixtures and utilities to set up and run a test using multiple validators
|
|
3
3
|
*/
|
|
4
4
|
import { type AztecNodeConfig, AztecNodeService } from '@aztec/aztec-node';
|
|
5
|
-
import type { SentTx } from '@aztec/aztec.js';
|
|
6
5
|
import type { DateProvider } from '@aztec/foundation/timer';
|
|
7
6
|
import type { ProverNodeDeps } from '@aztec/prover-node';
|
|
8
|
-
import type { PXEService } from '@aztec/pxe/server';
|
|
9
7
|
import type { PublicDataTreeLeaf } from '@aztec/stdlib/trees';
|
|
10
8
|
import { AsyncLocalStorage } from 'node:async_hooks';
|
|
11
9
|
export declare const ATTESTER_PRIVATE_KEYS_START_INDEX = 3;
|
|
12
|
-
export interface NodeContext {
|
|
13
|
-
node: AztecNodeService;
|
|
14
|
-
pxeService: PXEService;
|
|
15
|
-
txs: SentTx[];
|
|
16
|
-
}
|
|
17
10
|
export declare function generatePrivateKeys(startIndex: number, numberOfKeys: number): `0x${string}`[];
|
|
18
11
|
export declare function createNodes(config: AztecNodeConfig & {
|
|
19
12
|
dontStartSequencer?: boolean;
|