@aztec/end-to-end 0.0.1-fake-c83136db25 → 0.0.1-fake-ceab37513c
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 +2 -3
- package/dest/bench/client_flows/benchmark.d.ts.map +1 -1
- package/dest/bench/client_flows/benchmark.js +2 -2
- package/dest/bench/client_flows/client_flows_benchmark.d.ts +12 -16
- package/dest/bench/client_flows/client_flows_benchmark.d.ts.map +1 -1
- package/dest/bench/client_flows/client_flows_benchmark.js +58 -54
- package/dest/bench/client_flows/data_extractor.js +3 -3
- package/dest/bench/utils.d.ts +11 -2
- package/dest/bench/utils.d.ts.map +1 -1
- package/dest/bench/utils.js +34 -10
- 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 +8 -10
- 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 +33 -31
- package/dest/e2e_deploy_contract/deploy_test.d.ts +4 -10
- package/dest/e2e_deploy_contract/deploy_test.d.ts.map +1 -1
- package/dest/e2e_deploy_contract/deploy_test.js +18 -9
- package/dest/e2e_epochs/epochs_test.d.ts +1 -3
- package/dest/e2e_epochs/epochs_test.d.ts.map +1 -1
- package/dest/e2e_epochs/epochs_test.js +9 -10
- package/dest/e2e_fees/bridging_race.notest.js +9 -12
- 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 +31 -23
- package/dest/e2e_l1_publisher/write_json.d.ts +1 -3
- 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 +3 -6
- package/dest/e2e_nested_contract/nested_contract_test.d.ts.map +1 -1
- package/dest/e2e_nested_contract/nested_contract_test.js +9 -7
- 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 +2 -5
- package/dest/e2e_p2p/p2p_network.d.ts +2 -14
- package/dest/e2e_p2p/p2p_network.d.ts.map +1 -1
- package/dest/e2e_p2p/p2p_network.js +10 -32
- package/dest/e2e_p2p/shared.d.ts +13 -11
- package/dest/e2e_p2p/shared.d.ts.map +1 -1
- package/dest/e2e_p2p/shared.js +45 -49
- package/dest/e2e_token_contract/token_contract_test.d.ts +4 -5
- package/dest/e2e_token_contract/token_contract_test.d.ts.map +1 -1
- package/dest/e2e_token_contract/token_contract_test.js +17 -14
- package/dest/fixtures/e2e_prover_test.d.ts +6 -8
- package/dest/fixtures/e2e_prover_test.d.ts.map +1 -1
- package/dest/fixtures/e2e_prover_test.js +50 -40
- 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 +7 -0
- package/dest/fixtures/setup_p2p_test.d.ts.map +1 -1
- package/dest/fixtures/snapshot_manager.d.ts +7 -10
- package/dest/fixtures/snapshot_manager.d.ts.map +1 -1
- package/dest/fixtures/snapshot_manager.js +32 -42
- package/dest/fixtures/token_utils.d.ts +4 -6
- package/dest/fixtures/token_utils.d.ts.map +1 -1
- package/dest/fixtures/token_utils.js +15 -11
- package/dest/fixtures/utils.d.ts +27 -23
- package/dest/fixtures/utils.d.ts.map +1 -1
- package/dest/fixtures/utils.js +100 -75
- package/dest/fixtures/web3signer.d.ts +1 -1
- package/dest/fixtures/web3signer.d.ts.map +1 -1
- package/dest/fixtures/web3signer.js +5 -16
- 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 +10 -16
- package/dest/shared/cross_chain_test_harness.d.ts.map +1 -1
- package/dest/shared/cross_chain_test_harness.js +15 -13
- package/dest/shared/gas_portal_test_harness.d.ts +6 -9
- package/dest/shared/gas_portal_test_harness.d.ts.map +1 -1
- package/dest/shared/gas_portal_test_harness.js +7 -10
- package/dest/shared/jest_setup.js +1 -1
- package/dest/shared/submit-transactions.d.ts +3 -5
- package/dest/shared/submit-transactions.d.ts.map +1 -1
- package/dest/shared/submit-transactions.js +7 -8
- package/dest/shared/uniswap_l1_l2.d.ts +6 -9
- package/dest/shared/uniswap_l1_l2.d.ts.map +1 -1
- package/dest/shared/uniswap_l1_l2.js +45 -29
- package/dest/simulators/lending_simulator.d.ts +1 -2
- package/dest/simulators/lending_simulator.d.ts.map +1 -1
- package/dest/simulators/lending_simulator.js +2 -3
- package/dest/simulators/token_simulator.d.ts +1 -3
- 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 +13 -19
- package/dest/spartan/setup_test_wallets.d.ts.map +1 -1
- package/dest/spartan/setup_test_wallets.js +84 -107
- package/dest/spartan/utils.d.ts +0 -44
- package/dest/spartan/utils.d.ts.map +1 -1
- package/dest/spartan/utils.js +20 -212
- package/package.json +36 -37
- package/src/bench/client_flows/benchmark.ts +8 -8
- package/src/bench/client_flows/client_flows_benchmark.ts +82 -62
- package/src/bench/client_flows/data_extractor.ts +4 -4
- package/src/bench/utils.ts +37 -9
- package/src/e2e_blacklist_token_contract/blacklist_token_contract_test.ts +63 -46
- package/src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts +47 -33
- package/src/e2e_deploy_contract/deploy_test.ts +35 -17
- package/src/e2e_epochs/epochs_test.ts +14 -12
- package/src/e2e_fees/bridging_race.notest.ts +9 -14
- package/src/e2e_fees/fees_test.ts +38 -26
- package/src/e2e_l1_publisher/write_json.ts +6 -8
- package/src/e2e_multi_validator/utils.ts +1 -1
- package/src/e2e_nested_contract/nested_contract_test.ts +10 -11
- package/src/e2e_p2p/inactivity_slash_test.ts +3 -7
- package/src/e2e_p2p/p2p_network.ts +67 -105
- package/src/e2e_p2p/shared.ts +55 -50
- package/src/e2e_token_contract/token_contract_test.ts +17 -17
- package/src/fixtures/e2e_prover_test.ts +88 -51
- package/src/fixtures/get_acvm_config.ts +1 -1
- package/src/fixtures/get_bb_config.ts +2 -3
- package/src/fixtures/setup_l1_contracts.ts +3 -3
- package/src/fixtures/setup_p2p_test.ts +8 -0
- package/src/fixtures/snapshot_manager.ts +59 -59
- package/src/fixtures/token_utils.ts +21 -13
- package/src/fixtures/utils.ts +137 -86
- package/src/fixtures/web3signer.ts +5 -22
- package/src/guides/up_quick_start.sh +10 -2
- package/src/quality_of_service/alert_checker.ts +1 -1
- package/src/shared/cross_chain_test_harness.ts +29 -18
- package/src/shared/gas_portal_test_harness.ts +19 -12
- package/src/shared/jest_setup.ts +1 -1
- package/src/shared/submit-transactions.ts +8 -12
- package/src/shared/uniswap_l1_l2.ts +67 -61
- package/src/simulators/lending_simulator.ts +2 -3
- package/src/simulators/token_simulator.ts +2 -5
- package/src/spartan/DEVELOP.md +3 -8
- package/src/spartan/setup_test_wallets.ts +125 -132
- package/src/spartan/utils.ts +18 -268
package/dest/e2e_p2p/shared.js
CHANGED
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Fr } from '@aztec/aztec.js
|
|
3
|
-
import { TxStatus } from '@aztec/aztec.js/tx';
|
|
1
|
+
import { getSchnorrAccount } from '@aztec/accounts/schnorr';
|
|
2
|
+
import { Fr, TxStatus, getContractInstanceFromInstantiationParams, retryUntil } from '@aztec/aztec.js';
|
|
4
3
|
import { timesAsync, unique } from '@aztec/foundation/collection';
|
|
5
|
-
import { retryUntil } from '@aztec/foundation/retry';
|
|
6
4
|
import { pluralize } from '@aztec/foundation/string';
|
|
7
5
|
import { TestContract, TestContractArtifact } from '@aztec/noir-test-contracts.js/Test';
|
|
8
|
-
import {
|
|
6
|
+
import { createPXEService, getPXEServiceConfig as getRpcConfig } from '@aztec/pxe/server';
|
|
9
7
|
import { getRoundForOffense } from '@aztec/slasher';
|
|
10
|
-
import { TestWallet, proveInteraction } from '@aztec/test-wallet/server';
|
|
11
8
|
import { submitTxsTo } from '../shared/submit-transactions.js';
|
|
12
9
|
// submits a set of transactions to the provided Private eXecution Environment (PXE)
|
|
13
10
|
export const submitComplexTxsTo = async (logger, from, spamContract, numTxs, opts = {})=>{
|
|
@@ -30,42 +27,51 @@ export const submitComplexTxsTo = async (logger, from, spamContract, numTxs, opt
|
|
|
30
27
|
}
|
|
31
28
|
return txs;
|
|
32
29
|
};
|
|
33
|
-
// creates
|
|
34
|
-
export const
|
|
30
|
+
// creates an instance of the PXE and submit a given number of transactions to it.
|
|
31
|
+
export const createPXEServiceAndSubmitTransactions = async (logger, node, numTxs, fundedAccount)=>{
|
|
35
32
|
const rpcConfig = getRpcConfig();
|
|
36
33
|
rpcConfig.proverEnabled = false;
|
|
37
|
-
const
|
|
38
|
-
...getPXEConfig(),
|
|
39
|
-
proverEnabled: false
|
|
40
|
-
}, {
|
|
34
|
+
const pxeService = await createPXEService(node, rpcConfig, {
|
|
41
35
|
useLogSuffix: true
|
|
42
36
|
});
|
|
43
|
-
const
|
|
44
|
-
|
|
37
|
+
const account = await getSchnorrAccount(pxeService, fundedAccount.secret, fundedAccount.signingKey, fundedAccount.salt);
|
|
38
|
+
await account.register();
|
|
39
|
+
const wallet = await account.getWallet();
|
|
40
|
+
const txs = await submitTxsTo(pxeService, numTxs, wallet, logger);
|
|
41
|
+
return {
|
|
42
|
+
txs,
|
|
43
|
+
pxeService,
|
|
44
|
+
node
|
|
45
|
+
};
|
|
45
46
|
};
|
|
46
|
-
export async function
|
|
47
|
+
export async function createPXEServiceAndPrepareTransactions(logger, node, numTxs, fundedAccount) {
|
|
47
48
|
const rpcConfig = getRpcConfig();
|
|
48
49
|
rpcConfig.proverEnabled = false;
|
|
49
|
-
const
|
|
50
|
-
...getPXEConfig(),
|
|
51
|
-
proverEnabled: false
|
|
52
|
-
}, {
|
|
50
|
+
const pxe = await createPXEService(node, rpcConfig, {
|
|
53
51
|
useLogSuffix: true
|
|
54
52
|
});
|
|
55
|
-
const
|
|
56
|
-
|
|
57
|
-
|
|
53
|
+
const account = await getSchnorrAccount(pxe, fundedAccount.secret, fundedAccount.signingKey, fundedAccount.salt);
|
|
54
|
+
await account.register();
|
|
55
|
+
const wallet = await account.getWallet();
|
|
56
|
+
const testContractInstance = await getContractInstanceFromInstantiationParams(TestContractArtifact, {});
|
|
57
|
+
await wallet.registerContract({
|
|
58
|
+
instance: testContractInstance,
|
|
59
|
+
artifact: TestContractArtifact
|
|
58
60
|
});
|
|
59
|
-
await wallet.registerContract(testContractInstance, TestContractArtifact);
|
|
60
61
|
const contract = await TestContract.at(testContractInstance.address, wallet);
|
|
61
|
-
|
|
62
|
-
const tx = await
|
|
63
|
-
from:
|
|
62
|
+
const txs = await timesAsync(numTxs, async ()=>{
|
|
63
|
+
const tx = await contract.methods.emit_nullifier(Fr.random()).prove({
|
|
64
|
+
from: account.getAddress()
|
|
64
65
|
});
|
|
65
66
|
const txHash = tx.getTxHash();
|
|
66
67
|
logger.info(`Tx prepared with hash ${txHash}`);
|
|
67
68
|
return tx;
|
|
68
69
|
});
|
|
70
|
+
return {
|
|
71
|
+
txs,
|
|
72
|
+
pxeService: pxe,
|
|
73
|
+
node
|
|
74
|
+
};
|
|
69
75
|
}
|
|
70
76
|
export function awaitProposalExecution(slashingProposer, timeoutSeconds, logger) {
|
|
71
77
|
return new Promise((resolve, reject)=>{
|
|
@@ -102,7 +108,7 @@ export async function awaitCommitteeExists({ rollup, logger }) {
|
|
|
102
108
|
}, 'non-empty committee', 60);
|
|
103
109
|
return committee;
|
|
104
110
|
}
|
|
105
|
-
export async function awaitOffenseDetected({ logger, nodeAdmin, slashingRoundSize, epochDuration, waitUntilOffenseCount
|
|
111
|
+
export async function awaitOffenseDetected({ logger, nodeAdmin, slashingRoundSize, epochDuration, waitUntilOffenseCount }) {
|
|
106
112
|
const targetOffenseCount = waitUntilOffenseCount ?? 1;
|
|
107
113
|
logger.warn(`Waiting for ${pluralize('offense', targetOffenseCount)} to be detected`);
|
|
108
114
|
const offenses = await retryUntil(async ()=>{
|
|
@@ -110,28 +116,27 @@ export async function awaitOffenseDetected({ logger, nodeAdmin, slashingRoundSiz
|
|
|
110
116
|
if (offenses.length >= targetOffenseCount) {
|
|
111
117
|
return offenses;
|
|
112
118
|
}
|
|
113
|
-
}, 'non-empty offenses',
|
|
119
|
+
}, 'non-empty offenses', 60);
|
|
114
120
|
logger.info(`Hit ${offenses.length} offenses on rounds ${unique(offenses.map((o)=>getRoundForOffense(o, {
|
|
115
121
|
slashingRoundSize,
|
|
116
122
|
epochDuration
|
|
117
|
-
})))}`,
|
|
118
|
-
offenses
|
|
119
|
-
});
|
|
123
|
+
})))}`, offenses);
|
|
120
124
|
return offenses;
|
|
121
125
|
}
|
|
122
126
|
/**
|
|
123
127
|
* Await the committee to be slashed out of the validator set.
|
|
124
128
|
* Currently assumes that the committee is the same size as the validator set.
|
|
125
|
-
*/ export async function awaitCommitteeKicked({ rollup, cheatCodes, committee, slashFactory, slashingProposer, slashingRoundSize, aztecSlotDuration,
|
|
129
|
+
*/ export async function awaitCommitteeKicked({ rollup, cheatCodes, committee, slashFactory, slashingProposer, slashingRoundSize, aztecSlotDuration, logger, dateProvider }) {
|
|
126
130
|
if (!slashingProposer) {
|
|
127
131
|
throw new Error('No slashing proposer configured. Cannot test slashing.');
|
|
128
132
|
}
|
|
133
|
+
logger.info(`Advancing epochs so we start slashing`);
|
|
129
134
|
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)
|
|
130
139
|
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);
|
|
135
140
|
const slashPayloadEvents = await retryUntil(async ()=>{
|
|
136
141
|
const events = await slashFactory.getSlashPayloadCreatedEvents();
|
|
137
142
|
return events.length > 0 ? events : undefined;
|
|
@@ -139,17 +144,6 @@ export async function awaitOffenseDetected({ logger, nodeAdmin, slashingRoundSiz
|
|
|
139
144
|
expect(slashPayloadEvents.length).toBe(1);
|
|
140
145
|
// 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)
|
|
141
146
|
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
|
-
});
|
|
153
147
|
}
|
|
154
148
|
const attestersPre = await rollup.getAttesters();
|
|
155
149
|
expect(attestersPre.length).toBe(committee.length);
|
|
@@ -157,7 +151,7 @@ export async function awaitOffenseDetected({ logger, nodeAdmin, slashingRoundSiz
|
|
|
157
151
|
const attesterInfo = await rollup.getAttesterView(attester);
|
|
158
152
|
expect(attesterInfo.status).toEqual(1); // Validating
|
|
159
153
|
}
|
|
160
|
-
const timeout = slashingRoundSize * 2 * aztecSlotDuration
|
|
154
|
+
const timeout = slashingRoundSize * 2 * aztecSlotDuration;
|
|
161
155
|
logger.info(`Waiting for slash to be executed (timeout ${timeout}s)`);
|
|
162
156
|
await awaitProposalExecution(slashingProposer, timeout, logger);
|
|
163
157
|
// The attesters should still form the committee but they should be reduced to the "living" status
|
|
@@ -172,7 +166,9 @@ export async function awaitOffenseDetected({ logger, nodeAdmin, slashingRoundSiz
|
|
|
172
166
|
}
|
|
173
167
|
logger.info(`Advancing to check current committee`);
|
|
174
168
|
await cheatCodes.debugRollup();
|
|
175
|
-
await cheatCodes.advanceToEpoch(await cheatCodes.getEpoch() + await rollup.getLagInEpochs() + 1n
|
|
169
|
+
await cheatCodes.advanceToEpoch(await cheatCodes.getEpoch() + await rollup.getLagInEpochs() + 1n, {
|
|
170
|
+
updateDateProvider: dateProvider
|
|
171
|
+
});
|
|
176
172
|
await cheatCodes.debugRollup();
|
|
177
173
|
const committeeNextEpoch = await rollup.getCurrentEpochCommittee();
|
|
178
174
|
// The committee should be undefined, since the validator set is empty
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
import { AztecAddress } from '@aztec/aztec.js
|
|
2
|
-
import { type Logger } from '@aztec/aztec.js/log';
|
|
3
|
-
import type { AztecNode } from '@aztec/aztec.js/node';
|
|
1
|
+
import { type AccountWallet, AztecAddress, type AztecNode, type Logger } from '@aztec/aztec.js';
|
|
4
2
|
import { TokenContract } from '@aztec/noir-contracts.js/Token';
|
|
5
3
|
import { InvalidAccountContract } from '@aztec/noir-test-contracts.js/InvalidAccount';
|
|
6
|
-
import type { TestWallet } from '@aztec/test-wallet/server';
|
|
7
4
|
import { type SubsystemsContext } from '../fixtures/snapshot_manager.js';
|
|
8
5
|
import { TokenSimulator } from '../simulators/token_simulator.js';
|
|
9
6
|
export declare class TokenContractTest {
|
|
@@ -16,9 +13,11 @@ export declare class TokenContractTest {
|
|
|
16
13
|
tokenSim: TokenSimulator;
|
|
17
14
|
node: AztecNode;
|
|
18
15
|
badAccount: InvalidAccountContract;
|
|
19
|
-
|
|
16
|
+
admin: AccountWallet;
|
|
20
17
|
adminAddress: AztecAddress;
|
|
18
|
+
account1: AccountWallet;
|
|
21
19
|
account1Address: AztecAddress;
|
|
20
|
+
account2: AccountWallet;
|
|
22
21
|
account2Address: AztecAddress;
|
|
23
22
|
constructor(testName: string);
|
|
24
23
|
/**
|
|
@@ -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":"AACA,OAAO,EAAE,KAAK,aAAa,EAAE,YAAY,EAAE,KAAK,SAAS,EAAE,KAAK,MAAM,EAAgB,MAAM,iBAAiB,CAAC;AAC9G,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAC/D,OAAO,EAAE,sBAAsB,EAAE,MAAM,8CAA8C,CAAC;AAItF,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,KAAK,EAAG,aAAa,CAAC;IACtB,YAAY,EAAG,YAAY,CAAC;IAC5B,QAAQ,EAAG,aAAa,CAAC;IACzB,eAAe,EAAG,YAAY,CAAC;IAC/B,QAAQ,EAAG,aAAa,CAAC;IACzB,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,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getSchnorrWallet } from '@aztec/accounts/schnorr';
|
|
2
|
+
import { createLogger } from '@aztec/aztec.js';
|
|
2
3
|
import { TokenContract } from '@aztec/noir-contracts.js/Token';
|
|
3
4
|
import { InvalidAccountContract } from '@aztec/noir-test-contracts.js/InvalidAccount';
|
|
4
5
|
import { jest } from '@jest/globals';
|
|
@@ -16,9 +17,11 @@ export class TokenContractTest {
|
|
|
16
17
|
tokenSim;
|
|
17
18
|
node;
|
|
18
19
|
badAccount;
|
|
19
|
-
|
|
20
|
+
admin;
|
|
20
21
|
adminAddress;
|
|
22
|
+
account1;
|
|
21
23
|
account1Address;
|
|
24
|
+
account2;
|
|
22
25
|
account2Address;
|
|
23
26
|
constructor(testName){
|
|
24
27
|
this.logger = createLogger(`e2e:e2e_token_contract:${testName}`);
|
|
@@ -33,27 +36,27 @@ export class TokenContractTest {
|
|
|
33
36
|
*/ async applyBaseSnapshots() {
|
|
34
37
|
// Adding a timeout of 2 minutes in here such that it is propagated to the underlying tests
|
|
35
38
|
jest.setTimeout(120_000);
|
|
36
|
-
await this.snapshotManager.snapshot('3_accounts', deployAccounts(3, this.logger), ({ deployedAccounts }, {
|
|
39
|
+
await this.snapshotManager.snapshot('3_accounts', deployAccounts(3, this.logger), async ({ deployedAccounts }, { pxe, aztecNode })=>{
|
|
37
40
|
this.node = aztecNode;
|
|
38
|
-
|
|
39
|
-
[this.
|
|
40
|
-
|
|
41
|
+
const wallets = await Promise.all(deployedAccounts.map((a)=>getSchnorrWallet(pxe, a.address, a.signingKey)));
|
|
42
|
+
[this.admin, this.account1, this.account2] = wallets;
|
|
43
|
+
[this.adminAddress, this.account1Address, this.account2Address] = wallets.map((w)=>w.getAddress());
|
|
41
44
|
});
|
|
42
45
|
await this.snapshotManager.snapshot('e2e_token_contract', async ()=>{
|
|
43
46
|
// Create the token contract state.
|
|
44
47
|
// Move this account thing to addAccounts above?
|
|
45
48
|
this.logger.verbose(`Public deploy accounts...`);
|
|
46
|
-
await publicDeployAccounts(this.
|
|
49
|
+
await publicDeployAccounts(this.admin, [
|
|
47
50
|
this.adminAddress,
|
|
48
51
|
this.account1Address
|
|
49
52
|
]);
|
|
50
53
|
this.logger.verbose(`Deploying TokenContract...`);
|
|
51
|
-
const asset = await TokenContract.deploy(this.
|
|
54
|
+
const asset = await TokenContract.deploy(this.admin, this.adminAddress, TokenContractTest.TOKEN_NAME, TokenContractTest.TOKEN_SYMBOL, TokenContractTest.TOKEN_DECIMALS).send({
|
|
52
55
|
from: this.adminAddress
|
|
53
56
|
}).deployed();
|
|
54
57
|
this.logger.verbose(`Token deployed to ${asset.address}`);
|
|
55
58
|
this.logger.verbose(`Deploying bad account...`);
|
|
56
|
-
this.badAccount = await InvalidAccountContract.deploy(this.
|
|
59
|
+
this.badAccount = await InvalidAccountContract.deploy(this.admin).send({
|
|
57
60
|
from: this.adminAddress
|
|
58
61
|
}).deployed();
|
|
59
62
|
this.logger.verbose(`Deployed to ${this.badAccount.address}.`);
|
|
@@ -63,13 +66,13 @@ export class TokenContractTest {
|
|
|
63
66
|
};
|
|
64
67
|
}, async ({ tokenContractAddress, badAccountAddress })=>{
|
|
65
68
|
// Restore the token contract state.
|
|
66
|
-
this.asset = await TokenContract.at(tokenContractAddress, this.
|
|
69
|
+
this.asset = await TokenContract.at(tokenContractAddress, this.admin);
|
|
67
70
|
this.logger.verbose(`Token contract address: ${this.asset.address}`);
|
|
68
|
-
this.tokenSim = new TokenSimulator(this.asset, this.
|
|
71
|
+
this.tokenSim = new TokenSimulator(this.asset, this.admin, this.adminAddress, this.logger, [
|
|
69
72
|
this.adminAddress,
|
|
70
73
|
this.account1Address
|
|
71
74
|
]);
|
|
72
|
-
this.badAccount = await InvalidAccountContract.at(badAccountAddress, this.
|
|
75
|
+
this.badAccount = await InvalidAccountContract.at(badAccountAddress, this.admin);
|
|
73
76
|
this.logger.verbose(`Bad account address: ${this.badAccount.address}`);
|
|
74
77
|
expect(await this.asset.methods.get_admin().simulate({
|
|
75
78
|
from: this.adminAddress
|
|
@@ -89,14 +92,14 @@ export class TokenContractTest {
|
|
|
89
92
|
}
|
|
90
93
|
async applyMintSnapshot() {
|
|
91
94
|
await this.snapshotManager.snapshot('mint', async ()=>{
|
|
92
|
-
const { asset, adminAddress } = this;
|
|
95
|
+
const { asset, admin, adminAddress } = this;
|
|
93
96
|
const amount = 10000n;
|
|
94
97
|
this.logger.verbose(`Minting ${amount} publicly...`);
|
|
95
98
|
await asset.methods.mint_to_public(adminAddress, amount).send({
|
|
96
99
|
from: adminAddress
|
|
97
100
|
}).wait();
|
|
98
101
|
this.logger.verbose(`Minting ${amount} privately...`);
|
|
99
|
-
await mintTokensToPrivate(asset, adminAddress, adminAddress, amount);
|
|
102
|
+
await mintTokensToPrivate(asset, adminAddress, admin, adminAddress, amount);
|
|
100
103
|
this.logger.verbose(`Minting complete.`);
|
|
101
104
|
return {
|
|
102
105
|
amount
|
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
import type { InitialAccountData } from '@aztec/accounts/testing';
|
|
2
|
-
import {
|
|
3
|
-
import { type Logger } from '@aztec/aztec.js/log';
|
|
4
|
-
import type { AztecNode } from '@aztec/aztec.js/node';
|
|
2
|
+
import { type AccountWalletWithSecretKey, type AztecNode, type CompleteAddress, EthAddress, type Logger } from '@aztec/aztec.js';
|
|
5
3
|
import { CheatCodes } from '@aztec/aztec/testing';
|
|
6
4
|
import { type ClientProtocolCircuitVerifier } from '@aztec/bb-prover';
|
|
7
5
|
import type { BlobSinkServer } from '@aztec/blob-sink/server';
|
|
8
6
|
import type { DeployL1ContractsReturnType } from '@aztec/ethereum';
|
|
9
7
|
import { TokenContract } from '@aztec/noir-contracts.js/Token';
|
|
8
|
+
import type { PXEService } from '@aztec/pxe/server';
|
|
10
9
|
import type { AztecNodeAdmin } from '@aztec/stdlib/interfaces/client';
|
|
11
|
-
import { TestWallet } from '@aztec/test-wallet/server';
|
|
12
10
|
import { TokenSimulator } from '../simulators/token_simulator.js';
|
|
13
11
|
import { type SubsystemsContext } from './snapshot_manager.js';
|
|
14
12
|
/**
|
|
@@ -25,21 +23,21 @@ export declare class FullProverTest {
|
|
|
25
23
|
static TOKEN_DECIMALS: bigint;
|
|
26
24
|
private snapshotManager;
|
|
27
25
|
logger: Logger;
|
|
28
|
-
wallet: TestWallet;
|
|
29
|
-
provenWallet: TestWallet;
|
|
30
|
-
accounts: AztecAddress[];
|
|
31
26
|
deployedAccounts: InitialAccountData[];
|
|
27
|
+
wallets: AccountWalletWithSecretKey[];
|
|
28
|
+
accounts: CompleteAddress[];
|
|
32
29
|
fakeProofsAsset: TokenContract;
|
|
33
30
|
tokenSim: TokenSimulator;
|
|
34
31
|
aztecNode: AztecNode;
|
|
35
32
|
aztecNodeAdmin: AztecNodeAdmin;
|
|
33
|
+
pxe: PXEService;
|
|
36
34
|
cheatCodes: CheatCodes;
|
|
37
35
|
blobSink: BlobSinkServer;
|
|
38
36
|
private provenComponents;
|
|
39
37
|
private bbConfigCleanup?;
|
|
40
38
|
private acvmConfigCleanup?;
|
|
41
39
|
circuitProofVerifier?: ClientProtocolCircuitVerifier;
|
|
42
|
-
|
|
40
|
+
provenAssets: TokenContract[];
|
|
43
41
|
private context;
|
|
44
42
|
private proverNode;
|
|
45
43
|
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":"AAKA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAElE,OAAO,EACL,KAAK,0BAA0B,EAC/B,KAAK,SAAS,EACd,KAAK,eAAe,EACpB,UAAU,EACV,KAAK,MAAM,EAGZ,MAAM,iBAAiB,CAAC;AACzB,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,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAMtE,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,gBAAgB,EAAE,kBAAkB,EAAE,CAAM;IAC5C,OAAO,EAAE,0BAA0B,EAAE,CAAM;IAC3C,QAAQ,EAAE,eAAe,EAAE,CAAM;IACjC,eAAe,EAAG,aAAa,CAAC;IAChC,QAAQ,EAAG,cAAc,CAAC;IAC1B,SAAS,EAAG,SAAS,CAAC;IACtB,cAAc,EAAG,cAAc,CAAC;IAChC,GAAG,EAAG,UAAU,CAAC;IACjB,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,YAAY,EAAE,aAAa,EAAE,CAAM;IACnC,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;IAwDlB,KAAK;YAkKG,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;CAiDxB"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { SchnorrAccountContractArtifact, getSchnorrAccount, getSchnorrWalletWithSecretKey } from '@aztec/accounts/schnorr';
|
|
1
2
|
import { createArchiver } from '@aztec/archiver';
|
|
2
|
-
import { EthAddress } from '@aztec/aztec.js
|
|
3
|
-
import { createLogger } from '@aztec/aztec.js/log';
|
|
3
|
+
import { EthAddress, createLogger } from '@aztec/aztec.js';
|
|
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, setupPXEService } 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
|
-
wallet;
|
|
34
|
-
provenWallet;
|
|
35
|
-
accounts;
|
|
36
33
|
deployedAccounts;
|
|
34
|
+
wallets;
|
|
35
|
+
accounts;
|
|
37
36
|
fakeProofsAsset;
|
|
38
37
|
tokenSim;
|
|
39
38
|
aztecNode;
|
|
40
39
|
aztecNodeAdmin;
|
|
40
|
+
pxe;
|
|
41
41
|
cheatCodes;
|
|
42
42
|
blobSink;
|
|
43
43
|
provenComponents;
|
|
44
44
|
bbConfigCleanup;
|
|
45
45
|
acvmConfigCleanup;
|
|
46
46
|
circuitProofVerifier;
|
|
47
|
-
|
|
47
|
+
provenAssets;
|
|
48
48
|
context;
|
|
49
49
|
proverNode;
|
|
50
50
|
simulatedProverNode;
|
|
@@ -53,8 +53,11 @@ 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 = [];
|
|
56
58
|
this.accounts = [];
|
|
57
59
|
this.provenComponents = [];
|
|
60
|
+
this.provenAssets = [];
|
|
58
61
|
this.snapshot = (name, apply, restore = ()=>Promise.resolve())=>this.snapshotManager.snapshot(name, apply, restore);
|
|
59
62
|
this.logger = createLogger(`e2e:full_prover_test:${testName}`);
|
|
60
63
|
this.snapshotManager = createSnapshotManager(`full_prover_integration/${testName}`, dataPath, {
|
|
@@ -70,20 +73,20 @@ const { E2E_DATA_PATH: dataPath } = process.env;
|
|
|
70
73
|
* 1. Add 2 accounts.
|
|
71
74
|
* 2. Publicly deploy accounts, deploy token contract
|
|
72
75
|
*/ async applyBaseSnapshots() {
|
|
73
|
-
await this.snapshotManager.snapshot('2_accounts', deployAccounts(2, this.logger), ({ deployedAccounts }, {
|
|
76
|
+
await this.snapshotManager.snapshot('2_accounts', deployAccounts(2, this.logger), async ({ deployedAccounts }, { pxe })=>{
|
|
74
77
|
this.deployedAccounts = deployedAccounts;
|
|
75
|
-
this.
|
|
76
|
-
this.
|
|
77
|
-
|
|
78
|
+
this.wallets = await Promise.all(deployedAccounts.map((a)=>getSchnorrWalletWithSecretKey(pxe, a.secret, a.signingKey, a.salt)));
|
|
79
|
+
this.accounts = this.wallets.map((w)=>w.getCompleteAddress());
|
|
80
|
+
this.wallets.forEach((w, i)=>this.logger.verbose(`Wallet ${i} address: ${w.getAddress()}`));
|
|
78
81
|
});
|
|
79
82
|
await this.snapshotManager.snapshot('client_prover_integration', async ()=>{
|
|
80
83
|
// Create the token contract state.
|
|
81
84
|
// Move this account thing to addAccounts above?
|
|
82
85
|
this.logger.verbose(`Public deploy accounts...`);
|
|
83
|
-
await publicDeployAccounts(this.
|
|
86
|
+
await publicDeployAccounts(this.wallets[0], this.accounts.slice(0, 2));
|
|
84
87
|
this.logger.verbose(`Deploying TokenContract...`);
|
|
85
|
-
const asset = await TokenContract.deploy(this.
|
|
86
|
-
from: this.
|
|
88
|
+
const asset = await TokenContract.deploy(this.wallets[0], this.accounts[0], FullProverTest.TOKEN_NAME, FullProverTest.TOKEN_SYMBOL, FullProverTest.TOKEN_DECIMALS).send({
|
|
89
|
+
from: this.wallets[0].getAddress()
|
|
87
90
|
}).deployed();
|
|
88
91
|
this.logger.verbose(`Token deployed to ${asset.address}`);
|
|
89
92
|
return {
|
|
@@ -91,12 +94,12 @@ const { E2E_DATA_PATH: dataPath } = process.env;
|
|
|
91
94
|
};
|
|
92
95
|
}, async ({ tokenContractAddress })=>{
|
|
93
96
|
// Restore the token contract state.
|
|
94
|
-
this.fakeProofsAsset = await TokenContract.at(tokenContractAddress, this.
|
|
97
|
+
this.fakeProofsAsset = await TokenContract.at(tokenContractAddress, this.wallets[0]);
|
|
95
98
|
this.logger.verbose(`Token contract address: ${this.fakeProofsAsset.address}`);
|
|
96
|
-
this.tokenSim = new TokenSimulator(this.fakeProofsAsset, this.
|
|
99
|
+
this.tokenSim = new TokenSimulator(this.fakeProofsAsset, this.wallets[0], this.wallets[0].getAddress(), this.logger, this.accounts.map((a)=>a.address));
|
|
97
100
|
expect(await this.fakeProofsAsset.methods.get_admin().simulate({
|
|
98
|
-
from: this.accounts[0]
|
|
99
|
-
})).toBe(this.accounts[0].toBigInt());
|
|
101
|
+
from: this.accounts[0].address
|
|
102
|
+
})).toBe(this.accounts[0].address.toBigInt());
|
|
100
103
|
});
|
|
101
104
|
}
|
|
102
105
|
async setup() {
|
|
@@ -104,7 +107,7 @@ const { E2E_DATA_PATH: dataPath } = process.env;
|
|
|
104
107
|
// We don't wish to mark as proven automatically, so we set the flag to false
|
|
105
108
|
this.context.watcher.setIsMarkingAsProven(false);
|
|
106
109
|
this.simulatedProverNode = this.context.proverNode;
|
|
107
|
-
({ aztecNode: this.aztecNode, deployL1ContractsValues: this.l1Contracts, cheatCodes: this.cheatCodes, blobSink: this.blobSink } = this.context);
|
|
110
|
+
({ pxe: this.pxe, aztecNode: this.aztecNode, deployL1ContractsValues: this.l1Contracts, cheatCodes: this.cheatCodes, blobSink: this.blobSink } = this.context);
|
|
108
111
|
this.aztecNodeAdmin = this.context.aztecNode;
|
|
109
112
|
const blobSinkClient = createBlobSinkClient({
|
|
110
113
|
blobSinkUrl: `http://localhost:${this.blobSink.port}`
|
|
@@ -144,24 +147,31 @@ const { E2E_DATA_PATH: dataPath } = process.env;
|
|
|
144
147
|
this.logger.verbose(`Marking current block as proven`);
|
|
145
148
|
await this.context.cheatCodes.rollup.markAsProven();
|
|
146
149
|
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);
|
|
154
150
|
for(let i = 0; i < 2; i++){
|
|
155
|
-
await
|
|
156
|
-
|
|
151
|
+
const result = await setupPXEService(this.aztecNode, {
|
|
152
|
+
proverEnabled: this.realProofs,
|
|
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);
|
|
157
174
|
}
|
|
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;
|
|
165
175
|
this.logger.info(`Full prover PXE started`);
|
|
166
176
|
// Shutdown the current, simulated prover node
|
|
167
177
|
this.logger.verbose('Shutting down simulated prover node');
|
|
@@ -250,19 +260,19 @@ const { E2E_DATA_PATH: dataPath } = process.env;
|
|
|
250
260
|
const privateAmount = 10000n;
|
|
251
261
|
const publicAmount = 10000n;
|
|
252
262
|
this.logger.verbose(`Minting ${privateAmount + publicAmount} publicly...`);
|
|
253
|
-
await asset.methods.mint_to_public(accounts[0], privateAmount + publicAmount).send({
|
|
254
|
-
from: accounts[0]
|
|
263
|
+
await asset.methods.mint_to_public(accounts[0].address, privateAmount + publicAmount).send({
|
|
264
|
+
from: accounts[0].address
|
|
255
265
|
}).wait();
|
|
256
266
|
this.logger.verbose(`Transferring ${privateAmount} to private...`);
|
|
257
|
-
await asset.methods.transfer_to_private(accounts[0], privateAmount).send({
|
|
258
|
-
from: accounts[0]
|
|
267
|
+
await asset.methods.transfer_to_private(accounts[0].address, privateAmount).send({
|
|
268
|
+
from: accounts[0].address
|
|
259
269
|
}).wait();
|
|
260
270
|
this.logger.verbose(`Minting complete.`);
|
|
261
271
|
return {
|
|
262
272
|
amount: publicAmount
|
|
263
273
|
};
|
|
264
274
|
}, async ({ amount })=>{
|
|
265
|
-
const { fakeProofsAsset: asset, accounts: [address], tokenSim } = this;
|
|
275
|
+
const { fakeProofsAsset: asset, accounts: [{ address }], tokenSim } = this;
|
|
266
276
|
tokenSim.mintPublic(address, amount);
|
|
267
277
|
const publicBalance = await asset.methods.balance_of_public(address).simulate({
|
|
268
278
|
from: address
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Logger } from '@aztec/aztec.js
|
|
1
|
+
import type { Logger } from '@aztec/aztec.js';
|
|
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,iBAAiB,CAAC;AAO9C,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,KAAK,
|
|
1
|
+
{"version":3,"file":"get_bb_config.d.ts","sourceRoot":"","sources":["../../src/fixtures/get_bb_config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,MAAM,EAAiB,MAAM,iBAAiB,CAAC;AAC7D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAiBjD,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';
|
|
1
2
|
import { tryRmDir } from '@aztec/foundation/fs';
|
|
2
3
|
import fs from 'node:fs/promises';
|
|
3
4
|
import { tmpdir } from 'node:os';
|
|
4
5
|
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');
|
|
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';
|
|
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,iBAAiB,CAAC;AAC9C,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 { protocolContractTreeRoot } 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
|
+
protocolContractTreeRoot,
|
|
12
12
|
salt: undefined,
|
|
13
13
|
realVerifier: false,
|
|
14
14
|
...args
|
|
@@ -2,11 +2,18 @@
|
|
|
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';
|
|
5
6
|
import type { DateProvider } from '@aztec/foundation/timer';
|
|
6
7
|
import type { ProverNodeDeps } from '@aztec/prover-node';
|
|
8
|
+
import type { PXEService } from '@aztec/pxe/server';
|
|
7
9
|
import type { PublicDataTreeLeaf } from '@aztec/stdlib/trees';
|
|
8
10
|
import { AsyncLocalStorage } from 'node:async_hooks';
|
|
9
11
|
export declare const ATTESTER_PRIVATE_KEYS_START_INDEX = 3;
|
|
12
|
+
export interface NodeContext {
|
|
13
|
+
node: AztecNodeService;
|
|
14
|
+
pxeService: PXEService;
|
|
15
|
+
txs: SentTx[];
|
|
16
|
+
}
|
|
10
17
|
export declare function generatePrivateKeys(startIndex: number, numberOfKeys: number): `0x${string}`[];
|
|
11
18
|
export declare function createNodes(config: AztecNodeConfig & {
|
|
12
19
|
dontStartSequencer?: boolean;
|