@aztec/end-to-end 0.0.1-commit.21ecf947b → 0.0.1-commit.2448fdb
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +27 -0
- package/dest/bench/client_flows/client_flows_benchmark.d.ts +1 -1
- package/dest/bench/client_flows/client_flows_benchmark.d.ts.map +1 -1
- package/dest/bench/client_flows/client_flows_benchmark.js +18 -11
- package/dest/bench/utils.d.ts +1 -1
- package/dest/bench/utils.d.ts.map +1 -1
- package/dest/bench/utils.js +6 -3
- package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts +3 -2
- 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 +15 -15
- package/dest/e2e_epochs/epochs_test.d.ts +11 -7
- package/dest/e2e_epochs/epochs_test.d.ts.map +1 -1
- package/dest/e2e_epochs/epochs_test.js +58 -36
- package/dest/e2e_fees/fees_test.d.ts +1 -1
- package/dest/e2e_fees/fees_test.d.ts.map +1 -1
- package/dest/e2e_fees/fees_test.js +14 -7
- package/dest/e2e_nested_contract/nested_contract_test.d.ts +1 -1
- package/dest/e2e_nested_contract/nested_contract_test.d.ts.map +1 -1
- package/dest/e2e_nested_contract/nested_contract_test.js +4 -6
- package/dest/e2e_p2p/inactivity_slash_test.d.ts +1 -1
- package/dest/e2e_p2p/inactivity_slash_test.d.ts.map +1 -1
- package/dest/e2e_p2p/inactivity_slash_test.js +1 -0
- package/dest/e2e_p2p/p2p_network.d.ts +3 -2
- package/dest/e2e_p2p/p2p_network.d.ts.map +1 -1
- package/dest/e2e_p2p/p2p_network.js +23 -6
- package/dest/e2e_p2p/reqresp/utils.d.ts +3 -3
- package/dest/e2e_p2p/reqresp/utils.d.ts.map +1 -1
- package/dest/e2e_p2p/reqresp/utils.js +32 -8
- package/dest/e2e_p2p/shared.d.ts +33 -1
- package/dest/e2e_p2p/shared.d.ts.map +1 -1
- package/dest/e2e_p2p/shared.js +56 -2
- package/dest/e2e_token_contract/token_contract_test.d.ts +1 -1
- package/dest/e2e_token_contract/token_contract_test.d.ts.map +1 -1
- package/dest/e2e_token_contract/token_contract_test.js +11 -11
- package/dest/fixtures/authwit_proxy.d.ts +3 -3
- package/dest/fixtures/authwit_proxy.d.ts.map +1 -1
- package/dest/fixtures/authwit_proxy.js +4 -0
- package/dest/fixtures/e2e_prover_test.d.ts +3 -3
- package/dest/fixtures/e2e_prover_test.d.ts.map +1 -1
- package/dest/fixtures/e2e_prover_test.js +33 -40
- package/dest/fixtures/fixtures.d.ts +5 -1
- package/dest/fixtures/fixtures.d.ts.map +1 -1
- package/dest/fixtures/fixtures.js +6 -0
- package/dest/fixtures/setup.d.ts +32 -12
- package/dest/fixtures/setup.d.ts.map +1 -1
- package/dest/fixtures/setup.js +62 -89
- package/dest/fixtures/setup_p2p_test.d.ts +6 -3
- package/dest/fixtures/setup_p2p_test.d.ts.map +1 -1
- package/dest/fixtures/setup_p2p_test.js +12 -9
- package/dest/fixtures/token_utils.d.ts +2 -2
- package/dest/fixtures/token_utils.d.ts.map +1 -1
- package/dest/fixtures/token_utils.js +5 -4
- package/dest/forward-compatibility/wallet_rpc_client.d.ts +7 -0
- package/dest/forward-compatibility/wallet_rpc_client.d.ts.map +1 -0
- package/dest/forward-compatibility/wallet_rpc_client.js +15 -0
- package/dest/forward-compatibility/wallet_service.d.ts +3 -0
- package/dest/forward-compatibility/wallet_service.d.ts.map +1 -0
- package/dest/forward-compatibility/wallet_service.js +109 -0
- package/dest/install_legacy_contracts.d.cts +10 -0
- package/dest/install_legacy_contracts.d.cts.map +1 -0
- package/dest/legacy-jest-resolver.d.cts +3 -0
- package/dest/legacy-jest-resolver.d.cts.map +1 -0
- package/dest/shared/cross_chain_test_harness.d.ts +1 -1
- package/dest/shared/cross_chain_test_harness.d.ts.map +1 -1
- package/dest/shared/cross_chain_test_harness.js +13 -13
- package/dest/shared/gas_portal_test_harness.js +2 -2
- package/dest/shared/submit-transactions.d.ts +1 -1
- package/dest/shared/submit-transactions.d.ts.map +1 -1
- package/dest/shared/submit-transactions.js +1 -1
- package/dest/shared/uniswap_l1_l2.d.ts +1 -1
- package/dest/shared/uniswap_l1_l2.d.ts.map +1 -1
- package/dest/shared/uniswap_l1_l2.js +14 -17
- package/dest/simulators/lending_simulator.d.ts +1 -1
- package/dest/simulators/lending_simulator.d.ts.map +1 -1
- package/dest/simulators/lending_simulator.js +4 -4
- package/dest/simulators/token_simulator.d.ts +1 -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 +11 -2
- package/dest/spartan/setup_test_wallets.d.ts.map +1 -1
- package/dest/spartan/setup_test_wallets.js +56 -15
- package/dest/spartan/utils/bot.d.ts +3 -2
- package/dest/spartan/utils/bot.d.ts.map +1 -1
- package/dest/spartan/utils/bot.js +2 -1
- package/dest/spartan/utils/index.d.ts +3 -2
- package/dest/spartan/utils/index.d.ts.map +1 -1
- package/dest/spartan/utils/index.js +3 -1
- package/dest/spartan/utils/k8s.d.ts +3 -1
- package/dest/spartan/utils/k8s.d.ts.map +1 -1
- package/dest/spartan/utils/k8s.js +6 -0
- package/dest/test-wallet/test_wallet.d.ts +24 -23
- package/dest/test-wallet/test_wallet.d.ts.map +1 -1
- package/dest/test-wallet/test_wallet.js +116 -81
- package/dest/test-wallet/wallet_worker_script.d.ts +2 -0
- package/dest/test-wallet/wallet_worker_script.d.ts.map +1 -0
- package/dest/test-wallet/wallet_worker_script.js +48 -0
- package/dest/test-wallet/worker_wallet.d.ts +52 -0
- package/dest/test-wallet/worker_wallet.d.ts.map +1 -0
- package/dest/test-wallet/worker_wallet.js +151 -0
- package/dest/test-wallet/worker_wallet_schema.d.ts +274 -0
- package/dest/test-wallet/worker_wallet_schema.d.ts.map +1 -0
- package/dest/test-wallet/worker_wallet_schema.js +10 -0
- package/package.json +41 -40
- package/src/bench/client_flows/client_flows_benchmark.ts +40 -32
- package/src/bench/utils.ts +7 -2
- package/src/e2e_blacklist_token_contract/blacklist_token_contract_test.ts +21 -20
- package/src/e2e_epochs/epochs_test.ts +76 -64
- package/src/e2e_fees/fees_test.ts +14 -7
- package/src/e2e_nested_contract/nested_contract_test.ts +6 -4
- package/src/e2e_p2p/inactivity_slash_test.ts +1 -0
- package/src/e2e_p2p/p2p_network.ts +30 -4
- package/src/e2e_p2p/reqresp/utils.ts +36 -8
- package/src/e2e_p2p/shared.ts +97 -2
- package/src/e2e_token_contract/token_contract_test.ts +16 -8
- package/src/fixtures/authwit_proxy.ts +4 -0
- package/src/fixtures/e2e_prover_test.ts +36 -40
- package/src/fixtures/fixtures.ts +10 -0
- package/src/fixtures/setup.ts +86 -120
- package/src/fixtures/setup_p2p_test.ts +9 -17
- package/src/fixtures/token_utils.ts +6 -3
- package/src/forward-compatibility/wallet_rpc_client.ts +14 -0
- package/src/forward-compatibility/wallet_service.ts +104 -0
- package/src/install_legacy_contracts.cjs +71 -0
- package/src/legacy-jest-resolver.cjs +101 -0
- package/src/shared/cross_chain_test_harness.ts +13 -9
- package/src/shared/gas_portal_test_harness.ts +1 -1
- package/src/shared/submit-transactions.ts +4 -1
- package/src/shared/uniswap_l1_l2.ts +35 -28
- package/src/simulators/lending_simulator.ts +8 -4
- package/src/simulators/token_simulator.ts +6 -2
- package/src/spartan/setup_test_wallets.ts +101 -17
- package/src/spartan/utils/bot.ts +3 -0
- package/src/spartan/utils/index.ts +4 -0
- package/src/spartan/utils/k8s.ts +8 -0
- package/src/test-wallet/test_wallet.ts +145 -100
- package/src/test-wallet/wallet_worker_script.ts +60 -0
- package/src/test-wallet/worker_wallet.ts +214 -0
- package/src/test-wallet/worker_wallet_schema.ts +13 -0
package/src/e2e_p2p/shared.ts
CHANGED
|
@@ -6,12 +6,13 @@ import { Fr } from '@aztec/aztec.js/fields';
|
|
|
6
6
|
import type { Logger } from '@aztec/aztec.js/log';
|
|
7
7
|
import { TxHash } from '@aztec/aztec.js/tx';
|
|
8
8
|
import type { RollupCheatCodes } from '@aztec/aztec/testing';
|
|
9
|
+
import type { EpochCacheInterface } from '@aztec/epoch-cache';
|
|
9
10
|
import type {
|
|
10
11
|
EmpireSlashingProposerContract,
|
|
11
12
|
RollupContract,
|
|
12
13
|
TallySlashingProposerContract,
|
|
13
14
|
} from '@aztec/ethereum/contracts';
|
|
14
|
-
import { EpochNumber } from '@aztec/foundation/branded-types';
|
|
15
|
+
import { EpochNumber, SlotNumber } from '@aztec/foundation/branded-types';
|
|
15
16
|
import { timesAsync, unique } from '@aztec/foundation/collection';
|
|
16
17
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
17
18
|
import { retryUntil } from '@aztec/foundation/retry';
|
|
@@ -41,7 +42,7 @@ export const submitComplexTxsTo = async (
|
|
|
41
42
|
const spamCount = 15;
|
|
42
43
|
for (let i = 0; i < numTxs; i++) {
|
|
43
44
|
const method = spamContract.methods.spam(seed + BigInt(i * spamCount), spamCount, !!opts.callPublic);
|
|
44
|
-
const txHash = await method.send({ from, wait: NO_WAIT });
|
|
45
|
+
const { txHash } = await method.send({ from, wait: NO_WAIT });
|
|
45
46
|
logger.info(`Tx sent with hash ${txHash.toString()}`);
|
|
46
47
|
txs.push(txHash);
|
|
47
48
|
}
|
|
@@ -150,6 +151,100 @@ export async function awaitCommitteeExists({
|
|
|
150
151
|
return committee!.map(c => c.toString() as `0x${string}`);
|
|
151
152
|
}
|
|
152
153
|
|
|
154
|
+
/**
|
|
155
|
+
* Advance epochs until we find one where the target proposer is selected for at least one slot,
|
|
156
|
+
* then stop one epoch before it. This leaves time for the caller to start sequencers before
|
|
157
|
+
* warping to the target epoch, avoiding the race where the target epoch passes before sequencers
|
|
158
|
+
* are ready.
|
|
159
|
+
*
|
|
160
|
+
* Returns the target epoch number so the caller can warp to it after starting sequencers.
|
|
161
|
+
*/
|
|
162
|
+
export async function advanceToEpochBeforeProposer({
|
|
163
|
+
epochCache,
|
|
164
|
+
cheatCodes,
|
|
165
|
+
targetProposer,
|
|
166
|
+
logger,
|
|
167
|
+
maxAttempts = 20,
|
|
168
|
+
}: {
|
|
169
|
+
epochCache: EpochCacheInterface;
|
|
170
|
+
cheatCodes: RollupCheatCodes;
|
|
171
|
+
targetProposer: EthAddress;
|
|
172
|
+
logger: Logger;
|
|
173
|
+
maxAttempts?: number;
|
|
174
|
+
}): Promise<{ targetEpoch: EpochNumber }> {
|
|
175
|
+
const { epochDuration } = await cheatCodes.getConfig();
|
|
176
|
+
|
|
177
|
+
for (let attempt = 0; attempt < maxAttempts; attempt++) {
|
|
178
|
+
const currentEpoch = await cheatCodes.getEpoch();
|
|
179
|
+
// Check the NEXT epoch's slots so we stay one epoch before the target,
|
|
180
|
+
// giving the caller time to start sequencers before the target epoch arrives.
|
|
181
|
+
const nextEpoch = Number(currentEpoch) + 1;
|
|
182
|
+
const startSlot = nextEpoch * Number(epochDuration);
|
|
183
|
+
const endSlot = startSlot + Number(epochDuration);
|
|
184
|
+
|
|
185
|
+
logger.info(
|
|
186
|
+
`Checking next epoch ${nextEpoch} (slots ${startSlot}-${endSlot - 1}) for proposer ${targetProposer} (current epoch: ${currentEpoch})`,
|
|
187
|
+
);
|
|
188
|
+
|
|
189
|
+
for (let s = startSlot; s < endSlot; s++) {
|
|
190
|
+
const proposer = await epochCache.getProposerAttesterAddressInSlot(SlotNumber(s));
|
|
191
|
+
if (proposer && proposer.equals(targetProposer)) {
|
|
192
|
+
logger.warn(
|
|
193
|
+
`Found target proposer ${targetProposer} in slot ${s} of epoch ${nextEpoch}. Staying at epoch ${currentEpoch} to allow sequencer startup.`,
|
|
194
|
+
);
|
|
195
|
+
return { targetEpoch: EpochNumber(nextEpoch) };
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
logger.info(`Target proposer not found in epoch ${nextEpoch}, advancing to next epoch`);
|
|
200
|
+
await cheatCodes.advanceToNextEpoch();
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
throw new Error(`Target proposer ${targetProposer} not found in any slot after ${maxAttempts} epoch attempts`);
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
/**
|
|
207
|
+
* Advance epochs until we find one where the target proposer is selected for at least one slot.
|
|
208
|
+
* With N validators and M slots per epoch, a specific proposer may not be selected in any given epoch.
|
|
209
|
+
* For example, with 4 validators and 2 slots/epoch, there is about a 44% chance per epoch.
|
|
210
|
+
*/
|
|
211
|
+
export async function awaitEpochWithProposer({
|
|
212
|
+
epochCache,
|
|
213
|
+
cheatCodes,
|
|
214
|
+
targetProposer,
|
|
215
|
+
logger,
|
|
216
|
+
maxAttempts = 20,
|
|
217
|
+
}: {
|
|
218
|
+
epochCache: EpochCacheInterface;
|
|
219
|
+
cheatCodes: RollupCheatCodes;
|
|
220
|
+
targetProposer: EthAddress;
|
|
221
|
+
logger: Logger;
|
|
222
|
+
maxAttempts?: number;
|
|
223
|
+
}): Promise<void> {
|
|
224
|
+
const { epochDuration } = await cheatCodes.getConfig();
|
|
225
|
+
|
|
226
|
+
for (let attempt = 0; attempt < maxAttempts; attempt++) {
|
|
227
|
+
const currentEpoch = await cheatCodes.getEpoch();
|
|
228
|
+
const startSlot = Number(currentEpoch) * Number(epochDuration);
|
|
229
|
+
const endSlot = startSlot + Number(epochDuration);
|
|
230
|
+
|
|
231
|
+
logger.info(`Checking epoch ${currentEpoch} (slots ${startSlot}-${endSlot - 1}) for proposer ${targetProposer}`);
|
|
232
|
+
|
|
233
|
+
for (let s = startSlot; s < endSlot; s++) {
|
|
234
|
+
const proposer = await epochCache.getProposerAttesterAddressInSlot(SlotNumber(s));
|
|
235
|
+
if (proposer && proposer.equals(targetProposer)) {
|
|
236
|
+
logger.warn(`Found target proposer ${targetProposer} in slot ${s} of epoch ${currentEpoch}`);
|
|
237
|
+
return;
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
logger.info(`Target proposer not found in epoch ${currentEpoch}, advancing to next epoch`);
|
|
242
|
+
await cheatCodes.advanceToNextEpoch();
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
throw new Error(`Target proposer ${targetProposer} not found in any slot after ${maxAttempts} epoch attempts`);
|
|
246
|
+
}
|
|
247
|
+
|
|
153
248
|
export async function awaitOffenseDetected({
|
|
154
249
|
logger,
|
|
155
250
|
nodeAdmin,
|
|
@@ -81,24 +81,28 @@ export class TokenContractTest {
|
|
|
81
81
|
await publicDeployAccounts(this.wallet, [this.adminAddress, this.account1Address]);
|
|
82
82
|
|
|
83
83
|
this.logger.verbose(`Deploying TokenContract...`);
|
|
84
|
-
this.asset = await TokenContract.deploy(
|
|
84
|
+
({ contract: this.asset } = await TokenContract.deploy(
|
|
85
85
|
this.wallet,
|
|
86
86
|
this.adminAddress,
|
|
87
87
|
TokenContractTest.TOKEN_NAME,
|
|
88
88
|
TokenContractTest.TOKEN_SYMBOL,
|
|
89
89
|
TokenContractTest.TOKEN_DECIMALS,
|
|
90
|
-
).send({ from: this.adminAddress });
|
|
90
|
+
).send({ from: this.adminAddress }));
|
|
91
91
|
this.logger.verbose(`Token deployed to ${this.asset.address}`);
|
|
92
92
|
|
|
93
93
|
this.logger.verbose(`Deploying bad account...`);
|
|
94
|
-
this.badAccount = await InvalidAccountContract.deploy(this.wallet).send({
|
|
94
|
+
({ contract: this.badAccount } = await InvalidAccountContract.deploy(this.wallet).send({
|
|
95
|
+
from: this.adminAddress,
|
|
96
|
+
}));
|
|
95
97
|
this.logger.verbose(`Deployed to ${this.badAccount.address}.`);
|
|
96
98
|
|
|
97
99
|
// Deploy a proxy contract for "on behalf of other" tests. The note owner must be the tx sender
|
|
98
100
|
// (so their notes are in scope), but msg_sender in the target must differ from the note owner
|
|
99
101
|
// to trigger authwit validation. The proxy forwards calls so that msg_sender != tx sender.
|
|
100
102
|
this.logger.verbose(`Deploying generic proxy...`);
|
|
101
|
-
this.authwitProxy = await GenericProxyContract.deploy(this.wallet).send({
|
|
103
|
+
({ contract: this.authwitProxy } = await GenericProxyContract.deploy(this.wallet).send({
|
|
104
|
+
from: this.adminAddress,
|
|
105
|
+
}));
|
|
102
106
|
this.logger.verbose(`Deployed to ${this.authwitProxy.address}.`);
|
|
103
107
|
|
|
104
108
|
this.tokenSim = new TokenSimulator(this.asset, this.wallet, this.adminAddress, this.logger, [
|
|
@@ -106,7 +110,7 @@ export class TokenContractTest {
|
|
|
106
110
|
this.account1Address,
|
|
107
111
|
]);
|
|
108
112
|
|
|
109
|
-
expect(await this.asset.methods.get_admin().simulate({ from: this.adminAddress })).toBe(
|
|
113
|
+
expect((await this.asset.methods.get_admin().simulate({ from: this.adminAddress })).result).toBe(
|
|
110
114
|
this.adminAddress.toBigInt(),
|
|
111
115
|
);
|
|
112
116
|
}
|
|
@@ -140,7 +144,9 @@ export class TokenContractTest {
|
|
|
140
144
|
await asset.methods.mint_to_public(adminAddress, amount).send({ from: adminAddress });
|
|
141
145
|
tokenSim.mintPublic(adminAddress, amount);
|
|
142
146
|
|
|
143
|
-
const publicBalance = await asset.methods
|
|
147
|
+
const { result: publicBalance } = await asset.methods
|
|
148
|
+
.balance_of_public(adminAddress)
|
|
149
|
+
.simulate({ from: adminAddress });
|
|
144
150
|
this.logger.verbose(`Public balance of wallet 0: ${publicBalance}`);
|
|
145
151
|
expect(publicBalance).toEqual(this.tokenSim.balanceOfPublic(adminAddress));
|
|
146
152
|
|
|
@@ -148,11 +154,13 @@ export class TokenContractTest {
|
|
|
148
154
|
await mintTokensToPrivate(asset, adminAddress, adminAddress, amount);
|
|
149
155
|
tokenSim.mintPrivate(adminAddress, amount);
|
|
150
156
|
|
|
151
|
-
const privateBalance = await asset.methods
|
|
157
|
+
const { result: privateBalance } = await asset.methods
|
|
158
|
+
.balance_of_private(adminAddress)
|
|
159
|
+
.simulate({ from: adminAddress });
|
|
152
160
|
this.logger.verbose(`Private balance of wallet 0: ${privateBalance}`);
|
|
153
161
|
expect(privateBalance).toEqual(tokenSim.balanceOfPrivate(adminAddress));
|
|
154
162
|
|
|
155
|
-
const totalSupply = await asset.methods.total_supply().simulate({ from: adminAddress });
|
|
163
|
+
const { result: totalSupply } = await asset.methods.total_supply().simulate({ from: adminAddress });
|
|
156
164
|
this.logger.verbose(`Total supply: ${totalSupply}`);
|
|
157
165
|
expect(totalSupply).toEqual(tokenSim.totalSupply);
|
|
158
166
|
|
|
@@ -17,6 +17,10 @@ async function buildProxyCall(proxy: GenericProxyContract, action: ContractFunct
|
|
|
17
17
|
return proxy.methods.forward_private_3(call.to, call.selector, call.args);
|
|
18
18
|
} else if (argCount === 4) {
|
|
19
19
|
return proxy.methods.forward_private_4(call.to, call.selector, call.args);
|
|
20
|
+
} else if (argCount === 5) {
|
|
21
|
+
return proxy.methods.forward_private_5(call.to, call.selector, call.args);
|
|
22
|
+
} else if (argCount === 6) {
|
|
23
|
+
return proxy.methods.forward_private_6(call.to, call.selector, call.args);
|
|
20
24
|
}
|
|
21
25
|
throw new Error(`No forward_private_${argCount} method on proxy`);
|
|
22
26
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { InitialAccountData } from '@aztec/accounts/testing';
|
|
2
|
-
import {
|
|
2
|
+
import { AztecNodeService } from '@aztec/aztec-node';
|
|
3
3
|
import { AztecAddress, EthAddress } from '@aztec/aztec.js/addresses';
|
|
4
4
|
import { type Logger, createLogger } from '@aztec/aztec.js/log';
|
|
5
5
|
import type { AztecNode } from '@aztec/aztec.js/node';
|
|
@@ -11,13 +11,11 @@ import {
|
|
|
11
11
|
TestCircuitVerifier,
|
|
12
12
|
} from '@aztec/bb-prover';
|
|
13
13
|
import { BackendType, Barretenberg } from '@aztec/bb.js';
|
|
14
|
-
import { createBlobClientWithFileStores } from '@aztec/blob-client/client';
|
|
15
14
|
import type { DeployAztecL1ContractsReturnType } from '@aztec/ethereum/deploy-aztec-l1-contracts';
|
|
16
15
|
import { Buffer32 } from '@aztec/foundation/buffer';
|
|
17
16
|
import { SecretValue } from '@aztec/foundation/config';
|
|
18
17
|
import { FeeAssetHandlerAbi } from '@aztec/l1-artifacts';
|
|
19
18
|
import { TokenContract } from '@aztec/noir-contracts.js/Token';
|
|
20
|
-
import { type ProverNode, type ProverNodeConfig, createProverNode } from '@aztec/prover-node';
|
|
21
19
|
import type { ContractInstanceWithAddress } from '@aztec/stdlib/contract';
|
|
22
20
|
import type { AztecNodeAdmin } from '@aztec/stdlib/interfaces/client';
|
|
23
21
|
import { getGenesisValues } from '@aztec/world-state/testing';
|
|
@@ -73,8 +71,8 @@ export class FullProverTest {
|
|
|
73
71
|
circuitProofVerifier?: ClientProtocolCircuitVerifier;
|
|
74
72
|
provenAsset!: TokenContract;
|
|
75
73
|
context!: EndToEndContext;
|
|
76
|
-
private
|
|
77
|
-
private
|
|
74
|
+
private proverAztecNode!: AztecNodeService;
|
|
75
|
+
private simulatedProverAztecNode!: AztecNodeService;
|
|
78
76
|
public l1Contracts!: DeployAztecL1ContractsReturnType;
|
|
79
77
|
public proverAddress!: EthAddress;
|
|
80
78
|
private minNumberOfTxsPerBlock: number;
|
|
@@ -108,7 +106,9 @@ export class FullProverTest {
|
|
|
108
106
|
await publicDeployAccounts(this.wallet, this.accounts.slice(0, 2));
|
|
109
107
|
|
|
110
108
|
this.logger.info('Applying base setup: deploying token contract');
|
|
111
|
-
const {
|
|
109
|
+
const {
|
|
110
|
+
receipt: { contract: asset, instance },
|
|
111
|
+
} = await TokenContract.deploy(
|
|
112
112
|
this.wallet,
|
|
113
113
|
this.accounts[0],
|
|
114
114
|
FullProverTest.TOKEN_NAME,
|
|
@@ -123,7 +123,7 @@ export class FullProverTest {
|
|
|
123
123
|
|
|
124
124
|
this.tokenSim = new TokenSimulator(this.fakeProofsAsset, this.wallet, this.accounts[0], this.logger, this.accounts);
|
|
125
125
|
|
|
126
|
-
expect(await this.fakeProofsAsset.methods.get_admin().simulate({ from: this.accounts[0] })).toBe(
|
|
126
|
+
expect((await this.fakeProofsAsset.methods.get_admin().simulate({ from: this.accounts[0] })).result).toBe(
|
|
127
127
|
this.accounts[0].toBigInt(),
|
|
128
128
|
);
|
|
129
129
|
}
|
|
@@ -146,7 +146,7 @@ export class FullProverTest {
|
|
|
146
146
|
// We don't wish to mark as proven automatically, so we set the flag to false
|
|
147
147
|
this.context.watcher.setIsMarkingAsProven(false);
|
|
148
148
|
|
|
149
|
-
this.
|
|
149
|
+
this.simulatedProverAztecNode = this.context.proverNode!;
|
|
150
150
|
({
|
|
151
151
|
aztecNode: this.aztecNode,
|
|
152
152
|
deployL1ContractsValues: this.l1Contracts,
|
|
@@ -155,7 +155,6 @@ export class FullProverTest {
|
|
|
155
155
|
this.aztecNodeAdmin = this.context.aztecNodeService;
|
|
156
156
|
|
|
157
157
|
const config = this.context.aztecNodeConfig;
|
|
158
|
-
const blobClient = await createBlobClientWithFileStores(config, this.logger);
|
|
159
158
|
|
|
160
159
|
// Configure a full prover PXE
|
|
161
160
|
let acvmConfig: Awaited<ReturnType<typeof getACVMConfig>> | undefined;
|
|
@@ -217,20 +216,13 @@ export class FullProverTest {
|
|
|
217
216
|
this.provenWallet = provenWallet;
|
|
218
217
|
this.logger.info(`Full prover PXE started`);
|
|
219
218
|
|
|
220
|
-
// Shutdown the current, simulated prover node
|
|
219
|
+
// Shutdown the current, simulated prover node (by stopping its hosting aztec node)
|
|
221
220
|
this.logger.verbose('Shutting down simulated prover node');
|
|
222
|
-
await this.
|
|
223
|
-
|
|
224
|
-
// Creating temp store and archiver for fully proven prover node
|
|
225
|
-
this.logger.verbose('Starting archiver for new prover node');
|
|
226
|
-
const archiver = await createArchiver(
|
|
227
|
-
{ ...this.context.aztecNodeConfig, dataDirectory: undefined },
|
|
228
|
-
{ blobClient, dateProvider: this.context.dateProvider },
|
|
229
|
-
{ blockUntilSync: true },
|
|
230
|
-
);
|
|
221
|
+
await this.simulatedProverAztecNode.stop();
|
|
231
222
|
|
|
232
223
|
// The simulated prover node (now shutdown) used private key index 2
|
|
233
224
|
const proverNodePrivateKey = getPrivateKeyFromIndex(2);
|
|
225
|
+
const proverNodePrivateKeyHex = `0x${proverNodePrivateKey!.toString('hex')}` as const;
|
|
234
226
|
const proverNodeSenderAddress = privateKeyToAddress(new Buffer32(proverNodePrivateKey!).toString());
|
|
235
227
|
this.proverAddress = EthAddress.fromString(proverNodeSenderAddress);
|
|
236
228
|
|
|
@@ -238,14 +230,21 @@ export class FullProverTest {
|
|
|
238
230
|
await this.mintFeeJuice(proverNodeSenderAddress);
|
|
239
231
|
|
|
240
232
|
this.logger.verbose('Starting prover node');
|
|
241
|
-
const
|
|
242
|
-
|
|
243
|
-
|
|
233
|
+
const sponsoredFPCAddress = await getSponsoredFPCAddress();
|
|
234
|
+
const { prefilledPublicData } = await getGenesisValues(
|
|
235
|
+
this.context.initialFundedAccounts.map(a => a.address).concat(sponsoredFPCAddress),
|
|
236
|
+
);
|
|
237
|
+
|
|
238
|
+
const proverNodeConfig: Parameters<typeof AztecNodeService.createAndSync>[0] = {
|
|
239
|
+
...config,
|
|
240
|
+
enableProverNode: true,
|
|
241
|
+
disableValidator: true,
|
|
244
242
|
dataDirectory: undefined,
|
|
243
|
+
txCollectionNodeRpcUrls: [],
|
|
245
244
|
proverId: this.proverAddress,
|
|
246
245
|
realProofs: this.realProofs,
|
|
247
246
|
proverAgentCount: 2,
|
|
248
|
-
|
|
247
|
+
proverPublisherPrivateKeys: [new SecretValue(proverNodePrivateKeyHex)],
|
|
249
248
|
proverNodeMaxPendingJobs: 100,
|
|
250
249
|
proverNodeMaxParallelBlocksPerEpoch: 32,
|
|
251
250
|
proverNodePollingIntervalMs: 100,
|
|
@@ -255,21 +254,14 @@ export class FullProverTest {
|
|
|
255
254
|
txGatheringTimeoutMs: 24_000,
|
|
256
255
|
proverNodeFailedEpochStore: undefined,
|
|
257
256
|
proverNodeEpochProvingDelayMs: undefined,
|
|
257
|
+
validatorPrivateKeys: new SecretValue([]),
|
|
258
258
|
};
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
this.proverNode = await createProverNode(
|
|
264
|
-
proverConfig,
|
|
265
|
-
{
|
|
266
|
-
aztecNodeTxProvider: this.aztecNode,
|
|
267
|
-
archiver: archiver as Archiver,
|
|
268
|
-
},
|
|
259
|
+
|
|
260
|
+
this.proverAztecNode = await AztecNodeService.createAndSync(
|
|
261
|
+
proverNodeConfig,
|
|
262
|
+
{ dateProvider: this.context.dateProvider, p2pClientDeps: { rpcTxProviders: [this.aztecNode] } },
|
|
269
263
|
{ prefilledPublicData },
|
|
270
264
|
);
|
|
271
|
-
await this.proverNode.start();
|
|
272
|
-
|
|
273
265
|
this.logger.warn(`Proofs are now enabled`, { realProofs: this.realProofs });
|
|
274
266
|
return this;
|
|
275
267
|
}
|
|
@@ -289,8 +281,8 @@ export class FullProverTest {
|
|
|
289
281
|
await this.provenComponents[i].teardown();
|
|
290
282
|
}
|
|
291
283
|
|
|
292
|
-
// clean up the full prover node
|
|
293
|
-
await this.
|
|
284
|
+
// clean up the full prover node (by stopping its hosting aztec node)
|
|
285
|
+
await this.proverAztecNode.stop();
|
|
294
286
|
|
|
295
287
|
await Barretenberg.destroySingleton();
|
|
296
288
|
await this.bbConfigCleanup?.();
|
|
@@ -320,16 +312,20 @@ export class FullProverTest {
|
|
|
320
312
|
} = this;
|
|
321
313
|
tokenSim.mintPublic(address, publicAmount);
|
|
322
314
|
|
|
323
|
-
const publicBalance = await fakeProofsAsset.methods
|
|
315
|
+
const { result: publicBalance } = await fakeProofsAsset.methods
|
|
316
|
+
.balance_of_public(address)
|
|
317
|
+
.simulate({ from: address });
|
|
324
318
|
this.logger.verbose(`Public balance of wallet 0: ${publicBalance}`);
|
|
325
319
|
expect(publicBalance).toEqual(this.tokenSim.balanceOfPublic(address));
|
|
326
320
|
|
|
327
321
|
tokenSim.mintPrivate(address, publicAmount);
|
|
328
|
-
const privateBalance = await fakeProofsAsset.methods
|
|
322
|
+
const { result: privateBalance } = await fakeProofsAsset.methods
|
|
323
|
+
.balance_of_private(address)
|
|
324
|
+
.simulate({ from: address });
|
|
329
325
|
this.logger.verbose(`Private balance of wallet 0: ${privateBalance}`);
|
|
330
326
|
expect(privateBalance).toEqual(tokenSim.balanceOfPrivate(address));
|
|
331
327
|
|
|
332
|
-
const totalSupply = await fakeProofsAsset.methods.total_supply().simulate({ from: address });
|
|
328
|
+
const { result: totalSupply } = await fakeProofsAsset.methods.total_supply().simulate({ from: address });
|
|
333
329
|
this.logger.verbose(`Total supply: ${totalSupply}`);
|
|
334
330
|
expect(totalSupply).toEqual(tokenSim.totalSupply);
|
|
335
331
|
}
|
package/src/fixtures/fixtures.ts
CHANGED
|
@@ -7,6 +7,16 @@ export const shouldCollectMetrics = () => {
|
|
|
7
7
|
return undefined;
|
|
8
8
|
};
|
|
9
9
|
|
|
10
|
+
/** Returns the boot node UDP port from environment variable or default value. */
|
|
11
|
+
export function getBootNodeUdpPort(): number {
|
|
12
|
+
return process.env.BOOT_NODE_UDP_PORT ? parseInt(process.env.BOOT_NODE_UDP_PORT, 10) : 4500;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/** Returns the anvil port from environment variable or default value. */
|
|
16
|
+
export function getAnvilPort(): number {
|
|
17
|
+
return process.env.ANVIL_PORT ? parseInt(process.env.ANVIL_PORT, 10) : 8545;
|
|
18
|
+
}
|
|
19
|
+
|
|
10
20
|
export const TEST_PEER_CHECK_INTERVAL_MS = 1000;
|
|
11
21
|
export const TEST_MAX_PENDING_TX_POOL_COUNT = 10_000; // Number of max pending TXs ~ 1.56GB
|
|
12
22
|
|