@aztec/end-to-end 0.85.0 → 0.86.0-nightly.20250426
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/bench/client_flows/config.js +3 -3
- package/dest/bench/client_flows/data_extractor.js +12 -7
- package/dest/bench/utils.d.ts.map +1 -1
- package/dest/bench/utils.js +2 -0
- 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 +3 -3
- package/dest/e2e_epochs/epochs_test.d.ts.map +1 -1
- package/dest/e2e_epochs/epochs_test.js +4 -2
- 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 +22 -10
- package/dest/e2e_p2p/p2p_network.d.ts +67 -72
- package/dest/e2e_p2p/p2p_network.d.ts.map +1 -1
- package/dest/e2e_p2p/p2p_network.js +20 -61
- package/dest/e2e_prover/e2e_prover_test.d.ts.map +1 -1
- package/dest/e2e_prover/e2e_prover_test.js +10 -9
- 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 +15 -13
- package/dest/fixtures/utils.d.ts +5 -2
- package/dest/fixtures/utils.d.ts.map +1 -1
- package/dest/fixtures/utils.js +70 -62
- package/dest/shared/capture_private_execution_steps.d.ts.map +1 -1
- package/dest/shared/capture_private_execution_steps.js +3 -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 +34 -35
- package/src/bench/client_flows/client_flows_benchmark.ts +6 -8
- package/src/bench/client_flows/config.ts +3 -3
- package/src/bench/client_flows/data_extractor.ts +10 -6
- package/src/bench/utils.ts +2 -0
- package/src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts +14 -18
- package/src/e2e_epochs/epochs_test.ts +9 -5
- package/src/e2e_fees/fees_test.ts +32 -10
- package/src/e2e_p2p/p2p_network.ts +28 -74
- package/src/e2e_prover/e2e_prover_test.ts +10 -14
- 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 +11 -13
- package/src/fixtures/utils.ts +66 -64
- package/src/shared/capture_private_execution_steps.ts +3 -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.
|
|
3
|
+
"version": "0.86.0-nightly.20250426",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": "./dest/index.js",
|
|
6
6
|
"inherits": [
|
|
@@ -11,7 +11,6 @@
|
|
|
11
11
|
"build": "yarn clean && tsc -b",
|
|
12
12
|
"build:dev": "tsc -b --watch",
|
|
13
13
|
"clean": "rm -rf ./dest .tsbuildinfo",
|
|
14
|
-
"formatting:fix": "run -T eslint --fix ./src && run -T prettier -w ./src",
|
|
15
14
|
"test:with-alerts": "./scripts/test-with-alerts.sh",
|
|
16
15
|
"test:e2e": "LOG_LEVEL=${LOG_LEVEL:-verbose} NODE_NO_WARNINGS=1 node --experimental-vm-modules ../node_modules/.bin/jest --testTimeout=300000 --forceExit",
|
|
17
16
|
"test:e2e-docker": "./scripts/run_test.sh simple",
|
|
@@ -26,41 +25,40 @@
|
|
|
26
25
|
"formatting": "run -T prettier --check ./src && run -T eslint ./src"
|
|
27
26
|
},
|
|
28
27
|
"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/cli": "0.
|
|
39
|
-
"@aztec/constants": "0.
|
|
40
|
-
"@aztec/entrypoints": "0.
|
|
41
|
-
"@aztec/epoch-cache": "0.
|
|
42
|
-
"@aztec/ethereum": "0.
|
|
43
|
-
"@aztec/foundation": "0.
|
|
44
|
-
"@aztec/kv-store": "0.
|
|
45
|
-
"@aztec/l1-artifacts": "0.
|
|
46
|
-
"@aztec/merkle-tree": "0.
|
|
47
|
-
"@aztec/noir-contracts.js": "0.
|
|
48
|
-
"@aztec/noir-noirc_abi": "0.
|
|
49
|
-
"@aztec/noir-protocol-circuits-types": "0.
|
|
50
|
-
"@aztec/p2p": "0.
|
|
51
|
-
"@aztec/protocol-contracts": "0.
|
|
52
|
-
"@aztec/prover-client": "0.
|
|
53
|
-
"@aztec/prover-node": "0.
|
|
54
|
-
"@aztec/pxe": "0.
|
|
55
|
-
"@aztec/sequencer-client": "0.
|
|
56
|
-
"@aztec/simulator": "0.
|
|
57
|
-
"@aztec/stdlib": "0.
|
|
58
|
-
"@aztec/telemetry-client": "0.
|
|
59
|
-
"@aztec/validator-client": "0.
|
|
60
|
-
"@aztec/world-state": "0.
|
|
28
|
+
"@aztec/accounts": "0.86.0-nightly.20250426",
|
|
29
|
+
"@aztec/archiver": "0.86.0-nightly.20250426",
|
|
30
|
+
"@aztec/aztec": "0.86.0-nightly.20250426",
|
|
31
|
+
"@aztec/aztec-node": "0.86.0-nightly.20250426",
|
|
32
|
+
"@aztec/aztec.js": "0.86.0-nightly.20250426",
|
|
33
|
+
"@aztec/bb-prover": "0.86.0-nightly.20250426",
|
|
34
|
+
"@aztec/blob-lib": "0.86.0-nightly.20250426",
|
|
35
|
+
"@aztec/blob-sink": "0.86.0-nightly.20250426",
|
|
36
|
+
"@aztec/bot": "0.86.0-nightly.20250426",
|
|
37
|
+
"@aztec/cli": "0.86.0-nightly.20250426",
|
|
38
|
+
"@aztec/constants": "0.86.0-nightly.20250426",
|
|
39
|
+
"@aztec/entrypoints": "0.86.0-nightly.20250426",
|
|
40
|
+
"@aztec/epoch-cache": "0.86.0-nightly.20250426",
|
|
41
|
+
"@aztec/ethereum": "0.86.0-nightly.20250426",
|
|
42
|
+
"@aztec/foundation": "0.86.0-nightly.20250426",
|
|
43
|
+
"@aztec/kv-store": "0.86.0-nightly.20250426",
|
|
44
|
+
"@aztec/l1-artifacts": "0.86.0-nightly.20250426",
|
|
45
|
+
"@aztec/merkle-tree": "0.86.0-nightly.20250426",
|
|
46
|
+
"@aztec/noir-contracts.js": "0.86.0-nightly.20250426",
|
|
47
|
+
"@aztec/noir-noirc_abi": "0.86.0-nightly.20250426",
|
|
48
|
+
"@aztec/noir-protocol-circuits-types": "0.86.0-nightly.20250426",
|
|
49
|
+
"@aztec/p2p": "0.86.0-nightly.20250426",
|
|
50
|
+
"@aztec/protocol-contracts": "0.86.0-nightly.20250426",
|
|
51
|
+
"@aztec/prover-client": "0.86.0-nightly.20250426",
|
|
52
|
+
"@aztec/prover-node": "0.86.0-nightly.20250426",
|
|
53
|
+
"@aztec/pxe": "0.86.0-nightly.20250426",
|
|
54
|
+
"@aztec/sequencer-client": "0.86.0-nightly.20250426",
|
|
55
|
+
"@aztec/simulator": "0.86.0-nightly.20250426",
|
|
56
|
+
"@aztec/stdlib": "0.86.0-nightly.20250426",
|
|
57
|
+
"@aztec/telemetry-client": "0.86.0-nightly.20250426",
|
|
58
|
+
"@aztec/validator-client": "0.86.0-nightly.20250426",
|
|
59
|
+
"@aztec/world-state": "0.86.0-nightly.20250426",
|
|
61
60
|
"@iarna/toml": "^2.2.5",
|
|
62
61
|
"@jest/globals": "^29.5.0",
|
|
63
|
-
"@msgpack/msgpack": "^3.0.0-beta2",
|
|
64
62
|
"@noble/curves": "^1.0.0",
|
|
65
63
|
"@swc/core": "^1.4.11",
|
|
66
64
|
"@swc/jest": "^0.2.36",
|
|
@@ -85,6 +83,7 @@
|
|
|
85
83
|
"lodash.compact": "^3.0.1",
|
|
86
84
|
"lodash.every": "^4.6.0",
|
|
87
85
|
"lodash.omit": "^4.5.0",
|
|
86
|
+
"msgpackr": "^1.11.2",
|
|
88
87
|
"process": "^0.11.10",
|
|
89
88
|
"stream-browserify": "^3.0.0",
|
|
90
89
|
"string-argv": "^0.3.2",
|
|
@@ -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,
|
|
@@ -26,9 +26,9 @@ export const KEY_FLOWS_CONFIG: ClientFlowsConfig = {
|
|
|
26
26
|
feePaymentMethods: ['sponsored_fpc'],
|
|
27
27
|
},
|
|
28
28
|
transfers: {
|
|
29
|
-
accounts: ['ecdsar1'
|
|
30
|
-
feePaymentMethods: ['sponsored_fpc', '
|
|
31
|
-
recursions: [1],
|
|
29
|
+
accounts: ['ecdsar1'],
|
|
30
|
+
feePaymentMethods: ['sponsored_fpc', 'private_fpc'],
|
|
31
|
+
recursions: [0, 1],
|
|
32
32
|
},
|
|
33
33
|
};
|
|
34
34
|
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { Logger } from '@aztec/aztec.js';
|
|
2
|
-
import { BBNativePrivateKernelProver } from '@aztec/bb-prover';
|
|
3
|
-
import { BBWASMBundlePrivateKernelProver } from '@aztec/bb-prover/wasm/bundle';
|
|
2
|
+
import { BBNativePrivateKernelProver } from '@aztec/bb-prover/client/native';
|
|
3
|
+
import { BBWASMBundlePrivateKernelProver } from '@aztec/bb-prover/client/wasm/bundle';
|
|
4
4
|
import { createLogger, logger } from '@aztec/foundation/log';
|
|
5
5
|
import { WASMSimulator } from '@aztec/simulator/client';
|
|
6
6
|
import type { PrivateExecutionStep } from '@aztec/stdlib/kernel';
|
|
7
7
|
|
|
8
|
-
import {
|
|
8
|
+
import { Decoder } from 'msgpackr';
|
|
9
9
|
import assert from 'node:assert';
|
|
10
10
|
import { readFile, readdir, writeFile } from 'node:fs/promises';
|
|
11
11
|
import { join } from 'node:path';
|
|
@@ -149,9 +149,10 @@ async function main() {
|
|
|
149
149
|
|
|
150
150
|
for (const flow of flows) {
|
|
151
151
|
userLog.info(`Processing flow ${flow}`);
|
|
152
|
-
const
|
|
153
|
-
const
|
|
152
|
+
const ivcInputs = await readFile(join(ivcFolder, flow, 'ivc-inputs.msgpack'));
|
|
153
|
+
const stepsFromFile: PrivateExecutionStep[] = new Decoder({ useRecords: false }).unpack(ivcInputs);
|
|
154
154
|
const witnesses = await readFile(join(ivcFolder, flow, 'witnesses.json'));
|
|
155
|
+
|
|
155
156
|
const witnessStack = JSON.parse(witnesses.toString()).map((witnessMap: Record<string, string>) => {
|
|
156
157
|
return new Map<number, string>(Object.entries(witnessMap).map(([k, v]) => [Number(k), v]));
|
|
157
158
|
});
|
|
@@ -160,8 +161,11 @@ async function main() {
|
|
|
160
161
|
const privateExecutionSteps: PrivateExecutionStep[] = executionSteps.map((step, i) => ({
|
|
161
162
|
functionName: step.fnName,
|
|
162
163
|
gateCount: step.gateCount,
|
|
163
|
-
bytecode:
|
|
164
|
+
bytecode: stepsFromFile[i].bytecode,
|
|
165
|
+
// TODO(AD) do we still want to take this from witness.json?
|
|
164
166
|
witness: witnessStack[i],
|
|
167
|
+
// This can be left empty. If so, the prover will generate a vk on the fly (~25% slower).
|
|
168
|
+
vk: Buffer.from([]),
|
|
165
169
|
}));
|
|
166
170
|
let stats: { duration: number; eventName: string; proofSize: number } | undefined;
|
|
167
171
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
package/src/bench/utils.ts
CHANGED
|
@@ -166,7 +166,9 @@ export async function createNewPXE(node: AztecNode, contract: BenchmarkingContra
|
|
|
166
166
|
l1ChainId,
|
|
167
167
|
rollupVersion,
|
|
168
168
|
} as PXEServiceConfig;
|
|
169
|
+
// docs:start:PXEcreate
|
|
169
170
|
const pxe = await createPXEService(node, pxeConfig);
|
|
171
|
+
// docs:end:PXEcreate
|
|
170
172
|
await pxe.registerContract(contract);
|
|
171
173
|
return pxe;
|
|
172
174
|
}
|
|
@@ -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,
|
|
@@ -30,7 +31,10 @@ export const WORLD_STATE_BLOCK_CHECK_INTERVAL = 50;
|
|
|
30
31
|
export const ARCHIVER_POLL_INTERVAL = 50;
|
|
31
32
|
|
|
32
33
|
export type EpochsTestOpts = Partial<
|
|
33
|
-
Pick<
|
|
34
|
+
Pick<
|
|
35
|
+
SetupOptions,
|
|
36
|
+
'startProverNode' | 'aztecProofSubmissionWindow' | 'aztecEpochDuration' | 'proverTestDelayMs' | 'proverNodeConfig'
|
|
37
|
+
>
|
|
34
38
|
>;
|
|
35
39
|
|
|
36
40
|
/**
|
|
@@ -40,7 +44,7 @@ export type EpochsTestOpts = Partial<
|
|
|
40
44
|
*/
|
|
41
45
|
export class EpochsTestContext {
|
|
42
46
|
public context!: EndToEndContext;
|
|
43
|
-
public l1Client!:
|
|
47
|
+
public l1Client!: ViemClient;
|
|
44
48
|
public rollup!: RollupContract;
|
|
45
49
|
public constants!: L1RollupConstants;
|
|
46
50
|
public logger!: Logger;
|
|
@@ -92,7 +96,7 @@ export class EpochsTestContext {
|
|
|
92
96
|
this.proverNodes = context.proverNode ? [context.proverNode] : [];
|
|
93
97
|
this.nodes = context.aztecNode ? [context.aztecNode as AztecNodeService] : [];
|
|
94
98
|
this.logger = context.logger;
|
|
95
|
-
this.l1Client = context.deployL1ContractsValues.
|
|
99
|
+
this.l1Client = context.deployL1ContractsValues.l1Client;
|
|
96
100
|
this.rollup = RollupContract.getFromConfig(context.config);
|
|
97
101
|
|
|
98
102
|
// Loop that tracks L1 and L2 block numbers and logs whenever there's a new one.
|
|
@@ -142,8 +146,8 @@ export class EpochsTestContext {
|
|
|
142
146
|
createAndSyncProverNode(
|
|
143
147
|
proverNodePrivateKey,
|
|
144
148
|
{ ...this.context.config, proverId: Fr.fromString(suffix) },
|
|
149
|
+
{ dataDirectory: join(this.context.config.dataDirectory!, randomBytes(8).toString('hex')) },
|
|
145
150
|
this.context.aztecNode,
|
|
146
|
-
join(this.context.config.dataDirectory!, randomBytes(8).toString('hex')),
|
|
147
151
|
),
|
|
148
152
|
);
|
|
149
153
|
this.proverNodes.push(proverNode);
|
|
@@ -10,7 +10,13 @@ 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 {
|
|
13
|
+
import {
|
|
14
|
+
type DeployL1ContractsArgs,
|
|
15
|
+
RollupContract,
|
|
16
|
+
createExtendedL1Client,
|
|
17
|
+
getPublicClient,
|
|
18
|
+
l1Artifacts,
|
|
19
|
+
} from '@aztec/ethereum';
|
|
14
20
|
import { ChainMonitor } from '@aztec/ethereum/test';
|
|
15
21
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
16
22
|
import { TestERC20Abi } from '@aztec/l1-artifacts';
|
|
@@ -140,6 +146,26 @@ export class FeesTest {
|
|
|
140
146
|
}
|
|
141
147
|
}
|
|
142
148
|
|
|
149
|
+
async getBlockRewards() {
|
|
150
|
+
const rewardDistributor = getContract({
|
|
151
|
+
address: this.context.deployL1ContractsValues.l1ContractAddresses.rewardDistributorAddress.toString(),
|
|
152
|
+
abi: l1Artifacts.rewardDistributor.contractAbi,
|
|
153
|
+
client: this.context.deployL1ContractsValues.l1Client,
|
|
154
|
+
});
|
|
155
|
+
|
|
156
|
+
const blockReward = await rewardDistributor.read.BLOCK_REWARD();
|
|
157
|
+
|
|
158
|
+
const balance = await this.feeJuiceBridgeTestHarness.getL1FeeJuiceBalance(
|
|
159
|
+
EthAddress.fromString(rewardDistributor.address),
|
|
160
|
+
);
|
|
161
|
+
|
|
162
|
+
const toDistribute = balance > blockReward ? blockReward : balance;
|
|
163
|
+
const sequencerBlockRewards = toDistribute / 2n;
|
|
164
|
+
const proverBlockRewards = toDistribute - sequencerBlockRewards;
|
|
165
|
+
|
|
166
|
+
return { sequencerBlockRewards, proverBlockRewards };
|
|
167
|
+
}
|
|
168
|
+
|
|
143
169
|
async mintAndBridgeFeeJuice(address: AztecAddress, amount: bigint) {
|
|
144
170
|
const claim = await this.feeJuiceBridgeTestHarness.prepareTokensOnL1(amount, address);
|
|
145
171
|
const { claimSecret: secret, messageLeafIndex: index } = claim;
|
|
@@ -209,8 +235,7 @@ export class FeesTest {
|
|
|
209
235
|
aztecNode: context.aztecNode,
|
|
210
236
|
aztecNodeAdmin: context.aztecNode,
|
|
211
237
|
pxeService: context.pxe,
|
|
212
|
-
|
|
213
|
-
walletClient: context.deployL1ContractsValues.walletClient,
|
|
238
|
+
l1Client: context.deployL1ContractsValues.l1Client,
|
|
214
239
|
wallet: this.aliceWallet,
|
|
215
240
|
logger: this.logger,
|
|
216
241
|
});
|
|
@@ -269,21 +294,18 @@ export class FeesTest {
|
|
|
269
294
|
this.bananaFPC = bananaFPC;
|
|
270
295
|
|
|
271
296
|
this.getCoinbaseBalance = async () => {
|
|
272
|
-
const
|
|
297
|
+
const l1Client = createExtendedL1Client(context.aztecNodeConfig.l1RpcUrls, MNEMONIC);
|
|
273
298
|
const gasL1 = getContract({
|
|
274
299
|
address: data.l1FeeJuiceAddress.toString(),
|
|
275
300
|
abi: TestERC20Abi,
|
|
276
|
-
client:
|
|
301
|
+
client: l1Client,
|
|
277
302
|
});
|
|
278
303
|
return await gasL1.read.balanceOf([this.coinbase.toString()]);
|
|
279
304
|
};
|
|
280
305
|
|
|
281
306
|
this.getCoinbaseSequencerRewards = async () => {
|
|
282
|
-
const
|
|
283
|
-
|
|
284
|
-
l1ChainId: context.aztecNodeConfig.l1ChainId,
|
|
285
|
-
});
|
|
286
|
-
const rollup = new RollupContract(publicClient, data.rollupAddress);
|
|
307
|
+
const l1Client = createExtendedL1Client(context.aztecNodeConfig.l1RpcUrls, MNEMONIC);
|
|
308
|
+
const rollup = new RollupContract(l1Client, data.rollupAddress);
|
|
287
309
|
return await rollup.getSequencerRewards(this.coinbase);
|
|
288
310
|
};
|
|
289
311
|
|