@aztec/end-to-end 0.81.0 → 0.82.1-alpha-testnet.1
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 +4 -0
- package/dest/e2e_fees/fees_test.d.ts.map +1 -1
- package/dest/e2e_fees/fees_test.js +41 -33
- 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 +10 -10
- 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 +24 -18
- package/dest/fixtures/utils.d.ts +17 -6
- package/dest/fixtures/utils.d.ts.map +1 -1
- package/dest/fixtures/utils.js +50 -11
- 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 +53 -36
- package/src/e2e_prover/e2e_prover_test.ts +13 -9
- package/src/e2e_token_contract/token_contract_test.ts +4 -2
- package/src/fixtures/snapshot_manager.ts +37 -12
- package/src/fixtures/utils.ts +69 -12
- package/src/guides/up_quick_start.sh +2 -3
- 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
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/end-to-end",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.82.1-alpha-testnet.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": "./dest/index.js",
|
|
6
6
|
"inherits": [
|
|
@@ -26,38 +26,40 @@
|
|
|
26
26
|
"formatting": "run -T prettier --check ./src && run -T eslint ./src"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@aztec/accounts": "0.
|
|
30
|
-
"@aztec/archiver": "0.
|
|
31
|
-
"@aztec/aztec": "0.
|
|
32
|
-
"@aztec/aztec-node": "0.
|
|
33
|
-
"@aztec/aztec.js": "0.
|
|
34
|
-
"@aztec/bb-prover": "0.
|
|
35
|
-
"@aztec/blob-lib": "0.
|
|
36
|
-
"@aztec/blob-sink": "0.
|
|
37
|
-
"@aztec/bot": "0.
|
|
38
|
-
"@aztec/constants": "0.
|
|
39
|
-
"@aztec/entrypoints": "0.
|
|
40
|
-
"@aztec/epoch-cache": "0.
|
|
41
|
-
"@aztec/ethereum": "0.
|
|
42
|
-
"@aztec/foundation": "0.
|
|
43
|
-
"@aztec/kv-store": "0.
|
|
44
|
-
"@aztec/l1-artifacts": "0.
|
|
45
|
-
"@aztec/merkle-tree": "0.
|
|
46
|
-
"@aztec/noir-contracts.js": "0.
|
|
47
|
-
"@aztec/noir-
|
|
48
|
-
"@aztec/
|
|
49
|
-
"@aztec/
|
|
50
|
-
"@aztec/
|
|
51
|
-
"@aztec/prover-
|
|
52
|
-
"@aztec/
|
|
53
|
-
"@aztec/
|
|
54
|
-
"@aztec/
|
|
55
|
-
"@aztec/
|
|
56
|
-
"@aztec/
|
|
57
|
-
"@aztec/
|
|
58
|
-
"@aztec/
|
|
29
|
+
"@aztec/accounts": "0.82.1-alpha-testnet.1",
|
|
30
|
+
"@aztec/archiver": "0.82.1-alpha-testnet.1",
|
|
31
|
+
"@aztec/aztec": "0.82.1-alpha-testnet.1",
|
|
32
|
+
"@aztec/aztec-node": "0.82.1-alpha-testnet.1",
|
|
33
|
+
"@aztec/aztec.js": "0.82.1-alpha-testnet.1",
|
|
34
|
+
"@aztec/bb-prover": "0.82.1-alpha-testnet.1",
|
|
35
|
+
"@aztec/blob-lib": "0.82.1-alpha-testnet.1",
|
|
36
|
+
"@aztec/blob-sink": "0.82.1-alpha-testnet.1",
|
|
37
|
+
"@aztec/bot": "0.82.1-alpha-testnet.1",
|
|
38
|
+
"@aztec/constants": "0.82.1-alpha-testnet.1",
|
|
39
|
+
"@aztec/entrypoints": "0.82.1-alpha-testnet.1",
|
|
40
|
+
"@aztec/epoch-cache": "0.82.1-alpha-testnet.1",
|
|
41
|
+
"@aztec/ethereum": "0.82.1-alpha-testnet.1",
|
|
42
|
+
"@aztec/foundation": "0.82.1-alpha-testnet.1",
|
|
43
|
+
"@aztec/kv-store": "0.82.1-alpha-testnet.1",
|
|
44
|
+
"@aztec/l1-artifacts": "0.82.1-alpha-testnet.1",
|
|
45
|
+
"@aztec/merkle-tree": "0.82.1-alpha-testnet.1",
|
|
46
|
+
"@aztec/noir-contracts.js": "0.82.1-alpha-testnet.1",
|
|
47
|
+
"@aztec/noir-noirc_abi": "0.82.1-alpha-testnet.1",
|
|
48
|
+
"@aztec/noir-protocol-circuits-types": "0.82.1-alpha-testnet.1",
|
|
49
|
+
"@aztec/p2p": "0.82.1-alpha-testnet.1",
|
|
50
|
+
"@aztec/protocol-contracts": "0.82.1-alpha-testnet.1",
|
|
51
|
+
"@aztec/prover-client": "0.82.1-alpha-testnet.1",
|
|
52
|
+
"@aztec/prover-node": "0.82.1-alpha-testnet.1",
|
|
53
|
+
"@aztec/pxe": "0.82.1-alpha-testnet.1",
|
|
54
|
+
"@aztec/sequencer-client": "0.82.1-alpha-testnet.1",
|
|
55
|
+
"@aztec/simulator": "0.82.1-alpha-testnet.1",
|
|
56
|
+
"@aztec/stdlib": "0.82.1-alpha-testnet.1",
|
|
57
|
+
"@aztec/telemetry-client": "0.82.1-alpha-testnet.1",
|
|
58
|
+
"@aztec/validator-client": "0.82.1-alpha-testnet.1",
|
|
59
|
+
"@aztec/world-state": "0.82.1-alpha-testnet.1",
|
|
59
60
|
"@iarna/toml": "^2.2.5",
|
|
60
61
|
"@jest/globals": "^29.5.0",
|
|
62
|
+
"@msgpack/msgpack": "^3.0.0-beta2",
|
|
61
63
|
"@noble/curves": "^1.0.0",
|
|
62
64
|
"@swc/core": "^1.4.11",
|
|
63
65
|
"@swc/jest": "^0.2.36",
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { getSchnorrWallet } from '@aztec/accounts/schnorr';
|
|
2
2
|
import {
|
|
3
3
|
type AccountWallet,
|
|
4
|
+
AztecAddress,
|
|
4
5
|
type CompleteAddress,
|
|
5
6
|
Fr,
|
|
6
7
|
type Logger,
|
|
8
|
+
type PXE,
|
|
7
9
|
type TxHash,
|
|
8
10
|
computeSecretHash,
|
|
9
11
|
createLogger,
|
|
@@ -61,6 +63,7 @@ export class BlacklistTokenContractTest {
|
|
|
61
63
|
private snapshotManager: ISnapshotManager;
|
|
62
64
|
logger: Logger;
|
|
63
65
|
wallets: AccountWallet[] = [];
|
|
66
|
+
pxe!: PXE;
|
|
64
67
|
accounts: CompleteAddress[] = [];
|
|
65
68
|
asset!: TokenBlacklistContract;
|
|
66
69
|
tokenSim!: TokenSimulator;
|
|
@@ -94,6 +97,7 @@ export class BlacklistTokenContractTest {
|
|
|
94
97
|
'3_accounts',
|
|
95
98
|
deployAccounts(3, this.logger),
|
|
96
99
|
async ({ deployedAccounts }, { pxe }) => {
|
|
100
|
+
this.pxe = pxe;
|
|
97
101
|
this.wallets = await Promise.all(deployedAccounts.map(a => getSchnorrWallet(pxe, a.address, a.signingKey)));
|
|
98
102
|
this.admin = this.wallets[0];
|
|
99
103
|
this.other = this.wallets[1];
|
|
@@ -164,12 +168,12 @@ export class BlacklistTokenContractTest {
|
|
|
164
168
|
|
|
165
169
|
async addPendingShieldNoteToPXE(
|
|
166
170
|
contract: TokenBlacklistContract,
|
|
167
|
-
|
|
171
|
+
recipient: AztecAddress,
|
|
168
172
|
amount: bigint,
|
|
169
173
|
secretHash: Fr,
|
|
170
174
|
txHash: TxHash,
|
|
171
175
|
) {
|
|
172
|
-
const txEffects = await
|
|
176
|
+
const txEffects = await this.pxe.getTxEffect(txHash);
|
|
173
177
|
await contract.methods
|
|
174
178
|
.deliver_transparent_note(
|
|
175
179
|
contract.address,
|
|
@@ -178,7 +182,7 @@ export class BlacklistTokenContractTest {
|
|
|
178
182
|
txHash.hash,
|
|
179
183
|
this.#toBoundedVec(txEffects!.data.noteHashes, MAX_NOTE_HASHES_PER_TX),
|
|
180
184
|
txEffects!.data.nullifiers[0],
|
|
181
|
-
|
|
185
|
+
recipient,
|
|
182
186
|
)
|
|
183
187
|
.simulate();
|
|
184
188
|
}
|
|
@@ -218,9 +222,9 @@ export class BlacklistTokenContractTest {
|
|
|
218
222
|
const secretHash = await computeSecretHash(secret);
|
|
219
223
|
const receipt = await asset.methods.mint_private(amount, secretHash).send().wait();
|
|
220
224
|
|
|
221
|
-
await this.addPendingShieldNoteToPXE(asset, wallets[0], amount, secretHash, receipt.txHash);
|
|
225
|
+
await this.addPendingShieldNoteToPXE(asset, wallets[0].getAddress(), amount, secretHash, receipt.txHash);
|
|
222
226
|
const txClaim = asset.methods.redeem_shield(accounts[0].address, amount, secret).send();
|
|
223
|
-
await txClaim.wait(
|
|
227
|
+
await txClaim.wait();
|
|
224
228
|
this.logger.verbose(`Minting complete.`);
|
|
225
229
|
|
|
226
230
|
return { amount };
|
|
@@ -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,18 +10,18 @@ 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';
|
|
20
20
|
import { FeeJuiceContract } from '@aztec/noir-contracts.js/FeeJuice';
|
|
21
|
+
import { SponsoredFPCContract } from '@aztec/noir-contracts.js/SponsoredFPC';
|
|
21
22
|
import { TokenContract as BananaCoin } from '@aztec/noir-contracts.js/Token';
|
|
22
23
|
import { ProtocolContractAddress } from '@aztec/protocol-contracts';
|
|
23
24
|
import { getCanonicalFeeJuice } from '@aztec/protocol-contracts/fee-juice';
|
|
24
|
-
import { computePartialAddress } from '@aztec/stdlib/contract';
|
|
25
25
|
import { GasSettings } from '@aztec/stdlib/gas';
|
|
26
26
|
|
|
27
27
|
import { getContract } from 'viem';
|
|
@@ -40,6 +40,7 @@ import {
|
|
|
40
40
|
ensureAccountsPubliclyDeployed,
|
|
41
41
|
getBalancesFn,
|
|
42
42
|
setupCanonicalFeeJuice,
|
|
43
|
+
setupSponsoredFPC,
|
|
43
44
|
} from '../fixtures/utils.js';
|
|
44
45
|
import { FeeJuicePortalTestingHarnessFactory, type GasBridgingTestHarness } from '../shared/gas_portal_test_harness.js';
|
|
45
46
|
|
|
@@ -51,6 +52,7 @@ const { E2E_DATA_PATH: dataPath } = process.env;
|
|
|
51
52
|
* PublicDeployAccounts: Deploys the accounts publicly.
|
|
52
53
|
* DeployFeeJuice: Deploys the Fee Juice contract.
|
|
53
54
|
* FPCSetup: Deploys BananaCoin and FPC contracts, and bridges gas from L1.
|
|
55
|
+
* SponsoredFPCSetup: Deploys Sponsored FPC contract, and bridges gas from L1.
|
|
54
56
|
* FundAlice: Mints private and public bananas to Alice.
|
|
55
57
|
* SetupSubscription: Deploys a counter contract and a subscription contract, and mints Fee Juice to the subscription contract.
|
|
56
58
|
*/
|
|
@@ -77,6 +79,7 @@ export class FeesTest {
|
|
|
77
79
|
public feeJuiceContract!: FeeJuiceContract;
|
|
78
80
|
public bananaCoin!: BananaCoin;
|
|
79
81
|
public bananaFPC!: FPCContract;
|
|
82
|
+
public sponsoredFPC!: SponsoredFPCContract;
|
|
80
83
|
public counterContract!: CounterContract;
|
|
81
84
|
public subscriptionContract!: AppSubscriptionContract;
|
|
82
85
|
public feeJuiceBridgeTestHarness!: GasBridgingTestHarness;
|
|
@@ -165,8 +168,9 @@ export class FeesTest {
|
|
|
165
168
|
await this.snapshotManager.snapshot(
|
|
166
169
|
'initial_accounts',
|
|
167
170
|
deployAccounts(this.numberOfAccounts, this.logger),
|
|
168
|
-
async ({ deployedAccounts }, { pxe, aztecNode, aztecNodeConfig }) => {
|
|
171
|
+
async ({ deployedAccounts }, { pxe, aztecNode, aztecNodeConfig, deployL1ContractsValues }) => {
|
|
169
172
|
this.pxe = pxe;
|
|
173
|
+
|
|
170
174
|
this.aztecNode = aztecNode;
|
|
171
175
|
this.gasSettings = GasSettings.default({ maxFeesPerGas: (await this.aztecNode.getCurrentBaseFees()).mul(2) });
|
|
172
176
|
this.cheatCodes = await CheatCodes.create(aztecNodeConfig.l1RpcUrls, pxe);
|
|
@@ -180,18 +184,14 @@ export class FeesTest {
|
|
|
180
184
|
|
|
181
185
|
const canonicalFeeJuice = await getCanonicalFeeJuice();
|
|
182
186
|
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
187
|
this.coinbase = EthAddress.random();
|
|
188
188
|
|
|
189
|
-
const { publicClient, walletClient } = createL1Clients(aztecNodeConfig.l1RpcUrls, MNEMONIC);
|
|
190
189
|
this.feeJuiceBridgeTestHarness = await FeeJuicePortalTestingHarnessFactory.create({
|
|
191
|
-
aztecNode
|
|
190
|
+
aztecNode,
|
|
191
|
+
aztecNodeAdmin: aztecNode,
|
|
192
192
|
pxeService: pxe,
|
|
193
|
-
publicClient: publicClient,
|
|
194
|
-
walletClient: walletClient,
|
|
193
|
+
publicClient: deployL1ContractsValues.publicClient,
|
|
194
|
+
walletClient: deployL1ContractsValues.walletClient,
|
|
195
195
|
wallet: this.aliceWallet,
|
|
196
196
|
logger: this.logger,
|
|
197
197
|
});
|
|
@@ -218,12 +218,12 @@ export class FeesTest {
|
|
|
218
218
|
|
|
219
219
|
this.getGasBalanceFn = getBalancesFn('⛽', this.feeJuiceContract.methods.balance_of_public, this.logger);
|
|
220
220
|
|
|
221
|
-
const { publicClient, walletClient } = createL1Clients(context.aztecNodeConfig.l1RpcUrls, MNEMONIC);
|
|
222
221
|
this.feeJuiceBridgeTestHarness = await FeeJuicePortalTestingHarnessFactory.create({
|
|
223
222
|
aztecNode: context.aztecNode,
|
|
223
|
+
aztecNodeAdmin: context.aztecNode,
|
|
224
224
|
pxeService: context.pxe,
|
|
225
|
-
publicClient: publicClient,
|
|
226
|
-
walletClient: walletClient,
|
|
225
|
+
publicClient: context.deployL1ContractsValues.publicClient,
|
|
226
|
+
walletClient: context.deployL1ContractsValues.walletClient,
|
|
227
227
|
wallet: this.aliceWallet,
|
|
228
228
|
logger: this.logger,
|
|
229
229
|
});
|
|
@@ -243,6 +243,13 @@ export class FeesTest {
|
|
|
243
243
|
},
|
|
244
244
|
async ({ bananaCoinAddress }) => {
|
|
245
245
|
this.bananaCoin = await BananaCoin.at(bananaCoinAddress, this.aliceWallet);
|
|
246
|
+
const logger = this.logger;
|
|
247
|
+
this.getBananaPublicBalanceFn = getBalancesFn('🍌.public', this.bananaCoin.methods.balance_of_public, logger);
|
|
248
|
+
this.getBananaPrivateBalanceFn = getBalancesFn(
|
|
249
|
+
'🍌.private',
|
|
250
|
+
this.bananaCoin.methods.balance_of_private,
|
|
251
|
+
logger,
|
|
252
|
+
);
|
|
246
253
|
},
|
|
247
254
|
);
|
|
248
255
|
}
|
|
@@ -274,14 +281,6 @@ export class FeesTest {
|
|
|
274
281
|
const bananaFPC = await FPCContract.at(data.bananaFPCAddress, this.aliceWallet);
|
|
275
282
|
this.bananaFPC = bananaFPC;
|
|
276
283
|
|
|
277
|
-
const logger = this.logger;
|
|
278
|
-
this.getBananaPublicBalanceFn = getBalancesFn('🍌.public', this.bananaCoin.methods.balance_of_public, logger);
|
|
279
|
-
this.getBananaPrivateBalanceFn = getBalancesFn(
|
|
280
|
-
'🍌.private',
|
|
281
|
-
this.bananaCoin.methods.balance_of_private,
|
|
282
|
-
logger,
|
|
283
|
-
);
|
|
284
|
-
|
|
285
284
|
this.getCoinbaseBalance = async () => {
|
|
286
285
|
const { walletClient } = createL1Clients(context.aztecNodeConfig.l1RpcUrls, MNEMONIC);
|
|
287
286
|
const gasL1 = getContract({
|
|
@@ -293,25 +292,22 @@ export class FeesTest {
|
|
|
293
292
|
};
|
|
294
293
|
|
|
295
294
|
this.getCoinbaseSequencerRewards = async () => {
|
|
296
|
-
const
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
abi: RollupAbi,
|
|
300
|
-
client: walletClient,
|
|
295
|
+
const publicClient = getPublicClient({
|
|
296
|
+
l1RpcUrls: context.aztecNodeConfig.l1RpcUrls,
|
|
297
|
+
l1ChainId: context.aztecNodeConfig.l1ChainId,
|
|
301
298
|
});
|
|
302
|
-
|
|
303
|
-
return await rollup.
|
|
299
|
+
const rollup = new RollupContract(publicClient, data.rollupAddress);
|
|
300
|
+
return await rollup.getSequencerRewards(this.coinbase);
|
|
304
301
|
};
|
|
305
302
|
|
|
306
303
|
this.getProverFee = async (blockNumber: number) => {
|
|
307
|
-
const
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
abi: RollupAbi,
|
|
311
|
-
client: walletClient,
|
|
304
|
+
const publicClient = getPublicClient({
|
|
305
|
+
l1RpcUrls: context.aztecNodeConfig.l1RpcUrls,
|
|
306
|
+
l1ChainId: context.aztecNodeConfig.l1ChainId,
|
|
312
307
|
});
|
|
308
|
+
const rollup = new RollupContract(publicClient, data.rollupAddress);
|
|
313
309
|
|
|
314
|
-
const provingCostPerMana = await rollup.
|
|
310
|
+
const provingCostPerMana = await rollup.getProvingCostPerManaInFeeAsset();
|
|
315
311
|
|
|
316
312
|
const block = await this.pxe.getBlock(blockNumber);
|
|
317
313
|
const mana = block!.header.totalManaUsed.toBigInt();
|
|
@@ -321,6 +317,27 @@ export class FeesTest {
|
|
|
321
317
|
);
|
|
322
318
|
}
|
|
323
319
|
|
|
320
|
+
public async applySponsoredFPCSetupSnapshot() {
|
|
321
|
+
await this.snapshotManager.snapshot(
|
|
322
|
+
'sponsored_fpc_setup',
|
|
323
|
+
async context => {
|
|
324
|
+
const feeJuiceContract = this.feeJuiceBridgeTestHarness.feeJuice;
|
|
325
|
+
expect((await context.pxe.getContractMetadata(feeJuiceContract.address)).isContractPubliclyDeployed).toBe(true);
|
|
326
|
+
|
|
327
|
+
this.sponsoredFPC = await setupSponsoredFPC(context.pxe);
|
|
328
|
+
this.logger.info(`SponsoredFPC deployed at ${this.sponsoredFPC.address}`);
|
|
329
|
+
|
|
330
|
+
return {
|
|
331
|
+
sponsoredFPCAddress: this.sponsoredFPC.address,
|
|
332
|
+
};
|
|
333
|
+
},
|
|
334
|
+
async data => {
|
|
335
|
+
const sponsoredFPC = await SponsoredFPCContract.at(data.sponsoredFPCAddress, this.aliceWallet);
|
|
336
|
+
this.sponsoredFPC = sponsoredFPC;
|
|
337
|
+
},
|
|
338
|
+
);
|
|
339
|
+
}
|
|
340
|
+
|
|
324
341
|
public async applyFundAliceWithBananas() {
|
|
325
342
|
await this.snapshotManager.snapshot(
|
|
326
343
|
'fund_alice',
|
|
@@ -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';
|
|
@@ -38,7 +39,7 @@ import {
|
|
|
38
39
|
deployAccounts,
|
|
39
40
|
publicDeployAccounts,
|
|
40
41
|
} from '../fixtures/snapshot_manager.js';
|
|
41
|
-
import { getPrivateKeyFromIndex, setupPXEService } from '../fixtures/utils.js';
|
|
42
|
+
import { getPrivateKeyFromIndex, getSponsoredFPCAddress, setupPXEService } from '../fixtures/utils.js';
|
|
42
43
|
import { TokenSimulator } from '../simulators/token_simulator.js';
|
|
43
44
|
|
|
44
45
|
const { E2E_DATA_PATH: dataPath } = process.env;
|
|
@@ -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
|
}
|
|
@@ -292,7 +295,10 @@ export class FullProverTest {
|
|
|
292
295
|
txGatheringIntervalMs: 1000,
|
|
293
296
|
txGatheringMaxParallelRequests: 100,
|
|
294
297
|
};
|
|
295
|
-
const
|
|
298
|
+
const sponsoredFPCAddress = await getSponsoredFPCAddress();
|
|
299
|
+
const { prefilledPublicData } = await getGenesisValues(
|
|
300
|
+
this.context.initialFundedAccounts.map(a => a.address).concat(sponsoredFPCAddress),
|
|
301
|
+
);
|
|
296
302
|
this.proverNode = await createProverNode(
|
|
297
303
|
proverConfig,
|
|
298
304
|
{
|
|
@@ -345,16 +351,14 @@ export class FullProverTest {
|
|
|
345
351
|
const privateAmount = 10000n;
|
|
346
352
|
const publicAmount = 10000n;
|
|
347
353
|
|
|
348
|
-
const waitOpts = { proven: false };
|
|
349
|
-
|
|
350
354
|
this.logger.verbose(`Minting ${privateAmount + publicAmount} publicly...`);
|
|
351
355
|
await asset.methods
|
|
352
356
|
.mint_to_public(accounts[0].address, privateAmount + publicAmount)
|
|
353
357
|
.send()
|
|
354
|
-
.wait(
|
|
358
|
+
.wait();
|
|
355
359
|
|
|
356
360
|
this.logger.verbose(`Transferring ${privateAmount} to private...`);
|
|
357
|
-
await asset.methods.transfer_to_private(accounts[0].address, privateAmount).send().wait(
|
|
361
|
+
await asset.methods.transfer_to_private(accounts[0].address, privateAmount).send().wait();
|
|
358
362
|
|
|
359
363
|
this.logger.verbose(`Minting complete.`);
|
|
360
364
|
|
|
@@ -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
|
},
|