@aztec/end-to-end 0.0.1-commit.0c875d939 → 0.0.1-commit.0ec55a70b
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/README.md +27 -0
- package/dest/bench/client_flows/client_flows_benchmark.d.ts +1 -1
- package/dest/bench/client_flows/client_flows_benchmark.d.ts.map +1 -1
- package/dest/bench/client_flows/client_flows_benchmark.js +21 -28
- package/dest/bench/utils.d.ts +1 -1
- package/dest/bench/utils.d.ts.map +1 -1
- package/dest/bench/utils.js +6 -3
- 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 +15 -15
- package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.js +1 -1
- package/dest/e2e_epochs/epochs_test.d.ts +26 -7
- package/dest/e2e_epochs/epochs_test.d.ts.map +1 -1
- package/dest/e2e_epochs/epochs_test.js +113 -43
- package/dest/e2e_fees/fees_test.d.ts +1 -1
- package/dest/e2e_fees/fees_test.d.ts.map +1 -1
- package/dest/e2e_fees/fees_test.js +17 -10
- package/dest/e2e_nested_contract/nested_contract_test.d.ts +1 -1
- package/dest/e2e_nested_contract/nested_contract_test.d.ts.map +1 -1
- package/dest/e2e_nested_contract/nested_contract_test.js +4 -6
- package/dest/e2e_p2p/inactivity_slash_test.js +3 -3
- package/dest/e2e_p2p/p2p_network.d.ts +13 -11
- package/dest/e2e_p2p/p2p_network.d.ts.map +1 -1
- package/dest/e2e_p2p/p2p_network.js +70 -34
- package/dest/e2e_p2p/reqresp/utils.d.ts +3 -3
- package/dest/e2e_p2p/reqresp/utils.d.ts.map +1 -1
- package/dest/e2e_p2p/reqresp/utils.js +49 -9
- package/dest/e2e_p2p/shared.d.ts +25 -7
- package/dest/e2e_p2p/shared.d.ts.map +1 -1
- package/dest/e2e_p2p/shared.js +69 -49
- package/dest/e2e_token_contract/token_contract_test.d.ts +1 -1
- package/dest/e2e_token_contract/token_contract_test.d.ts.map +1 -1
- package/dest/e2e_token_contract/token_contract_test.js +11 -11
- package/dest/fixtures/authwit_proxy.d.ts +3 -3
- package/dest/fixtures/authwit_proxy.d.ts.map +1 -1
- package/dest/fixtures/authwit_proxy.js +4 -0
- package/dest/fixtures/e2e_prover_test.d.ts +6 -5
- package/dest/fixtures/e2e_prover_test.d.ts.map +1 -1
- package/dest/fixtures/e2e_prover_test.js +37 -49
- package/dest/fixtures/elu_monitor.d.ts +21 -0
- package/dest/fixtures/elu_monitor.d.ts.map +1 -0
- package/dest/fixtures/elu_monitor.js +102 -0
- package/dest/fixtures/fixtures.d.ts +16 -1
- package/dest/fixtures/fixtures.d.ts.map +1 -1
- package/dest/fixtures/fixtures.js +16 -0
- package/dest/fixtures/get_bb_config.d.ts +1 -1
- package/dest/fixtures/get_bb_config.d.ts.map +1 -1
- package/dest/fixtures/get_bb_config.js +5 -5
- package/dest/fixtures/ha_setup.d.ts +2 -2
- package/dest/fixtures/ha_setup.d.ts.map +1 -1
- package/dest/fixtures/ha_setup.js +1 -1
- package/dest/fixtures/schnorr_hardcoded_account_contract.d.ts +25 -0
- package/dest/fixtures/schnorr_hardcoded_account_contract.d.ts.map +1 -0
- package/dest/fixtures/schnorr_hardcoded_account_contract.js +39 -0
- package/dest/fixtures/setup.d.ts +45 -17
- package/dest/fixtures/setup.d.ts.map +1 -1
- package/dest/fixtures/setup.js +89 -100
- package/dest/fixtures/setup_p2p_test.d.ts +10 -7
- package/dest/fixtures/setup_p2p_test.d.ts.map +1 -1
- package/dest/fixtures/setup_p2p_test.js +18 -15
- package/dest/fixtures/token_utils.d.ts +2 -2
- package/dest/fixtures/token_utils.d.ts.map +1 -1
- package/dest/fixtures/token_utils.js +5 -7
- package/dest/forward-compatibility/wallet_rpc_client.d.ts +7 -0
- package/dest/forward-compatibility/wallet_rpc_client.d.ts.map +1 -0
- package/dest/forward-compatibility/wallet_rpc_client.js +15 -0
- package/dest/forward-compatibility/wallet_service.d.ts +3 -0
- package/dest/forward-compatibility/wallet_service.d.ts.map +1 -0
- package/dest/forward-compatibility/wallet_service.js +109 -0
- package/dest/legacy-jest-resolver.d.cts +3 -0
- package/dest/legacy-jest-resolver.d.cts.map +1 -0
- package/dest/shared/cross_chain_test_harness.d.ts +1 -1
- package/dest/shared/cross_chain_test_harness.d.ts.map +1 -1
- package/dest/shared/cross_chain_test_harness.js +13 -13
- package/dest/shared/gas_portal_test_harness.js +3 -3
- package/dest/shared/jest_setup.js +41 -1
- package/dest/shared/submit-transactions.js +1 -1
- package/dest/shared/uniswap_l1_l2.d.ts +1 -1
- package/dest/shared/uniswap_l1_l2.d.ts.map +1 -1
- package/dest/shared/uniswap_l1_l2.js +14 -21
- package/dest/simulators/lending_simulator.d.ts +1 -1
- package/dest/simulators/lending_simulator.d.ts.map +1 -1
- package/dest/simulators/lending_simulator.js +4 -4
- package/dest/simulators/token_simulator.d.ts +1 -1
- package/dest/simulators/token_simulator.d.ts.map +1 -1
- package/dest/simulators/token_simulator.js +2 -2
- package/dest/spartan/setup_test_wallets.d.ts +11 -2
- package/dest/spartan/setup_test_wallets.d.ts.map +1 -1
- package/dest/spartan/setup_test_wallets.js +97 -38
- package/dest/spartan/tx_metrics.d.ts +1 -1
- package/dest/spartan/tx_metrics.d.ts.map +1 -1
- package/dest/spartan/tx_metrics.js +19 -3
- package/dest/spartan/utils/bot.d.ts +3 -2
- package/dest/spartan/utils/bot.d.ts.map +1 -1
- package/dest/spartan/utils/bot.js +2 -1
- package/dest/spartan/utils/config.d.ts +7 -1
- package/dest/spartan/utils/config.d.ts.map +1 -1
- package/dest/spartan/utils/config.js +3 -1
- package/dest/spartan/utils/index.d.ts +4 -2
- package/dest/spartan/utils/index.d.ts.map +1 -1
- package/dest/spartan/utils/index.js +5 -1
- package/dest/spartan/utils/k8s.d.ts +3 -1
- package/dest/spartan/utils/k8s.d.ts.map +1 -1
- package/dest/spartan/utils/k8s.js +6 -0
- package/dest/spartan/utils/nodes.d.ts +4 -5
- package/dest/spartan/utils/nodes.d.ts.map +1 -1
- package/dest/spartan/utils/nodes.js +9 -9
- package/dest/spartan/utils/pod_logs.d.ts +25 -0
- package/dest/spartan/utils/pod_logs.d.ts.map +1 -0
- package/dest/spartan/utils/pod_logs.js +74 -0
- package/dest/test-wallet/test_wallet.d.ts +24 -23
- package/dest/test-wallet/test_wallet.d.ts.map +1 -1
- package/dest/test-wallet/test_wallet.js +124 -83
- package/dest/test-wallet/wallet_worker_script.d.ts +2 -0
- package/dest/test-wallet/wallet_worker_script.d.ts.map +1 -0
- package/dest/test-wallet/wallet_worker_script.js +48 -0
- package/dest/test-wallet/worker_wallet.d.ts +52 -0
- package/dest/test-wallet/worker_wallet.d.ts.map +1 -0
- package/dest/test-wallet/worker_wallet.js +151 -0
- package/dest/test-wallet/worker_wallet_schema.d.ts +279 -0
- package/dest/test-wallet/worker_wallet_schema.d.ts.map +1 -0
- package/dest/test-wallet/worker_wallet_schema.js +10 -0
- package/package.json +43 -44
- package/src/bench/client_flows/client_flows_benchmark.ts +29 -12
- package/src/bench/utils.ts +7 -2
- package/src/e2e_blacklist_token_contract/blacklist_token_contract_test.ts +21 -20
- package/src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts +1 -1
- package/src/e2e_epochs/epochs_test.ts +131 -70
- package/src/e2e_fees/fees_test.ts +18 -9
- package/src/e2e_nested_contract/nested_contract_test.ts +6 -4
- package/src/e2e_p2p/inactivity_slash_test.ts +3 -3
- package/src/e2e_p2p/p2p_network.ts +88 -44
- package/src/e2e_p2p/reqresp/utils.ts +59 -9
- package/src/e2e_p2p/shared.ts +88 -63
- package/src/e2e_token_contract/token_contract_test.ts +16 -8
- package/src/fixtures/authwit_proxy.ts +4 -0
- package/src/fixtures/dumps/epoch_proof_result.json +1 -1
- package/src/fixtures/e2e_prover_test.ts +43 -52
- package/src/fixtures/elu_monitor.ts +126 -0
- package/src/fixtures/fixtures.ts +32 -0
- package/src/fixtures/get_bb_config.ts +7 -6
- package/src/fixtures/ha_setup.ts +4 -2
- package/src/fixtures/schnorr_hardcoded_account_contract.ts +49 -0
- package/src/fixtures/setup.ts +126 -133
- package/src/fixtures/setup_p2p_test.ts +17 -25
- package/src/fixtures/token_utils.ts +3 -3
- package/src/forward-compatibility/wallet_rpc_client.ts +14 -0
- package/src/forward-compatibility/wallet_service.ts +104 -0
- package/src/guides/up_quick_start.sh +0 -2
- package/src/legacy-jest-resolver.cjs +135 -0
- package/src/shared/cross_chain_test_harness.ts +13 -9
- package/src/shared/gas_portal_test_harness.ts +1 -2
- package/src/shared/jest_setup.ts +51 -1
- package/src/shared/submit-transactions.ts +1 -1
- package/src/shared/uniswap_l1_l2.ts +35 -32
- package/src/simulators/lending_simulator.ts +8 -4
- package/src/simulators/token_simulator.ts +6 -2
- package/src/spartan/setup_test_wallets.ts +138 -31
- package/src/spartan/tx_metrics.ts +17 -5
- package/src/spartan/utils/bot.ts +3 -0
- package/src/spartan/utils/config.ts +2 -0
- package/src/spartan/utils/index.ts +7 -0
- package/src/spartan/utils/k8s.ts +8 -0
- package/src/spartan/utils/nodes.ts +15 -10
- package/src/spartan/utils/pod_logs.ts +99 -0
- package/src/test-wallet/test_wallet.ts +152 -101
- package/src/test-wallet/wallet_worker_script.ts +60 -0
- package/src/test-wallet/worker_wallet.ts +214 -0
- package/src/test-wallet/worker_wallet_schema.ts +13 -0
|
@@ -130,7 +130,9 @@ export const uniswapL1L2TestSuite = (
|
|
|
130
130
|
client: l1Client,
|
|
131
131
|
});
|
|
132
132
|
// deploy l2 uniswap contract and attach to portal
|
|
133
|
-
uniswapL2Contract = await UniswapContract.deploy(wallet, uniswapPortalAddress).send({
|
|
133
|
+
({ contract: uniswapL2Contract } = await UniswapContract.deploy(wallet, uniswapPortalAddress).send({
|
|
134
|
+
from: ownerAddress,
|
|
135
|
+
}));
|
|
134
136
|
|
|
135
137
|
const registryAddress = (await aztecNode.getNodeInfo()).l1ContractAddresses.registryAddress;
|
|
136
138
|
|
|
@@ -152,7 +154,6 @@ export const uniswapL1L2TestSuite = (
|
|
|
152
154
|
await cleanup();
|
|
153
155
|
});
|
|
154
156
|
|
|
155
|
-
// docs:start:uniswap_private
|
|
156
157
|
it('should uniswap trade on L1 from L2 funds privately (swaps WETH -> DAI)', async () => {
|
|
157
158
|
const wethL1BeforeBalance = await wethCrossChainHarness.getL1BalanceOf(ownerEthAddress);
|
|
158
159
|
|
|
@@ -195,7 +196,7 @@ export const uniswapL1L2TestSuite = (
|
|
|
195
196
|
logger.info('Withdrawing weth to L1 and sending message to swap to dai');
|
|
196
197
|
const [secretForDepositingSwappedDai, secretHashForDepositingSwappedDai] = await generateClaimSecret();
|
|
197
198
|
|
|
198
|
-
const l2UniswapInteractionReceipt = await uniswapL2Contract.methods
|
|
199
|
+
const { receipt: l2UniswapInteractionReceipt } = await uniswapL2Contract.methods
|
|
199
200
|
.swap_private(
|
|
200
201
|
wethCrossChainHarness.l2Token.address,
|
|
201
202
|
wethCrossChainHarness.l2Bridge.address,
|
|
@@ -250,8 +251,12 @@ export const uniswapL1L2TestSuite = (
|
|
|
250
251
|
await wethCrossChainHarness.expectPublicBalanceOnL2(uniswapL2Contract.address, 0n);
|
|
251
252
|
|
|
252
253
|
// Since the outbox is only consumable when the epoch is proven, we need to advance to the next epoch.
|
|
253
|
-
const
|
|
254
|
-
|
|
254
|
+
const swapResult = (await computeL2ToL1MembershipWitness(
|
|
255
|
+
aztecNode,
|
|
256
|
+
swapPrivateLeaf,
|
|
257
|
+
l2UniswapInteractionReceipt.txHash,
|
|
258
|
+
))!;
|
|
259
|
+
const { epochNumber: epoch } = swapResult;
|
|
255
260
|
await cheatCodes.rollup.advanceToEpoch(EpochNumber(epoch + 1));
|
|
256
261
|
await waitForProven(aztecNode, l2UniswapInteractionReceipt, { provenTimeout: 300 });
|
|
257
262
|
|
|
@@ -260,14 +265,17 @@ export const uniswapL1L2TestSuite = (
|
|
|
260
265
|
const daiL1BalanceOfPortalBeforeSwap = await daiCrossChainHarness.getL1BalanceOf(
|
|
261
266
|
daiCrossChainHarness.tokenPortalAddress,
|
|
262
267
|
);
|
|
263
|
-
const
|
|
264
|
-
|
|
268
|
+
const withdrawResult = (await computeL2ToL1MembershipWitness(
|
|
269
|
+
aztecNode,
|
|
270
|
+
withdrawLeaf,
|
|
271
|
+
l2UniswapInteractionReceipt.txHash,
|
|
272
|
+
))!;
|
|
265
273
|
|
|
266
|
-
const swapPrivateL2MessageIndex = swapResult
|
|
267
|
-
const swapPrivateSiblingPath = swapResult
|
|
274
|
+
const swapPrivateL2MessageIndex = swapResult.leafIndex;
|
|
275
|
+
const swapPrivateSiblingPath = swapResult.siblingPath;
|
|
268
276
|
|
|
269
|
-
const withdrawL2MessageIndex = withdrawResult
|
|
270
|
-
const withdrawSiblingPath = withdrawResult
|
|
277
|
+
const withdrawL2MessageIndex = withdrawResult.leafIndex;
|
|
278
|
+
const withdrawSiblingPath = withdrawResult.siblingPath;
|
|
271
279
|
|
|
272
280
|
const withdrawMessageMetadata = {
|
|
273
281
|
_epoch: BigInt(epoch),
|
|
@@ -336,10 +344,8 @@ export const uniswapL1L2TestSuite = (
|
|
|
336
344
|
logger.info('WETH balance after swap : ', wethL2BalanceAfterSwap.toString());
|
|
337
345
|
logger.info('DAI balance after swap : ', daiL2BalanceAfterSwap.toString());
|
|
338
346
|
});
|
|
339
|
-
// docs:end:uniswap_private
|
|
340
347
|
|
|
341
348
|
// TODO(#7463): reenable look into this failure https://github.com/AztecProtocol/aztec-packages/actions/runs/9912612912/job/27388320150?pr=7462
|
|
342
|
-
// // docs:start:uniswap_public
|
|
343
349
|
// it('should uniswap trade on L1 from L2 funds publicly (swaps WETH -> DAI)', async () => {
|
|
344
350
|
// const wethL1BeforeBalance = await wethCrossChainHarness.getL1BalanceOf(ownerEthAddress);
|
|
345
351
|
|
|
@@ -572,7 +578,6 @@ export const uniswapL1L2TestSuite = (
|
|
|
572
578
|
// logger.info('WETH balance after swap : ', wethL2BalanceAfterSwap.toString());
|
|
573
579
|
// logger.info('DAI balance after swap : ', daiL2BalanceAfterSwap.toString());
|
|
574
580
|
// });
|
|
575
|
-
// // docs:end:uniswap_public
|
|
576
581
|
|
|
577
582
|
// Edge cases for the private flow:
|
|
578
583
|
// note - tests for uniswapPortal.sol and minting asset on L2 are covered in other tests.
|
|
@@ -787,7 +792,7 @@ export const uniswapL1L2TestSuite = (
|
|
|
787
792
|
logger.info('Withdrawing weth to L1 and sending message to swap to dai');
|
|
788
793
|
|
|
789
794
|
const [, secretHashForDepositingSwappedDai] = await generateClaimSecret();
|
|
790
|
-
const withdrawReceipt = await uniswapL2Contract.methods
|
|
795
|
+
const { receipt: withdrawReceipt } = await uniswapL2Contract.methods
|
|
791
796
|
.swap_private(
|
|
792
797
|
wethCrossChainHarness.l2Token.address,
|
|
793
798
|
wethCrossChainHarness.l2Bridge.address,
|
|
@@ -838,16 +843,15 @@ export const uniswapL1L2TestSuite = (
|
|
|
838
843
|
chainId: new Fr(l1Client.chain.id),
|
|
839
844
|
});
|
|
840
845
|
|
|
841
|
-
const
|
|
842
|
-
const epoch =
|
|
843
|
-
const
|
|
844
|
-
const withdrawResult = await computeL2ToL1MembershipWitness(aztecNode, epoch, withdrawLeaf);
|
|
846
|
+
const swapResult = (await computeL2ToL1MembershipWitness(aztecNode, swapPrivateLeaf, withdrawReceipt.txHash))!;
|
|
847
|
+
const { epochNumber: epoch } = swapResult;
|
|
848
|
+
const withdrawResult = (await computeL2ToL1MembershipWitness(aztecNode, withdrawLeaf, withdrawReceipt.txHash))!;
|
|
845
849
|
|
|
846
|
-
const swapPrivateL2MessageIndex = swapResult
|
|
847
|
-
const swapPrivateSiblingPath = swapResult
|
|
850
|
+
const swapPrivateL2MessageIndex = swapResult.leafIndex;
|
|
851
|
+
const swapPrivateSiblingPath = swapResult.siblingPath;
|
|
848
852
|
|
|
849
|
-
const withdrawL2MessageIndex = withdrawResult
|
|
850
|
-
const withdrawSiblingPath = withdrawResult
|
|
853
|
+
const withdrawL2MessageIndex = withdrawResult.leafIndex;
|
|
854
|
+
const withdrawSiblingPath = withdrawResult.siblingPath;
|
|
851
855
|
|
|
852
856
|
const withdrawMessageMetadata = {
|
|
853
857
|
_epoch: BigInt(epoch),
|
|
@@ -915,7 +919,7 @@ export const uniswapL1L2TestSuite = (
|
|
|
915
919
|
|
|
916
920
|
// Call swap_public on L2
|
|
917
921
|
const secretHashForDepositingSwappedDai = Fr.random();
|
|
918
|
-
const withdrawReceipt = await uniswapL2Contract.methods
|
|
922
|
+
const { receipt: withdrawReceipt } = await uniswapL2Contract.methods
|
|
919
923
|
.swap_public(
|
|
920
924
|
ownerAddress,
|
|
921
925
|
wethCrossChainHarness.l2Bridge.address,
|
|
@@ -971,16 +975,15 @@ export const uniswapL1L2TestSuite = (
|
|
|
971
975
|
chainId: new Fr(l1Client.chain.id),
|
|
972
976
|
});
|
|
973
977
|
|
|
974
|
-
const
|
|
975
|
-
const epoch =
|
|
976
|
-
const
|
|
977
|
-
const withdrawResult = await computeL2ToL1MembershipWitness(aztecNode, epoch, withdrawLeaf);
|
|
978
|
+
const swapResult = (await computeL2ToL1MembershipWitness(aztecNode, swapPublicLeaf, withdrawReceipt.txHash))!;
|
|
979
|
+
const { epochNumber: epoch } = swapResult;
|
|
980
|
+
const withdrawResult = (await computeL2ToL1MembershipWitness(aztecNode, withdrawLeaf, withdrawReceipt.txHash))!;
|
|
978
981
|
|
|
979
|
-
const swapPublicL2MessageIndex = swapResult
|
|
980
|
-
const swapPublicSiblingPath = swapResult
|
|
982
|
+
const swapPublicL2MessageIndex = swapResult.leafIndex;
|
|
983
|
+
const swapPublicSiblingPath = swapResult.siblingPath;
|
|
981
984
|
|
|
982
|
-
const withdrawL2MessageIndex = withdrawResult
|
|
983
|
-
const withdrawSiblingPath = withdrawResult
|
|
985
|
+
const withdrawL2MessageIndex = withdrawResult.leafIndex;
|
|
986
|
+
const withdrawSiblingPath = withdrawResult.siblingPath;
|
|
984
987
|
|
|
985
988
|
const withdrawMessageMetadata = {
|
|
986
989
|
_epoch: BigInt(epoch),
|
|
@@ -94,7 +94,9 @@ export class LendingSimulator {
|
|
|
94
94
|
|
|
95
95
|
async prepare() {
|
|
96
96
|
this.accumulator = BASE;
|
|
97
|
-
const slot = await this.rollup.getSlotAt(
|
|
97
|
+
const slot = await this.rollup.getSlotAt(
|
|
98
|
+
BigInt(await this.cc.eth.lastBlockTimestamp()) + BigInt(this.ethereumSlotDuration),
|
|
99
|
+
);
|
|
98
100
|
this.time = Number(await this.rollup.getTimestampForSlot(slot));
|
|
99
101
|
}
|
|
100
102
|
|
|
@@ -103,7 +105,7 @@ export class LendingSimulator {
|
|
|
103
105
|
return;
|
|
104
106
|
}
|
|
105
107
|
|
|
106
|
-
const slot = await this.rollup.getSlotAt(BigInt(await this.cc.eth.
|
|
108
|
+
const slot = await this.rollup.getSlotAt(BigInt(await this.cc.eth.lastBlockTimestamp()));
|
|
107
109
|
const targetSlot = SlotNumber(slot + diff);
|
|
108
110
|
const ts = Number(await this.rollup.getTimestampForSlot(targetSlot));
|
|
109
111
|
const timeDiff = ts - this.time;
|
|
@@ -186,14 +188,16 @@ export class LendingSimulator {
|
|
|
186
188
|
|
|
187
189
|
expect(this.borrowed).toEqual(this.stableCoin.totalSupply - this.mintedOutside);
|
|
188
190
|
|
|
189
|
-
const asset = await this.lendingContract.methods.get_asset(0).simulate({ from: this.account.address });
|
|
191
|
+
const { result: asset } = await this.lendingContract.methods.get_asset(0).simulate({ from: this.account.address });
|
|
190
192
|
|
|
191
193
|
const interestAccumulator = asset['interest_accumulator'];
|
|
192
194
|
expect(interestAccumulator).toEqual(this.accumulator);
|
|
193
195
|
expect(asset['last_updated_ts']).toEqual(BigInt(this.time));
|
|
194
196
|
|
|
195
197
|
for (const key of [this.account.address, AztecAddress.fromField(await this.account.key())]) {
|
|
196
|
-
const privatePos = await this.lendingContract.methods
|
|
198
|
+
const { result: privatePos } = await this.lendingContract.methods
|
|
199
|
+
.get_position(key)
|
|
200
|
+
.simulate({ from: this.account.address });
|
|
197
201
|
expect(new Fr(privatePos['collateral'])).toEqual(this.collateral[key.toString()] ?? Fr.ZERO);
|
|
198
202
|
expect(new Fr(privatePos['static_debt'])).toEqual(this.staticDebt[key.toString()] ?? Fr.ZERO);
|
|
199
203
|
expect(privatePos['debt']).toEqual(
|
|
@@ -109,7 +109,9 @@ export class TokenSimulator {
|
|
|
109
109
|
await Promise.all(
|
|
110
110
|
chunk(calls, 5).map(batch => new BatchCall(this.defaultWallet, batch).simulate({ from: this.defaultAddress })),
|
|
111
111
|
)
|
|
112
|
-
)
|
|
112
|
+
)
|
|
113
|
+
.flatMap(r => r.result)
|
|
114
|
+
.map(r => r.result);
|
|
113
115
|
expect(results[0]).toEqual(this.totalSupply);
|
|
114
116
|
|
|
115
117
|
// Check that all our balances match
|
|
@@ -123,7 +125,9 @@ export class TokenSimulator {
|
|
|
123
125
|
const wallet = this.lookupProvider.get(address.toString());
|
|
124
126
|
const asset = wallet ? this.token.withWallet(wallet) : this.token;
|
|
125
127
|
|
|
126
|
-
const actualPrivateBalance = await asset.methods
|
|
128
|
+
const { result: actualPrivateBalance } = await asset.methods
|
|
129
|
+
.balance_of_private(address)
|
|
130
|
+
.simulate({ from: address });
|
|
127
131
|
expect(actualPrivateBalance).toEqual(this.balanceOfPrivate(address));
|
|
128
132
|
}
|
|
129
133
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { generateSchnorrAccounts } from '@aztec/accounts/testing';
|
|
2
|
+
import { NO_FROM } from '@aztec/aztec.js/account';
|
|
2
3
|
import { AztecAddress } from '@aztec/aztec.js/addresses';
|
|
3
4
|
import { NO_WAIT } from '@aztec/aztec.js/contracts';
|
|
4
5
|
import { L1FeeJuicePortalManager } from '@aztec/aztec.js/ethereum';
|
|
@@ -10,7 +11,7 @@ import type { Wallet } from '@aztec/aztec.js/wallet';
|
|
|
10
11
|
import { createEthereumChain } from '@aztec/ethereum/chain';
|
|
11
12
|
import { createExtendedL1Client } from '@aztec/ethereum/client';
|
|
12
13
|
import type { Logger } from '@aztec/foundation/log';
|
|
13
|
-
import { retryUntil } from '@aztec/foundation/retry';
|
|
14
|
+
import { makeBackoff, retry, retryUntil } from '@aztec/foundation/retry';
|
|
14
15
|
import { TokenContract } from '@aztec/noir-contracts.js/Token';
|
|
15
16
|
import type { AztecNodeAdmin } from '@aztec/stdlib/interfaces/client';
|
|
16
17
|
import { registerInitialLocalNetworkAccountsInWallet } from '@aztec/wallets/testing';
|
|
@@ -20,6 +21,7 @@ import { getBBConfig } from '../fixtures/get_bb_config.js';
|
|
|
20
21
|
import { getSponsoredFPCAddress, registerSponsoredFPC } from '../fixtures/utils.js';
|
|
21
22
|
import { TestWallet } from '../test-wallet/test_wallet.js';
|
|
22
23
|
import { proveInteraction } from '../test-wallet/utils.js';
|
|
24
|
+
import { WorkerWallet } from '../test-wallet/worker_wallet.js';
|
|
23
25
|
|
|
24
26
|
export interface TestAccounts {
|
|
25
27
|
aztecNode: AztecNode;
|
|
@@ -87,11 +89,19 @@ export async function deploySponsoredTestAccountsWithTokens(
|
|
|
87
89
|
|
|
88
90
|
const paymentMethod = new SponsoredFeePaymentMethod(await getSponsoredFPCAddress());
|
|
89
91
|
const recipientDeployMethod = await recipientAccount.getDeployMethod();
|
|
90
|
-
await recipientDeployMethod.send({
|
|
92
|
+
await recipientDeployMethod.send({
|
|
93
|
+
from: NO_FROM,
|
|
94
|
+
fee: { paymentMethod },
|
|
95
|
+
wait: { timeout: 2400 },
|
|
96
|
+
});
|
|
91
97
|
await Promise.all(
|
|
92
98
|
fundedAccounts.map(async a => {
|
|
93
99
|
const deployMethod = await a.getDeployMethod();
|
|
94
|
-
await deployMethod.send({
|
|
100
|
+
await deployMethod.send({
|
|
101
|
+
from: NO_FROM,
|
|
102
|
+
fee: { paymentMethod },
|
|
103
|
+
wait: { timeout: 2400 },
|
|
104
|
+
}); // increase timeout on purpose in order to account for two empty epochs
|
|
95
105
|
logger.info(`Account deployed at ${a.address}`);
|
|
96
106
|
}),
|
|
97
107
|
);
|
|
@@ -120,49 +130,91 @@ export async function deploySponsoredTestAccountsWithTokens(
|
|
|
120
130
|
}
|
|
121
131
|
|
|
122
132
|
async function deployAccountWithDiagnostics(
|
|
123
|
-
account: { getDeployMethod: () => Promise<{ send: (opts: any) => any }>; address: any },
|
|
133
|
+
account: { getDeployMethod: () => Promise<{ simulate: (opts: any) => any; send: (opts: any) => any }>; address: any },
|
|
124
134
|
paymentMethod: SponsoredFeePaymentMethod,
|
|
125
135
|
aztecNode: AztecNode,
|
|
126
136
|
logger: Logger,
|
|
127
137
|
accountLabel: string,
|
|
138
|
+
estimateGas?: boolean,
|
|
128
139
|
): Promise<void> {
|
|
129
140
|
const deployMethod = await account.getDeployMethod();
|
|
130
|
-
let
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
logger.info(`${accountLabel}
|
|
135
|
-
} catch (error) {
|
|
136
|
-
const blockNumber = await aztecNode.getBlockNumber();
|
|
137
|
-
let receipt;
|
|
138
|
-
try {
|
|
139
|
-
receipt = await aztecNode.getTxReceipt(txHash);
|
|
140
|
-
} catch {
|
|
141
|
-
receipt = 'unavailable';
|
|
142
|
-
}
|
|
143
|
-
logger.error(`${accountLabel} deployment failed`, {
|
|
144
|
-
txHash: txHash.toString(),
|
|
145
|
-
receipt: JSON.stringify(receipt),
|
|
146
|
-
currentBlockNumber: blockNumber,
|
|
147
|
-
error: String(error),
|
|
148
|
-
});
|
|
149
|
-
throw error;
|
|
141
|
+
let gasSettings: any;
|
|
142
|
+
if (estimateGas) {
|
|
143
|
+
const sim = await deployMethod.simulate({ from: NO_FROM, fee: { paymentMethod } });
|
|
144
|
+
gasSettings = sim.estimatedGas;
|
|
145
|
+
logger.info(`${accountLabel} estimated gas: DA=${gasSettings.gasLimits.daGas} L2=${gasSettings.gasLimits.l2Gas}`);
|
|
150
146
|
}
|
|
147
|
+
|
|
148
|
+
// Track the tx hash across retries so we don't re-send when the previous tx is still pending.
|
|
149
|
+
let sentTxHash: { txHash: any } | undefined;
|
|
150
|
+
|
|
151
|
+
await retry(
|
|
152
|
+
async () => {
|
|
153
|
+
// Check if already deployed (handles case where previous attempt succeeded but waitForTx timed out)
|
|
154
|
+
const existing = await aztecNode.getContract(account.address);
|
|
155
|
+
if (existing) {
|
|
156
|
+
logger.info(`${accountLabel} already deployed at ${account.address}, skipping`);
|
|
157
|
+
return;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
// If we already sent a tx, check if it was dropped before deciding to re-send.
|
|
161
|
+
if (sentTxHash) {
|
|
162
|
+
const prevReceipt = await aztecNode.getTxReceipt(sentTxHash.txHash);
|
|
163
|
+
if (prevReceipt.isDropped()) {
|
|
164
|
+
logger.info(`${accountLabel} previous tx ${sentTxHash.txHash} was dropped, re-sending`);
|
|
165
|
+
sentTxHash = undefined;
|
|
166
|
+
} else {
|
|
167
|
+
logger.info(`${accountLabel} previous tx ${sentTxHash.txHash} still pending, waiting again...`);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
if (!sentTxHash) {
|
|
172
|
+
const deployResult = await deployMethod.send({
|
|
173
|
+
from: NO_FROM,
|
|
174
|
+
fee: { paymentMethod, gasSettings },
|
|
175
|
+
wait: NO_WAIT,
|
|
176
|
+
});
|
|
177
|
+
sentTxHash = { txHash: deployResult.txHash };
|
|
178
|
+
logger.info(`${accountLabel} tx sent`, { txHash: sentTxHash.txHash.toString() });
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
const receipt = await waitForTx(aztecNode, sentTxHash.txHash, { timeout: 600 });
|
|
182
|
+
if (receipt.isDropped()) {
|
|
183
|
+
sentTxHash = undefined;
|
|
184
|
+
throw new Error(`${accountLabel} tx was dropped, retrying...`);
|
|
185
|
+
}
|
|
186
|
+
logger.info(`${accountLabel} deployed at ${account.address}`);
|
|
187
|
+
},
|
|
188
|
+
`deploy ${accountLabel}`,
|
|
189
|
+
makeBackoff([1, 2, 4, 8, 16]),
|
|
190
|
+
logger,
|
|
191
|
+
);
|
|
151
192
|
}
|
|
152
193
|
|
|
153
194
|
async function deployAccountsInBatches(
|
|
154
|
-
accounts: {
|
|
195
|
+
accounts: {
|
|
196
|
+
getDeployMethod: () => Promise<{ simulate: (opts: any) => any; send: (opts: any) => any }>;
|
|
197
|
+
address: any;
|
|
198
|
+
}[],
|
|
155
199
|
paymentMethod: SponsoredFeePaymentMethod,
|
|
156
200
|
aztecNode: AztecNode,
|
|
157
201
|
logger: Logger,
|
|
158
202
|
labelPrefix: string,
|
|
159
203
|
batchSize = 2,
|
|
204
|
+
estimateGas?: boolean,
|
|
160
205
|
): Promise<void> {
|
|
161
206
|
for (let i = 0; i < accounts.length; i += batchSize) {
|
|
162
207
|
const batch = accounts.slice(i, i + batchSize);
|
|
163
208
|
await Promise.all(
|
|
164
209
|
batch.map((account, idx) =>
|
|
165
|
-
deployAccountWithDiagnostics(
|
|
210
|
+
deployAccountWithDiagnostics(
|
|
211
|
+
account,
|
|
212
|
+
paymentMethod,
|
|
213
|
+
aztecNode,
|
|
214
|
+
logger,
|
|
215
|
+
`${labelPrefix}${i + idx + 1}`,
|
|
216
|
+
estimateGas,
|
|
217
|
+
),
|
|
166
218
|
),
|
|
167
219
|
);
|
|
168
220
|
}
|
|
@@ -173,6 +225,7 @@ export async function deploySponsoredTestAccounts(
|
|
|
173
225
|
aztecNode: AztecNode,
|
|
174
226
|
logger: Logger,
|
|
175
227
|
numberOfFundedWallets = 1,
|
|
228
|
+
opts?: { estimateGas?: boolean },
|
|
176
229
|
): Promise<TestAccountsWithoutTokens> {
|
|
177
230
|
const [recipient, ...funded] = await generateSchnorrAccounts(numberOfFundedWallets + 1);
|
|
178
231
|
const recipientAccount = await wallet.createSchnorrAccount(recipient.secret, recipient.salt);
|
|
@@ -182,8 +235,23 @@ export async function deploySponsoredTestAccounts(
|
|
|
182
235
|
|
|
183
236
|
const paymentMethod = new SponsoredFeePaymentMethod(await getSponsoredFPCAddress());
|
|
184
237
|
|
|
185
|
-
await deployAccountWithDiagnostics(
|
|
186
|
-
|
|
238
|
+
await deployAccountWithDiagnostics(
|
|
239
|
+
recipientAccount,
|
|
240
|
+
paymentMethod,
|
|
241
|
+
aztecNode,
|
|
242
|
+
logger,
|
|
243
|
+
'Recipient account',
|
|
244
|
+
opts?.estimateGas,
|
|
245
|
+
);
|
|
246
|
+
await deployAccountsInBatches(
|
|
247
|
+
fundedAccounts,
|
|
248
|
+
paymentMethod,
|
|
249
|
+
aztecNode,
|
|
250
|
+
logger,
|
|
251
|
+
'Funded account ',
|
|
252
|
+
2,
|
|
253
|
+
opts?.estimateGas,
|
|
254
|
+
);
|
|
187
255
|
|
|
188
256
|
return {
|
|
189
257
|
aztecNode,
|
|
@@ -221,7 +289,7 @@ export async function deployTestAccountsWithTokens(
|
|
|
221
289
|
fundedAccounts.map(async (a, i) => {
|
|
222
290
|
const paymentMethod = new FeeJuicePaymentMethodWithClaim(a.address, claims[i]);
|
|
223
291
|
const deployMethod = await a.getDeployMethod();
|
|
224
|
-
await deployMethod.send({ from:
|
|
292
|
+
await deployMethod.send({ from: NO_FROM, fee: { paymentMethod } });
|
|
225
293
|
logger.info(`Account deployed at ${a.address}`);
|
|
226
294
|
}),
|
|
227
295
|
);
|
|
@@ -265,7 +333,7 @@ async function bridgeL1FeeJuice(
|
|
|
265
333
|
const claim = await portal.bridgeTokensPublic(recipient, amount, true /* mint */);
|
|
266
334
|
|
|
267
335
|
const isSynced = async () =>
|
|
268
|
-
(await aztecNode.
|
|
336
|
+
(await aztecNode.getL1ToL2MessageCheckpoint(Fr.fromHexString(claim.messageHash))) !== undefined;
|
|
269
337
|
await retryUntil(isSynced, `message ${claim.messageHash} sync`, 24, 0.5);
|
|
270
338
|
|
|
271
339
|
log.info(`Created a claim for ${amount} L1 fee juice to ${recipient}.`, claim);
|
|
@@ -308,7 +376,7 @@ async function deployTokenAndMint(
|
|
|
308
376
|
fee: {
|
|
309
377
|
paymentMethod,
|
|
310
378
|
},
|
|
311
|
-
wait: { timeout: 600
|
|
379
|
+
wait: { timeout: 600 },
|
|
312
380
|
});
|
|
313
381
|
|
|
314
382
|
const tokenAddress = tokenContract.address;
|
|
@@ -397,3 +465,42 @@ export async function createWalletAndAztecNodeClient(
|
|
|
397
465
|
},
|
|
398
466
|
};
|
|
399
467
|
}
|
|
468
|
+
|
|
469
|
+
export type WorkerWalletWrapper = {
|
|
470
|
+
wallet: WorkerWallet;
|
|
471
|
+
aztecNode: AztecNode;
|
|
472
|
+
cleanup: () => Promise<void>;
|
|
473
|
+
};
|
|
474
|
+
|
|
475
|
+
export async function createWorkerWalletClient(
|
|
476
|
+
nodeUrl: string,
|
|
477
|
+
proverEnabled: boolean,
|
|
478
|
+
logger: Logger,
|
|
479
|
+
): Promise<WorkerWalletWrapper> {
|
|
480
|
+
const aztecNode = createAztecNodeClient(nodeUrl);
|
|
481
|
+
const [bbConfig, acvmConfig] = await Promise.all([getBBConfig(logger), getACVMConfig(logger)]);
|
|
482
|
+
|
|
483
|
+
// Strip cleanup functions — they can't be structured-cloned for worker transfer
|
|
484
|
+
const { cleanup: bbCleanup, ...bbPaths } = bbConfig ?? {};
|
|
485
|
+
const { cleanup: acvmCleanup, ...acvmPaths } = acvmConfig ?? {};
|
|
486
|
+
|
|
487
|
+
const pxeConfig = {
|
|
488
|
+
dataDirectory: undefined,
|
|
489
|
+
dataStoreMapSizeKb: 1024 * 1024,
|
|
490
|
+
...bbPaths,
|
|
491
|
+
...acvmPaths,
|
|
492
|
+
proverEnabled,
|
|
493
|
+
};
|
|
494
|
+
|
|
495
|
+
const wallet = await WorkerWallet.create(nodeUrl, pxeConfig);
|
|
496
|
+
|
|
497
|
+
return {
|
|
498
|
+
wallet,
|
|
499
|
+
aztecNode,
|
|
500
|
+
async cleanup() {
|
|
501
|
+
await wallet.stop();
|
|
502
|
+
await bbCleanup?.();
|
|
503
|
+
await acvmCleanup?.();
|
|
504
|
+
},
|
|
505
|
+
};
|
|
506
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { AztecNode } from '@aztec/aztec.js/node';
|
|
2
2
|
import type { Logger } from '@aztec/foundation/log';
|
|
3
|
-
import type {
|
|
3
|
+
import type { BlockResponse } from '@aztec/stdlib/interfaces/client';
|
|
4
4
|
import type { TopicType } from '@aztec/stdlib/p2p';
|
|
5
5
|
import { Tx, type TxReceipt } from '@aztec/stdlib/tx';
|
|
6
6
|
|
|
@@ -147,7 +147,7 @@ export type TxInclusionData = {
|
|
|
147
147
|
export class TxInclusionMetrics {
|
|
148
148
|
private data = new Map<string, TxInclusionData>();
|
|
149
149
|
private groups = new Set<string>();
|
|
150
|
-
private blocks = new Map<number, Promise<
|
|
150
|
+
private blocks = new Map<number, Promise<BlockResponse<{ includeTransactions: true }> | undefined>>();
|
|
151
151
|
|
|
152
152
|
private p2pGossipLatencyByTopic: Partial<Record<TopicType, { p50: number; p95: number }>> = {};
|
|
153
153
|
|
|
@@ -198,7 +198,7 @@ export class TxInclusionMetrics {
|
|
|
198
198
|
}
|
|
199
199
|
|
|
200
200
|
if (!this.blocks.has(blockNumber)) {
|
|
201
|
-
this.blocks.set(blockNumber, this.aztecNode.getBlock(blockNumber));
|
|
201
|
+
this.blocks.set(blockNumber, this.aztecNode.getBlock(blockNumber, { includeTransactions: true }));
|
|
202
202
|
}
|
|
203
203
|
|
|
204
204
|
const block = await this.blocks.get(blockNumber)!;
|
|
@@ -229,12 +229,24 @@ export class TxInclusionMetrics {
|
|
|
229
229
|
p99: number;
|
|
230
230
|
} {
|
|
231
231
|
const histogram = createHistogram({});
|
|
232
|
+
let nonPositive = 0;
|
|
232
233
|
for (const tx of this.data.values()) {
|
|
233
234
|
if (!tx.blocknumber || tx.group !== group || tx.minedAt === -1) {
|
|
234
235
|
continue;
|
|
235
236
|
}
|
|
236
237
|
|
|
237
|
-
|
|
238
|
+
// `minedAt` is the block's L2 slot timestamp (seconds) while `sentAt` is the wall-clock
|
|
239
|
+
// send time. Because the slot timestamp can precede or equal the send time, the delta
|
|
240
|
+
// can be <= 0, which perf_hooks.createHistogram rejects. Skip those instead of crashing.
|
|
241
|
+
const delta = tx.minedAt - tx.sentAt;
|
|
242
|
+
if (delta <= 0) {
|
|
243
|
+
nonPositive++;
|
|
244
|
+
continue;
|
|
245
|
+
}
|
|
246
|
+
histogram.record(delta);
|
|
247
|
+
}
|
|
248
|
+
if (nonPositive > 0) {
|
|
249
|
+
this.logger?.debug(`Dropped ${nonPositive} tx inclusion samples with non-positive delta`, { group });
|
|
238
250
|
}
|
|
239
251
|
|
|
240
252
|
if (histogram.count === 0) {
|
|
@@ -296,7 +308,7 @@ export class TxInclusionMetrics {
|
|
|
296
308
|
value: stats.mean,
|
|
297
309
|
},
|
|
298
310
|
{
|
|
299
|
-
name: `${group}/
|
|
311
|
+
name: `${group}/p50_inclusion`,
|
|
300
312
|
unit: 's',
|
|
301
313
|
value: stats.median,
|
|
302
314
|
},
|
package/src/spartan/utils/bot.ts
CHANGED
|
@@ -35,6 +35,7 @@ export async function installTransferBot({
|
|
|
35
35
|
replicas = 1,
|
|
36
36
|
txIntervalSeconds = 10,
|
|
37
37
|
followChain = 'CHECKPOINTED',
|
|
38
|
+
pxeSyncChainTip = 'proposed',
|
|
38
39
|
mnemonic = process.env.LABS_INFRA_MNEMONIC ?? 'test test test test test test test test test test test junk',
|
|
39
40
|
mnemonicStartIndex,
|
|
40
41
|
botPrivateKey = process.env.BOT_TRANSFERS_L2_PRIVATE_KEY ?? '0xcafe01',
|
|
@@ -49,6 +50,7 @@ export async function installTransferBot({
|
|
|
49
50
|
replicas?: number;
|
|
50
51
|
txIntervalSeconds?: number;
|
|
51
52
|
followChain?: string;
|
|
53
|
+
pxeSyncChainTip?: string;
|
|
52
54
|
mnemonic?: string;
|
|
53
55
|
mnemonicStartIndex?: number | string;
|
|
54
56
|
botPrivateKey?: string;
|
|
@@ -67,6 +69,7 @@ export async function installTransferBot({
|
|
|
67
69
|
'bot.replicaCount': replicas,
|
|
68
70
|
'bot.txIntervalSeconds': txIntervalSeconds,
|
|
69
71
|
'bot.followChain': followChain,
|
|
72
|
+
'bot.pxeSyncChainTip': pxeSyncChainTip,
|
|
70
73
|
'bot.botPrivateKey': botPrivateKey,
|
|
71
74
|
'bot.nodeUrl': resolvedNodeUrl,
|
|
72
75
|
'bot.mnemonic': mnemonic,
|
|
@@ -8,6 +8,7 @@ const logger = createLogger('e2e:k8s-utils');
|
|
|
8
8
|
const testConfigSchema = z.object({
|
|
9
9
|
NAMESPACE: z.string().default('scenario'),
|
|
10
10
|
REAL_VERIFIER: schemas.Boolean.optional().default(true),
|
|
11
|
+
DEBUG_FORCE_TX_PROOF_VERIFICATION: schemas.Boolean.optional().default(true),
|
|
11
12
|
CREATE_ETH_DEVNET: schemas.Boolean.optional().default(false),
|
|
12
13
|
L1_RPC_URLS_JSON: z.string().optional(),
|
|
13
14
|
L1_ACCOUNT_MNEMONIC: z.string().optional(),
|
|
@@ -16,6 +17,7 @@ const testConfigSchema = z.object({
|
|
|
16
17
|
AZTEC_PROOF_SUBMISSION_WINDOW: z.coerce.number().optional().default(5),
|
|
17
18
|
AZTEC_LAG_IN_EPOCHS_FOR_VALIDATOR_SET: z.coerce.number().optional().default(2),
|
|
18
19
|
FUNDING_PRIVATE_KEY: z.string().optional(),
|
|
20
|
+
AZTEC_ADMIN_API_KEY: z.string().optional(),
|
|
19
21
|
});
|
|
20
22
|
|
|
21
23
|
export type TestConfig = z.infer<typeof testConfigSchema>;
|
|
@@ -25,6 +25,7 @@ export {
|
|
|
25
25
|
getRPCEndpoint,
|
|
26
26
|
getEthereumEndpoint,
|
|
27
27
|
createResilientPrometheusConnection,
|
|
28
|
+
scaleProverAgents,
|
|
28
29
|
} from './k8s.js';
|
|
29
30
|
|
|
30
31
|
// Chaos Mesh
|
|
@@ -40,6 +41,9 @@ export {
|
|
|
40
41
|
applyNetworkShaping,
|
|
41
42
|
} from './chaos.js';
|
|
42
43
|
|
|
44
|
+
// Helm
|
|
45
|
+
export { hasDeployedHelmRelease } from './helm.js';
|
|
46
|
+
|
|
43
47
|
// Bot management
|
|
44
48
|
export { restartBot, installTransferBot, uninstallTransferBot } from './bot.js';
|
|
45
49
|
|
|
@@ -62,3 +66,6 @@ export { getPublicViemClient, getL1DeploymentAddresses, getNodeClient } from './
|
|
|
62
66
|
|
|
63
67
|
// Health checks
|
|
64
68
|
export { ChainHealth, type ChainHealthSnapshot } from './health.js';
|
|
69
|
+
|
|
70
|
+
// Pod log extraction
|
|
71
|
+
export { type BlockBuiltLogEntry, fetchBlockBuiltLogs } from './pod_logs.js';
|
package/src/spartan/utils/k8s.ts
CHANGED
|
@@ -522,6 +522,14 @@ export function createResilientPrometheusConnection(
|
|
|
522
522
|
return { connect, runAlertCheck };
|
|
523
523
|
}
|
|
524
524
|
|
|
525
|
+
/** Scales the prover-agent Deployment to the given number of replicas. */
|
|
526
|
+
export async function scaleProverAgents(namespace: string, replicas: number, log: Logger): Promise<void> {
|
|
527
|
+
const label = 'app.kubernetes.io/component=prover-agent';
|
|
528
|
+
const command = `kubectl scale deployment -l ${label} -n ${namespace} --replicas=${replicas} --timeout=2m`;
|
|
529
|
+
log.info(`Scaling prover agents to ${replicas}: ${command}`);
|
|
530
|
+
await execAsync(command);
|
|
531
|
+
}
|
|
532
|
+
|
|
525
533
|
export function getChartDir(spartanDir: string, chartName: string) {
|
|
526
534
|
return path.join(spartanDir.trim(), chartName);
|
|
527
535
|
}
|