@aztec/end-to-end 0.81.0 → 0.82.0
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/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 +7 -7
- package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts +0 -1
- 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 +3 -18
- package/dest/e2e_deploy_contract/deploy_test.d.ts +2 -0
- package/dest/e2e_deploy_contract/deploy_test.d.ts.map +1 -1
- package/dest/e2e_deploy_contract/deploy_test.js +2 -0
- package/dest/e2e_epochs/epochs_test.d.ts +1 -2
- package/dest/e2e_epochs/epochs_test.d.ts.map +1 -1
- package/dest/e2e_epochs/epochs_test.js +7 -6
- package/dest/e2e_fees/fees_test.d.ts.map +1 -1
- package/dest/e2e_fees/fees_test.js +20 -29
- package/dest/e2e_prover/e2e_prover_test.d.ts +2 -0
- package/dest/e2e_prover/e2e_prover_test.d.ts.map +1 -1
- package/dest/e2e_prover/e2e_prover_test.js +7 -8
- package/dest/e2e_token_contract/token_contract_test.d.ts +2 -1
- package/dest/e2e_token_contract/token_contract_test.d.ts.map +1 -1
- package/dest/e2e_token_contract/token_contract_test.js +3 -1
- package/dest/fixtures/snapshot_manager.d.ts +4 -2
- package/dest/fixtures/snapshot_manager.d.ts.map +1 -1
- package/dest/fixtures/snapshot_manager.js +17 -16
- package/dest/fixtures/utils.d.ts +5 -5
- package/dest/fixtures/utils.d.ts.map +1 -1
- package/dest/fixtures/utils.js +13 -8
- package/dest/shared/capture_private_execution_steps.d.ts +7 -0
- package/dest/shared/capture_private_execution_steps.d.ts.map +1 -0
- package/dest/shared/capture_private_execution_steps.js +40 -0
- package/dest/shared/cross_chain_test_harness.d.ts +2 -2
- package/dest/shared/cross_chain_test_harness.d.ts.map +1 -1
- package/dest/shared/cross_chain_test_harness.js +16 -4
- package/dest/shared/gas_portal_test_harness.d.ts +11 -1
- package/dest/shared/gas_portal_test_harness.d.ts.map +1 -1
- package/dest/shared/gas_portal_test_harness.js +27 -12
- package/dest/shared/uniswap_l1_l2.d.ts.map +1 -1
- package/dest/shared/uniswap_l1_l2.js +24 -16
- package/dest/simulators/lending_simulator.d.ts +3 -5
- package/dest/simulators/lending_simulator.d.ts.map +1 -1
- package/dest/simulators/lending_simulator.js +5 -13
- package/dest/spartan/setup_test_wallets.d.ts +1 -1
- package/dest/spartan/setup_test_wallets.d.ts.map +1 -1
- package/dest/spartan/setup_test_wallets.js +6 -4
- package/dest/spartan/utils.d.ts +18 -5
- package/dest/spartan/utils.d.ts.map +1 -1
- package/dest/spartan/utils.js +8 -5
- package/package.json +33 -31
- package/src/e2e_blacklist_token_contract/blacklist_token_contract_test.ts +9 -5
- package/src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts +3 -19
- package/src/e2e_deploy_contract/deploy_test.ts +3 -0
- package/src/e2e_epochs/epochs_test.ts +6 -5
- package/src/e2e_fees/fees_test.ts +21 -28
- package/src/e2e_prover/e2e_prover_test.ts +8 -7
- package/src/e2e_token_contract/token_contract_test.ts +4 -2
- package/src/fixtures/snapshot_manager.ts +24 -10
- package/src/fixtures/utils.ts +25 -9
- package/src/guides/up_quick_start.sh +1 -2
- package/src/shared/capture_private_execution_steps.ts +43 -0
- package/src/shared/cross_chain_test_harness.ts +14 -3
- package/src/shared/gas_portal_test_harness.ts +29 -9
- package/src/shared/uniswap_l1_l2.ts +16 -16
- package/src/simulators/lending_simulator.ts +7 -12
- package/src/spartan/setup_test_wallets.ts +7 -7
- package/src/spartan/utils.ts +8 -5
|
@@ -10,10 +10,10 @@ import {
|
|
|
10
10
|
} from '@aztec/aztec.js';
|
|
11
11
|
import { CheatCodes } from '@aztec/aztec.js/testing';
|
|
12
12
|
import { FEE_FUNDING_FOR_TESTER_ACCOUNT } from '@aztec/constants';
|
|
13
|
-
import { type DeployL1ContractsArgs, RollupContract, createL1Clients } from '@aztec/ethereum';
|
|
13
|
+
import { type DeployL1ContractsArgs, RollupContract, createL1Clients, getPublicClient } from '@aztec/ethereum';
|
|
14
14
|
import { ChainMonitor } from '@aztec/ethereum/test';
|
|
15
15
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
16
|
-
import {
|
|
16
|
+
import { TestERC20Abi } from '@aztec/l1-artifacts';
|
|
17
17
|
import { AppSubscriptionContract } from '@aztec/noir-contracts.js/AppSubscription';
|
|
18
18
|
import { CounterContract } from '@aztec/noir-contracts.js/Counter';
|
|
19
19
|
import { FPCContract } from '@aztec/noir-contracts.js/FPC';
|
|
@@ -21,7 +21,6 @@ import { FeeJuiceContract } from '@aztec/noir-contracts.js/FeeJuice';
|
|
|
21
21
|
import { TokenContract as BananaCoin } from '@aztec/noir-contracts.js/Token';
|
|
22
22
|
import { ProtocolContractAddress } from '@aztec/protocol-contracts';
|
|
23
23
|
import { getCanonicalFeeJuice } from '@aztec/protocol-contracts/fee-juice';
|
|
24
|
-
import { computePartialAddress } from '@aztec/stdlib/contract';
|
|
25
24
|
import { GasSettings } from '@aztec/stdlib/gas';
|
|
26
25
|
|
|
27
26
|
import { getContract } from 'viem';
|
|
@@ -165,8 +164,9 @@ export class FeesTest {
|
|
|
165
164
|
await this.snapshotManager.snapshot(
|
|
166
165
|
'initial_accounts',
|
|
167
166
|
deployAccounts(this.numberOfAccounts, this.logger),
|
|
168
|
-
async ({ deployedAccounts }, { pxe, aztecNode, aztecNodeConfig }) => {
|
|
167
|
+
async ({ deployedAccounts }, { pxe, aztecNode, aztecNodeConfig, deployL1ContractsValues }) => {
|
|
169
168
|
this.pxe = pxe;
|
|
169
|
+
|
|
170
170
|
this.aztecNode = aztecNode;
|
|
171
171
|
this.gasSettings = GasSettings.default({ maxFeesPerGas: (await this.aztecNode.getCurrentBaseFees()).mul(2) });
|
|
172
172
|
this.cheatCodes = await CheatCodes.create(aztecNodeConfig.l1RpcUrls, pxe);
|
|
@@ -180,18 +180,14 @@ export class FeesTest {
|
|
|
180
180
|
|
|
181
181
|
const canonicalFeeJuice = await getCanonicalFeeJuice();
|
|
182
182
|
this.feeJuiceContract = await FeeJuiceContract.at(canonicalFeeJuice.address, this.aliceWallet);
|
|
183
|
-
if (this.numberOfAccounts > 1) {
|
|
184
|
-
const bobInstance = (await this.bobWallet.getContractMetadata(this.bobAddress)).contractInstance;
|
|
185
|
-
await this.aliceWallet.registerAccount(deployedAccounts[1].secret, await computePartialAddress(bobInstance!));
|
|
186
|
-
}
|
|
187
183
|
this.coinbase = EthAddress.random();
|
|
188
184
|
|
|
189
|
-
const { publicClient, walletClient } = createL1Clients(aztecNodeConfig.l1RpcUrls, MNEMONIC);
|
|
190
185
|
this.feeJuiceBridgeTestHarness = await FeeJuicePortalTestingHarnessFactory.create({
|
|
191
|
-
aztecNode
|
|
186
|
+
aztecNode,
|
|
187
|
+
aztecNodeAdmin: aztecNode,
|
|
192
188
|
pxeService: pxe,
|
|
193
|
-
publicClient: publicClient,
|
|
194
|
-
walletClient: walletClient,
|
|
189
|
+
publicClient: deployL1ContractsValues.publicClient,
|
|
190
|
+
walletClient: deployL1ContractsValues.walletClient,
|
|
195
191
|
wallet: this.aliceWallet,
|
|
196
192
|
logger: this.logger,
|
|
197
193
|
});
|
|
@@ -218,12 +214,12 @@ export class FeesTest {
|
|
|
218
214
|
|
|
219
215
|
this.getGasBalanceFn = getBalancesFn('⛽', this.feeJuiceContract.methods.balance_of_public, this.logger);
|
|
220
216
|
|
|
221
|
-
const { publicClient, walletClient } = createL1Clients(context.aztecNodeConfig.l1RpcUrls, MNEMONIC);
|
|
222
217
|
this.feeJuiceBridgeTestHarness = await FeeJuicePortalTestingHarnessFactory.create({
|
|
223
218
|
aztecNode: context.aztecNode,
|
|
219
|
+
aztecNodeAdmin: context.aztecNode,
|
|
224
220
|
pxeService: context.pxe,
|
|
225
|
-
publicClient: publicClient,
|
|
226
|
-
walletClient: walletClient,
|
|
221
|
+
publicClient: context.deployL1ContractsValues.publicClient,
|
|
222
|
+
walletClient: context.deployL1ContractsValues.walletClient,
|
|
227
223
|
wallet: this.aliceWallet,
|
|
228
224
|
logger: this.logger,
|
|
229
225
|
});
|
|
@@ -293,25 +289,22 @@ export class FeesTest {
|
|
|
293
289
|
};
|
|
294
290
|
|
|
295
291
|
this.getCoinbaseSequencerRewards = async () => {
|
|
296
|
-
const
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
abi: RollupAbi,
|
|
300
|
-
client: walletClient,
|
|
292
|
+
const publicClient = getPublicClient({
|
|
293
|
+
l1RpcUrls: context.aztecNodeConfig.l1RpcUrls,
|
|
294
|
+
l1ChainId: context.aztecNodeConfig.l1ChainId,
|
|
301
295
|
});
|
|
302
|
-
|
|
303
|
-
return await rollup.
|
|
296
|
+
const rollup = new RollupContract(publicClient, data.rollupAddress);
|
|
297
|
+
return await rollup.getSequencerRewards(this.coinbase);
|
|
304
298
|
};
|
|
305
299
|
|
|
306
300
|
this.getProverFee = async (blockNumber: number) => {
|
|
307
|
-
const
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
abi: RollupAbi,
|
|
311
|
-
client: walletClient,
|
|
301
|
+
const publicClient = getPublicClient({
|
|
302
|
+
l1RpcUrls: context.aztecNodeConfig.l1RpcUrls,
|
|
303
|
+
l1ChainId: context.aztecNodeConfig.l1ChainId,
|
|
312
304
|
});
|
|
305
|
+
const rollup = new RollupContract(publicClient, data.rollupAddress);
|
|
313
306
|
|
|
314
|
-
const provingCostPerMana = await rollup.
|
|
307
|
+
const provingCostPerMana = await rollup.getProvingCostPerManaInFeeAsset();
|
|
315
308
|
|
|
316
309
|
const block = await this.pxe.getBlock(blockNumber);
|
|
317
310
|
const mana = block!.header.totalManaUsed.toBigInt();
|
|
@@ -24,6 +24,7 @@ import { HonkVerifierAbi, HonkVerifierBytecode, RollupAbi, TestERC20Abi } from '
|
|
|
24
24
|
import { TokenContract } from '@aztec/noir-contracts.js/Token';
|
|
25
25
|
import { type ProverNode, type ProverNodeConfig, createProverNode } from '@aztec/prover-node';
|
|
26
26
|
import type { PXEService } from '@aztec/pxe/server';
|
|
27
|
+
import type { AztecNodeAdmin } from '@aztec/stdlib/interfaces/client';
|
|
27
28
|
import { getGenesisValues } from '@aztec/world-state/testing';
|
|
28
29
|
|
|
29
30
|
import { type Hex, getContract } from 'viem';
|
|
@@ -67,6 +68,7 @@ export class FullProverTest {
|
|
|
67
68
|
fakeProofsAsset!: TokenContract;
|
|
68
69
|
tokenSim!: TokenSimulator;
|
|
69
70
|
aztecNode!: AztecNode;
|
|
71
|
+
aztecNodeAdmin!: AztecNodeAdmin;
|
|
70
72
|
pxe!: PXEService;
|
|
71
73
|
cheatCodes!: CheatCodes;
|
|
72
74
|
blobSink!: BlobSinkServer;
|
|
@@ -121,7 +123,7 @@ export class FullProverTest {
|
|
|
121
123
|
// Create the token contract state.
|
|
122
124
|
// Move this account thing to addAccounts above?
|
|
123
125
|
this.logger.verbose(`Public deploy accounts...`);
|
|
124
|
-
await publicDeployAccounts(this.wallets[0], this.accounts.slice(0, 2)
|
|
126
|
+
await publicDeployAccounts(this.wallets[0], this.accounts.slice(0, 2));
|
|
125
127
|
|
|
126
128
|
this.logger.verbose(`Deploying TokenContract...`);
|
|
127
129
|
const asset = await TokenContract.deploy(
|
|
@@ -168,6 +170,7 @@ export class FullProverTest {
|
|
|
168
170
|
cheatCodes: this.cheatCodes,
|
|
169
171
|
blobSink: this.blobSink,
|
|
170
172
|
} = this.context);
|
|
173
|
+
this.aztecNodeAdmin = this.context.aztecNode;
|
|
171
174
|
|
|
172
175
|
const blobSinkClient = createBlobSinkClient({ blobSinkUrl: `http://localhost:${this.blobSink.port}` });
|
|
173
176
|
|
|
@@ -190,14 +193,14 @@ export class FullProverTest {
|
|
|
190
193
|
this.circuitProofVerifier = await BBCircuitVerifier.new(bbConfig);
|
|
191
194
|
|
|
192
195
|
this.logger.debug(`Configuring the node for real proofs...`);
|
|
193
|
-
await this.
|
|
196
|
+
await this.aztecNodeAdmin.setConfig({
|
|
194
197
|
realProofs: true,
|
|
195
198
|
minTxsPerBlock: this.minNumberOfTxsPerBlock,
|
|
196
199
|
});
|
|
197
200
|
} else {
|
|
198
201
|
this.logger.debug(`Configuring the node min txs per block ${this.minNumberOfTxsPerBlock}...`);
|
|
199
202
|
this.circuitProofVerifier = new TestCircuitVerifier();
|
|
200
|
-
await this.
|
|
203
|
+
await this.aztecNodeAdmin.setConfig({
|
|
201
204
|
minTxsPerBlock: this.minNumberOfTxsPerBlock,
|
|
202
205
|
});
|
|
203
206
|
}
|
|
@@ -345,16 +348,14 @@ export class FullProverTest {
|
|
|
345
348
|
const privateAmount = 10000n;
|
|
346
349
|
const publicAmount = 10000n;
|
|
347
350
|
|
|
348
|
-
const waitOpts = { proven: false };
|
|
349
|
-
|
|
350
351
|
this.logger.verbose(`Minting ${privateAmount + publicAmount} publicly...`);
|
|
351
352
|
await asset.methods
|
|
352
353
|
.mint_to_public(accounts[0].address, privateAmount + publicAmount)
|
|
353
354
|
.send()
|
|
354
|
-
.wait(
|
|
355
|
+
.wait();
|
|
355
356
|
|
|
356
357
|
this.logger.verbose(`Transferring ${privateAmount} to private...`);
|
|
357
|
-
await asset.methods.transfer_to_private(accounts[0].address, privateAmount).send().wait(
|
|
358
|
+
await asset.methods.transfer_to_private(accounts[0].address, privateAmount).send().wait();
|
|
358
359
|
|
|
359
360
|
this.logger.verbose(`Minting complete.`);
|
|
360
361
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { getSchnorrWallet } from '@aztec/accounts/schnorr';
|
|
2
|
-
import { type AccountWallet, type CompleteAddress, type Logger, createLogger } from '@aztec/aztec.js';
|
|
2
|
+
import { type AccountWallet, type AztecNode, type CompleteAddress, type Logger, createLogger } from '@aztec/aztec.js';
|
|
3
3
|
import { DocsExampleContract } from '@aztec/noir-contracts.js/DocsExample';
|
|
4
4
|
import { TokenContract } from '@aztec/noir-contracts.js/Token';
|
|
5
5
|
|
|
@@ -28,6 +28,7 @@ export class TokenContractTest {
|
|
|
28
28
|
asset!: TokenContract;
|
|
29
29
|
tokenSim!: TokenSimulator;
|
|
30
30
|
badAccount!: DocsExampleContract;
|
|
31
|
+
node!: AztecNode;
|
|
31
32
|
|
|
32
33
|
constructor(testName: string) {
|
|
33
34
|
this.logger = createLogger(`e2e:e2e_token_contract:${testName}`);
|
|
@@ -48,7 +49,8 @@ export class TokenContractTest {
|
|
|
48
49
|
await this.snapshotManager.snapshot(
|
|
49
50
|
'3_accounts',
|
|
50
51
|
deployAccounts(3, this.logger),
|
|
51
|
-
async ({ deployedAccounts }, { pxe }) => {
|
|
52
|
+
async ({ deployedAccounts }, { pxe, aztecNode }) => {
|
|
53
|
+
this.node = aztecNode;
|
|
52
54
|
this.wallets = await Promise.all(deployedAccounts.map(a => getSchnorrWallet(pxe, a.address, a.signingKey)));
|
|
53
55
|
this.accounts = this.wallets.map(w => w.getCompleteAddress());
|
|
54
56
|
},
|
|
@@ -3,13 +3,16 @@ import { type InitialAccountData, deployFundedSchnorrAccounts, generateSchnorrAc
|
|
|
3
3
|
import { type AztecNodeConfig, AztecNodeService, getConfigEnvVars } from '@aztec/aztec-node';
|
|
4
4
|
import {
|
|
5
5
|
type AztecAddress,
|
|
6
|
+
type AztecNode,
|
|
6
7
|
BatchCall,
|
|
7
8
|
type CompleteAddress,
|
|
8
9
|
type ContractFunctionInteraction,
|
|
10
|
+
DefaultWaitForProvenOpts,
|
|
9
11
|
type Logger,
|
|
10
12
|
type PXE,
|
|
11
13
|
type Wallet,
|
|
12
14
|
getContractClassFromArtifact,
|
|
15
|
+
waitForProven,
|
|
13
16
|
} from '@aztec/aztec.js';
|
|
14
17
|
import { deployInstance, registerContractClass } from '@aztec/aztec.js/deployment';
|
|
15
18
|
import { AnvilTestWatcher, CheatCodes } from '@aztec/aztec.js/testing';
|
|
@@ -400,10 +403,8 @@ async function setupFromFresh(
|
|
|
400
403
|
l1RpcUrls: aztecNodeConfig.l1RpcUrls,
|
|
401
404
|
rollupAddress: aztecNodeConfig.l1Contracts.rollupAddress,
|
|
402
405
|
port: blobSinkPort,
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
dataStoreMapSizeKB: aztecNodeConfig.dataStoreMapSizeKB,
|
|
406
|
-
},
|
|
406
|
+
dataDirectory: aztecNodeConfig.dataDirectory,
|
|
407
|
+
dataStoreMapSizeKB: aztecNodeConfig.dataStoreMapSizeKB,
|
|
407
408
|
},
|
|
408
409
|
telemetry,
|
|
409
410
|
);
|
|
@@ -522,10 +523,8 @@ async function setupFromState(statePath: string, logger: Logger): Promise<Subsys
|
|
|
522
523
|
l1RpcUrls: aztecNodeConfig.l1RpcUrls,
|
|
523
524
|
rollupAddress: aztecNodeConfig.l1Contracts.rollupAddress,
|
|
524
525
|
port: blobSinkPort,
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
dataStoreMapSizeKB: aztecNodeConfig.dataStoreMapSizeKB,
|
|
528
|
-
},
|
|
526
|
+
dataDirectory: statePath,
|
|
527
|
+
dataStoreMapSizeKB: aztecNodeConfig.dataStoreMapSizeKB,
|
|
529
528
|
},
|
|
530
529
|
telemetry,
|
|
531
530
|
);
|
|
@@ -594,7 +593,12 @@ export const deployAccounts =
|
|
|
594
593
|
|
|
595
594
|
logger.verbose('Deploying accounts funded with fee juice...');
|
|
596
595
|
const deployedAccounts = initialFundedAccounts.slice(0, numberOfAccounts);
|
|
597
|
-
await deployFundedSchnorrAccounts(
|
|
596
|
+
await deployFundedSchnorrAccounts(
|
|
597
|
+
pxe,
|
|
598
|
+
deployedAccounts,
|
|
599
|
+
undefined,
|
|
600
|
+
waitUntilProven ? DefaultWaitForProvenOpts : undefined,
|
|
601
|
+
);
|
|
598
602
|
|
|
599
603
|
return { deployedAccounts };
|
|
600
604
|
};
|
|
@@ -604,11 +608,14 @@ export const deployAccounts =
|
|
|
604
608
|
* Use this when you need to make a public call to an account contract, such as for requesting a public authwit.
|
|
605
609
|
* @param sender - Wallet to send the deployment tx.
|
|
606
610
|
* @param accountsToDeploy - Which accounts to publicly deploy.
|
|
611
|
+
* @param waitUntilProven - Whether to wait for the tx to be proven.
|
|
612
|
+
* @param pxeOrNode - PXE or AztecNode to wait for proven.
|
|
607
613
|
*/
|
|
608
614
|
export async function publicDeployAccounts(
|
|
609
615
|
sender: Wallet,
|
|
610
616
|
accountsToDeploy: (CompleteAddress | AztecAddress)[],
|
|
611
617
|
waitUntilProven = false,
|
|
618
|
+
pxeOrNode?: PXE | AztecNode,
|
|
612
619
|
) {
|
|
613
620
|
const accountAddressesToDeploy = accountsToDeploy.map(a => ('address' in a ? a.address : a));
|
|
614
621
|
const instances = (
|
|
@@ -625,5 +632,12 @@ export async function publicDeployAccounts(
|
|
|
625
632
|
|
|
626
633
|
const batch = new BatchCall(sender, calls);
|
|
627
634
|
|
|
628
|
-
await batch.send().wait(
|
|
635
|
+
const txReceipt = await batch.send().wait();
|
|
636
|
+
if (waitUntilProven) {
|
|
637
|
+
if (!pxeOrNode) {
|
|
638
|
+
throw new Error('Need to provide a PXE or AztecNode to wait for proven.');
|
|
639
|
+
} else {
|
|
640
|
+
await waitForProven(pxeOrNode, txReceipt);
|
|
641
|
+
}
|
|
642
|
+
}
|
|
629
643
|
}
|
package/src/fixtures/utils.ts
CHANGED
|
@@ -27,7 +27,6 @@ import {
|
|
|
27
27
|
} from '@aztec/aztec.js';
|
|
28
28
|
import { deployInstance, registerContractClass } from '@aztec/aztec.js/deployment';
|
|
29
29
|
import { AnvilTestWatcher, CheatCodes } from '@aztec/aztec.js/testing';
|
|
30
|
-
import type { BBNativePrivateKernelProver } from '@aztec/bb-prover';
|
|
31
30
|
import { createBlobSinkClient } from '@aztec/blob-sink/client';
|
|
32
31
|
import { type BlobSinkServer, createBlobSinkServer } from '@aztec/blob-sink/server';
|
|
33
32
|
import { FEE_JUICE_INITIAL_MINT, GENESIS_ARCHIVE_ROOT, GENESIS_BLOCK_HASH } from '@aztec/constants';
|
|
@@ -52,11 +51,19 @@ import { FeeJuiceContract } from '@aztec/noir-contracts.js/FeeJuice';
|
|
|
52
51
|
import { getVKTreeRoot } from '@aztec/noir-protocol-circuits-types/vk-tree';
|
|
53
52
|
import { ProtocolContractAddress, protocolContractTreeRoot } from '@aztec/protocol-contracts';
|
|
54
53
|
import { type ProverNode, type ProverNodeConfig, createProverNode } from '@aztec/prover-node';
|
|
55
|
-
import {
|
|
54
|
+
import {
|
|
55
|
+
type PXEService,
|
|
56
|
+
type PXEServiceConfig,
|
|
57
|
+
createPXEServiceWithSimulationProvider,
|
|
58
|
+
getPXEServiceConfig,
|
|
59
|
+
} from '@aztec/pxe/server';
|
|
56
60
|
import type { SequencerClient } from '@aztec/sequencer-client';
|
|
57
61
|
import type { TestSequencerClient } from '@aztec/sequencer-client/test';
|
|
62
|
+
import { WASMSimulator } from '@aztec/simulator/client';
|
|
63
|
+
import { SimulationProviderRecorderWrapper } from '@aztec/simulator/testing';
|
|
58
64
|
import { getContractClassFromArtifact } from '@aztec/stdlib/contract';
|
|
59
65
|
import { Gas } from '@aztec/stdlib/gas';
|
|
66
|
+
import type { AztecNodeAdmin } from '@aztec/stdlib/interfaces/client';
|
|
60
67
|
import type { PublicDataTreeLeaf } from '@aztec/stdlib/trees';
|
|
61
68
|
import {
|
|
62
69
|
type TelemetryClient,
|
|
@@ -134,18 +141,15 @@ export const setupL1Contracts = async (
|
|
|
134
141
|
* Sets up Private eXecution Environment (PXE).
|
|
135
142
|
* @param aztecNode - An instance of Aztec Node.
|
|
136
143
|
* @param opts - Partial configuration for the PXE service.
|
|
137
|
-
* @param firstPrivKey - The private key of the first account to be created.
|
|
138
144
|
* @param logger - The logger to be used.
|
|
139
145
|
* @param useLogSuffix - Whether to add a randomly generated suffix to the PXE debug logs.
|
|
140
|
-
* @
|
|
141
|
-
* @returns Private eXecution Environment (PXE), accounts, wallets and logger.
|
|
146
|
+
* @returns Private eXecution Environment (PXE), logger and teardown function.
|
|
142
147
|
*/
|
|
143
148
|
export async function setupPXEService(
|
|
144
149
|
aztecNode: AztecNode,
|
|
145
150
|
opts: Partial<PXEServiceConfig> = {},
|
|
146
151
|
logger = getLogger(),
|
|
147
152
|
useLogSuffix = false,
|
|
148
|
-
proofCreator?: BBNativePrivateKernelProver,
|
|
149
153
|
): Promise<{
|
|
150
154
|
/**
|
|
151
155
|
* The PXE instance.
|
|
@@ -168,7 +172,14 @@ export async function setupPXEService(
|
|
|
168
172
|
pxeServiceConfig.dataDirectory = path.join(tmpdir(), randomBytes(8).toString('hex'));
|
|
169
173
|
}
|
|
170
174
|
|
|
171
|
-
const
|
|
175
|
+
const simulationProvider = new WASMSimulator();
|
|
176
|
+
const simulationProviderWithRecorder = new SimulationProviderRecorderWrapper(simulationProvider);
|
|
177
|
+
const pxe = await createPXEServiceWithSimulationProvider(
|
|
178
|
+
aztecNode,
|
|
179
|
+
simulationProviderWithRecorder,
|
|
180
|
+
pxeServiceConfig,
|
|
181
|
+
useLogSuffix,
|
|
182
|
+
);
|
|
172
183
|
|
|
173
184
|
const teardown = async () => {
|
|
174
185
|
if (!configuredDataDirectory) {
|
|
@@ -201,7 +212,7 @@ async function setupWithRemoteEnvironment(
|
|
|
201
212
|
config: AztecNodeConfig,
|
|
202
213
|
logger: Logger,
|
|
203
214
|
numberOfAccounts: number,
|
|
204
|
-
) {
|
|
215
|
+
): Promise<EndToEndContext> {
|
|
205
216
|
// we are setting up against a remote environment, l1 contracts are already deployed
|
|
206
217
|
const aztecNodeUrl = getAztecUrl();
|
|
207
218
|
logger.verbose(`Creating Aztec Node client to remote host ${aztecNodeUrl}`);
|
|
@@ -236,11 +247,11 @@ async function setupWithRemoteEnvironment(
|
|
|
236
247
|
|
|
237
248
|
return {
|
|
238
249
|
aztecNode,
|
|
250
|
+
aztecNodeAdmin: undefined,
|
|
239
251
|
sequencer: undefined,
|
|
240
252
|
proverNode: undefined,
|
|
241
253
|
pxe: pxeClient,
|
|
242
254
|
deployL1ContractsValues,
|
|
243
|
-
accounts: await pxeClient!.getRegisteredAccounts(),
|
|
244
255
|
config,
|
|
245
256
|
initialFundedAccounts,
|
|
246
257
|
wallet: wallets[0],
|
|
@@ -293,6 +304,8 @@ export type SetupOptions = {
|
|
|
293
304
|
export type EndToEndContext = {
|
|
294
305
|
/** The Aztec Node service or client a connected to it. */
|
|
295
306
|
aztecNode: AztecNode;
|
|
307
|
+
/** Client to the Aztec Node admin interface (undefined if connected to remote environment) */
|
|
308
|
+
aztecNodeAdmin?: AztecNodeAdmin;
|
|
296
309
|
/** The prover node service (only set if startProverNode is true) */
|
|
297
310
|
proverNode: ProverNode | undefined;
|
|
298
311
|
/** A client to the sequencer service (undefined if connected to remote environment) */
|
|
@@ -478,6 +491,8 @@ export async function setup(
|
|
|
478
491
|
l1RpcUrls: config.l1RpcUrls,
|
|
479
492
|
rollupAddress: config.l1Contracts.rollupAddress,
|
|
480
493
|
port: blobSinkPort,
|
|
494
|
+
dataDirectory: config.dataDirectory,
|
|
495
|
+
dataStoreMapSizeKB: config.dataStoreMapSizeKB,
|
|
481
496
|
},
|
|
482
497
|
telemetry,
|
|
483
498
|
);
|
|
@@ -583,6 +598,7 @@ export async function setup(
|
|
|
583
598
|
|
|
584
599
|
return {
|
|
585
600
|
aztecNode,
|
|
601
|
+
aztecNodeAdmin: aztecNode,
|
|
586
602
|
blobSink,
|
|
587
603
|
cheatCodes,
|
|
588
604
|
config,
|
|
@@ -45,9 +45,8 @@ fi
|
|
|
45
45
|
TRANSFER_AMOUNT=42
|
|
46
46
|
|
|
47
47
|
aztec-wallet create-authwit transfer_in_private accounts:test0 -ca last --args accounts:alice accounts:bob $TRANSFER_AMOUNT 1 -f alice
|
|
48
|
-
aztec-wallet add-authwit authwits:last alice -f test0
|
|
49
48
|
|
|
50
|
-
aztec-wallet send transfer_in_private -ca last --args accounts:alice accounts:bob $TRANSFER_AMOUNT 1 -f test0
|
|
49
|
+
aztec-wallet send transfer_in_private -ca last --args accounts:alice accounts:bob $TRANSFER_AMOUNT 1 -aw authwits:last -f test0
|
|
51
50
|
# docs:end:transfer
|
|
52
51
|
|
|
53
52
|
# Test end result
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This module exposes the ability to capture the private exection steps that go into our "Client IVC" prover.
|
|
3
|
+
* These are used for debugging and benchmarking barretenberg (the prover component).
|
|
4
|
+
*/
|
|
5
|
+
import type { ContractFunctionInteraction } from '@aztec/aztec.js/contracts';
|
|
6
|
+
import { createLogger } from '@aztec/foundation/log';
|
|
7
|
+
import { serializeWitness } from '@aztec/noir-noirc_abi';
|
|
8
|
+
import type { PrivateExecutionStep } from '@aztec/stdlib/kernel';
|
|
9
|
+
|
|
10
|
+
import { encode } from '@msgpack/msgpack';
|
|
11
|
+
import { promises as fs } from 'fs';
|
|
12
|
+
import path from 'path';
|
|
13
|
+
|
|
14
|
+
const logger = createLogger('e2e:capture-private-execution-steps');
|
|
15
|
+
|
|
16
|
+
// TODO(#7371): This is duplicated.
|
|
17
|
+
// Longer term we won't use this hacked together msgpack format
|
|
18
|
+
// Leaving duplicated as this eventually bb will provide a serialization
|
|
19
|
+
// helper for passing to a generic msgpack RPC endpoint.
|
|
20
|
+
async function _createClientIvcProofFiles(directory: string, executionSteps: PrivateExecutionStep[]) {
|
|
21
|
+
const acirPath = path.join(directory, 'acir.msgpack');
|
|
22
|
+
const witnessPath = path.join(directory, 'witnesses.msgpack');
|
|
23
|
+
await fs.writeFile(acirPath, encode(executionSteps.map(map => map.bytecode)));
|
|
24
|
+
await fs.writeFile(witnessPath, encode(executionSteps.map(map => serializeWitness(map.witness))));
|
|
25
|
+
return {
|
|
26
|
+
acirPath,
|
|
27
|
+
witnessPath,
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export async function capturePrivateExecutionStepsIfEnvSet(label: string, interaction: ContractFunctionInteraction) {
|
|
32
|
+
// Not included in env_var.ts as internal to e2e tests.
|
|
33
|
+
const ivcFolder = process.env.CAPTURE_IVC_FOLDER;
|
|
34
|
+
if (ivcFolder) {
|
|
35
|
+
logger.info(`Capturing client ivc execution steps for ${label}`);
|
|
36
|
+
const result = await interaction.profile({ profileMode: 'execution-steps' });
|
|
37
|
+
const resultsDirectory = path.join(ivcFolder, label);
|
|
38
|
+
logger.info(`Writing private execution steps to ${resultsDirectory}`);
|
|
39
|
+
await fs.mkdir(resultsDirectory, { recursive: true });
|
|
40
|
+
await _createClientIvcProofFiles(resultsDirectory, result.executionSteps);
|
|
41
|
+
logger.info(`Wrote private execution steps to ${resultsDirectory}`);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// docs:start:cross_chain_test_harness
|
|
2
2
|
import {
|
|
3
3
|
type AccountWallet,
|
|
4
|
+
AuthWitness,
|
|
4
5
|
type AztecAddress,
|
|
5
6
|
type AztecNode,
|
|
6
7
|
EthAddress,
|
|
@@ -204,6 +205,7 @@ export class CrossChainTestHarness {
|
|
|
204
205
|
this.l1TokenPortalManager = new L1TokenPortalManager(
|
|
205
206
|
this.tokenPortalAddress,
|
|
206
207
|
this.underlyingERC20Address,
|
|
208
|
+
this.l1ContractAddresses.feeAssetHandlerAddress,
|
|
207
209
|
this.l1ContractAddresses.outboxAddress,
|
|
208
210
|
this.publicClient,
|
|
209
211
|
this.walletClient,
|
|
@@ -214,7 +216,12 @@ export class CrossChainTestHarness {
|
|
|
214
216
|
}
|
|
215
217
|
|
|
216
218
|
async mintTokensOnL1(amount: bigint) {
|
|
217
|
-
|
|
219
|
+
const contract = getContract({
|
|
220
|
+
abi: TestERC20Abi,
|
|
221
|
+
address: this.l1TokenManager.tokenAddress.toString(),
|
|
222
|
+
client: this.walletClient,
|
|
223
|
+
});
|
|
224
|
+
await contract.write.mint([this.ethAccount.toString(), amount]);
|
|
218
225
|
expect(await this.l1TokenManager.getL1TokenBalance(this.ethAccount.toString())).toEqual(amount);
|
|
219
226
|
}
|
|
220
227
|
|
|
@@ -266,10 +273,14 @@ export class CrossChainTestHarness {
|
|
|
266
273
|
.wait();
|
|
267
274
|
}
|
|
268
275
|
|
|
269
|
-
async withdrawPrivateFromAztecToL1(
|
|
276
|
+
async withdrawPrivateFromAztecToL1(
|
|
277
|
+
withdrawAmount: bigint,
|
|
278
|
+
nonce: Fr = Fr.ZERO,
|
|
279
|
+
authWitness: AuthWitness,
|
|
280
|
+
): Promise<FieldsOf<TxReceipt>> {
|
|
270
281
|
const withdrawReceipt = await this.l2Bridge.methods
|
|
271
282
|
.exit_to_l1_private(this.l2Token.address, this.ethAccount, withdrawAmount, EthAddress.ZERO, nonce)
|
|
272
|
-
.send()
|
|
283
|
+
.send({ authWitnesses: [authWitness] })
|
|
273
284
|
.wait();
|
|
274
285
|
|
|
275
286
|
return withdrawReceipt;
|
|
@@ -12,8 +12,12 @@ import {
|
|
|
12
12
|
retryUntil,
|
|
13
13
|
} from '@aztec/aztec.js';
|
|
14
14
|
import type { ViemPublicClient, ViemWalletClient } from '@aztec/ethereum';
|
|
15
|
+
import { TestERC20Abi } from '@aztec/l1-artifacts/TestERC20Abi';
|
|
15
16
|
import { FeeJuiceContract } from '@aztec/noir-contracts.js/FeeJuice';
|
|
16
17
|
import { ProtocolContractAddress } from '@aztec/protocol-contracts';
|
|
18
|
+
import type { AztecNodeAdmin } from '@aztec/stdlib/interfaces/client';
|
|
19
|
+
|
|
20
|
+
import { getContract } from 'viem';
|
|
17
21
|
|
|
18
22
|
export interface IGasBridgingTestHarness {
|
|
19
23
|
getL1FeeJuiceBalance(address: EthAddress): Promise<bigint>;
|
|
@@ -25,6 +29,7 @@ export interface IGasBridgingTestHarness {
|
|
|
25
29
|
|
|
26
30
|
export interface FeeJuicePortalTestingHarnessFactoryConfig {
|
|
27
31
|
aztecNode: AztecNode;
|
|
32
|
+
aztecNodeAdmin?: AztecNodeAdmin;
|
|
28
33
|
pxeService: PXE;
|
|
29
34
|
publicClient: ViemPublicClient;
|
|
30
35
|
walletClient: ViemWalletClient;
|
|
@@ -37,7 +42,7 @@ export class FeeJuicePortalTestingHarnessFactory {
|
|
|
37
42
|
private constructor(private config: FeeJuicePortalTestingHarnessFactoryConfig) {}
|
|
38
43
|
|
|
39
44
|
private async createReal() {
|
|
40
|
-
const { aztecNode, pxeService, publicClient, walletClient, wallet, logger } = this.config;
|
|
45
|
+
const { aztecNode, aztecNodeAdmin, pxeService, publicClient, walletClient, wallet, logger } = this.config;
|
|
41
46
|
|
|
42
47
|
const ethAccount = EthAddress.fromString((await walletClient.getAddresses())[0]);
|
|
43
48
|
const l1ContractAddresses = (await pxeService.getNodeInfo()).l1ContractAddresses;
|
|
@@ -53,12 +58,14 @@ export class FeeJuicePortalTestingHarnessFactory {
|
|
|
53
58
|
|
|
54
59
|
return new GasBridgingTestHarness(
|
|
55
60
|
aztecNode,
|
|
61
|
+
aztecNodeAdmin,
|
|
56
62
|
pxeService,
|
|
57
63
|
logger,
|
|
58
64
|
gasL2,
|
|
59
65
|
ethAccount,
|
|
60
66
|
feeJuicePortalAddress,
|
|
61
67
|
feeJuiceAddress,
|
|
68
|
+
l1ContractAddresses.feeAssetHandlerAddress!,
|
|
62
69
|
publicClient,
|
|
63
70
|
walletClient,
|
|
64
71
|
);
|
|
@@ -81,6 +88,8 @@ export class GasBridgingTestHarness implements IGasBridgingTestHarness {
|
|
|
81
88
|
constructor(
|
|
82
89
|
/** Aztec node */
|
|
83
90
|
public aztecNode: AztecNode,
|
|
91
|
+
/** Aztec node admin interface */
|
|
92
|
+
public aztecNodeAdmin: AztecNodeAdmin | undefined,
|
|
84
93
|
/** Private eXecution Environment (PXE). */
|
|
85
94
|
public pxeService: PXE,
|
|
86
95
|
/** Logger. */
|
|
@@ -96,6 +105,8 @@ export class GasBridgingTestHarness implements IGasBridgingTestHarness {
|
|
|
96
105
|
public feeJuicePortalAddress: EthAddress,
|
|
97
106
|
/** Underlying token for portal tests. */
|
|
98
107
|
public l1FeeJuiceAddress: EthAddress,
|
|
108
|
+
/** Fee asset handler address. */
|
|
109
|
+
public feeAssetHandlerAddress: EthAddress,
|
|
99
110
|
/** Viem Public client instance. */
|
|
100
111
|
public publicClient: ViemPublicClient,
|
|
101
112
|
/** Viem Wallet Client instance. */
|
|
@@ -104,6 +115,7 @@ export class GasBridgingTestHarness implements IGasBridgingTestHarness {
|
|
|
104
115
|
this.feeJuicePortalManager = new L1FeeJuicePortalManager(
|
|
105
116
|
this.feeJuicePortalAddress,
|
|
106
117
|
this.l1FeeJuiceAddress,
|
|
118
|
+
this.feeAssetHandlerAddress,
|
|
107
119
|
this.publicClient,
|
|
108
120
|
this.walletClient,
|
|
109
121
|
this.logger,
|
|
@@ -113,17 +125,25 @@ export class GasBridgingTestHarness implements IGasBridgingTestHarness {
|
|
|
113
125
|
}
|
|
114
126
|
|
|
115
127
|
async mintTokensOnL1(amount: bigint, to: EthAddress = this.ethAccount) {
|
|
116
|
-
const balanceBefore = await this.l1TokenManager.getL1TokenBalance(to.toString());
|
|
117
|
-
await this.l1TokenManager.mint(
|
|
118
|
-
|
|
128
|
+
// const balanceBefore = await this.l1TokenManager.getL1TokenBalance(to.toString());
|
|
129
|
+
await this.l1TokenManager.mint(to.toString());
|
|
130
|
+
const feeAssetL1 = getContract({
|
|
131
|
+
address: this.l1FeeJuiceAddress.toString(),
|
|
132
|
+
abi: TestERC20Abi,
|
|
133
|
+
client: this.walletClient,
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
await feeAssetL1.write.mint([to.toString(), amount]);
|
|
137
|
+
|
|
138
|
+
// expect(await this.l1TokenManager.getL1TokenBalance(to.toString())).toEqual(balanceBefore + amount);
|
|
119
139
|
}
|
|
120
140
|
|
|
121
141
|
async getL1FeeJuiceBalance(address: EthAddress) {
|
|
122
142
|
return await this.l1TokenManager.getL1TokenBalance(address.toString());
|
|
123
143
|
}
|
|
124
144
|
|
|
125
|
-
sendTokensToPortalPublic(bridgeAmount: bigint, l2Address: AztecAddress
|
|
126
|
-
return this.feeJuicePortalManager.bridgeTokensPublic(l2Address, bridgeAmount,
|
|
145
|
+
sendTokensToPortalPublic(bridgeAmount: bigint, l2Address: AztecAddress) {
|
|
146
|
+
return this.feeJuicePortalManager.bridgeTokensPublic(l2Address, bridgeAmount, false);
|
|
127
147
|
}
|
|
128
148
|
|
|
129
149
|
async consumeMessageOnAztecAndClaimPrivately(owner: AztecAddress, claim: L2AmountClaim) {
|
|
@@ -142,7 +162,8 @@ export class GasBridgingTestHarness implements IGasBridgingTestHarness {
|
|
|
142
162
|
}
|
|
143
163
|
|
|
144
164
|
async prepareTokensOnL1(bridgeAmount: bigint, owner: AztecAddress) {
|
|
145
|
-
|
|
165
|
+
await this.mintTokensOnL1(bridgeAmount);
|
|
166
|
+
const claim = await this.sendTokensToPortalPublic(bridgeAmount, owner);
|
|
146
167
|
|
|
147
168
|
const isSynced = async () => await this.aztecNode.isL1ToL2MessageSynced(Fr.fromHexString(claim.messageHash));
|
|
148
169
|
await retryUntil(isSynced, `message ${claim.messageHash} sync`, 24, 1);
|
|
@@ -160,12 +181,11 @@ export class GasBridgingTestHarness implements IGasBridgingTestHarness {
|
|
|
160
181
|
|
|
161
182
|
// Consume L1 -> L2 message and claim tokens privately on L2
|
|
162
183
|
await this.consumeMessageOnAztecAndClaimPrivately(owner, claim);
|
|
163
|
-
await this.expectPublicBalanceOnL2(owner, bridgeAmount);
|
|
164
184
|
}
|
|
165
185
|
|
|
166
186
|
private async advanceL2Block() {
|
|
167
187
|
const initialBlockNumber = await this.aztecNode.getBlockNumber();
|
|
168
|
-
await this.
|
|
188
|
+
await this.aztecNodeAdmin?.flushTxs();
|
|
169
189
|
await retryUntil(async () => (await this.aztecNode.getBlockNumber()) >= initialBlockNumber + 1);
|
|
170
190
|
}
|
|
171
191
|
}
|