@aztec/end-to-end 0.85.0-nightly.20250422 → 0.85.0-nightly.20250424
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/client_flows/client_flows_benchmark.d.ts.map +1 -1
- package/dest/bench/client_flows/client_flows_benchmark.js +6 -7
- package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts +2 -2
- 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 +11 -11
- package/dest/e2e_epochs/epochs_test.d.ts +2 -2
- package/dest/e2e_epochs/epochs_test.d.ts.map +1 -1
- package/dest/e2e_epochs/epochs_test.js +1 -1
- package/dest/e2e_fees/fees_test.d.ts.map +1 -1
- package/dest/e2e_fees/fees_test.js +7 -11
- package/dest/e2e_p2p/p2p_network.d.ts +62 -62
- package/dest/e2e_p2p/p2p_network.d.ts.map +1 -1
- package/dest/e2e_p2p/p2p_network.js +12 -12
- package/dest/e2e_prover/e2e_prover_test.d.ts.map +1 -1
- package/dest/e2e_prover/e2e_prover_test.js +5 -5
- package/dest/fixtures/l1_to_l2_messaging.d.ts +2 -3
- package/dest/fixtures/l1_to_l2_messaging.d.ts.map +1 -1
- package/dest/fixtures/l1_to_l2_messaging.js +3 -3
- package/dest/fixtures/setup_l1_contracts.d.ts +1 -1
- package/dest/fixtures/setup_l1_contracts.d.ts.map +1 -1
- package/dest/fixtures/snapshot_manager.d.ts.map +1 -1
- package/dest/fixtures/snapshot_manager.js +9 -11
- package/dest/fixtures/utils.d.ts.map +1 -1
- package/dest/fixtures/utils.js +14 -17
- package/dest/shared/cross_chain_test_harness.d.ts +7 -11
- package/dest/shared/cross_chain_test_harness.d.ts.map +1 -1
- package/dest/shared/cross_chain_test_harness.js +14 -16
- package/dest/shared/gas_portal_test_harness.d.ts +6 -11
- package/dest/shared/gas_portal_test_harness.d.ts.map +1 -1
- package/dest/shared/gas_portal_test_harness.js +8 -10
- package/dest/shared/uniswap_l1_l2.d.ts +3 -5
- package/dest/shared/uniswap_l1_l2.d.ts.map +1 -1
- package/dest/shared/uniswap_l1_l2.js +18 -19
- package/dest/spartan/setup_test_wallets.js +3 -3
- package/package.json +33 -33
- package/src/bench/client_flows/client_flows_benchmark.ts +6 -8
- package/src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts +14 -18
- package/src/e2e_epochs/epochs_test.ts +4 -3
- package/src/e2e_fees/fees_test.ts +7 -11
- package/src/e2e_p2p/p2p_network.ts +13 -24
- package/src/e2e_prover/e2e_prover_test.ts +5 -10
- package/src/fixtures/l1_to_l2_messaging.ts +5 -14
- package/src/fixtures/setup_l1_contracts.ts +1 -2
- package/src/fixtures/snapshot_manager.ts +9 -11
- package/src/fixtures/utils.ts +16 -19
- package/src/shared/cross_chain_test_harness.ts +14 -31
- package/src/shared/gas_portal_test_harness.ts +9 -14
- package/src/shared/uniswap_l1_l2.ts +25 -43
- package/src/spartan/setup_test_wallets.ts +3 -3
|
@@ -25,8 +25,7 @@ export const uniswapL1L2TestSuite = (setup, cleanup, expectedForkBlockNumber = 1
|
|
|
25
25
|
let aztecNode;
|
|
26
26
|
let pxe;
|
|
27
27
|
let logger;
|
|
28
|
-
let
|
|
29
|
-
let publicClient;
|
|
28
|
+
let l1Client;
|
|
30
29
|
let ownerWallet;
|
|
31
30
|
let ownerAddress;
|
|
32
31
|
let ownerEthAddress;
|
|
@@ -46,29 +45,29 @@ export const uniswapL1L2TestSuite = (setup, cleanup, expectedForkBlockNumber = 1
|
|
|
46
45
|
let cheatCodes;
|
|
47
46
|
let version;
|
|
48
47
|
beforeAll(async ()=>{
|
|
49
|
-
({ aztecNode, pxe, logger,
|
|
50
|
-
if (Number(await
|
|
48
|
+
({ aztecNode, pxe, logger, l1Client, ownerWallet, sponsorWallet, deployL1ContractsValues, cheatCodes } = await setup());
|
|
49
|
+
if (Number(await l1Client.getBlockNumber()) < expectedForkBlockNumber) {
|
|
51
50
|
throw new Error('This test must be run on a fork of mainnet with the expected fork block');
|
|
52
51
|
}
|
|
53
|
-
rollup = new RollupContract(deployL1ContractsValues.
|
|
52
|
+
rollup = new RollupContract(deployL1ContractsValues.l1Client, deployL1ContractsValues.l1ContractAddresses.rollupAddress);
|
|
54
53
|
version = Number(await rollup.getVersion());
|
|
55
54
|
ownerAddress = ownerWallet.getAddress();
|
|
56
55
|
// sponsorAddress = sponsorWallet.getAddress();
|
|
57
|
-
ownerEthAddress = EthAddress.fromString((await
|
|
56
|
+
ownerEthAddress = EthAddress.fromString((await l1Client.getAddresses())[0]);
|
|
58
57
|
await ensureAccountsPubliclyDeployed(ownerWallet, [
|
|
59
58
|
ownerWallet,
|
|
60
59
|
sponsorWallet
|
|
61
60
|
]);
|
|
62
61
|
logger.info('Deploying DAI Portal, initializing and deploying l2 contract...');
|
|
63
|
-
daiCrossChainHarness = await CrossChainTestHarness.new(aztecNode, pxe,
|
|
62
|
+
daiCrossChainHarness = await CrossChainTestHarness.new(aztecNode, pxe, deployL1ContractsValues.l1Client, ownerWallet, logger, DAI_ADDRESS);
|
|
64
63
|
logger.info('Deploying WETH Portal, initializing and deploying l2 contract...');
|
|
65
|
-
wethCrossChainHarness = await CrossChainTestHarness.new(aztecNode, pxe,
|
|
64
|
+
wethCrossChainHarness = await CrossChainTestHarness.new(aztecNode, pxe, l1Client, ownerWallet, logger, WETH9_ADDRESS);
|
|
66
65
|
logger.info('Deploy Uniswap portal on L1 and L2...');
|
|
67
|
-
uniswapPortalAddress = await deployL1Contract(
|
|
66
|
+
uniswapPortalAddress = await deployL1Contract(l1Client, UniswapPortalAbi, UniswapPortalBytecode).then(({ address })=>address);
|
|
68
67
|
uniswapPortal = getContract({
|
|
69
68
|
address: uniswapPortalAddress.toString(),
|
|
70
69
|
abi: UniswapPortalAbi,
|
|
71
|
-
client:
|
|
70
|
+
client: l1Client
|
|
72
71
|
});
|
|
73
72
|
// deploy l2 uniswap contract and attach to portal
|
|
74
73
|
uniswapL2Contract = await UniswapContract.deploy(ownerWallet, uniswapPortalAddress).send().deployed();
|
|
@@ -79,11 +78,11 @@ export const uniswapL1L2TestSuite = (setup, cleanup, expectedForkBlockNumber = 1
|
|
|
79
78
|
], {});
|
|
80
79
|
// Give me some WETH so I can deposit to L2 and do the swap...
|
|
81
80
|
logger.info('Getting some weth');
|
|
82
|
-
const hash = await
|
|
81
|
+
const hash = await l1Client.sendTransaction({
|
|
83
82
|
to: WETH9_ADDRESS.toString(),
|
|
84
83
|
value: parseEther('1000')
|
|
85
84
|
});
|
|
86
|
-
await
|
|
85
|
+
await l1Client.waitForTransactionReceipt({
|
|
87
86
|
hash
|
|
88
87
|
});
|
|
89
88
|
const wethBalance = await wethCrossChainHarness.getL1BalanceOf(ownerEthAddress);
|
|
@@ -139,7 +138,7 @@ export const uniswapL1L2TestSuite = (setup, cleanup, expectedForkBlockNumber = 1
|
|
|
139
138
|
uniswapL2Contract.address,
|
|
140
139
|
new Fr(version),
|
|
141
140
|
EthAddress.fromString(uniswapPortal.address).toBuffer32(),
|
|
142
|
-
new Fr(
|
|
141
|
+
new Fr(l1Client.chain.id),
|
|
143
142
|
swapPrivateContent
|
|
144
143
|
]);
|
|
145
144
|
const withdrawContent = sha256ToField([
|
|
@@ -152,7 +151,7 @@ export const uniswapL1L2TestSuite = (setup, cleanup, expectedForkBlockNumber = 1
|
|
|
152
151
|
wethCrossChainHarness.l2Bridge.address,
|
|
153
152
|
new Fr(version),
|
|
154
153
|
wethCrossChainHarness.tokenPortalAddress.toBuffer32(),
|
|
155
|
-
new Fr(
|
|
154
|
+
new Fr(l1Client.chain.id),
|
|
156
155
|
withdrawContent
|
|
157
156
|
]);
|
|
158
157
|
// ensure that user's funds were burnt
|
|
@@ -190,7 +189,7 @@ export const uniswapL1L2TestSuite = (setup, cleanup, expectedForkBlockNumber = 1
|
|
|
190
189
|
]
|
|
191
190
|
];
|
|
192
191
|
// this should also insert a message into the inbox.
|
|
193
|
-
const txReceipt = await daiCrossChainHarness.
|
|
192
|
+
const txReceipt = await daiCrossChainHarness.l1Client.waitForTransactionReceipt({
|
|
194
193
|
hash: await uniswapPortal.write.swapPrivate(swapArgs)
|
|
195
194
|
});
|
|
196
195
|
// We get the msg leaf from event so that we can later wait for it to be available for consumption
|
|
@@ -536,7 +535,7 @@ export const uniswapL1L2TestSuite = (setup, cleanup, expectedForkBlockNumber = 1
|
|
|
536
535
|
uniswapL2Contract.address,
|
|
537
536
|
new Fr(version),
|
|
538
537
|
EthAddress.fromString(uniswapPortal.address).toBuffer32(),
|
|
539
|
-
new Fr(
|
|
538
|
+
new Fr(l1Client.chain.id),
|
|
540
539
|
swapPrivateContent
|
|
541
540
|
]);
|
|
542
541
|
const withdrawContent = sha256ToField([
|
|
@@ -549,7 +548,7 @@ export const uniswapL1L2TestSuite = (setup, cleanup, expectedForkBlockNumber = 1
|
|
|
549
548
|
wethCrossChainHarness.l2Bridge.address,
|
|
550
549
|
new Fr(version),
|
|
551
550
|
wethCrossChainHarness.tokenPortalAddress.toBuffer32(),
|
|
552
|
-
new Fr(
|
|
551
|
+
new Fr(l1Client.chain.id),
|
|
553
552
|
withdrawContent
|
|
554
553
|
]);
|
|
555
554
|
const [swapPrivateL2MessageIndex, swapPrivateSiblingPath] = await aztecNode.getL2ToL1MessageMembershipWitness(withdrawReceipt.blockNumber, swapPrivateLeaf);
|
|
@@ -616,7 +615,7 @@ export const uniswapL1L2TestSuite = (setup, cleanup, expectedForkBlockNumber = 1
|
|
|
616
615
|
uniswapL2Contract.address,
|
|
617
616
|
new Fr(version),
|
|
618
617
|
EthAddress.fromString(uniswapPortal.address).toBuffer32(),
|
|
619
|
-
new Fr(
|
|
618
|
+
new Fr(l1Client.chain.id),
|
|
620
619
|
swapPublicContent
|
|
621
620
|
]);
|
|
622
621
|
const withdrawContent = sha256ToField([
|
|
@@ -629,7 +628,7 @@ export const uniswapL1L2TestSuite = (setup, cleanup, expectedForkBlockNumber = 1
|
|
|
629
628
|
wethCrossChainHarness.l2Bridge.address,
|
|
630
629
|
new Fr(version),
|
|
631
630
|
wethCrossChainHarness.tokenPortalAddress.toBuffer32(),
|
|
632
|
-
new Fr(
|
|
631
|
+
new Fr(l1Client.chain.id),
|
|
633
632
|
withdrawContent
|
|
634
633
|
]);
|
|
635
634
|
const [swapPublicL2MessageIndex, swapPublicSiblingPath] = await aztecNode.getL2ToL1MessageMembershipWitness(withdrawReceipt.blockNumber, swapPublicLeaf);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { getSchnorrAccount, getSchnorrWalletWithSecretKey } from '@aztec/accounts/schnorr';
|
|
2
2
|
import { generateSchnorrAccounts, getDeployedTestAccountsWallets } from '@aztec/accounts/testing';
|
|
3
3
|
import { FeeJuicePaymentMethodWithClaim, Fr, L1FeeJuicePortalManager, createAztecNodeClient, createCompatibleClient, retryUntil } from '@aztec/aztec.js';
|
|
4
|
-
import { createEthereumChain,
|
|
4
|
+
import { createEthereumChain, createExtendedL1Client } from '@aztec/ethereum';
|
|
5
5
|
import { TokenContract } from '@aztec/noir-contracts.js/Token';
|
|
6
6
|
const TOKEN_NAME = 'USDC';
|
|
7
7
|
const TOKEN_SYMBOL = 'USD';
|
|
@@ -59,9 +59,9 @@ export async function deployTestWalletWithTokens(pxeUrl, nodeUrl, l1RpcUrls, mne
|
|
|
59
59
|
async function bridgeL1FeeJuice(l1RpcUrls, mnemonicOrPrivateKey, pxe, recipient, amount, log) {
|
|
60
60
|
const { l1ChainId } = await pxe.getNodeInfo();
|
|
61
61
|
const chain = createEthereumChain(l1RpcUrls, l1ChainId);
|
|
62
|
-
const
|
|
62
|
+
const l1Client = createExtendedL1Client(chain.rpcUrls, mnemonicOrPrivateKey, chain.chainInfo);
|
|
63
63
|
// docs:start:bridge_fee_juice
|
|
64
|
-
const portal = await L1FeeJuicePortalManager.new(pxe,
|
|
64
|
+
const portal = await L1FeeJuicePortalManager.new(pxe, l1Client, log);
|
|
65
65
|
const claim = await portal.bridgeTokensPublic(recipient, amount, true);
|
|
66
66
|
// docs:end:bridge_fee_juice
|
|
67
67
|
const isSynced = async ()=>await pxe.isL1ToL2MessageSynced(Fr.fromHexString(claim.messageHash));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/end-to-end",
|
|
3
|
-
"version": "0.85.0-nightly.
|
|
3
|
+
"version": "0.85.0-nightly.20250424",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": "./dest/index.js",
|
|
6
6
|
"inherits": [
|
|
@@ -25,38 +25,38 @@
|
|
|
25
25
|
"formatting": "run -T prettier --check ./src && run -T eslint ./src"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@aztec/accounts": "0.85.0-nightly.
|
|
29
|
-
"@aztec/archiver": "0.85.0-nightly.
|
|
30
|
-
"@aztec/aztec": "0.85.0-nightly.
|
|
31
|
-
"@aztec/aztec-node": "0.85.0-nightly.
|
|
32
|
-
"@aztec/aztec.js": "0.85.0-nightly.
|
|
33
|
-
"@aztec/bb-prover": "0.85.0-nightly.
|
|
34
|
-
"@aztec/blob-lib": "0.85.0-nightly.
|
|
35
|
-
"@aztec/blob-sink": "0.85.0-nightly.
|
|
36
|
-
"@aztec/bot": "0.85.0-nightly.
|
|
37
|
-
"@aztec/cli": "0.85.0-nightly.
|
|
38
|
-
"@aztec/constants": "0.85.0-nightly.
|
|
39
|
-
"@aztec/entrypoints": "0.85.0-nightly.
|
|
40
|
-
"@aztec/epoch-cache": "0.85.0-nightly.
|
|
41
|
-
"@aztec/ethereum": "0.85.0-nightly.
|
|
42
|
-
"@aztec/foundation": "0.85.0-nightly.
|
|
43
|
-
"@aztec/kv-store": "0.85.0-nightly.
|
|
44
|
-
"@aztec/l1-artifacts": "0.85.0-nightly.
|
|
45
|
-
"@aztec/merkle-tree": "0.85.0-nightly.
|
|
46
|
-
"@aztec/noir-contracts.js": "0.85.0-nightly.
|
|
47
|
-
"@aztec/noir-noirc_abi": "0.85.0-nightly.
|
|
48
|
-
"@aztec/noir-protocol-circuits-types": "0.85.0-nightly.
|
|
49
|
-
"@aztec/p2p": "0.85.0-nightly.
|
|
50
|
-
"@aztec/protocol-contracts": "0.85.0-nightly.
|
|
51
|
-
"@aztec/prover-client": "0.85.0-nightly.
|
|
52
|
-
"@aztec/prover-node": "0.85.0-nightly.
|
|
53
|
-
"@aztec/pxe": "0.85.0-nightly.
|
|
54
|
-
"@aztec/sequencer-client": "0.85.0-nightly.
|
|
55
|
-
"@aztec/simulator": "0.85.0-nightly.
|
|
56
|
-
"@aztec/stdlib": "0.85.0-nightly.
|
|
57
|
-
"@aztec/telemetry-client": "0.85.0-nightly.
|
|
58
|
-
"@aztec/validator-client": "0.85.0-nightly.
|
|
59
|
-
"@aztec/world-state": "0.85.0-nightly.
|
|
28
|
+
"@aztec/accounts": "0.85.0-nightly.20250424",
|
|
29
|
+
"@aztec/archiver": "0.85.0-nightly.20250424",
|
|
30
|
+
"@aztec/aztec": "0.85.0-nightly.20250424",
|
|
31
|
+
"@aztec/aztec-node": "0.85.0-nightly.20250424",
|
|
32
|
+
"@aztec/aztec.js": "0.85.0-nightly.20250424",
|
|
33
|
+
"@aztec/bb-prover": "0.85.0-nightly.20250424",
|
|
34
|
+
"@aztec/blob-lib": "0.85.0-nightly.20250424",
|
|
35
|
+
"@aztec/blob-sink": "0.85.0-nightly.20250424",
|
|
36
|
+
"@aztec/bot": "0.85.0-nightly.20250424",
|
|
37
|
+
"@aztec/cli": "0.85.0-nightly.20250424",
|
|
38
|
+
"@aztec/constants": "0.85.0-nightly.20250424",
|
|
39
|
+
"@aztec/entrypoints": "0.85.0-nightly.20250424",
|
|
40
|
+
"@aztec/epoch-cache": "0.85.0-nightly.20250424",
|
|
41
|
+
"@aztec/ethereum": "0.85.0-nightly.20250424",
|
|
42
|
+
"@aztec/foundation": "0.85.0-nightly.20250424",
|
|
43
|
+
"@aztec/kv-store": "0.85.0-nightly.20250424",
|
|
44
|
+
"@aztec/l1-artifacts": "0.85.0-nightly.20250424",
|
|
45
|
+
"@aztec/merkle-tree": "0.85.0-nightly.20250424",
|
|
46
|
+
"@aztec/noir-contracts.js": "0.85.0-nightly.20250424",
|
|
47
|
+
"@aztec/noir-noirc_abi": "0.85.0-nightly.20250424",
|
|
48
|
+
"@aztec/noir-protocol-circuits-types": "0.85.0-nightly.20250424",
|
|
49
|
+
"@aztec/p2p": "0.85.0-nightly.20250424",
|
|
50
|
+
"@aztec/protocol-contracts": "0.85.0-nightly.20250424",
|
|
51
|
+
"@aztec/prover-client": "0.85.0-nightly.20250424",
|
|
52
|
+
"@aztec/prover-node": "0.85.0-nightly.20250424",
|
|
53
|
+
"@aztec/pxe": "0.85.0-nightly.20250424",
|
|
54
|
+
"@aztec/sequencer-client": "0.85.0-nightly.20250424",
|
|
55
|
+
"@aztec/simulator": "0.85.0-nightly.20250424",
|
|
56
|
+
"@aztec/stdlib": "0.85.0-nightly.20250424",
|
|
57
|
+
"@aztec/telemetry-client": "0.85.0-nightly.20250424",
|
|
58
|
+
"@aztec/validator-client": "0.85.0-nightly.20250424",
|
|
59
|
+
"@aztec/world-state": "0.85.0-nightly.20250424",
|
|
60
60
|
"@iarna/toml": "^2.2.5",
|
|
61
61
|
"@jest/globals": "^29.5.0",
|
|
62
62
|
"@noble/curves": "^1.0.0",
|
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
} from '@aztec/aztec.js';
|
|
17
17
|
import { CheatCodes } from '@aztec/aztec.js/testing';
|
|
18
18
|
import { FEE_FUNDING_FOR_TESTER_ACCOUNT } from '@aztec/constants';
|
|
19
|
-
import { type DeployL1ContractsArgs, RollupContract,
|
|
19
|
+
import { type DeployL1ContractsArgs, RollupContract, createExtendedL1Client, deployL1Contract } from '@aztec/ethereum';
|
|
20
20
|
import { ChainMonitor } from '@aztec/ethereum/test';
|
|
21
21
|
import { randomBytes } from '@aztec/foundation/crypto';
|
|
22
22
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
@@ -234,8 +234,7 @@ export class ClientFlowsBenchmark {
|
|
|
234
234
|
aztecNode: context.aztecNode,
|
|
235
235
|
aztecNodeAdmin: context.aztecNode,
|
|
236
236
|
pxeService: context.pxe,
|
|
237
|
-
|
|
238
|
-
walletClient: context.deployL1ContractsValues.walletClient,
|
|
237
|
+
l1Client: context.deployL1ContractsValues.l1Client,
|
|
239
238
|
wallet: this.adminWallet,
|
|
240
239
|
logger: this.logger,
|
|
241
240
|
});
|
|
@@ -314,20 +313,19 @@ export class ClientFlowsBenchmark {
|
|
|
314
313
|
}
|
|
315
314
|
|
|
316
315
|
public async createCrossChainTestHarness(owner: AccountWallet) {
|
|
317
|
-
const
|
|
316
|
+
const l1Client = createExtendedL1Client(this.context.aztecNodeConfig.l1RpcUrls, MNEMONIC);
|
|
318
317
|
|
|
319
|
-
const underlyingERC20Address = await deployL1Contract(
|
|
318
|
+
const underlyingERC20Address = await deployL1Contract(l1Client, TestERC20Abi, TestERC20Bytecode, [
|
|
320
319
|
'Underlying',
|
|
321
320
|
'UND',
|
|
322
|
-
|
|
321
|
+
l1Client.account.address,
|
|
323
322
|
]).then(({ address }) => address);
|
|
324
323
|
|
|
325
324
|
this.logger.verbose(`Setting up cross chain harness...`);
|
|
326
325
|
const crossChainTestHarness = await CrossChainTestHarness.new(
|
|
327
326
|
this.aztecNode,
|
|
328
327
|
this.pxe,
|
|
329
|
-
|
|
330
|
-
walletClient,
|
|
328
|
+
l1Client,
|
|
331
329
|
owner,
|
|
332
330
|
this.logger,
|
|
333
331
|
underlyingERC20Address,
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
createLogger,
|
|
12
12
|
} from '@aztec/aztec.js';
|
|
13
13
|
import { CheatCodes } from '@aztec/aztec.js/testing';
|
|
14
|
-
import { type
|
|
14
|
+
import { type ExtendedViemWalletClient, createExtendedL1Client, deployL1Contract } from '@aztec/ethereum';
|
|
15
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';
|
|
@@ -39,7 +39,7 @@ export class CrossChainMessagingTest {
|
|
|
39
39
|
pxe!: PXE;
|
|
40
40
|
aztecNodeConfig!: AztecNodeConfig;
|
|
41
41
|
|
|
42
|
-
|
|
42
|
+
l1Client!: ExtendedViemWalletClient | undefined;
|
|
43
43
|
|
|
44
44
|
user1Wallet!: AccountWallet;
|
|
45
45
|
user2Wallet!: AccountWallet;
|
|
@@ -109,22 +109,19 @@ export class CrossChainMessagingTest {
|
|
|
109
109
|
this.logger.verbose(`Public deploy accounts...`);
|
|
110
110
|
await publicDeployAccounts(this.wallets[0], this.accounts.slice(0, 3));
|
|
111
111
|
|
|
112
|
-
|
|
112
|
+
this.l1Client = createExtendedL1Client(this.aztecNodeConfig.l1RpcUrls, MNEMONIC);
|
|
113
113
|
|
|
114
|
-
const underlyingERC20Address = await deployL1Contract(
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
['Underlying', 'UND', walletClient.account.address],
|
|
120
|
-
).then(({ address }) => address);
|
|
114
|
+
const underlyingERC20Address = await deployL1Contract(this.l1Client, TestERC20Abi, TestERC20Bytecode, [
|
|
115
|
+
'Underlying',
|
|
116
|
+
'UND',
|
|
117
|
+
this.l1Client.account.address,
|
|
118
|
+
]).then(({ address }) => address);
|
|
121
119
|
|
|
122
120
|
this.logger.verbose(`Setting up cross chain harness...`);
|
|
123
121
|
this.crossChainTestHarness = await CrossChainTestHarness.new(
|
|
124
122
|
this.aztecNode,
|
|
125
123
|
this.pxe,
|
|
126
|
-
|
|
127
|
-
walletClient,
|
|
124
|
+
this.l1Client,
|
|
128
125
|
this.wallets[0],
|
|
129
126
|
this.logger,
|
|
130
127
|
underlyingERC20Address,
|
|
@@ -143,17 +140,17 @@ export class CrossChainMessagingTest {
|
|
|
143
140
|
this.ownerAddress = AztecAddress.fromString(crossChainContext.ownerAddress.toString());
|
|
144
141
|
const tokenPortalAddress = EthAddress.fromString(crossChainContext.tokenPortal.toString());
|
|
145
142
|
|
|
146
|
-
const
|
|
143
|
+
const l1Client = createExtendedL1Client(this.aztecNodeConfig.l1RpcUrls, MNEMONIC);
|
|
147
144
|
|
|
148
145
|
const inbox = getContract({
|
|
149
146
|
address: this.aztecNodeConfig.l1Contracts.inboxAddress.toString(),
|
|
150
147
|
abi: InboxAbi,
|
|
151
|
-
client:
|
|
148
|
+
client: l1Client,
|
|
152
149
|
});
|
|
153
150
|
const outbox = getContract({
|
|
154
151
|
address: this.aztecNodeConfig.l1Contracts.outboxAddress.toString(),
|
|
155
152
|
abi: OutboxAbi,
|
|
156
|
-
client:
|
|
153
|
+
client: l1Client,
|
|
157
154
|
});
|
|
158
155
|
|
|
159
156
|
this.crossChainTestHarness = new CrossChainTestHarness(
|
|
@@ -165,13 +162,12 @@ export class CrossChainMessagingTest {
|
|
|
165
162
|
this.ethAccount,
|
|
166
163
|
tokenPortalAddress,
|
|
167
164
|
crossChainContext.underlying,
|
|
168
|
-
|
|
169
|
-
walletClient,
|
|
165
|
+
l1Client,
|
|
170
166
|
this.aztecNodeConfig.l1Contracts,
|
|
171
167
|
this.user1Wallet,
|
|
172
168
|
);
|
|
173
169
|
|
|
174
|
-
this.
|
|
170
|
+
this.l1Client = l1Client;
|
|
175
171
|
this.inbox = inbox;
|
|
176
172
|
this.outbox = outbox;
|
|
177
173
|
},
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { AztecNodeService } from '@aztec/aztec-node';
|
|
2
2
|
import { Fr, type Logger, MerkleTreeId, getTimestampRangeForEpoch, retryUntil, sleep } from '@aztec/aztec.js';
|
|
3
|
+
import type { ViemClient } from '@aztec/ethereum';
|
|
3
4
|
import { RollupContract } from '@aztec/ethereum/contracts';
|
|
4
5
|
import { ChainMonitor, DelayedTxUtils, type Delayer, waitUntilL1Timestamp } from '@aztec/ethereum/test';
|
|
5
6
|
import { randomBytes } from '@aztec/foundation/crypto';
|
|
@@ -12,7 +13,7 @@ import type { L2BlockNumber } from '@aztec/stdlib/block';
|
|
|
12
13
|
import type { L1RollupConstants } from '@aztec/stdlib/epoch-helpers';
|
|
13
14
|
|
|
14
15
|
import { join } from 'path';
|
|
15
|
-
import type { Hex
|
|
16
|
+
import type { Hex } from 'viem';
|
|
16
17
|
|
|
17
18
|
import {
|
|
18
19
|
type EndToEndContext,
|
|
@@ -40,7 +41,7 @@ export type EpochsTestOpts = Partial<
|
|
|
40
41
|
*/
|
|
41
42
|
export class EpochsTestContext {
|
|
42
43
|
public context!: EndToEndContext;
|
|
43
|
-
public l1Client!:
|
|
44
|
+
public l1Client!: ViemClient;
|
|
44
45
|
public rollup!: RollupContract;
|
|
45
46
|
public constants!: L1RollupConstants;
|
|
46
47
|
public logger!: Logger;
|
|
@@ -92,7 +93,7 @@ export class EpochsTestContext {
|
|
|
92
93
|
this.proverNodes = context.proverNode ? [context.proverNode] : [];
|
|
93
94
|
this.nodes = context.aztecNode ? [context.aztecNode as AztecNodeService] : [];
|
|
94
95
|
this.logger = context.logger;
|
|
95
|
-
this.l1Client = context.deployL1ContractsValues.
|
|
96
|
+
this.l1Client = context.deployL1ContractsValues.l1Client;
|
|
96
97
|
this.rollup = RollupContract.getFromConfig(context.config);
|
|
97
98
|
|
|
98
99
|
// Loop that tracks L1 and L2 block numbers and logs whenever there's a new one.
|
|
@@ -13,7 +13,7 @@ import { FEE_FUNDING_FOR_TESTER_ACCOUNT } from '@aztec/constants';
|
|
|
13
13
|
import {
|
|
14
14
|
type DeployL1ContractsArgs,
|
|
15
15
|
RollupContract,
|
|
16
|
-
|
|
16
|
+
createExtendedL1Client,
|
|
17
17
|
getPublicClient,
|
|
18
18
|
l1Artifacts,
|
|
19
19
|
} from '@aztec/ethereum';
|
|
@@ -150,7 +150,7 @@ export class FeesTest {
|
|
|
150
150
|
const rewardDistributor = getContract({
|
|
151
151
|
address: this.context.deployL1ContractsValues.l1ContractAddresses.rewardDistributorAddress.toString(),
|
|
152
152
|
abi: l1Artifacts.rewardDistributor.contractAbi,
|
|
153
|
-
client: this.context.deployL1ContractsValues.
|
|
153
|
+
client: this.context.deployL1ContractsValues.l1Client,
|
|
154
154
|
});
|
|
155
155
|
|
|
156
156
|
const blockReward = await rewardDistributor.read.BLOCK_REWARD();
|
|
@@ -235,8 +235,7 @@ export class FeesTest {
|
|
|
235
235
|
aztecNode: context.aztecNode,
|
|
236
236
|
aztecNodeAdmin: context.aztecNode,
|
|
237
237
|
pxeService: context.pxe,
|
|
238
|
-
|
|
239
|
-
walletClient: context.deployL1ContractsValues.walletClient,
|
|
238
|
+
l1Client: context.deployL1ContractsValues.l1Client,
|
|
240
239
|
wallet: this.aliceWallet,
|
|
241
240
|
logger: this.logger,
|
|
242
241
|
});
|
|
@@ -295,21 +294,18 @@ export class FeesTest {
|
|
|
295
294
|
this.bananaFPC = bananaFPC;
|
|
296
295
|
|
|
297
296
|
this.getCoinbaseBalance = async () => {
|
|
298
|
-
const
|
|
297
|
+
const l1Client = createExtendedL1Client(context.aztecNodeConfig.l1RpcUrls, MNEMONIC);
|
|
299
298
|
const gasL1 = getContract({
|
|
300
299
|
address: data.l1FeeJuiceAddress.toString(),
|
|
301
300
|
abi: TestERC20Abi,
|
|
302
|
-
client:
|
|
301
|
+
client: l1Client,
|
|
303
302
|
});
|
|
304
303
|
return await gasL1.read.balanceOf([this.coinbase.toString()]);
|
|
305
304
|
};
|
|
306
305
|
|
|
307
306
|
this.getCoinbaseSequencerRewards = async () => {
|
|
308
|
-
const
|
|
309
|
-
|
|
310
|
-
l1ChainId: context.aztecNodeConfig.l1ChainId,
|
|
311
|
-
});
|
|
312
|
-
const rollup = new RollupContract(publicClient, data.rollupAddress);
|
|
307
|
+
const l1Client = createExtendedL1Client(context.aztecNodeConfig.l1RpcUrls, MNEMONIC);
|
|
308
|
+
const rollup = new RollupContract(l1Client, data.rollupAddress);
|
|
313
309
|
return await rollup.getSequencerRewards(this.coinbase);
|
|
314
310
|
};
|
|
315
311
|
|
|
@@ -3,10 +3,9 @@ import type { InitialAccountData } from '@aztec/accounts/testing';
|
|
|
3
3
|
import type { AztecNodeConfig, AztecNodeService } from '@aztec/aztec-node';
|
|
4
4
|
import type { AccountWalletWithSecretKey } from '@aztec/aztec.js';
|
|
5
5
|
import {
|
|
6
|
+
type ExtendedViemWalletClient,
|
|
6
7
|
L1TxUtils,
|
|
7
8
|
RollupContract,
|
|
8
|
-
type ViemPublicClient,
|
|
9
|
-
type ViemWalletClient,
|
|
10
9
|
getExpectedAddress,
|
|
11
10
|
getL1ContractsConfigEnvVars,
|
|
12
11
|
} from '@aztec/ethereum';
|
|
@@ -191,14 +190,13 @@ export class P2PNetworkTest {
|
|
|
191
190
|
|
|
192
191
|
async applyBaseSnapshots() {
|
|
193
192
|
await this.addBootstrapNode();
|
|
194
|
-
|
|
195
193
|
await this.snapshotManager.snapshot(
|
|
196
194
|
'add-validators',
|
|
197
195
|
async ({ deployL1ContractsValues, aztecNodeConfig, dateProvider }) => {
|
|
198
196
|
const rollup = getContract({
|
|
199
197
|
address: deployL1ContractsValues.l1ContractAddresses.rollupAddress.toString(),
|
|
200
198
|
abi: RollupAbi,
|
|
201
|
-
client: deployL1ContractsValues.
|
|
199
|
+
client: deployL1ContractsValues.l1Client,
|
|
202
200
|
});
|
|
203
201
|
|
|
204
202
|
this.logger.verbose(`Adding ${this.numberOfNodes} validators`);
|
|
@@ -206,26 +204,23 @@ export class P2PNetworkTest {
|
|
|
206
204
|
const stakingAsset = getContract({
|
|
207
205
|
address: deployL1ContractsValues.l1ContractAddresses.stakingAssetAddress.toString(),
|
|
208
206
|
abi: TestERC20Abi,
|
|
209
|
-
client: deployL1ContractsValues.
|
|
207
|
+
client: deployL1ContractsValues.l1Client,
|
|
210
208
|
});
|
|
211
209
|
|
|
212
210
|
const stakeNeeded = l1ContractsConfig.minimumStake * BigInt(this.numberOfNodes);
|
|
213
211
|
await Promise.all(
|
|
214
212
|
[
|
|
215
|
-
await stakingAsset.write.mint(
|
|
216
|
-
[deployL1ContractsValues.walletClient.account.address, stakeNeeded],
|
|
217
|
-
{} as any,
|
|
218
|
-
),
|
|
213
|
+
await stakingAsset.write.mint([deployL1ContractsValues.l1Client.account.address, stakeNeeded], {} as any),
|
|
219
214
|
await stakingAsset.write.approve(
|
|
220
215
|
[deployL1ContractsValues.l1ContractAddresses.rollupAddress.toString(), stakeNeeded],
|
|
221
216
|
{} as any,
|
|
222
217
|
),
|
|
223
|
-
].map(txHash => deployL1ContractsValues.
|
|
218
|
+
].map(txHash => deployL1ContractsValues.l1Client.waitForTransactionReceipt({ hash: txHash })),
|
|
224
219
|
);
|
|
225
220
|
|
|
226
221
|
const { validators } = this.getValidators();
|
|
227
222
|
this.validators = validators;
|
|
228
|
-
await deployL1ContractsValues.
|
|
223
|
+
await deployL1ContractsValues.l1Client.waitForTransactionReceipt({
|
|
229
224
|
hash: await rollup.write.cheat__InitialiseValidatorSet([this.validators]),
|
|
230
225
|
});
|
|
231
226
|
|
|
@@ -239,7 +234,7 @@ export class P2PNetworkTest {
|
|
|
239
234
|
}
|
|
240
235
|
|
|
241
236
|
// Send and await a tx to make sure we mine a block for the warp to correctly progress.
|
|
242
|
-
await this._sendDummyTx(deployL1ContractsValues.
|
|
237
|
+
await this._sendDummyTx(deployL1ContractsValues.l1Client);
|
|
243
238
|
|
|
244
239
|
// Set the system time in the node, only after we have warped the time and waited for a block
|
|
245
240
|
// Time is only set in the NEXT block
|
|
@@ -285,11 +280,8 @@ export class P2PNetworkTest {
|
|
|
285
280
|
'remove-inital-validator',
|
|
286
281
|
async ({ deployL1ContractsValues, aztecNode, dateProvider }) => {
|
|
287
282
|
// Send and await a tx to make sure we mine a block for the warp to correctly progress.
|
|
288
|
-
const { receipt } = await this._sendDummyTx(
|
|
289
|
-
|
|
290
|
-
deployL1ContractsValues.walletClient,
|
|
291
|
-
);
|
|
292
|
-
const block = await deployL1ContractsValues.publicClient.getBlock({
|
|
283
|
+
const { receipt } = await this._sendDummyTx(deployL1ContractsValues.l1Client);
|
|
284
|
+
const block = await deployL1ContractsValues.l1Client.getBlock({
|
|
293
285
|
blockNumber: receipt.blockNumber,
|
|
294
286
|
});
|
|
295
287
|
dateProvider.setTime(Number(block.timestamp) * 1000);
|
|
@@ -300,16 +292,13 @@ export class P2PNetworkTest {
|
|
|
300
292
|
}
|
|
301
293
|
|
|
302
294
|
async sendDummyTx() {
|
|
303
|
-
return await this._sendDummyTx(
|
|
304
|
-
this.ctx.deployL1ContractsValues.publicClient,
|
|
305
|
-
this.ctx.deployL1ContractsValues.walletClient,
|
|
306
|
-
);
|
|
295
|
+
return await this._sendDummyTx(this.ctx.deployL1ContractsValues.l1Client);
|
|
307
296
|
}
|
|
308
297
|
|
|
309
|
-
private async _sendDummyTx(
|
|
310
|
-
const l1TxUtils = new L1TxUtils(
|
|
298
|
+
private async _sendDummyTx(l1Client: ExtendedViemWalletClient) {
|
|
299
|
+
const l1TxUtils = new L1TxUtils(l1Client);
|
|
311
300
|
return await l1TxUtils.sendAndMonitorTransaction({
|
|
312
|
-
to:
|
|
301
|
+
to: l1Client.account!.address,
|
|
313
302
|
value: 1n,
|
|
314
303
|
});
|
|
315
304
|
}
|
|
@@ -316,10 +316,10 @@ export class FullProverTest {
|
|
|
316
316
|
|
|
317
317
|
private async mintL1ERC20(recipient: Hex, amount: bigint) {
|
|
318
318
|
const erc20Address = this.context.deployL1ContractsValues.l1ContractAddresses.feeJuiceAddress;
|
|
319
|
-
const client = this.context.deployL1ContractsValues.
|
|
319
|
+
const client = this.context.deployL1ContractsValues.l1Client;
|
|
320
320
|
const erc20 = getContract({ abi: TestERC20Abi, address: erc20Address.toString(), client });
|
|
321
321
|
const hash = await erc20.write.mint([recipient, amount]);
|
|
322
|
-
await this.context.deployL1ContractsValues.
|
|
322
|
+
await this.context.deployL1ContractsValues.l1Client.waitForTransactionReceipt({ hash });
|
|
323
323
|
}
|
|
324
324
|
|
|
325
325
|
snapshot = <T>(
|
|
@@ -399,19 +399,14 @@ export class FullProverTest {
|
|
|
399
399
|
throw new Error('No verifier');
|
|
400
400
|
}
|
|
401
401
|
|
|
402
|
-
const {
|
|
402
|
+
const { l1Client, l1ContractAddresses } = this.context.deployL1ContractsValues;
|
|
403
403
|
const rollup = getContract({
|
|
404
404
|
abi: RollupAbi,
|
|
405
405
|
address: l1ContractAddresses.rollupAddress.toString(),
|
|
406
|
-
client:
|
|
406
|
+
client: l1Client,
|
|
407
407
|
});
|
|
408
408
|
|
|
409
|
-
const { address: verifierAddress } = await deployL1Contract(
|
|
410
|
-
walletClient,
|
|
411
|
-
publicClient,
|
|
412
|
-
HonkVerifierAbi,
|
|
413
|
-
HonkVerifierBytecode,
|
|
414
|
-
);
|
|
409
|
+
const { address: verifierAddress } = await deployL1Contract(l1Client, HonkVerifierAbi, HonkVerifierBytecode);
|
|
415
410
|
this.logger.info(`Deployed honk verifier at ${verifierAddress}`);
|
|
416
411
|
|
|
417
412
|
await rollup.write.setEpochVerifier([verifierAddress.toString()]);
|
|
@@ -1,9 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
type L1ContractAddresses,
|
|
3
|
-
RollupContract,
|
|
4
|
-
type ViemPublicClient,
|
|
5
|
-
type ViemWalletClient,
|
|
6
|
-
} from '@aztec/ethereum';
|
|
1
|
+
import { type ExtendedViemWalletClient, type L1ContractAddresses, RollupContract } from '@aztec/ethereum';
|
|
7
2
|
import { Fr } from '@aztec/foundation/fields';
|
|
8
3
|
import { InboxAbi } from '@aztec/l1-artifacts';
|
|
9
4
|
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
@@ -14,23 +9,19 @@ import { decodeEventLog, getContract } from 'viem';
|
|
|
14
9
|
export async function sendL1ToL2Message(
|
|
15
10
|
message: { recipient: AztecAddress; content: Fr; secretHash: Fr },
|
|
16
11
|
ctx: {
|
|
17
|
-
|
|
18
|
-
publicClient: ViemPublicClient;
|
|
12
|
+
l1Client: ExtendedViemWalletClient;
|
|
19
13
|
l1ContractAddresses: Pick<L1ContractAddresses, 'inboxAddress' | 'rollupAddress'>;
|
|
20
14
|
},
|
|
21
15
|
) {
|
|
22
16
|
const inbox = getContract({
|
|
23
17
|
address: ctx.l1ContractAddresses.inboxAddress.toString(),
|
|
24
18
|
abi: InboxAbi,
|
|
25
|
-
client: ctx.
|
|
19
|
+
client: ctx.l1Client,
|
|
26
20
|
});
|
|
27
21
|
|
|
28
22
|
const { recipient, content, secretHash } = message;
|
|
29
23
|
|
|
30
|
-
const version = await new RollupContract(
|
|
31
|
-
ctx.publicClient,
|
|
32
|
-
ctx.l1ContractAddresses.rollupAddress.toString(),
|
|
33
|
-
).getVersion();
|
|
24
|
+
const version = await new RollupContract(ctx.l1Client, ctx.l1ContractAddresses.rollupAddress.toString()).getVersion();
|
|
34
25
|
|
|
35
26
|
// We inject the message to Inbox
|
|
36
27
|
const txHash = await inbox.write.sendL2Message([
|
|
@@ -40,7 +31,7 @@ export async function sendL1ToL2Message(
|
|
|
40
31
|
]);
|
|
41
32
|
|
|
42
33
|
// We check that the message was correctly injected by checking the emitted event
|
|
43
|
-
const txReceipt = await ctx.
|
|
34
|
+
const txReceipt = await ctx.l1Client.waitForTransactionReceipt({ hash: txHash });
|
|
44
35
|
|
|
45
36
|
// Exactly 1 event should be emitted in the transaction
|
|
46
37
|
expect(txReceipt.logs.length).toBe(1);
|
|
@@ -12,8 +12,7 @@ export const setupL1Contracts = async (
|
|
|
12
12
|
l1RpcUrl: string,
|
|
13
13
|
account: HDAccount | PrivateKeyAccount,
|
|
14
14
|
logger: Logger,
|
|
15
|
-
args: Pick<DeployL1ContractsArgs, 'genesisArchiveRoot' | '
|
|
16
|
-
L1ContractsConfig,
|
|
15
|
+
args: Pick<DeployL1ContractsArgs, 'genesisArchiveRoot' | 'initialValidators'> & L1ContractsConfig,
|
|
17
16
|
) => {
|
|
18
17
|
const l1Data = await deployL1Contracts([l1RpcUrl], account, foundry, logger, {
|
|
19
18
|
vkTreeRoot: getVKTreeRoot(),
|