@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
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
// Convenience struct to hold an account's address and secret that can easily be passed around.
|
|
2
2
|
import { AztecAddress, Fr } from '@aztec/aztec.js';
|
|
3
3
|
import { CheatCodes } from '@aztec/aztec.js/testing';
|
|
4
|
+
import type { RollupContract } from '@aztec/ethereum';
|
|
4
5
|
import { pedersenHash } from '@aztec/foundation/crypto';
|
|
5
6
|
import type { TestDateProvider } from '@aztec/foundation/timer';
|
|
6
|
-
import type { RollupAbi } from '@aztec/l1-artifacts';
|
|
7
7
|
import type { LendingContract } from '@aztec/noir-contracts.js/Lending';
|
|
8
8
|
|
|
9
|
-
import type { Account, GetContractReturnType, HttpTransport, WalletClient } from 'viem';
|
|
10
|
-
import type * as chains from 'viem/chains';
|
|
11
|
-
|
|
12
9
|
import type { TokenSimulator } from './token_simulator.js';
|
|
13
10
|
|
|
14
11
|
/**
|
|
@@ -84,7 +81,7 @@ export class LendingSimulator {
|
|
|
84
81
|
private rate: bigint,
|
|
85
82
|
private ethereumSlotDuration: number,
|
|
86
83
|
/** the rollup contract */
|
|
87
|
-
public rollup:
|
|
84
|
+
public rollup: RollupContract,
|
|
88
85
|
/** the lending contract */
|
|
89
86
|
public lendingContract: LendingContract,
|
|
90
87
|
/** the collateral asset used in the lending contract */
|
|
@@ -95,10 +92,8 @@ export class LendingSimulator {
|
|
|
95
92
|
|
|
96
93
|
async prepare() {
|
|
97
94
|
this.accumulator = BASE;
|
|
98
|
-
const slot = await this.rollup.
|
|
99
|
-
|
|
100
|
-
]);
|
|
101
|
-
this.time = Number(await this.rollup.read.getTimestampForSlot([slot]));
|
|
95
|
+
const slot = await this.rollup.getSlotAt(BigInt(await this.cc.eth.timestamp()) + BigInt(this.ethereumSlotDuration));
|
|
96
|
+
this.time = Number(await this.rollup.getTimestampForSlot(slot));
|
|
102
97
|
}
|
|
103
98
|
|
|
104
99
|
async progressSlots(diff: number, dateProvider?: TestDateProvider) {
|
|
@@ -106,8 +101,8 @@ export class LendingSimulator {
|
|
|
106
101
|
return;
|
|
107
102
|
}
|
|
108
103
|
|
|
109
|
-
const slot = await this.rollup.
|
|
110
|
-
const ts = Number(await this.rollup.
|
|
104
|
+
const slot = await this.rollup.getSlotAt(BigInt(await this.cc.eth.timestamp()));
|
|
105
|
+
const ts = Number(await this.rollup.getTimestampForSlot(slot + BigInt(diff)));
|
|
111
106
|
const timeDiff = ts - this.time;
|
|
112
107
|
this.time = ts;
|
|
113
108
|
|
|
@@ -116,7 +111,7 @@ export class LendingSimulator {
|
|
|
116
111
|
if (dateProvider) {
|
|
117
112
|
dateProvider.setTime(this.time * 1000);
|
|
118
113
|
}
|
|
119
|
-
await this.cc.rollup.markAsProven(await this.rollup.
|
|
114
|
+
await this.cc.rollup.markAsProven(await this.rollup.getBlockNumber());
|
|
120
115
|
this.accumulator = muldivDown(this.accumulator, computeMultiplier(this.rate, BigInt(timeDiff)), BASE);
|
|
121
116
|
}
|
|
122
117
|
|
|
@@ -15,6 +15,7 @@ import {
|
|
|
15
15
|
import { createEthereumChain, createL1Clients } from '@aztec/ethereum';
|
|
16
16
|
import type { Logger } from '@aztec/foundation/log';
|
|
17
17
|
import { TokenContract } from '@aztec/noir-contracts.js/Token';
|
|
18
|
+
import type { AztecNodeAdmin } from '@aztec/stdlib/interfaces/client';
|
|
18
19
|
|
|
19
20
|
export interface TestWallets {
|
|
20
21
|
pxe: PXE;
|
|
@@ -55,7 +56,6 @@ export async function deployTestWalletWithTokens(
|
|
|
55
56
|
mintAmount: bigint,
|
|
56
57
|
logger: Logger,
|
|
57
58
|
numberOfFundedWallets = 1,
|
|
58
|
-
initialFeeJuice = 10n ** 22n,
|
|
59
59
|
): Promise<TestWallets> {
|
|
60
60
|
const pxe = await createCompatibleClient(pxeUrl, logger);
|
|
61
61
|
const node = createAztecNodeClient(nodeUrl);
|
|
@@ -70,9 +70,7 @@ export async function deployTestWalletWithTokens(
|
|
|
70
70
|
const fundedAccounts = await Promise.all(funded.map(a => getSchnorrAccount(pxe, a.secret, a.signingKey, a.salt)));
|
|
71
71
|
|
|
72
72
|
const claims = await Promise.all(
|
|
73
|
-
fundedAccounts.map(a =>
|
|
74
|
-
bridgeL1FeeJuice(l1RpcUrls, mnemonicOrPrivateKey, pxe, a.getAddress(), initialFeeJuice, logger),
|
|
75
|
-
),
|
|
73
|
+
fundedAccounts.map(a => bridgeL1FeeJuice(l1RpcUrls, mnemonicOrPrivateKey, pxe, a.getAddress(), undefined, logger)),
|
|
76
74
|
);
|
|
77
75
|
|
|
78
76
|
// Progress by 2 L2 blocks so that the l1ToL2Message added above will be available to use on L2.
|
|
@@ -101,15 +99,17 @@ async function bridgeL1FeeJuice(
|
|
|
101
99
|
mnemonicOrPrivateKey: string,
|
|
102
100
|
pxe: PXE,
|
|
103
101
|
recipient: AztecAddress,
|
|
104
|
-
amount: bigint,
|
|
102
|
+
amount: bigint | undefined,
|
|
105
103
|
log: Logger,
|
|
106
104
|
) {
|
|
107
105
|
const { l1ChainId } = await pxe.getNodeInfo();
|
|
108
106
|
const chain = createEthereumChain(l1RpcUrls, l1ChainId);
|
|
109
107
|
const { publicClient, walletClient } = createL1Clients(chain.rpcUrls, mnemonicOrPrivateKey, chain.chainInfo);
|
|
110
108
|
|
|
109
|
+
// docs:start:bridge_fee_juice
|
|
111
110
|
const portal = await L1FeeJuicePortalManager.new(pxe, publicClient, walletClient, log);
|
|
112
111
|
const claim = await portal.bridgeTokensPublic(recipient, amount, true /* mint */);
|
|
112
|
+
// docs:end:bridge_fee_juice
|
|
113
113
|
|
|
114
114
|
const isSynced = async () => await pxe.isL1ToL2MessageSynced(Fr.fromHexString(claim.messageHash));
|
|
115
115
|
await retryUntil(isSynced, `message ${claim.messageHash} sync`, 24, 0.5);
|
|
@@ -118,9 +118,9 @@ async function bridgeL1FeeJuice(
|
|
|
118
118
|
return claim;
|
|
119
119
|
}
|
|
120
120
|
|
|
121
|
-
async function advanceL2Block(node: AztecNode) {
|
|
121
|
+
async function advanceL2Block(node: AztecNode, nodeAdmin?: AztecNodeAdmin) {
|
|
122
122
|
const initialBlockNumber = await node.getBlockNumber();
|
|
123
|
-
await
|
|
123
|
+
await nodeAdmin?.flushTxs();
|
|
124
124
|
await retryUntil(async () => (await node.getBlockNumber()) >= initialBlockNumber + 1);
|
|
125
125
|
}
|
|
126
126
|
|
package/src/spartan/utils.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { createLogger, sleep } from '@aztec/aztec.js';
|
|
2
2
|
import type { RollupCheatCodes } from '@aztec/aztec.js/testing';
|
|
3
3
|
import type { Logger } from '@aztec/foundation/log';
|
|
4
4
|
import { makeBackoff, retry } from '@aztec/foundation/retry';
|
|
5
5
|
import type { SequencerConfig } from '@aztec/sequencer-client';
|
|
6
|
+
import { createAztecNodeAdminClient } from '@aztec/stdlib/interfaces/client';
|
|
6
7
|
|
|
7
8
|
import { ChildProcess, exec, execSync, spawn } from 'child_process';
|
|
8
9
|
import path from 'path';
|
|
@@ -36,6 +37,7 @@ const k8sLocalConfigSchema = z.object({
|
|
|
36
37
|
INSTANCE_NAME: z.string().min(1, 'INSTANCE_NAME env variable must be set'),
|
|
37
38
|
NAMESPACE: z.string().min(1, 'NAMESPACE env variable must be set'),
|
|
38
39
|
CONTAINER_NODE_PORT: z.coerce.number().default(8080),
|
|
40
|
+
CONTAINER_NODE_ADMIN_PORT: z.coerce.number().default(8880),
|
|
39
41
|
CONTAINER_SEQUENCER_PORT: z.coerce.number().default(8080),
|
|
40
42
|
CONTAINER_PROVER_NODE_PORT: z.coerce.number().default(8080),
|
|
41
43
|
CONTAINER_PXE_PORT: z.coerce.number().default(8080),
|
|
@@ -59,6 +61,7 @@ const k8sGCloudConfigSchema = k8sLocalConfigSchema.extend({
|
|
|
59
61
|
const directConfigSchema = z.object({
|
|
60
62
|
PXE_URL: z.string().url('PXE_URL must be a valid URL'),
|
|
61
63
|
NODE_URL: z.string().url('NODE_URL must be a valid URL'),
|
|
64
|
+
NODE_ADMIN_URL: z.string().url('NODE_ADMIN_URL must be a valid URL'),
|
|
62
65
|
ETHEREUM_HOSTS: ethereumHostsSchema,
|
|
63
66
|
K8S: z.literal('false'),
|
|
64
67
|
});
|
|
@@ -559,7 +562,7 @@ export async function runAlertCheck(config: EnvConfig, alerts: AlertConfig[], lo
|
|
|
559
562
|
}
|
|
560
563
|
|
|
561
564
|
export async function updateSequencerConfig(url: string, config: Partial<SequencerConfig>) {
|
|
562
|
-
const node =
|
|
565
|
+
const node = createAztecNodeAdminClient(url);
|
|
563
566
|
// Retry incase the port forward is not ready yet
|
|
564
567
|
await retry(() => node.setConfig(config), 'Update sequencer config', makeBackoff([1, 3, 6]), logger);
|
|
565
568
|
}
|
|
@@ -570,7 +573,7 @@ export async function getSequencers(namespace: string) {
|
|
|
570
573
|
return stdout.split(' ');
|
|
571
574
|
}
|
|
572
575
|
|
|
573
|
-
|
|
576
|
+
async function updateK8sSequencersConfig(args: {
|
|
574
577
|
containerPort: number;
|
|
575
578
|
namespace: string;
|
|
576
579
|
config: Partial<SequencerConfig>;
|
|
@@ -593,12 +596,12 @@ export async function updateK8sSequencersConfig(args: {
|
|
|
593
596
|
export async function updateSequencersConfig(env: EnvConfig, config: Partial<SequencerConfig>) {
|
|
594
597
|
if (isK8sConfig(env)) {
|
|
595
598
|
await updateK8sSequencersConfig({
|
|
596
|
-
containerPort: env.
|
|
599
|
+
containerPort: env.CONTAINER_NODE_ADMIN_PORT,
|
|
597
600
|
namespace: env.NAMESPACE,
|
|
598
601
|
config,
|
|
599
602
|
});
|
|
600
603
|
} else {
|
|
601
|
-
await updateSequencerConfig(env.
|
|
604
|
+
await updateSequencerConfig(env.NODE_ADMIN_URL, config);
|
|
602
605
|
}
|
|
603
606
|
}
|
|
604
607
|
|