@aztec/end-to-end 0.80.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/bench/utils.d.ts.map +1 -1
- package/dest/bench/utils.js +3 -0
- 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/setup_p2p_test.d.ts.map +1 -1
- package/dest/fixtures/setup_p2p_test.js +2 -4
- 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 +15 -9
- 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 +15 -6
- package/package.json +33 -31
- package/src/bench/utils.ts +3 -0
- 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/setup_p2p_test.ts +2 -4
- package/src/fixtures/snapshot_manager.ts +24 -10
- package/src/fixtures/utils.ts +26 -13
- 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 +11 -6
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
} from '@aztec/aztec.js';
|
|
13
13
|
import { CheatCodes } from '@aztec/aztec.js/testing';
|
|
14
14
|
import { type ViemPublicClient, createL1Clients, deployL1Contract } from '@aztec/ethereum';
|
|
15
|
-
import { InboxAbi, OutboxAbi,
|
|
15
|
+
import { InboxAbi, OutboxAbi, TestERC20Abi, TestERC20Bytecode } from '@aztec/l1-artifacts';
|
|
16
16
|
import { TokenContract } from '@aztec/noir-contracts.js/Token';
|
|
17
17
|
import { TokenBridgeContract } from '@aztec/noir-contracts.js/TokenBridge';
|
|
18
18
|
|
|
@@ -49,7 +49,6 @@ export class CrossChainMessagingTest {
|
|
|
49
49
|
l2Token!: TokenContract;
|
|
50
50
|
l2Bridge!: TokenBridgeContract;
|
|
51
51
|
|
|
52
|
-
rollup!: any; // GetContractReturnType<typeof RollupAbi> | undefined;
|
|
53
52
|
inbox!: any; // GetContractReturnType<typeof InboxAbi> | undefined;
|
|
54
53
|
outbox!: any; // GetContractReturnType<typeof OutboxAbi> | undefined;
|
|
55
54
|
cheatcodes!: CheatCodes;
|
|
@@ -60,7 +59,7 @@ export class CrossChainMessagingTest {
|
|
|
60
59
|
}
|
|
61
60
|
|
|
62
61
|
async assumeProven() {
|
|
63
|
-
await this.cheatcodes.rollup.markAsProven(
|
|
62
|
+
await this.cheatcodes.rollup.markAsProven();
|
|
64
63
|
}
|
|
65
64
|
|
|
66
65
|
async setup() {
|
|
@@ -88,17 +87,11 @@ export class CrossChainMessagingTest {
|
|
|
88
87
|
await this.snapshotManager.snapshot(
|
|
89
88
|
'3_accounts',
|
|
90
89
|
deployAccounts(3, this.logger),
|
|
91
|
-
async ({ deployedAccounts }, { pxe, aztecNodeConfig, aztecNode
|
|
90
|
+
async ({ deployedAccounts }, { pxe, aztecNodeConfig, aztecNode }) => {
|
|
92
91
|
this.wallets = await Promise.all(deployedAccounts.map(a => getSchnorrWallet(pxe, a.address, a.signingKey)));
|
|
93
92
|
this.accounts = this.wallets.map(w => w.getCompleteAddress());
|
|
94
93
|
this.wallets.forEach((w, i) => this.logger.verbose(`Wallet ${i} address: ${w.getAddress()}`));
|
|
95
94
|
|
|
96
|
-
this.rollup = getContract({
|
|
97
|
-
address: deployL1ContractsValues.l1ContractAddresses.rollupAddress.toString(),
|
|
98
|
-
abi: RollupAbi,
|
|
99
|
-
client: deployL1ContractsValues.walletClient,
|
|
100
|
-
});
|
|
101
|
-
|
|
102
95
|
this.user1Wallet = this.wallets[0];
|
|
103
96
|
this.user2Wallet = this.wallets[1];
|
|
104
97
|
|
|
@@ -126,15 +119,6 @@ export class CrossChainMessagingTest {
|
|
|
126
119
|
['Underlying', 'UND', walletClient.account.address],
|
|
127
120
|
).then(({ address }) => address);
|
|
128
121
|
|
|
129
|
-
const underlyingERC20 = getContract({
|
|
130
|
-
address: underlyingERC20Address!.toString(),
|
|
131
|
-
abi: TestERC20Abi,
|
|
132
|
-
client: walletClient,
|
|
133
|
-
});
|
|
134
|
-
|
|
135
|
-
// allow anyone to mint
|
|
136
|
-
await underlyingERC20.write.setFreeForAll([true], {} as any);
|
|
137
|
-
|
|
138
122
|
this.logger.verbose(`Setting up cross chain harness...`);
|
|
139
123
|
this.crossChainTestHarness = await CrossChainTestHarness.new(
|
|
140
124
|
this.aztecNode,
|
|
@@ -14,6 +14,7 @@ import {
|
|
|
14
14
|
getContractInstanceFromDeployParams,
|
|
15
15
|
} from '@aztec/aztec.js';
|
|
16
16
|
import type { StatefulTestContract } from '@aztec/noir-contracts.js/StatefulTest';
|
|
17
|
+
import type { AztecNodeAdmin } from '@aztec/stdlib/interfaces/client';
|
|
17
18
|
|
|
18
19
|
import { type ISnapshotManager, createSnapshotManager, deployAccounts } from '../fixtures/snapshot_manager.js';
|
|
19
20
|
|
|
@@ -27,6 +28,7 @@ export class DeployTest {
|
|
|
27
28
|
public pxe!: PXE;
|
|
28
29
|
public wallet!: AccountWallet;
|
|
29
30
|
public aztecNode!: AztecNode;
|
|
31
|
+
public aztecNodeAdmin!: AztecNodeAdmin;
|
|
30
32
|
|
|
31
33
|
constructor(testName: string) {
|
|
32
34
|
this.logger = createLogger(`e2e:e2e_deploy_contract:${testName}`);
|
|
@@ -37,6 +39,7 @@ export class DeployTest {
|
|
|
37
39
|
await this.applyInitialAccountSnapshot();
|
|
38
40
|
const context = await this.snapshotManager.setup();
|
|
39
41
|
({ pxe: this.pxe, aztecNode: this.aztecNode } = context);
|
|
42
|
+
this.aztecNodeAdmin = context.aztecNode;
|
|
40
43
|
return this;
|
|
41
44
|
}
|
|
42
45
|
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { AztecNodeService } from '@aztec/aztec-node';
|
|
2
|
-
import { Fr, type Logger, getTimestampRangeForEpoch, retryUntil, sleep } from '@aztec/aztec.js';
|
|
2
|
+
import { Fr, type Logger, MerkleTreeId, getTimestampRangeForEpoch, retryUntil, sleep } from '@aztec/aztec.js';
|
|
3
3
|
import { RollupContract } from '@aztec/ethereum/contracts';
|
|
4
|
-
import { ChainMonitor } from '@aztec/ethereum/test';
|
|
5
|
-
import { DelayedTxUtils, type Delayer, waitUntilL1Timestamp } from '@aztec/ethereum/test';
|
|
4
|
+
import { ChainMonitor, DelayedTxUtils, type Delayer, waitUntilL1Timestamp } from '@aztec/ethereum/test';
|
|
6
5
|
import { randomBytes } from '@aztec/foundation/crypto';
|
|
7
6
|
import { withLogNameSuffix } from '@aztec/foundation/log';
|
|
8
7
|
import { ProverNode, ProverNodePublisher } from '@aztec/prover-node';
|
|
@@ -11,7 +10,6 @@ import type { SequencerPublisher } from '@aztec/sequencer-client';
|
|
|
11
10
|
import type { TestSequencerClient } from '@aztec/sequencer-client/test';
|
|
12
11
|
import type { L2BlockNumber } from '@aztec/stdlib/block';
|
|
13
12
|
import type { L1RollupConstants } from '@aztec/stdlib/epoch-helpers';
|
|
14
|
-
import { MerkleTreeId } from '@aztec/stdlib/trees';
|
|
15
13
|
|
|
16
14
|
import { join } from 'path';
|
|
17
15
|
import type { Hex, PublicClient } from 'viem';
|
|
@@ -208,8 +206,11 @@ export class EpochsTestContext {
|
|
|
208
206
|
|
|
209
207
|
/** Verifies whether the given block number is found on the aztec node. */
|
|
210
208
|
public async verifyHistoricBlock(blockNumber: L2BlockNumber, expectedSuccess: boolean) {
|
|
209
|
+
// We use `findLeavesIndexes` here, but could use any function that queries the world-state
|
|
210
|
+
// at a particular block, so we know whether that historic block is available or has been
|
|
211
|
+
// pruned. Note that `getBlock` would not work here, since it only hits the archiver.
|
|
211
212
|
const result = await this.context.aztecNode
|
|
212
|
-
.
|
|
213
|
+
.findLeavesIndexes(blockNumber, MerkleTreeId.NULLIFIER_TREE, [Fr.ZERO])
|
|
213
214
|
.then(_ => true)
|
|
214
215
|
.catch(_ => false);
|
|
215
216
|
expect(result).toBe(expectedSuccess);
|
|
@@ -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
|
},
|
|
@@ -115,10 +115,8 @@ export async function createValidatorConfig(
|
|
|
115
115
|
|
|
116
116
|
const nodeConfig: AztecNodeConfig = {
|
|
117
117
|
...config,
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
tcpAnnounceAddress: `127.0.0.1:${port}`,
|
|
121
|
-
udpAnnounceAddress: `127.0.0.1:${port}`,
|
|
118
|
+
p2pIp: `127.0.0.1`,
|
|
119
|
+
p2pPort: port,
|
|
122
120
|
p2pEnabled: true,
|
|
123
121
|
peerCheckIntervalMS: TEST_PEER_CHECK_INTERVAL_MS,
|
|
124
122
|
blockCheckIntervalMS: 1000,
|
|
@@ -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
|
);
|
|
@@ -502,10 +517,7 @@ export async function setup(
|
|
|
502
517
|
const blobSinkClient = createBlobSinkClient(config);
|
|
503
518
|
const aztecNode = await AztecNodeService.createAndSync(
|
|
504
519
|
config,
|
|
505
|
-
{
|
|
506
|
-
dateProvider,
|
|
507
|
-
blobSinkClient,
|
|
508
|
-
},
|
|
520
|
+
{ dateProvider, blobSinkClient, telemetry },
|
|
509
521
|
{ prefilledPublicData },
|
|
510
522
|
);
|
|
511
523
|
const sequencer = aztecNode.getSequencer();
|
|
@@ -586,6 +598,7 @@ export async function setup(
|
|
|
586
598
|
|
|
587
599
|
return {
|
|
588
600
|
aztecNode,
|
|
601
|
+
aztecNodeAdmin: aztecNode,
|
|
589
602
|
blobSink,
|
|
590
603
|
cheatCodes,
|
|
591
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;
|