@aztec/end-to-end 0.80.0 → 0.82.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dest/bench/utils.d.ts.map +1 -1
- package/dest/bench/utils.js +3 -0
- package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts +3 -2
- package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts.map +1 -1
- package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.js +7 -7
- package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts +0 -1
- package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts.map +1 -1
- package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.js +3 -18
- package/dest/e2e_deploy_contract/deploy_test.d.ts +2 -0
- package/dest/e2e_deploy_contract/deploy_test.d.ts.map +1 -1
- package/dest/e2e_deploy_contract/deploy_test.js +2 -0
- package/dest/e2e_epochs/epochs_test.d.ts +1 -2
- package/dest/e2e_epochs/epochs_test.d.ts.map +1 -1
- package/dest/e2e_epochs/epochs_test.js +7 -6
- package/dest/e2e_fees/fees_test.d.ts.map +1 -1
- package/dest/e2e_fees/fees_test.js +20 -29
- package/dest/e2e_prover/e2e_prover_test.d.ts +2 -0
- package/dest/e2e_prover/e2e_prover_test.d.ts.map +1 -1
- package/dest/e2e_prover/e2e_prover_test.js +7 -8
- package/dest/e2e_token_contract/token_contract_test.d.ts +2 -1
- package/dest/e2e_token_contract/token_contract_test.d.ts.map +1 -1
- package/dest/e2e_token_contract/token_contract_test.js +3 -1
- package/dest/fixtures/setup_p2p_test.d.ts.map +1 -1
- package/dest/fixtures/setup_p2p_test.js +2 -4
- package/dest/fixtures/snapshot_manager.d.ts +4 -2
- package/dest/fixtures/snapshot_manager.d.ts.map +1 -1
- package/dest/fixtures/snapshot_manager.js +17 -16
- package/dest/fixtures/utils.d.ts +5 -5
- package/dest/fixtures/utils.d.ts.map +1 -1
- package/dest/fixtures/utils.js +15 -9
- package/dest/shared/capture_private_execution_steps.d.ts +7 -0
- package/dest/shared/capture_private_execution_steps.d.ts.map +1 -0
- package/dest/shared/capture_private_execution_steps.js +40 -0
- package/dest/shared/cross_chain_test_harness.d.ts +2 -2
- package/dest/shared/cross_chain_test_harness.d.ts.map +1 -1
- package/dest/shared/cross_chain_test_harness.js +16 -4
- package/dest/shared/gas_portal_test_harness.d.ts +11 -1
- package/dest/shared/gas_portal_test_harness.d.ts.map +1 -1
- package/dest/shared/gas_portal_test_harness.js +27 -12
- package/dest/shared/uniswap_l1_l2.d.ts.map +1 -1
- package/dest/shared/uniswap_l1_l2.js +24 -16
- package/dest/simulators/lending_simulator.d.ts +3 -5
- package/dest/simulators/lending_simulator.d.ts.map +1 -1
- package/dest/simulators/lending_simulator.js +5 -13
- package/dest/spartan/setup_test_wallets.d.ts +1 -1
- package/dest/spartan/setup_test_wallets.d.ts.map +1 -1
- package/dest/spartan/setup_test_wallets.js +6 -4
- package/dest/spartan/utils.d.ts +18 -5
- package/dest/spartan/utils.d.ts.map +1 -1
- package/dest/spartan/utils.js +15 -6
- package/package.json +33 -31
- package/src/bench/utils.ts +3 -0
- package/src/e2e_blacklist_token_contract/blacklist_token_contract_test.ts +9 -5
- package/src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts +3 -19
- package/src/e2e_deploy_contract/deploy_test.ts +3 -0
- package/src/e2e_epochs/epochs_test.ts +6 -5
- package/src/e2e_fees/fees_test.ts +21 -28
- package/src/e2e_prover/e2e_prover_test.ts +8 -7
- package/src/e2e_token_contract/token_contract_test.ts +4 -2
- package/src/fixtures/setup_p2p_test.ts +2 -4
- package/src/fixtures/snapshot_manager.ts +24 -10
- package/src/fixtures/utils.ts +26 -13
- package/src/guides/up_quick_start.sh +1 -2
- package/src/shared/capture_private_execution_steps.ts +43 -0
- package/src/shared/cross_chain_test_harness.ts +14 -3
- package/src/shared/gas_portal_test_harness.ts +29 -9
- package/src/shared/uniswap_l1_l2.ts +16 -16
- package/src/simulators/lending_simulator.ts +7 -12
- package/src/spartan/setup_test_wallets.ts +7 -7
- package/src/spartan/utils.ts +11 -6
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AztecAddress, EthAddress, Fr, computeAuthWitMessageHash, generateClaimSecret } from '@aztec/aztec.js';
|
|
2
|
-
import { deployL1Contract, extractEvent } from '@aztec/ethereum';
|
|
2
|
+
import { RollupContract, deployL1Contract, extractEvent } from '@aztec/ethereum';
|
|
3
3
|
import { sha256ToField } from '@aztec/foundation/crypto';
|
|
4
|
-
import { InboxAbi,
|
|
4
|
+
import { InboxAbi, UniswapPortalAbi, UniswapPortalBytecode } from '@aztec/l1-artifacts';
|
|
5
5
|
import { UniswapContract } from '@aztec/noir-contracts.js/Uniswap';
|
|
6
6
|
import { jest } from '@jest/globals';
|
|
7
7
|
import { getContract, parseEther, toFunctionSelector } from 'viem';
|
|
@@ -49,11 +49,7 @@ export const uniswapL1L2TestSuite = (setup, cleanup, expectedForkBlockNumber = 1
|
|
|
49
49
|
if (Number(await publicClient.getBlockNumber()) < expectedForkBlockNumber) {
|
|
50
50
|
throw new Error('This test must be run on a fork of mainnet with the expected fork block');
|
|
51
51
|
}
|
|
52
|
-
rollup =
|
|
53
|
-
address: deployL1ContractsValues.l1ContractAddresses.rollupAddress.toString(),
|
|
54
|
-
abi: RollupAbi,
|
|
55
|
-
client: deployL1ContractsValues.walletClient
|
|
56
|
-
});
|
|
52
|
+
rollup = new RollupContract(deployL1ContractsValues.publicClient, deployL1ContractsValues.l1ContractAddresses.rollupAddress);
|
|
57
53
|
ownerAddress = ownerWallet.getAddress();
|
|
58
54
|
// sponsorAddress = sponsorWallet.getAddress();
|
|
59
55
|
ownerEthAddress = EthAddress.fromString((await walletClient.getAddresses())[0]);
|
|
@@ -114,14 +110,18 @@ export const uniswapL1L2TestSuite = (setup, cleanup, expectedForkBlockNumber = 1
|
|
|
114
110
|
// 3. Owner gives uniswap approval to transfer the funds to public to self on its behalf
|
|
115
111
|
logger.info('Approving uniswap to transfer funds to public to self on my behalf');
|
|
116
112
|
const nonceForWETHTransferToPublicApproval = new Fr(1n);
|
|
117
|
-
await ownerWallet.createAuthWit({
|
|
113
|
+
const transferToPublicAuhtwit = await ownerWallet.createAuthWit({
|
|
118
114
|
caller: uniswapL2Contract.address,
|
|
119
115
|
action: wethCrossChainHarness.l2Token.methods.transfer_to_public(ownerAddress, uniswapL2Contract.address, wethAmountToBridge, nonceForWETHTransferToPublicApproval)
|
|
120
116
|
});
|
|
121
117
|
// 4. Swap on L1 - sends L2 to L1 message to withdraw WETH to L1 and another message to swap assets.
|
|
122
118
|
logger.info('Withdrawing weth to L1 and sending message to swap to dai');
|
|
123
119
|
const [secretForDepositingSwappedDai, secretHashForDepositingSwappedDai] = await generateClaimSecret();
|
|
124
|
-
const l2UniswapInteractionReceipt = await uniswapL2Contract.methods.swap_private(wethCrossChainHarness.l2Token.address, wethCrossChainHarness.l2Bridge.address, wethAmountToBridge, daiCrossChainHarness.l2Bridge.address, nonceForWETHTransferToPublicApproval, uniswapFeeTier, minimumOutputAmount, secretHashForDepositingSwappedDai, ownerEthAddress).send(
|
|
120
|
+
const l2UniswapInteractionReceipt = await uniswapL2Contract.methods.swap_private(wethCrossChainHarness.l2Token.address, wethCrossChainHarness.l2Bridge.address, wethAmountToBridge, daiCrossChainHarness.l2Bridge.address, nonceForWETHTransferToPublicApproval, uniswapFeeTier, minimumOutputAmount, secretHashForDepositingSwappedDai, ownerEthAddress).send({
|
|
121
|
+
authWitnesses: [
|
|
122
|
+
transferToPublicAuhtwit
|
|
123
|
+
]
|
|
124
|
+
}).wait();
|
|
125
125
|
const swapPrivateFunction = 'swap_private(address,uint256,uint24,address,uint256,bytes32,address)';
|
|
126
126
|
const swapPrivateContent = sha256ToField([
|
|
127
127
|
Buffer.from(toFunctionSelector(swapPrivateFunction).substring(2), 'hex'),
|
|
@@ -158,7 +158,7 @@ export const uniswapL1L2TestSuite = (setup, cleanup, expectedForkBlockNumber = 1
|
|
|
158
158
|
// ensure that uniswap contract didn't eat the funds.
|
|
159
159
|
await wethCrossChainHarness.expectPublicBalanceOnL2(uniswapL2Contract.address, 0n);
|
|
160
160
|
// Since the outbox is only consumable when the block is proven, we need to set the block to be proven
|
|
161
|
-
await cheatCodes.rollup.markAsProven(await rollup.
|
|
161
|
+
await cheatCodes.rollup.markAsProven(await rollup.getBlockNumber());
|
|
162
162
|
// 5. Consume L2 to L1 message by calling uniswapPortal.swap_private()
|
|
163
163
|
logger.info('Execute withdraw and swap on the uniswapPortal!');
|
|
164
164
|
const daiL1BalanceOfPortalBeforeSwap = await daiCrossChainHarness.getL1BalanceOf(daiCrossChainHarness.tokenPortalAddress);
|
|
@@ -446,13 +446,17 @@ export const uniswapL1L2TestSuite = (setup, cleanup, expectedForkBlockNumber = 1
|
|
|
446
446
|
// 2. owner gives uniswap approval to transfer the funds to public:
|
|
447
447
|
logger.info('Approving uniswap to transfer funds to public to self on my behalf');
|
|
448
448
|
const nonceForWETHTransferToPublicApproval = new Fr(3n);
|
|
449
|
-
await ownerWallet.createAuthWit({
|
|
449
|
+
const transferToPublicAuthwith = await ownerWallet.createAuthWit({
|
|
450
450
|
caller: uniswapL2Contract.address,
|
|
451
451
|
action: wethCrossChainHarness.l2Token.methods.transfer_to_public(ownerAddress, uniswapL2Contract.address, wethAmountToBridge, nonceForWETHTransferToPublicApproval)
|
|
452
452
|
});
|
|
453
453
|
// 3. Swap but send the wrong token address
|
|
454
454
|
logger.info('Swap but send the wrong token address');
|
|
455
|
-
await expect(uniswapL2Contract.methods.swap_private(wethCrossChainHarness.l2Token.address, daiCrossChainHarness.l2Bridge.address, wethAmountToBridge, daiCrossChainHarness.l2Bridge.address, nonceForWETHTransferToPublicApproval, uniswapFeeTier, minimumOutputAmount, Fr.random(), ownerEthAddress).prove(
|
|
455
|
+
await expect(uniswapL2Contract.methods.swap_private(wethCrossChainHarness.l2Token.address, daiCrossChainHarness.l2Bridge.address, wethAmountToBridge, daiCrossChainHarness.l2Bridge.address, nonceForWETHTransferToPublicApproval, uniswapFeeTier, minimumOutputAmount, Fr.random(), ownerEthAddress).prove({
|
|
456
|
+
authWitnesses: [
|
|
457
|
+
transferToPublicAuthwith
|
|
458
|
+
]
|
|
459
|
+
})).rejects.toThrow('Assertion failed: input_asset address is not the same as seen in the bridge contract');
|
|
456
460
|
});
|
|
457
461
|
// edge cases for public flow:
|
|
458
462
|
it("I don't need approval to call swap_public if I'm swapping on my own behalf", async ()=>{
|
|
@@ -503,7 +507,7 @@ export const uniswapL1L2TestSuite = (setup, cleanup, expectedForkBlockNumber = 1
|
|
|
503
507
|
// Owner gives uniswap approval to transfer the funds to public to self on its behalf
|
|
504
508
|
logger.info('Approving uniswap to transfer the funds to public to self on my behalf');
|
|
505
509
|
const nonceForWETHTransferToPublicApproval = new Fr(4n);
|
|
506
|
-
await ownerWallet.createAuthWit({
|
|
510
|
+
const transferToPublicAuhtwit = await ownerWallet.createAuthWit({
|
|
507
511
|
caller: uniswapL2Contract.address,
|
|
508
512
|
action: wethCrossChainHarness.l2Token.methods.transfer_to_public(ownerAddress, uniswapL2Contract.address, wethAmountToBridge, nonceForWETHTransferToPublicApproval)
|
|
509
513
|
});
|
|
@@ -511,7 +515,11 @@ export const uniswapL1L2TestSuite = (setup, cleanup, expectedForkBlockNumber = 1
|
|
|
511
515
|
// Swap
|
|
512
516
|
logger.info('Withdrawing weth to L1 and sending message to swap to dai');
|
|
513
517
|
const [, secretHashForDepositingSwappedDai] = await generateClaimSecret();
|
|
514
|
-
const withdrawReceipt = await uniswapL2Contract.methods.swap_private(wethCrossChainHarness.l2Token.address, wethCrossChainHarness.l2Bridge.address, wethAmountToBridge, daiCrossChainHarness.l2Bridge.address, nonceForWETHTransferToPublicApproval, uniswapFeeTier, minimumOutputAmount, secretHashForDepositingSwappedDai, ownerEthAddress).send(
|
|
518
|
+
const withdrawReceipt = await uniswapL2Contract.methods.swap_private(wethCrossChainHarness.l2Token.address, wethCrossChainHarness.l2Bridge.address, wethAmountToBridge, daiCrossChainHarness.l2Bridge.address, nonceForWETHTransferToPublicApproval, uniswapFeeTier, minimumOutputAmount, secretHashForDepositingSwappedDai, ownerEthAddress).send({
|
|
519
|
+
authWitnesses: [
|
|
520
|
+
transferToPublicAuhtwit
|
|
521
|
+
]
|
|
522
|
+
}).wait();
|
|
515
523
|
const swapPrivateContent = sha256ToField([
|
|
516
524
|
Buffer.from(toFunctionSelector('swap_private(address,uint256,uint24,address,uint256,bytes32,address)').substring(2), 'hex'),
|
|
517
525
|
wethCrossChainHarness.tokenPortalAddress.toBuffer32(),
|
|
@@ -557,7 +565,7 @@ export const uniswapL1L2TestSuite = (setup, cleanup, expectedForkBlockNumber = 1
|
|
|
557
565
|
// ensure that user's funds were burnt
|
|
558
566
|
await wethCrossChainHarness.expectPrivateBalanceOnL2(ownerAddress, wethL2BalanceBeforeSwap - wethAmountToBridge);
|
|
559
567
|
// Since the outbox is only consumable when the block is proven, we need to set the block to be proven
|
|
560
|
-
await cheatCodes.rollup.markAsProven(await rollup.
|
|
568
|
+
await cheatCodes.rollup.markAsProven(await rollup.getBlockNumber());
|
|
561
569
|
// On L1 call swap_public!
|
|
562
570
|
logger.info('call swap_public on L1');
|
|
563
571
|
const swapArgs = [
|
|
@@ -637,7 +645,7 @@ export const uniswapL1L2TestSuite = (setup, cleanup, expectedForkBlockNumber = 1
|
|
|
637
645
|
// check weth balance of owner on L2 (we first bridged `wethAmountToBridge` into L2 and now withdrew it!)
|
|
638
646
|
await wethCrossChainHarness.expectPublicBalanceOnL2(ownerAddress, 0n);
|
|
639
647
|
// Since the outbox is only consumable when the block is proven, we need to set the block to be proven
|
|
640
|
-
await cheatCodes.rollup.markAsProven(await rollup.
|
|
648
|
+
await cheatCodes.rollup.markAsProven(await rollup.getBlockNumber());
|
|
641
649
|
// Call swap_private on L1
|
|
642
650
|
logger.info('Execute withdraw and swap on the uniswapPortal!');
|
|
643
651
|
const swapArgs = [
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import { AztecAddress, Fr } from '@aztec/aztec.js';
|
|
2
2
|
import { CheatCodes } from '@aztec/aztec.js/testing';
|
|
3
|
+
import type { RollupContract } from '@aztec/ethereum';
|
|
3
4
|
import type { TestDateProvider } from '@aztec/foundation/timer';
|
|
4
|
-
import type { RollupAbi } from '@aztec/l1-artifacts';
|
|
5
5
|
import type { LendingContract } from '@aztec/noir-contracts.js/Lending';
|
|
6
|
-
import type { Account, GetContractReturnType, HttpTransport, WalletClient } from 'viem';
|
|
7
|
-
import type * as chains from 'viem/chains';
|
|
8
6
|
import type { TokenSimulator } from './token_simulator.js';
|
|
9
7
|
/**
|
|
10
8
|
* Contains utilities to compute the "key" for private holdings in the public state.
|
|
@@ -30,7 +28,7 @@ export declare class LendingSimulator {
|
|
|
30
28
|
private rate;
|
|
31
29
|
private ethereumSlotDuration;
|
|
32
30
|
/** the rollup contract */
|
|
33
|
-
rollup:
|
|
31
|
+
rollup: RollupContract;
|
|
34
32
|
/** the lending contract */
|
|
35
33
|
lendingContract: LendingContract;
|
|
36
34
|
/** the collateral asset used in the lending contract */
|
|
@@ -47,7 +45,7 @@ export declare class LendingSimulator {
|
|
|
47
45
|
private mintedOutside;
|
|
48
46
|
constructor(cc: CheatCodes, account: LendingAccount, rate: bigint, ethereumSlotDuration: number,
|
|
49
47
|
/** the rollup contract */
|
|
50
|
-
rollup:
|
|
48
|
+
rollup: RollupContract,
|
|
51
49
|
/** the lending contract */
|
|
52
50
|
lendingContract: LendingContract,
|
|
53
51
|
/** the collateral asset used in the lending contract */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lending_simulator.d.ts","sourceRoot":"","sources":["../../src/simulators/lending_simulator.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,EAAE,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"lending_simulator.d.ts","sourceRoot":"","sources":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,EAAE,cAAc;IAC7B,2BAA2B;IACpB,eAAe,EAAE,eAAe;IACvC,wDAAwD;IACjD,eAAe,EAAE,cAAc;IACtC,uDAAuD;IAChD,UAAU,EAAE,cAAc;IAG7B,OAAO;IAMP,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,gBAAgB;IAmBjE,cAAc,CAAC,IAAI,EAAE,YAAY,EAAE,UAAU,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM;IAKjE,aAAa,CAAC,IAAI,EAAE,YAAY,EAAE,UAAU,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM;IAKhE,OAAO,CAAC,OAAO;IAKf,QAAQ,CAAC,KAAK,EAAE,EAAE,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM;IAM3D,MAAM,CAAC,KAAK,EAAE,EAAE,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM;IASzD,YAAY,CAAC,IAAI,EAAE,YAAY,EAAE,UAAU,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM;IAK/D,WAAW,CAAC,IAAI,EAAE,YAAY,EAAE,UAAU,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM;IAK9D,OAAO,CAAC,KAAK;IAQb,yBAAyB,CAAC,SAAS,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,UAAQ;IASzE,KAAK;CA0BZ"}
|
|
@@ -76,23 +76,15 @@ const computeMultiplier = (rate, dt)=>{
|
|
|
76
76
|
}
|
|
77
77
|
async prepare() {
|
|
78
78
|
this.accumulator = BASE;
|
|
79
|
-
const slot = await this.rollup.
|
|
80
|
-
|
|
81
|
-
]);
|
|
82
|
-
this.time = Number(await this.rollup.read.getTimestampForSlot([
|
|
83
|
-
slot
|
|
84
|
-
]));
|
|
79
|
+
const slot = await this.rollup.getSlotAt(BigInt(await this.cc.eth.timestamp()) + BigInt(this.ethereumSlotDuration));
|
|
80
|
+
this.time = Number(await this.rollup.getTimestampForSlot(slot));
|
|
85
81
|
}
|
|
86
82
|
async progressSlots(diff, dateProvider) {
|
|
87
83
|
if (diff <= 1) {
|
|
88
84
|
return;
|
|
89
85
|
}
|
|
90
|
-
const slot = await this.rollup.
|
|
91
|
-
|
|
92
|
-
]);
|
|
93
|
-
const ts = Number(await this.rollup.read.getTimestampForSlot([
|
|
94
|
-
slot + BigInt(diff)
|
|
95
|
-
]));
|
|
86
|
+
const slot = await this.rollup.getSlotAt(BigInt(await this.cc.eth.timestamp()));
|
|
87
|
+
const ts = Number(await this.rollup.getTimestampForSlot(slot + BigInt(diff)));
|
|
96
88
|
const timeDiff = ts - this.time;
|
|
97
89
|
this.time = ts;
|
|
98
90
|
// Mine ethereum blocks such that the next block will be in a new slot
|
|
@@ -100,7 +92,7 @@ const computeMultiplier = (rate, dt)=>{
|
|
|
100
92
|
if (dateProvider) {
|
|
101
93
|
dateProvider.setTime(this.time * 1000);
|
|
102
94
|
}
|
|
103
|
-
await this.cc.rollup.markAsProven(await this.rollup.
|
|
95
|
+
await this.cc.rollup.markAsProven(await this.rollup.getBlockNumber());
|
|
104
96
|
this.accumulator = muldivDown(this.accumulator, computeMultiplier(this.rate, BigInt(timeDiff)), BASE);
|
|
105
97
|
}
|
|
106
98
|
depositPrivate(from, onBehalfOf, amount) {
|
|
@@ -10,7 +10,7 @@ export interface TestWallets {
|
|
|
10
10
|
tokenAddress: AztecAddress;
|
|
11
11
|
}
|
|
12
12
|
export declare function setupTestWalletsWithTokens(pxeUrl: string, mintAmount: bigint, logger: Logger): Promise<TestWallets>;
|
|
13
|
-
export declare function deployTestWalletWithTokens(pxeUrl: string, nodeUrl: string, l1RpcUrls: string[], mnemonicOrPrivateKey: string, mintAmount: bigint, logger: Logger, numberOfFundedWallets?: number
|
|
13
|
+
export declare function deployTestWalletWithTokens(pxeUrl: string, nodeUrl: string, l1RpcUrls: string[], mnemonicOrPrivateKey: string, mintAmount: bigint, logger: Logger, numberOfFundedWallets?: number): Promise<TestWallets>;
|
|
14
14
|
export declare function performTransfers({ testWallets, rounds, transferAmount, logger, }: {
|
|
15
15
|
testWallets: TestWallets;
|
|
16
16
|
rounds: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setup_test_wallets.d.ts","sourceRoot":"","sources":["../../src/spartan/setup_test_wallets.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,KAAK,0BAA0B,EAC/B,KAAK,YAAY,EAKjB,KAAK,GAAG,EAIT,MAAM,iBAAiB,CAAC;AAEzB,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;
|
|
1
|
+
{"version":3,"file":"setup_test_wallets.d.ts","sourceRoot":"","sources":["../../src/spartan/setup_test_wallets.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,KAAK,0BAA0B,EAC/B,KAAK,YAAY,EAKjB,KAAK,GAAG,EAIT,MAAM,iBAAiB,CAAC;AAEzB,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAG/D,MAAM,WAAW,WAAW;IAC1B,GAAG,EAAE,GAAG,CAAC;IACT,OAAO,EAAE,0BAA0B,EAAE,CAAC;IACtC,gBAAgB,EAAE,aAAa,CAAC;IAChC,SAAS,EAAE,MAAM,CAAC;IAClB,eAAe,EAAE,0BAA0B,CAAC;IAC5C,YAAY,EAAE,YAAY,CAAC;CAC5B;AAMD,wBAAsB,0BAA0B,CAC9C,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,WAAW,CAAC,CAYtB;AAED,wBAAsB,0BAA0B,CAC9C,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,MAAM,EACf,SAAS,EAAE,MAAM,EAAE,EACnB,oBAAoB,EAAE,MAAM,EAC5B,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,MAAM,EACd,qBAAqB,SAAI,GACxB,OAAO,CAAC,WAAW,CAAC,CAoCtB;AA6DD,wBAAsB,gBAAgB,CAAC,EACrC,WAAW,EACX,MAAM,EACN,cAAc,EACd,MAAM,GACP,EAAE;IACD,WAAW,EAAE,WAAW,CAAC;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,cAAc,EAAE,MAAM,CAAC;IACvB,MAAM,EAAE,MAAM,CAAC;CAChB,iBAkBA"}
|
|
@@ -22,13 +22,13 @@ export async function setupTestWalletsWithTokens(pxeUrl, mintAmount, logger) {
|
|
|
22
22
|
recipientWallet
|
|
23
23
|
};
|
|
24
24
|
}
|
|
25
|
-
export async function deployTestWalletWithTokens(pxeUrl, nodeUrl, l1RpcUrls, mnemonicOrPrivateKey, mintAmount, logger, numberOfFundedWallets = 1
|
|
25
|
+
export async function deployTestWalletWithTokens(pxeUrl, nodeUrl, l1RpcUrls, mnemonicOrPrivateKey, mintAmount, logger, numberOfFundedWallets = 1) {
|
|
26
26
|
const pxe = await createCompatibleClient(pxeUrl, logger);
|
|
27
27
|
const node = createAztecNodeClient(nodeUrl);
|
|
28
28
|
const [recipient, ...funded] = await generateSchnorrAccounts(numberOfFundedWallets + 1);
|
|
29
29
|
const recipientWallet = await getSchnorrWalletWithSecretKey(pxe, recipient.secret, recipient.signingKey, recipient.salt);
|
|
30
30
|
const fundedAccounts = await Promise.all(funded.map((a)=>getSchnorrAccount(pxe, a.secret, a.signingKey, a.salt)));
|
|
31
|
-
const claims = await Promise.all(fundedAccounts.map((a)=>bridgeL1FeeJuice(l1RpcUrls, mnemonicOrPrivateKey, pxe, a.getAddress(),
|
|
31
|
+
const claims = await Promise.all(fundedAccounts.map((a)=>bridgeL1FeeJuice(l1RpcUrls, mnemonicOrPrivateKey, pxe, a.getAddress(), undefined, logger)));
|
|
32
32
|
// Progress by 2 L2 blocks so that the l1ToL2Message added above will be available to use on L2.
|
|
33
33
|
await advanceL2Block(node);
|
|
34
34
|
await advanceL2Block(node);
|
|
@@ -59,16 +59,18 @@ async function bridgeL1FeeJuice(l1RpcUrls, mnemonicOrPrivateKey, pxe, recipient,
|
|
|
59
59
|
const { l1ChainId } = await pxe.getNodeInfo();
|
|
60
60
|
const chain = createEthereumChain(l1RpcUrls, l1ChainId);
|
|
61
61
|
const { publicClient, walletClient } = createL1Clients(chain.rpcUrls, mnemonicOrPrivateKey, chain.chainInfo);
|
|
62
|
+
// docs:start:bridge_fee_juice
|
|
62
63
|
const portal = await L1FeeJuicePortalManager.new(pxe, publicClient, walletClient, log);
|
|
63
64
|
const claim = await portal.bridgeTokensPublic(recipient, amount, true);
|
|
65
|
+
// docs:end:bridge_fee_juice
|
|
64
66
|
const isSynced = async ()=>await pxe.isL1ToL2MessageSynced(Fr.fromHexString(claim.messageHash));
|
|
65
67
|
await retryUntil(isSynced, `message ${claim.messageHash} sync`, 24, 0.5);
|
|
66
68
|
log.info(`Created a claim for ${amount} L1 fee juice to ${recipient}.`, claim);
|
|
67
69
|
return claim;
|
|
68
70
|
}
|
|
69
|
-
async function advanceL2Block(node) {
|
|
71
|
+
async function advanceL2Block(node, nodeAdmin) {
|
|
70
72
|
const initialBlockNumber = await node.getBlockNumber();
|
|
71
|
-
await
|
|
73
|
+
await nodeAdmin?.flushTxs();
|
|
72
74
|
await retryUntil(async ()=>await node.getBlockNumber() >= initialBlockNumber + 1);
|
|
73
75
|
}
|
|
74
76
|
async function deployTokenAndMint(wallets, admin, mintAmount, logger) {
|
package/dest/spartan/utils.d.ts
CHANGED
|
@@ -13,6 +13,7 @@ declare const k8sLocalConfigSchema: z.ZodObject<{
|
|
|
13
13
|
INSTANCE_NAME: z.ZodString;
|
|
14
14
|
NAMESPACE: z.ZodString;
|
|
15
15
|
CONTAINER_NODE_PORT: z.ZodDefault<z.ZodNumber>;
|
|
16
|
+
CONTAINER_NODE_ADMIN_PORT: z.ZodDefault<z.ZodNumber>;
|
|
16
17
|
CONTAINER_SEQUENCER_PORT: z.ZodDefault<z.ZodNumber>;
|
|
17
18
|
CONTAINER_PROVER_NODE_PORT: z.ZodDefault<z.ZodNumber>;
|
|
18
19
|
CONTAINER_PXE_PORT: z.ZodDefault<z.ZodNumber>;
|
|
@@ -33,6 +34,7 @@ declare const k8sLocalConfigSchema: z.ZodObject<{
|
|
|
33
34
|
INSTANCE_NAME: string;
|
|
34
35
|
NAMESPACE: string;
|
|
35
36
|
CONTAINER_NODE_PORT: number;
|
|
37
|
+
CONTAINER_NODE_ADMIN_PORT: number;
|
|
36
38
|
CONTAINER_SEQUENCER_PORT: number;
|
|
37
39
|
CONTAINER_PROVER_NODE_PORT: number;
|
|
38
40
|
CONTAINER_PXE_PORT: number;
|
|
@@ -56,6 +58,7 @@ declare const k8sLocalConfigSchema: z.ZodObject<{
|
|
|
56
58
|
K8S: "local";
|
|
57
59
|
ETHEREUM_HOSTS?: string | undefined;
|
|
58
60
|
CONTAINER_NODE_PORT?: number | undefined;
|
|
61
|
+
CONTAINER_NODE_ADMIN_PORT?: number | undefined;
|
|
59
62
|
CONTAINER_SEQUENCER_PORT?: number | undefined;
|
|
60
63
|
CONTAINER_PROVER_NODE_PORT?: number | undefined;
|
|
61
64
|
CONTAINER_PXE_PORT?: number | undefined;
|
|
@@ -74,6 +77,7 @@ declare const k8sGCloudConfigSchema: z.ZodObject<z.objectUtil.extendShape<{
|
|
|
74
77
|
INSTANCE_NAME: z.ZodString;
|
|
75
78
|
NAMESPACE: z.ZodString;
|
|
76
79
|
CONTAINER_NODE_PORT: z.ZodDefault<z.ZodNumber>;
|
|
80
|
+
CONTAINER_NODE_ADMIN_PORT: z.ZodDefault<z.ZodNumber>;
|
|
77
81
|
CONTAINER_SEQUENCER_PORT: z.ZodDefault<z.ZodNumber>;
|
|
78
82
|
CONTAINER_PROVER_NODE_PORT: z.ZodDefault<z.ZodNumber>;
|
|
79
83
|
CONTAINER_PXE_PORT: z.ZodDefault<z.ZodNumber>;
|
|
@@ -98,6 +102,7 @@ declare const k8sGCloudConfigSchema: z.ZodObject<z.objectUtil.extendShape<{
|
|
|
98
102
|
INSTANCE_NAME: string;
|
|
99
103
|
NAMESPACE: string;
|
|
100
104
|
CONTAINER_NODE_PORT: number;
|
|
105
|
+
CONTAINER_NODE_ADMIN_PORT: number;
|
|
101
106
|
CONTAINER_SEQUENCER_PORT: number;
|
|
102
107
|
CONTAINER_PROVER_NODE_PORT: number;
|
|
103
108
|
CONTAINER_PXE_PORT: number;
|
|
@@ -125,6 +130,7 @@ declare const k8sGCloudConfigSchema: z.ZodObject<z.objectUtil.extendShape<{
|
|
|
125
130
|
REGION: string;
|
|
126
131
|
ETHEREUM_HOSTS?: string | undefined;
|
|
127
132
|
CONTAINER_NODE_PORT?: number | undefined;
|
|
133
|
+
CONTAINER_NODE_ADMIN_PORT?: number | undefined;
|
|
128
134
|
CONTAINER_SEQUENCER_PORT?: number | undefined;
|
|
129
135
|
CONTAINER_PROVER_NODE_PORT?: number | undefined;
|
|
130
136
|
CONTAINER_PXE_PORT?: number | undefined;
|
|
@@ -138,6 +144,7 @@ declare const k8sGCloudConfigSchema: z.ZodObject<z.objectUtil.extendShape<{
|
|
|
138
144
|
declare const directConfigSchema: z.ZodObject<{
|
|
139
145
|
PXE_URL: z.ZodString;
|
|
140
146
|
NODE_URL: z.ZodString;
|
|
147
|
+
NODE_ADMIN_URL: z.ZodString;
|
|
141
148
|
ETHEREUM_HOSTS: z.ZodEffects<z.ZodString, string, string>;
|
|
142
149
|
K8S: z.ZodLiteral<"false">;
|
|
143
150
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -145,11 +152,13 @@ declare const directConfigSchema: z.ZodObject<{
|
|
|
145
152
|
ETHEREUM_HOSTS: string;
|
|
146
153
|
K8S: "false";
|
|
147
154
|
NODE_URL: string;
|
|
155
|
+
NODE_ADMIN_URL: string;
|
|
148
156
|
}, {
|
|
149
157
|
PXE_URL: string;
|
|
150
158
|
ETHEREUM_HOSTS: string;
|
|
151
159
|
K8S: "false";
|
|
152
160
|
NODE_URL: string;
|
|
161
|
+
NODE_ADMIN_URL: string;
|
|
153
162
|
}>;
|
|
154
163
|
declare const envSchema: z.ZodDiscriminatedUnion<"K8S", [z.ZodObject<{
|
|
155
164
|
ETHEREUM_SLOT_DURATION: z.ZodNumber;
|
|
@@ -159,6 +168,7 @@ declare const envSchema: z.ZodDiscriminatedUnion<"K8S", [z.ZodObject<{
|
|
|
159
168
|
INSTANCE_NAME: z.ZodString;
|
|
160
169
|
NAMESPACE: z.ZodString;
|
|
161
170
|
CONTAINER_NODE_PORT: z.ZodDefault<z.ZodNumber>;
|
|
171
|
+
CONTAINER_NODE_ADMIN_PORT: z.ZodDefault<z.ZodNumber>;
|
|
162
172
|
CONTAINER_SEQUENCER_PORT: z.ZodDefault<z.ZodNumber>;
|
|
163
173
|
CONTAINER_PROVER_NODE_PORT: z.ZodDefault<z.ZodNumber>;
|
|
164
174
|
CONTAINER_PXE_PORT: z.ZodDefault<z.ZodNumber>;
|
|
@@ -179,6 +189,7 @@ declare const envSchema: z.ZodDiscriminatedUnion<"K8S", [z.ZodObject<{
|
|
|
179
189
|
INSTANCE_NAME: string;
|
|
180
190
|
NAMESPACE: string;
|
|
181
191
|
CONTAINER_NODE_PORT: number;
|
|
192
|
+
CONTAINER_NODE_ADMIN_PORT: number;
|
|
182
193
|
CONTAINER_SEQUENCER_PORT: number;
|
|
183
194
|
CONTAINER_PROVER_NODE_PORT: number;
|
|
184
195
|
CONTAINER_PXE_PORT: number;
|
|
@@ -202,6 +213,7 @@ declare const envSchema: z.ZodDiscriminatedUnion<"K8S", [z.ZodObject<{
|
|
|
202
213
|
K8S: "local";
|
|
203
214
|
ETHEREUM_HOSTS?: string | undefined;
|
|
204
215
|
CONTAINER_NODE_PORT?: number | undefined;
|
|
216
|
+
CONTAINER_NODE_ADMIN_PORT?: number | undefined;
|
|
205
217
|
CONTAINER_SEQUENCER_PORT?: number | undefined;
|
|
206
218
|
CONTAINER_PROVER_NODE_PORT?: number | undefined;
|
|
207
219
|
CONTAINER_PXE_PORT?: number | undefined;
|
|
@@ -219,6 +231,7 @@ declare const envSchema: z.ZodDiscriminatedUnion<"K8S", [z.ZodObject<{
|
|
|
219
231
|
INSTANCE_NAME: z.ZodString;
|
|
220
232
|
NAMESPACE: z.ZodString;
|
|
221
233
|
CONTAINER_NODE_PORT: z.ZodDefault<z.ZodNumber>;
|
|
234
|
+
CONTAINER_NODE_ADMIN_PORT: z.ZodDefault<z.ZodNumber>;
|
|
222
235
|
CONTAINER_SEQUENCER_PORT: z.ZodDefault<z.ZodNumber>;
|
|
223
236
|
CONTAINER_PROVER_NODE_PORT: z.ZodDefault<z.ZodNumber>;
|
|
224
237
|
CONTAINER_PXE_PORT: z.ZodDefault<z.ZodNumber>;
|
|
@@ -243,6 +256,7 @@ declare const envSchema: z.ZodDiscriminatedUnion<"K8S", [z.ZodObject<{
|
|
|
243
256
|
INSTANCE_NAME: string;
|
|
244
257
|
NAMESPACE: string;
|
|
245
258
|
CONTAINER_NODE_PORT: number;
|
|
259
|
+
CONTAINER_NODE_ADMIN_PORT: number;
|
|
246
260
|
CONTAINER_SEQUENCER_PORT: number;
|
|
247
261
|
CONTAINER_PROVER_NODE_PORT: number;
|
|
248
262
|
CONTAINER_PXE_PORT: number;
|
|
@@ -270,6 +284,7 @@ declare const envSchema: z.ZodDiscriminatedUnion<"K8S", [z.ZodObject<{
|
|
|
270
284
|
REGION: string;
|
|
271
285
|
ETHEREUM_HOSTS?: string | undefined;
|
|
272
286
|
CONTAINER_NODE_PORT?: number | undefined;
|
|
287
|
+
CONTAINER_NODE_ADMIN_PORT?: number | undefined;
|
|
273
288
|
CONTAINER_SEQUENCER_PORT?: number | undefined;
|
|
274
289
|
CONTAINER_PROVER_NODE_PORT?: number | undefined;
|
|
275
290
|
CONTAINER_PXE_PORT?: number | undefined;
|
|
@@ -282,6 +297,7 @@ declare const envSchema: z.ZodDiscriminatedUnion<"K8S", [z.ZodObject<{
|
|
|
282
297
|
}>, z.ZodObject<{
|
|
283
298
|
PXE_URL: z.ZodString;
|
|
284
299
|
NODE_URL: z.ZodString;
|
|
300
|
+
NODE_ADMIN_URL: z.ZodString;
|
|
285
301
|
ETHEREUM_HOSTS: z.ZodEffects<z.ZodString, string, string>;
|
|
286
302
|
K8S: z.ZodLiteral<"false">;
|
|
287
303
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -289,11 +305,13 @@ declare const envSchema: z.ZodDiscriminatedUnion<"K8S", [z.ZodObject<{
|
|
|
289
305
|
ETHEREUM_HOSTS: string;
|
|
290
306
|
K8S: "false";
|
|
291
307
|
NODE_URL: string;
|
|
308
|
+
NODE_ADMIN_URL: string;
|
|
292
309
|
}, {
|
|
293
310
|
PXE_URL: string;
|
|
294
311
|
ETHEREUM_HOSTS: string;
|
|
295
312
|
K8S: "false";
|
|
296
313
|
NODE_URL: string;
|
|
314
|
+
NODE_ADMIN_URL: string;
|
|
297
315
|
}>]>;
|
|
298
316
|
export type K8sLocalConfig = z.infer<typeof k8sLocalConfigSchema>;
|
|
299
317
|
export type K8sGCloudConfig = z.infer<typeof k8sGCloudConfigSchema>;
|
|
@@ -407,11 +425,6 @@ export declare function enableValidatorDynamicBootNode(instanceName: string, nam
|
|
|
407
425
|
export declare function runAlertCheck(config: EnvConfig, alerts: AlertConfig[], logger: Logger): Promise<void>;
|
|
408
426
|
export declare function updateSequencerConfig(url: string, config: Partial<SequencerConfig>): Promise<void>;
|
|
409
427
|
export declare function getSequencers(namespace: string): Promise<string[]>;
|
|
410
|
-
export declare function updateK8sSequencersConfig(args: {
|
|
411
|
-
containerPort: number;
|
|
412
|
-
namespace: string;
|
|
413
|
-
config: Partial<SequencerConfig>;
|
|
414
|
-
}): Promise<void>;
|
|
415
428
|
export declare function updateSequencersConfig(env: EnvConfig, config: Partial<SequencerConfig>): Promise<void>;
|
|
416
429
|
/**
|
|
417
430
|
* Rolls the Aztec pods in the given namespace.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceR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,EAAE,MAAM,EAAE,MAAM,iBAMjE;AAED,wBAAsB,8BAA8B,CAClD,YAAY,EAAE,MAAM,EACpB,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,MAAM,iBAgBf;AAED,wBAAsB,aAAa,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,WAAW,EAAE,EAAE,MAAM,EAAE,MAAM,iBAgB3F;AAED,wBAAsB,qBAAqB,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,eAAe,CAAC,iBAIxF;AAED,wBAAsB,aAAa,CAAC,SAAS,EAAE,MAAM,qBAIpD;AAsBD,wBAAsB,sBAAsB,CAAC,GAAG,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,eAAe,CAAC,iBAU5F;AAED;;;;;;GAMG;AACH,wBAAsB,aAAa,CAAC,SAAS,EAAE,MAAM,iBAcpD;AAED;;GAEG;AACH,wBAAgB,iBAAiB,IAAI,MAAM,CAW1C"}
|
package/dest/spartan/utils.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { createLogger, sleep } from '@aztec/aztec.js';
|
|
2
|
+
import { makeBackoff, retry } from '@aztec/foundation/retry';
|
|
3
|
+
import { createAztecNodeAdminClient } from '@aztec/stdlib/interfaces/client';
|
|
2
4
|
import { exec, execSync, spawn } from 'child_process';
|
|
3
5
|
import path from 'path';
|
|
4
6
|
import { promisify } from 'util';
|
|
@@ -22,6 +24,7 @@ const k8sLocalConfigSchema = z.object({
|
|
|
22
24
|
INSTANCE_NAME: z.string().min(1, 'INSTANCE_NAME env variable must be set'),
|
|
23
25
|
NAMESPACE: z.string().min(1, 'NAMESPACE env variable must be set'),
|
|
24
26
|
CONTAINER_NODE_PORT: z.coerce.number().default(8080),
|
|
27
|
+
CONTAINER_NODE_ADMIN_PORT: z.coerce.number().default(8880),
|
|
25
28
|
CONTAINER_SEQUENCER_PORT: z.coerce.number().default(8080),
|
|
26
29
|
CONTAINER_PROVER_NODE_PORT: z.coerce.number().default(8080),
|
|
27
30
|
CONTAINER_PXE_PORT: z.coerce.number().default(8080),
|
|
@@ -43,6 +46,7 @@ const k8sGCloudConfigSchema = k8sLocalConfigSchema.extend({
|
|
|
43
46
|
const directConfigSchema = z.object({
|
|
44
47
|
PXE_URL: z.string().url('PXE_URL must be a valid URL'),
|
|
45
48
|
NODE_URL: z.string().url('NODE_URL must be a valid URL'),
|
|
49
|
+
NODE_ADMIN_URL: z.string().url('NODE_ADMIN_URL must be a valid URL'),
|
|
46
50
|
ETHEREUM_HOSTS: ethereumHostsSchema,
|
|
47
51
|
K8S: z.literal('false')
|
|
48
52
|
});
|
|
@@ -387,15 +391,20 @@ export async function runAlertCheck(config, alerts, logger) {
|
|
|
387
391
|
}
|
|
388
392
|
}
|
|
389
393
|
export async function updateSequencerConfig(url, config) {
|
|
390
|
-
const node =
|
|
391
|
-
|
|
394
|
+
const node = createAztecNodeAdminClient(url);
|
|
395
|
+
// Retry incase the port forward is not ready yet
|
|
396
|
+
await retry(()=>node.setConfig(config), 'Update sequencer config', makeBackoff([
|
|
397
|
+
1,
|
|
398
|
+
3,
|
|
399
|
+
6
|
|
400
|
+
]), logger);
|
|
392
401
|
}
|
|
393
402
|
export async function getSequencers(namespace) {
|
|
394
403
|
const command = `kubectl get pods -l app=validator -n ${namespace} -o jsonpath='{.items[*].metadata.name}'`;
|
|
395
404
|
const { stdout } = await execAsync(command);
|
|
396
405
|
return stdout.split(' ');
|
|
397
406
|
}
|
|
398
|
-
|
|
407
|
+
async function updateK8sSequencersConfig(args) {
|
|
399
408
|
const { containerPort, namespace, config } = args;
|
|
400
409
|
const sequencers = await getSequencers(namespace);
|
|
401
410
|
for (const sequencer of sequencers){
|
|
@@ -412,12 +421,12 @@ export async function updateK8sSequencersConfig(args) {
|
|
|
412
421
|
export async function updateSequencersConfig(env, config) {
|
|
413
422
|
if (isK8sConfig(env)) {
|
|
414
423
|
await updateK8sSequencersConfig({
|
|
415
|
-
containerPort: env.
|
|
424
|
+
containerPort: env.CONTAINER_NODE_ADMIN_PORT,
|
|
416
425
|
namespace: env.NAMESPACE,
|
|
417
426
|
config
|
|
418
427
|
});
|
|
419
428
|
} else {
|
|
420
|
-
await updateSequencerConfig(env.
|
|
429
|
+
await updateSequencerConfig(env.NODE_ADMIN_URL, config);
|
|
421
430
|
}
|
|
422
431
|
}
|
|
423
432
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/end-to-end",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.82.0",
|
|
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.0",
|
|
30
|
+
"@aztec/archiver": "0.82.0",
|
|
31
|
+
"@aztec/aztec": "0.82.0",
|
|
32
|
+
"@aztec/aztec-node": "0.82.0",
|
|
33
|
+
"@aztec/aztec.js": "0.82.0",
|
|
34
|
+
"@aztec/bb-prover": "0.82.0",
|
|
35
|
+
"@aztec/blob-lib": "0.82.0",
|
|
36
|
+
"@aztec/blob-sink": "0.82.0",
|
|
37
|
+
"@aztec/bot": "0.82.0",
|
|
38
|
+
"@aztec/constants": "0.82.0",
|
|
39
|
+
"@aztec/entrypoints": "0.82.0",
|
|
40
|
+
"@aztec/epoch-cache": "0.82.0",
|
|
41
|
+
"@aztec/ethereum": "0.82.0",
|
|
42
|
+
"@aztec/foundation": "0.82.0",
|
|
43
|
+
"@aztec/kv-store": "0.82.0",
|
|
44
|
+
"@aztec/l1-artifacts": "0.82.0",
|
|
45
|
+
"@aztec/merkle-tree": "0.82.0",
|
|
46
|
+
"@aztec/noir-contracts.js": "0.82.0",
|
|
47
|
+
"@aztec/noir-noirc_abi": "0.82.0",
|
|
48
|
+
"@aztec/noir-protocol-circuits-types": "0.82.0",
|
|
49
|
+
"@aztec/p2p": "0.82.0",
|
|
50
|
+
"@aztec/protocol-contracts": "0.82.0",
|
|
51
|
+
"@aztec/prover-client": "0.82.0",
|
|
52
|
+
"@aztec/prover-node": "0.82.0",
|
|
53
|
+
"@aztec/pxe": "0.82.0",
|
|
54
|
+
"@aztec/sequencer-client": "0.82.0",
|
|
55
|
+
"@aztec/simulator": "0.82.0",
|
|
56
|
+
"@aztec/stdlib": "0.82.0",
|
|
57
|
+
"@aztec/telemetry-client": "0.82.0",
|
|
58
|
+
"@aztec/validator-client": "0.82.0",
|
|
59
|
+
"@aztec/world-state": "0.82.0",
|
|
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",
|
package/src/bench/utils.ts
CHANGED
|
@@ -36,6 +36,9 @@ export async function benchmarkSetup(
|
|
|
36
36
|
await telemetry.flush();
|
|
37
37
|
const data = telemetry.getMeters();
|
|
38
38
|
const formatted = formatMetricsForGithubBenchmarkAction(data, opts.metrics);
|
|
39
|
+
if (formatted.length === 0) {
|
|
40
|
+
throw new Error(`No benchmark data generated. Please review your test setup.`);
|
|
41
|
+
}
|
|
39
42
|
const benchOutput = opts.benchOutput ?? process.env.BENCH_OUTPUT ?? 'bench.json';
|
|
40
43
|
writeFileSync(benchOutput, JSON.stringify(formatted));
|
|
41
44
|
context.logger.info(`Wrote ${data.length} metrics to ${benchOutput}`);
|
|
@@ -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 };
|