@aztec/end-to-end 0.0.1-commit.d1f2d6c → 0.0.1-commit.d431d1c
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 +1 -1
- package/dest/bench/client_flows/client_flows_benchmark.d.ts.map +1 -1
- package/dest/bench/client_flows/client_flows_benchmark.js +13 -28
- package/dest/bench/utils.d.ts +4 -5
- package/dest/bench/utils.d.ts.map +1 -1
- package/dest/bench/utils.js +7 -9
- package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts +1 -1
- 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 +8 -7
- package/dest/e2e_epochs/epochs_test.d.ts +1 -1
- package/dest/e2e_epochs/epochs_test.d.ts.map +1 -1
- package/dest/e2e_epochs/epochs_test.js +0 -3
- package/dest/e2e_fees/bridging_race.notest.js +1 -1
- 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 +6 -6
- package/dest/e2e_l1_publisher/write_json.d.ts +3 -3
- package/dest/e2e_l1_publisher/write_json.d.ts.map +1 -1
- 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 +2 -2
- package/dest/e2e_p2p/p2p_network.d.ts +1 -1
- package/dest/e2e_p2p/p2p_network.d.ts.map +1 -1
- package/dest/e2e_p2p/p2p_network.js +1 -4
- package/dest/e2e_p2p/shared.d.ts +6 -6
- package/dest/e2e_p2p/shared.d.ts.map +1 -1
- package/dest/e2e_p2p/shared.js +14 -7
- 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 +3 -3
- package/dest/fixtures/e2e_prover_test.d.ts +1 -1
- package/dest/fixtures/e2e_prover_test.d.ts.map +1 -1
- package/dest/fixtures/e2e_prover_test.js +4 -7
- package/dest/fixtures/setup.d.ts +1 -1
- package/dest/fixtures/setup.d.ts.map +1 -1
- package/dest/fixtures/setup.js +5 -5
- package/dest/fixtures/token_utils.d.ts +1 -1
- package/dest/fixtures/token_utils.d.ts.map +1 -1
- package/dest/fixtures/token_utils.js +4 -7
- package/dest/shared/cross_chain_test_harness.d.ts +4 -3
- package/dest/shared/cross_chain_test_harness.d.ts.map +1 -1
- package/dest/shared/cross_chain_test_harness.js +11 -11
- package/dest/shared/gas_portal_test_harness.js +1 -1
- package/dest/shared/submit-transactions.d.ts +3 -3
- package/dest/shared/submit-transactions.d.ts.map +1 -1
- package/dest/shared/submit-transactions.js +11 -9
- 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 +12 -12
- package/dest/simulators/lending_simulator.js +2 -2
- 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 +34 -61
- package/dest/spartan/tx_metrics.d.ts +2 -4
- package/dest/spartan/tx_metrics.d.ts.map +1 -1
- package/dest/spartan/tx_metrics.js +4 -28
- package/dest/spartan/utils.d.ts +260 -2
- package/dest/spartan/utils.d.ts.map +1 -1
- package/dest/spartan/utils.js +942 -1
- package/package.json +39 -39
- package/src/bench/client_flows/client_flows_benchmark.ts +24 -11
- package/src/bench/utils.ts +7 -9
- package/src/e2e_blacklist_token_contract/blacklist_token_contract_test.ts +12 -9
- package/src/e2e_epochs/epochs_test.ts +24 -29
- package/src/e2e_fees/bridging_race.notest.ts +4 -1
- package/src/e2e_fees/fees_test.ts +14 -10
- package/src/e2e_l1_publisher/write_json.ts +2 -2
- package/src/e2e_nested_contract/nested_contract_test.ts +4 -2
- package/src/e2e_p2p/p2p_network.ts +9 -14
- package/src/e2e_p2p/shared.ts +20 -10
- package/src/e2e_token_contract/token_contract_test.ts +5 -3
- package/src/fixtures/e2e_prover_test.ts +8 -3
- package/src/fixtures/setup.ts +12 -8
- package/src/fixtures/token_utils.ts +5 -6
- package/src/shared/cross_chain_test_harness.ts +27 -13
- package/src/shared/gas_portal_test_harness.ts +1 -1
- package/src/shared/submit-transactions.ts +15 -9
- package/src/shared/uniswap_l1_l2.ts +19 -12
- package/src/simulators/lending_simulator.ts +2 -2
- package/src/spartan/setup_test_wallets.ts +24 -72
- package/src/spartan/tx_metrics.ts +7 -26
- package/src/spartan/utils.ts +1246 -1
- package/dest/spartan/utils/bot.d.ts +0 -27
- package/dest/spartan/utils/bot.d.ts.map +0 -1
- package/dest/spartan/utils/bot.js +0 -141
- package/dest/spartan/utils/chaos.d.ts +0 -79
- package/dest/spartan/utils/chaos.d.ts.map +0 -1
- package/dest/spartan/utils/chaos.js +0 -142
- package/dest/spartan/utils/clients.d.ts +0 -39
- package/dest/spartan/utils/clients.d.ts.map +0 -1
- package/dest/spartan/utils/clients.js +0 -90
- package/dest/spartan/utils/config.d.ts +0 -36
- package/dest/spartan/utils/config.d.ts.map +0 -1
- package/dest/spartan/utils/config.js +0 -20
- package/dest/spartan/utils/health.d.ts +0 -63
- package/dest/spartan/utils/health.d.ts.map +0 -1
- package/dest/spartan/utils/health.js +0 -202
- package/dest/spartan/utils/helm.d.ts +0 -15
- package/dest/spartan/utils/helm.d.ts.map +0 -1
- package/dest/spartan/utils/helm.js +0 -47
- package/dest/spartan/utils/index.d.ts +0 -9
- package/dest/spartan/utils/index.d.ts.map +0 -1
- package/dest/spartan/utils/index.js +0 -18
- package/dest/spartan/utils/k8s.d.ts +0 -98
- package/dest/spartan/utils/k8s.d.ts.map +0 -1
- package/dest/spartan/utils/k8s.js +0 -257
- package/dest/spartan/utils/nodes.d.ts +0 -31
- package/dest/spartan/utils/nodes.d.ts.map +0 -1
- package/dest/spartan/utils/nodes.js +0 -290
- package/dest/spartan/utils/scripts.d.ts +0 -16
- package/dest/spartan/utils/scripts.d.ts.map +0 -1
- package/dest/spartan/utils/scripts.js +0 -66
- package/src/spartan/utils/bot.ts +0 -185
- package/src/spartan/utils/chaos.ts +0 -253
- package/src/spartan/utils/clients.ts +0 -100
- package/src/spartan/utils/config.ts +0 -26
- package/src/spartan/utils/health.ts +0 -255
- package/src/spartan/utils/helm.ts +0 -84
- package/src/spartan/utils/index.ts +0 -62
- package/src/spartan/utils/k8s.ts +0 -375
- package/src/spartan/utils/nodes.ts +0 -323
- package/src/spartan/utils/scripts.ts +0 -63
package/src/fixtures/setup.ts
CHANGED
|
@@ -629,7 +629,7 @@ export async function setup(
|
|
|
629
629
|
`${numberOfAccounts} accounts are being deployed. Reliably progressing past genesis by setting minTxsPerBlock to 1 and waiting for the accounts to be deployed`,
|
|
630
630
|
);
|
|
631
631
|
const accountsData = initialFundedAccounts.slice(0, numberOfAccounts);
|
|
632
|
-
const accountManagers = await deployFundedSchnorrAccounts(wallet, accountsData);
|
|
632
|
+
const accountManagers = await deployFundedSchnorrAccounts(wallet, aztecNodeService, accountsData);
|
|
633
633
|
accounts = accountManagers.map(accountManager => accountManager.address);
|
|
634
634
|
} else if (needsEmptyBlock) {
|
|
635
635
|
logger.info('No accounts are being deployed, waiting for an empty block 1 to be mined');
|
|
@@ -921,11 +921,13 @@ export async function ensureAccountContractsPublished(wallet: Wallet, accountsTo
|
|
|
921
921
|
).map(contractMetadata => contractMetadata.instance);
|
|
922
922
|
const contractClass = await getContractClassFromArtifact(SchnorrAccountContractArtifact);
|
|
923
923
|
if (!(await wallet.getContractClassMetadata(contractClass.id)).isContractClassPubliclyRegistered) {
|
|
924
|
-
await (await publishContractClass(wallet, SchnorrAccountContractArtifact))
|
|
924
|
+
await (await publishContractClass(wallet, SchnorrAccountContractArtifact))
|
|
925
|
+
.send({ from: accountsToDeploy[0] })
|
|
926
|
+
.wait();
|
|
925
927
|
}
|
|
926
928
|
const requests = instances.map(instance => publishInstance(wallet, instance!));
|
|
927
929
|
const batch = new BatchCall(wallet, requests);
|
|
928
|
-
await batch.send({ from: accountsToDeploy[0] });
|
|
930
|
+
await batch.send({ from: accountsToDeploy[0] }).wait();
|
|
929
931
|
}
|
|
930
932
|
|
|
931
933
|
/**
|
|
@@ -949,10 +951,12 @@ export const deployAccounts =
|
|
|
949
951
|
deployedAccounts[i].signingKey,
|
|
950
952
|
);
|
|
951
953
|
const deployMethod = await accountManager.getDeployMethod();
|
|
952
|
-
await deployMethod
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
954
|
+
await deployMethod
|
|
955
|
+
.send({
|
|
956
|
+
from: AztecAddress.ZERO,
|
|
957
|
+
skipClassPublication: i !== 0, // Publish the contract class at most once.
|
|
958
|
+
})
|
|
959
|
+
.wait();
|
|
956
960
|
}
|
|
957
961
|
|
|
958
962
|
return { deployedAccounts };
|
|
@@ -982,7 +986,7 @@ export async function publicDeployAccounts(
|
|
|
982
986
|
|
|
983
987
|
const batch = new BatchCall(wallet, calls);
|
|
984
988
|
|
|
985
|
-
const txReceipt = await batch.send({ from: accountsToDeploy[0] });
|
|
989
|
+
const txReceipt = await batch.send({ from: accountsToDeploy[0] }).wait();
|
|
986
990
|
if (waitUntilProven) {
|
|
987
991
|
if (!node) {
|
|
988
992
|
throw new Error('Need to provide an AztecNode to wait for proven.');
|
|
@@ -6,10 +6,9 @@ import { TokenContract } from '@aztec/noir-contracts.js/Token';
|
|
|
6
6
|
|
|
7
7
|
export async function deployToken(wallet: Wallet, admin: AztecAddress, initialAdminBalance: bigint, logger: Logger) {
|
|
8
8
|
logger.info(`Deploying Token contract...`);
|
|
9
|
-
const { contract, instance } = await TokenContract.deploy(wallet, admin, 'TokenName', 'TokenSymbol', 18)
|
|
10
|
-
from: admin
|
|
11
|
-
wait
|
|
12
|
-
});
|
|
9
|
+
const { contract, instance } = await TokenContract.deploy(wallet, admin, 'TokenName', 'TokenSymbol', 18)
|
|
10
|
+
.send({ from: admin })
|
|
11
|
+
.wait();
|
|
13
12
|
|
|
14
13
|
if (initialAdminBalance > 0n) {
|
|
15
14
|
await mintTokensToPrivate(contract, admin, admin, initialAdminBalance);
|
|
@@ -26,7 +25,7 @@ export async function mintTokensToPrivate(
|
|
|
26
25
|
recipient: AztecAddress,
|
|
27
26
|
amount: bigint,
|
|
28
27
|
) {
|
|
29
|
-
await token.methods.mint_to_private(recipient, amount).send({ from: minter });
|
|
28
|
+
await token.methods.mint_to_private(recipient, amount).send({ from: minter }).wait();
|
|
30
29
|
}
|
|
31
30
|
|
|
32
31
|
export async function expectTokenBalance(
|
|
@@ -56,7 +55,7 @@ export async function mintNotes(
|
|
|
56
55
|
for (let mintedNotes = 0; mintedNotes < noteAmounts.length; mintedNotes += notesPerIteration) {
|
|
57
56
|
const toMint = noteAmounts.slice(mintedNotes, mintedNotes + notesPerIteration);
|
|
58
57
|
const actions = toMint.map(amt => asset.methods.mint_to_private(recipient, amt));
|
|
59
|
-
await new BatchCall(wallet, actions).send({ from: minter });
|
|
58
|
+
await new BatchCall(wallet, actions).send({ from: minter }).wait();
|
|
60
59
|
}
|
|
61
60
|
|
|
62
61
|
return noteAmounts.reduce((prev, curr) => prev + curr, 0n);
|
|
@@ -18,6 +18,7 @@ import type { L1ContractAddresses } from '@aztec/ethereum/l1-contract-addresses'
|
|
|
18
18
|
import type { ExtendedViemWalletClient } from '@aztec/ethereum/types';
|
|
19
19
|
import { EpochNumber } from '@aztec/foundation/branded-types';
|
|
20
20
|
import { retryUntil } from '@aztec/foundation/retry';
|
|
21
|
+
import type { FieldsOf } from '@aztec/foundation/types';
|
|
21
22
|
import { TestERC20Abi, TokenPortalAbi, TokenPortalBytecode } from '@aztec/l1-artifacts';
|
|
22
23
|
import { TokenContract } from '@aztec/noir-contracts.js/Token';
|
|
23
24
|
import { TokenBridgeContract } from '@aztec/noir-contracts.js/TokenBridge';
|
|
@@ -73,10 +74,14 @@ export async function deployAndInitializeTokenAndBridgeContracts(
|
|
|
73
74
|
});
|
|
74
75
|
|
|
75
76
|
// deploy l2 token
|
|
76
|
-
const token = await TokenContract.deploy(wallet, owner, 'TokenName', 'TokenSymbol', 18)
|
|
77
|
+
const token = await TokenContract.deploy(wallet, owner, 'TokenName', 'TokenSymbol', 18)
|
|
78
|
+
.send({ from: owner })
|
|
79
|
+
.deployed();
|
|
77
80
|
|
|
78
81
|
// deploy l2 token bridge and attach to the portal
|
|
79
|
-
const bridge = await TokenBridgeContract.deploy(wallet, token.address, tokenPortalAddress)
|
|
82
|
+
const bridge = await TokenBridgeContract.deploy(wallet, token.address, tokenPortalAddress)
|
|
83
|
+
.send({ from: owner })
|
|
84
|
+
.deployed();
|
|
80
85
|
|
|
81
86
|
if ((await token.methods.get_admin().simulate({ from: owner })) !== owner.toBigInt()) {
|
|
82
87
|
throw new Error(`Token admin is not ${owner}`);
|
|
@@ -87,7 +92,7 @@ export async function deployAndInitializeTokenAndBridgeContracts(
|
|
|
87
92
|
}
|
|
88
93
|
|
|
89
94
|
// make the bridge a minter on the token:
|
|
90
|
-
await token.methods.set_minter(bridge.address, true).send({ from: owner });
|
|
95
|
+
await token.methods.set_minter(bridge.address, true).send({ from: owner }).wait();
|
|
91
96
|
if ((await token.methods.is_minter(bridge.address).simulate({ from: owner })) === 1n) {
|
|
92
97
|
throw new Error(`Bridge is not a minter`);
|
|
93
98
|
}
|
|
@@ -230,7 +235,7 @@ export class CrossChainTestHarness {
|
|
|
230
235
|
|
|
231
236
|
async mintTokensPublicOnL2(amount: bigint) {
|
|
232
237
|
this.logger.info('Minting tokens on L2 publicly');
|
|
233
|
-
await this.l2Token.methods.mint_to_public(this.ownerAddress, amount).send({ from: this.ownerAddress });
|
|
238
|
+
await this.l2Token.methods.mint_to_public(this.ownerAddress, amount).send({ from: this.ownerAddress }).wait();
|
|
234
239
|
}
|
|
235
240
|
|
|
236
241
|
async mintTokensPrivateOnL2(amount: bigint) {
|
|
@@ -241,7 +246,8 @@ export class CrossChainTestHarness {
|
|
|
241
246
|
// send a transfer tx to force through rollup with the message included
|
|
242
247
|
await this.l2Token.methods
|
|
243
248
|
.transfer_in_public(this.ownerAddress, receiverAddress, transferAmount, 0)
|
|
244
|
-
.send({ from: this.ownerAddress })
|
|
249
|
+
.send({ from: this.ownerAddress })
|
|
250
|
+
.wait();
|
|
245
251
|
}
|
|
246
252
|
|
|
247
253
|
async consumeMessageOnAztecAndMintPrivately(
|
|
@@ -251,7 +257,8 @@ export class CrossChainTestHarness {
|
|
|
251
257
|
const { recipient, claimAmount, claimSecret: secretForL2MessageConsumption, messageLeafIndex } = claim;
|
|
252
258
|
await this.l2Bridge.methods
|
|
253
259
|
.claim_private(recipient, claimAmount, secretForL2MessageConsumption, messageLeafIndex)
|
|
254
|
-
.send({ from: this.ownerAddress })
|
|
260
|
+
.send({ from: this.ownerAddress })
|
|
261
|
+
.wait();
|
|
255
262
|
}
|
|
256
263
|
|
|
257
264
|
async consumeMessageOnAztecAndMintPublicly(
|
|
@@ -261,25 +268,28 @@ export class CrossChainTestHarness {
|
|
|
261
268
|
const { claimAmount, claimSecret, messageLeafIndex } = claim;
|
|
262
269
|
await this.l2Bridge.methods
|
|
263
270
|
.claim_public(this.ownerAddress, claimAmount, claimSecret, messageLeafIndex)
|
|
264
|
-
.send({ from: this.ownerAddress })
|
|
271
|
+
.send({ from: this.ownerAddress })
|
|
272
|
+
.wait();
|
|
265
273
|
}
|
|
266
274
|
|
|
267
275
|
async withdrawPrivateFromAztecToL1(
|
|
268
276
|
withdrawAmount: bigint,
|
|
269
277
|
authwitNonce: Fr = Fr.ZERO,
|
|
270
278
|
authWitness: AuthWitness,
|
|
271
|
-
): Promise<TxReceipt
|
|
279
|
+
): Promise<FieldsOf<TxReceipt>> {
|
|
272
280
|
const withdrawReceipt = await this.l2Bridge.methods
|
|
273
281
|
.exit_to_l1_private(this.l2Token.address, this.ethAccount, withdrawAmount, EthAddress.ZERO, authwitNonce)
|
|
274
|
-
.send({ authWitnesses: [authWitness], from: this.ownerAddress })
|
|
282
|
+
.send({ authWitnesses: [authWitness], from: this.ownerAddress })
|
|
283
|
+
.wait();
|
|
275
284
|
|
|
276
285
|
return withdrawReceipt;
|
|
277
286
|
}
|
|
278
287
|
|
|
279
|
-
async withdrawPublicFromAztecToL1(withdrawAmount: bigint, authwitNonce: Fr = Fr.ZERO): Promise<TxReceipt
|
|
288
|
+
async withdrawPublicFromAztecToL1(withdrawAmount: bigint, authwitNonce: Fr = Fr.ZERO): Promise<FieldsOf<TxReceipt>> {
|
|
280
289
|
const withdrawReceipt = await this.l2Bridge.methods
|
|
281
290
|
.exit_to_l1_public(this.ethAccount, withdrawAmount, EthAddress.ZERO, authwitNonce)
|
|
282
|
-
.send({ from: this.ownerAddress })
|
|
291
|
+
.send({ from: this.ownerAddress })
|
|
292
|
+
.wait();
|
|
283
293
|
|
|
284
294
|
return withdrawReceipt;
|
|
285
295
|
}
|
|
@@ -323,14 +333,18 @@ export class CrossChainTestHarness {
|
|
|
323
333
|
|
|
324
334
|
async transferToPrivateOnL2(shieldAmount: bigint) {
|
|
325
335
|
this.logger.info('Transferring to private on L2');
|
|
326
|
-
await this.l2Token.methods
|
|
336
|
+
await this.l2Token.methods
|
|
337
|
+
.transfer_to_private(this.ownerAddress, shieldAmount)
|
|
338
|
+
.send({ from: this.ownerAddress })
|
|
339
|
+
.wait();
|
|
327
340
|
}
|
|
328
341
|
|
|
329
342
|
async transferToPublicOnL2(amount: bigint, authwitNonce = Fr.ZERO) {
|
|
330
343
|
this.logger.info('Transferring tokens to public');
|
|
331
344
|
await this.l2Token.methods
|
|
332
345
|
.transfer_to_public(this.ownerAddress, this.ownerAddress, amount, authwitNonce)
|
|
333
|
-
.send({ from: this.ownerAddress })
|
|
346
|
+
.send({ from: this.ownerAddress })
|
|
347
|
+
.wait();
|
|
334
348
|
}
|
|
335
349
|
|
|
336
350
|
/**
|
|
@@ -127,7 +127,7 @@ export class GasBridgingTestHarness implements IGasBridgingTestHarness {
|
|
|
127
127
|
async consumeMessageOnAztecAndClaimPrivately(owner: AztecAddress, claimer: AztecAddress, claim: L2AmountClaim) {
|
|
128
128
|
this.logger.info('Consuming messages on L2 Privately');
|
|
129
129
|
const { claimAmount, claimSecret, messageLeafIndex } = claim;
|
|
130
|
-
await this.feeJuice.methods.claim(owner, claimAmount, claimSecret, messageLeafIndex).send({ from: claimer });
|
|
130
|
+
await this.feeJuice.methods.claim(owner, claimAmount, claimSecret, messageLeafIndex).send({ from: claimer }).wait();
|
|
131
131
|
}
|
|
132
132
|
|
|
133
133
|
async getL2PublicBalanceOf(owner: AztecAddress) {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { AztecAddress } from '@aztec/aztec.js/addresses';
|
|
2
|
-
import {
|
|
2
|
+
import type { SentTx } from '@aztec/aztec.js/contracts';
|
|
3
3
|
import { Fr, GrumpkinScalar } from '@aztec/aztec.js/fields';
|
|
4
4
|
import type { Logger } from '@aztec/aztec.js/log';
|
|
5
|
-
import {
|
|
5
|
+
import { TxStatus } from '@aztec/aztec.js/tx';
|
|
6
6
|
import { times } from '@aztec/foundation/collection';
|
|
7
7
|
import type { TestWallet } from '@aztec/test-wallet/server';
|
|
8
8
|
|
|
@@ -12,20 +12,26 @@ export const submitTxsTo = async (
|
|
|
12
12
|
submitter: AztecAddress,
|
|
13
13
|
numTxs: number,
|
|
14
14
|
logger: Logger,
|
|
15
|
-
): Promise<
|
|
16
|
-
const
|
|
15
|
+
): Promise<SentTx[]> => {
|
|
16
|
+
const txs: SentTx[] = [];
|
|
17
17
|
await Promise.all(
|
|
18
18
|
times(numTxs, async () => {
|
|
19
19
|
const accountManager = await wallet.createSchnorrAccount(Fr.random(), Fr.random(), GrumpkinScalar.random());
|
|
20
20
|
const deployMethod = await accountManager.getDeployMethod();
|
|
21
|
-
const
|
|
21
|
+
const tx = deployMethod.send({ from: submitter });
|
|
22
|
+
const txHash = await tx.getTxHash();
|
|
22
23
|
|
|
23
24
|
logger.info(`Tx sent with hash ${txHash}`);
|
|
24
|
-
const receipt
|
|
25
|
-
expect(receipt
|
|
25
|
+
const receipt = await tx.getReceipt();
|
|
26
|
+
expect(receipt).toEqual(
|
|
27
|
+
expect.objectContaining({
|
|
28
|
+
status: TxStatus.PENDING,
|
|
29
|
+
error: '',
|
|
30
|
+
}),
|
|
31
|
+
);
|
|
26
32
|
logger.info(`Receipt received for ${txHash}`);
|
|
27
|
-
|
|
33
|
+
txs.push(tx);
|
|
28
34
|
}),
|
|
29
35
|
);
|
|
30
|
-
return
|
|
36
|
+
return txs;
|
|
31
37
|
};
|
|
@@ -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)
|
|
133
|
+
uniswapL2Contract = await UniswapContract.deploy(wallet, uniswapPortalAddress)
|
|
134
|
+
.send({ from: ownerAddress })
|
|
135
|
+
.deployed();
|
|
134
136
|
|
|
135
137
|
const registryAddress = (await aztecNode.getNodeInfo()).l1ContractAddresses.registryAddress;
|
|
136
138
|
|
|
@@ -207,7 +209,8 @@ export const uniswapL1L2TestSuite = (
|
|
|
207
209
|
secretHashForDepositingSwappedDai,
|
|
208
210
|
ownerEthAddress,
|
|
209
211
|
)
|
|
210
|
-
.send({ from: ownerAddress, authWitnesses: [transferToPublicAuhtwit] })
|
|
212
|
+
.send({ from: ownerAddress, authWitnesses: [transferToPublicAuhtwit] })
|
|
213
|
+
.wait();
|
|
211
214
|
|
|
212
215
|
const swapPrivateFunction = 'swap_private(address,uint256,uint24,address,uint256,bytes32,address)';
|
|
213
216
|
const swapPrivateContent = sha256ToField([
|
|
@@ -425,10 +428,10 @@ export const uniswapL1L2TestSuite = (
|
|
|
425
428
|
// ownerEthAddress,
|
|
426
429
|
// nonceForSwap,
|
|
427
430
|
// );
|
|
428
|
-
// await ownerWallet.setPublicAuthWit({ caller: sponsorAddress, action }, true).send();
|
|
431
|
+
// await ownerWallet.setPublicAuthWit({ caller: sponsorAddress, action }, true).send().wait();
|
|
429
432
|
|
|
430
433
|
// // 4.2 Call swap_public from user2 on behalf of owner
|
|
431
|
-
// const uniswapL2Interaction = await action.send();
|
|
434
|
+
// const uniswapL2Interaction = await action.send().wait();
|
|
432
435
|
|
|
433
436
|
// const swapPublicContent = sha256ToField([
|
|
434
437
|
// Buffer.from(
|
|
@@ -646,7 +649,8 @@ export const uniswapL1L2TestSuite = (
|
|
|
646
649
|
Fr.random(),
|
|
647
650
|
ownerEthAddress,
|
|
648
651
|
)
|
|
649
|
-
.send({ from: ownerAddress, authWitnesses: [transferToPublicAuthwith] })
|
|
652
|
+
.send({ from: ownerAddress, authWitnesses: [transferToPublicAuthwith] })
|
|
653
|
+
.wait(),
|
|
650
654
|
).rejects.toThrow('Assertion failed: input_asset address is not the same as seen in the bridge contract');
|
|
651
655
|
});
|
|
652
656
|
|
|
@@ -671,7 +675,7 @@ export const uniswapL1L2TestSuite = (
|
|
|
671
675
|
},
|
|
672
676
|
true,
|
|
673
677
|
);
|
|
674
|
-
await validateActionInteraction.send();
|
|
678
|
+
await validateActionInteraction.send().wait();
|
|
675
679
|
|
|
676
680
|
// No approval to call `swap` but should work even without it:
|
|
677
681
|
const [_, secretHashForDepositingSwappedDai] = await generateClaimSecret();
|
|
@@ -690,7 +694,8 @@ export const uniswapL1L2TestSuite = (
|
|
|
690
694
|
ownerEthAddress,
|
|
691
695
|
Fr.ZERO, // nonce for swap -> doesn't matter
|
|
692
696
|
)
|
|
693
|
-
.send({ from: ownerAddress })
|
|
697
|
+
.send({ from: ownerAddress })
|
|
698
|
+
.wait();
|
|
694
699
|
// check weth balance of owner on L2 (we first bridged `wethAmountToBridge` into L2 and now withdrew it!)
|
|
695
700
|
await wethCrossChainHarness.expectPublicBalanceOnL2(ownerAddress, 0n);
|
|
696
701
|
});
|
|
@@ -720,7 +725,7 @@ export const uniswapL1L2TestSuite = (
|
|
|
720
725
|
{ caller: approvedUser, action },
|
|
721
726
|
true,
|
|
722
727
|
);
|
|
723
|
-
await validateActionInteraction.send();
|
|
728
|
+
await validateActionInteraction.send().wait();
|
|
724
729
|
|
|
725
730
|
await expect(action.simulate({ from: sponsorAddress })).rejects.toThrow(/unauthorized/);
|
|
726
731
|
});
|
|
@@ -742,7 +747,7 @@ export const uniswapL1L2TestSuite = (
|
|
|
742
747
|
},
|
|
743
748
|
true,
|
|
744
749
|
);
|
|
745
|
-
await validateActionInteraction.send();
|
|
750
|
+
await validateActionInteraction.send().wait();
|
|
746
751
|
|
|
747
752
|
await expect(
|
|
748
753
|
uniswapL2Contract.methods
|
|
@@ -799,7 +804,8 @@ export const uniswapL1L2TestSuite = (
|
|
|
799
804
|
secretHashForDepositingSwappedDai,
|
|
800
805
|
ownerEthAddress,
|
|
801
806
|
)
|
|
802
|
-
.send({ from: ownerAddress, authWitnesses: [transferToPublicAuhtwit] })
|
|
807
|
+
.send({ from: ownerAddress, authWitnesses: [transferToPublicAuhtwit] })
|
|
808
|
+
.wait();
|
|
803
809
|
|
|
804
810
|
const swapPrivateContent = sha256ToField([
|
|
805
811
|
Buffer.from(
|
|
@@ -912,7 +918,7 @@ export const uniswapL1L2TestSuite = (
|
|
|
912
918
|
},
|
|
913
919
|
true,
|
|
914
920
|
);
|
|
915
|
-
await validateActionInteraction.send();
|
|
921
|
+
await validateActionInteraction.send().wait();
|
|
916
922
|
|
|
917
923
|
// Call swap_public on L2
|
|
918
924
|
const secretHashForDepositingSwappedDai = Fr.random();
|
|
@@ -930,7 +936,8 @@ export const uniswapL1L2TestSuite = (
|
|
|
930
936
|
ownerEthAddress,
|
|
931
937
|
Fr.ZERO,
|
|
932
938
|
)
|
|
933
|
-
.send({ from: ownerAddress })
|
|
939
|
+
.send({ from: ownerAddress })
|
|
940
|
+
.wait();
|
|
934
941
|
|
|
935
942
|
const swapPublicContent = sha256ToField([
|
|
936
943
|
Buffer.from(
|
|
@@ -4,7 +4,7 @@ import { Fr } from '@aztec/aztec.js/fields';
|
|
|
4
4
|
import { CheatCodes } from '@aztec/aztec/testing';
|
|
5
5
|
import type { RollupContract } from '@aztec/ethereum/contracts';
|
|
6
6
|
import { SlotNumber } from '@aztec/foundation/branded-types';
|
|
7
|
-
import {
|
|
7
|
+
import { pedersenHash } from '@aztec/foundation/crypto/pedersen';
|
|
8
8
|
import type { TestDateProvider } from '@aztec/foundation/timer';
|
|
9
9
|
import type { LendingContract } from '@aztec/noir-contracts.js/Lending';
|
|
10
10
|
|
|
@@ -29,7 +29,7 @@ export class LendingAccount {
|
|
|
29
29
|
* @returns Key in public space
|
|
30
30
|
*/
|
|
31
31
|
public key() {
|
|
32
|
-
return
|
|
32
|
+
return pedersenHash([this.address, this.secret]);
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
35
|
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { generateSchnorrAccounts } from '@aztec/accounts/testing';
|
|
2
2
|
import { AztecAddress } from '@aztec/aztec.js/addresses';
|
|
3
|
-
import { NO_WAIT } from '@aztec/aztec.js/contracts';
|
|
4
3
|
import { L1FeeJuicePortalManager } from '@aztec/aztec.js/ethereum';
|
|
5
4
|
import { FeeJuicePaymentMethodWithClaim } from '@aztec/aztec.js/fee';
|
|
6
5
|
import { type FeePaymentMethod, SponsoredFeePaymentMethod } from '@aztec/aztec.js/fee';
|
|
7
6
|
import { Fr } from '@aztec/aztec.js/fields';
|
|
8
|
-
import { type AztecNode, createAztecNodeClient
|
|
7
|
+
import { type AztecNode, createAztecNodeClient } from '@aztec/aztec.js/node';
|
|
9
8
|
import type { Wallet } from '@aztec/aztec.js/wallet';
|
|
10
9
|
import { createEthereumChain } from '@aztec/ethereum/chain';
|
|
11
10
|
import { createExtendedL1Client } from '@aztec/ethereum/client';
|
|
@@ -85,11 +84,11 @@ export async function deploySponsoredTestAccountsWithTokens(
|
|
|
85
84
|
|
|
86
85
|
const paymentMethod = new SponsoredFeePaymentMethod(await getSponsoredFPCAddress());
|
|
87
86
|
const recipientDeployMethod = await recipientAccount.getDeployMethod();
|
|
88
|
-
await recipientDeployMethod.send({ from: AztecAddress.ZERO, fee: { paymentMethod }
|
|
87
|
+
await recipientDeployMethod.send({ from: AztecAddress.ZERO, fee: { paymentMethod } }).wait({ timeout: 2400 });
|
|
89
88
|
await Promise.all(
|
|
90
89
|
fundedAccounts.map(async a => {
|
|
91
90
|
const deployMethod = await a.getDeployMethod();
|
|
92
|
-
await deployMethod.send({ from: AztecAddress.ZERO, fee: { paymentMethod }
|
|
91
|
+
await deployMethod.send({ from: AztecAddress.ZERO, fee: { paymentMethod } }).wait({ timeout: 2400 }); // increase timeout on purpose in order to account for two empty epochs
|
|
93
92
|
logger.info(`Account deployed at ${a.address}`);
|
|
94
93
|
}),
|
|
95
94
|
);
|
|
@@ -117,55 +116,6 @@ export async function deploySponsoredTestAccountsWithTokens(
|
|
|
117
116
|
};
|
|
118
117
|
}
|
|
119
118
|
|
|
120
|
-
async function deployAccountWithDiagnostics(
|
|
121
|
-
account: { getDeployMethod: () => Promise<{ send: (opts: any) => any }>; address: any },
|
|
122
|
-
paymentMethod: SponsoredFeePaymentMethod,
|
|
123
|
-
aztecNode: AztecNode,
|
|
124
|
-
logger: Logger,
|
|
125
|
-
accountLabel: string,
|
|
126
|
-
): Promise<void> {
|
|
127
|
-
const deployMethod = await account.getDeployMethod();
|
|
128
|
-
let txHash;
|
|
129
|
-
try {
|
|
130
|
-
txHash = await deployMethod.send({ from: AztecAddress.ZERO, fee: { paymentMethod }, wait: NO_WAIT });
|
|
131
|
-
await waitForTx(aztecNode, txHash, { timeout: 2400 });
|
|
132
|
-
logger.info(`${accountLabel} deployed at ${account.address}`);
|
|
133
|
-
} catch (error) {
|
|
134
|
-
const blockNumber = await aztecNode.getBlockNumber();
|
|
135
|
-
let receipt;
|
|
136
|
-
try {
|
|
137
|
-
receipt = await aztecNode.getTxReceipt(txHash);
|
|
138
|
-
} catch {
|
|
139
|
-
receipt = 'unavailable';
|
|
140
|
-
}
|
|
141
|
-
logger.error(`${accountLabel} deployment failed`, {
|
|
142
|
-
txHash: txHash.toString(),
|
|
143
|
-
receipt: JSON.stringify(receipt),
|
|
144
|
-
currentBlockNumber: blockNumber,
|
|
145
|
-
error: String(error),
|
|
146
|
-
});
|
|
147
|
-
throw error;
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
async function deployAccountsInBatches(
|
|
152
|
-
accounts: { getDeployMethod: () => Promise<{ send: (opts: any) => any }>; address: any }[],
|
|
153
|
-
paymentMethod: SponsoredFeePaymentMethod,
|
|
154
|
-
aztecNode: AztecNode,
|
|
155
|
-
logger: Logger,
|
|
156
|
-
labelPrefix: string,
|
|
157
|
-
batchSize = 2,
|
|
158
|
-
): Promise<void> {
|
|
159
|
-
for (let i = 0; i < accounts.length; i += batchSize) {
|
|
160
|
-
const batch = accounts.slice(i, i + batchSize);
|
|
161
|
-
await Promise.all(
|
|
162
|
-
batch.map((account, idx) =>
|
|
163
|
-
deployAccountWithDiagnostics(account, paymentMethod, aztecNode, logger, `${labelPrefix}${i + idx + 1}`),
|
|
164
|
-
),
|
|
165
|
-
);
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
|
|
169
119
|
export async function deploySponsoredTestAccounts(
|
|
170
120
|
wallet: TestWallet,
|
|
171
121
|
aztecNode: AztecNode,
|
|
@@ -179,9 +129,15 @@ export async function deploySponsoredTestAccounts(
|
|
|
179
129
|
await registerSponsoredFPC(wallet);
|
|
180
130
|
|
|
181
131
|
const paymentMethod = new SponsoredFeePaymentMethod(await getSponsoredFPCAddress());
|
|
182
|
-
|
|
183
|
-
await
|
|
184
|
-
await
|
|
132
|
+
const recipientDeployMethod = await recipientAccount.getDeployMethod();
|
|
133
|
+
await recipientDeployMethod.send({ from: AztecAddress.ZERO, fee: { paymentMethod } }).wait({ timeout: 2400 });
|
|
134
|
+
await Promise.all(
|
|
135
|
+
fundedAccounts.map(async a => {
|
|
136
|
+
const deployMethod = await a.getDeployMethod();
|
|
137
|
+
await deployMethod.send({ from: AztecAddress.ZERO, fee: { paymentMethod } }).wait({ timeout: 2400 }); // increase timeout on purpose in order to account for two empty epochs
|
|
138
|
+
logger.info(`Account deployed at ${a.address}`);
|
|
139
|
+
}),
|
|
140
|
+
);
|
|
185
141
|
|
|
186
142
|
return {
|
|
187
143
|
aztecNode,
|
|
@@ -219,7 +175,7 @@ export async function deployTestAccountsWithTokens(
|
|
|
219
175
|
fundedAccounts.map(async (a, i) => {
|
|
220
176
|
const paymentMethod = new FeeJuicePaymentMethodWithClaim(a.address, claims[i]);
|
|
221
177
|
const deployMethod = await a.getDeployMethod();
|
|
222
|
-
await deployMethod.send({ from: AztecAddress.ZERO, fee: { paymentMethod } });
|
|
178
|
+
await deployMethod.send({ from: AztecAddress.ZERO, fee: { paymentMethod } }).wait();
|
|
223
179
|
logger.info(`Account deployed at ${a.address}`);
|
|
224
180
|
}),
|
|
225
181
|
);
|
|
@@ -295,19 +251,14 @@ async function deployTokenAndMint(
|
|
|
295
251
|
logger: Logger,
|
|
296
252
|
) {
|
|
297
253
|
logger.verbose(`Deploying TokenContract...`);
|
|
298
|
-
const
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
fee: {
|
|
307
|
-
paymentMethod,
|
|
308
|
-
},
|
|
309
|
-
wait: { timeout: 600, returnReceipt: true },
|
|
310
|
-
});
|
|
254
|
+
const tokenContract = await TokenContract.deploy(wallet, admin, TOKEN_NAME, TOKEN_SYMBOL, TOKEN_DECIMALS)
|
|
255
|
+
.send({
|
|
256
|
+
from: admin,
|
|
257
|
+
fee: {
|
|
258
|
+
paymentMethod,
|
|
259
|
+
},
|
|
260
|
+
})
|
|
261
|
+
.deployed({ timeout: 600 });
|
|
311
262
|
|
|
312
263
|
const tokenAddress = tokenContract.address;
|
|
313
264
|
|
|
@@ -317,7 +268,8 @@ async function deployTokenAndMint(
|
|
|
317
268
|
accounts.map(acc =>
|
|
318
269
|
TokenContract.at(tokenAddress, wallet)
|
|
319
270
|
.methods.mint_to_public(acc, mintAmount)
|
|
320
|
-
.send({ from: admin, fee: { paymentMethod }
|
|
271
|
+
.send({ from: admin, fee: { paymentMethod } })
|
|
272
|
+
.wait({ timeout: 600 }),
|
|
321
273
|
),
|
|
322
274
|
);
|
|
323
275
|
|
|
@@ -357,7 +309,7 @@ export async function performTransfers({
|
|
|
357
309
|
|
|
358
310
|
const provenTxs = await Promise.all(txs);
|
|
359
311
|
|
|
360
|
-
await Promise.all(provenTxs.map(t => t.send(
|
|
312
|
+
await Promise.all(provenTxs.map(t => t.send().wait({ timeout: 600 })));
|
|
361
313
|
|
|
362
314
|
logger.info(`Completed round ${i + 1} / ${rounds}`);
|
|
363
315
|
}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import type { AztecNode } from '@aztec/aztec.js/node';
|
|
2
|
-
import type {
|
|
3
|
-
import type { L2Block } from '@aztec/stdlib/block';
|
|
2
|
+
import type { L2BlockNew } from '@aztec/stdlib/block';
|
|
4
3
|
import type { TopicType } from '@aztec/stdlib/p2p';
|
|
5
|
-
import { Tx, type TxReceipt } from '@aztec/stdlib/tx';
|
|
4
|
+
import { Tx, type TxReceipt, TxStatus } from '@aztec/stdlib/tx';
|
|
6
5
|
|
|
7
6
|
import { createHistogram } from 'perf_hooks';
|
|
8
7
|
|
|
@@ -21,7 +20,7 @@ export type TxInclusionData = {
|
|
|
21
20
|
export class TxInclusionMetrics {
|
|
22
21
|
private data = new Map<string, TxInclusionData>();
|
|
23
22
|
private groups = new Set<string>();
|
|
24
|
-
private blocks = new Map<number, Promise<
|
|
23
|
+
private blocks = new Map<number, Promise<L2BlockNew | undefined>>();
|
|
25
24
|
|
|
26
25
|
private p2pGossipLatencyByTopic: Partial<Record<TopicType, { p50: number; p95: number }>> = {};
|
|
27
26
|
|
|
@@ -33,19 +32,12 @@ export class TxInclusionMetrics {
|
|
|
33
32
|
| { txP50: number; txP95: number; attestationP50: number; attestationP95: number }
|
|
34
33
|
| undefined;
|
|
35
34
|
|
|
36
|
-
constructor(
|
|
37
|
-
private aztecNode: AztecNode,
|
|
38
|
-
private logger?: Logger,
|
|
39
|
-
) {}
|
|
35
|
+
constructor(private aztecNode: AztecNode) {}
|
|
40
36
|
|
|
41
37
|
recordSentTx(tx: Tx, group: string): void {
|
|
42
38
|
const txHash = tx.getTxHash().toString();
|
|
43
39
|
const priorityFees = tx.getGasSettings().maxPriorityFeesPerGas;
|
|
44
40
|
|
|
45
|
-
if (this.data.has(txHash)) {
|
|
46
|
-
this.logger?.debug(`Overwriting tx inclusion data for ${txHash}`, { txHash, group });
|
|
47
|
-
}
|
|
48
|
-
|
|
49
41
|
this.data.set(txHash, {
|
|
50
42
|
txHash,
|
|
51
43
|
sentAt: Math.trunc(Date.now() / 1000),
|
|
@@ -61,13 +53,8 @@ export class TxInclusionMetrics {
|
|
|
61
53
|
}
|
|
62
54
|
|
|
63
55
|
async recordMinedTx(txReceipt: TxReceipt): Promise<void> {
|
|
64
|
-
const { txHash, blockNumber } = txReceipt;
|
|
65
|
-
if (
|
|
66
|
-
this.logger?.debug('Skipping mined tx record due to receipt status', {
|
|
67
|
-
txHash: txHash.toString(),
|
|
68
|
-
status: txReceipt.status,
|
|
69
|
-
blockNumber,
|
|
70
|
-
});
|
|
56
|
+
const { status, txHash, blockNumber } = txReceipt;
|
|
57
|
+
if (status !== TxStatus.SUCCESS || !blockNumber) {
|
|
71
58
|
return;
|
|
72
59
|
}
|
|
73
60
|
|
|
@@ -77,15 +64,9 @@ export class TxInclusionMetrics {
|
|
|
77
64
|
|
|
78
65
|
const block = await this.blocks.get(blockNumber)!;
|
|
79
66
|
if (!block) {
|
|
80
|
-
this.logger?.warn('Failed to load block for mined tx receipt', { txHash: txHash.toString(), blockNumber });
|
|
81
67
|
return;
|
|
82
68
|
}
|
|
83
|
-
const data = this.data.get(txHash.toString())
|
|
84
|
-
if (!data) {
|
|
85
|
-
const message = `Missing sent tx record for mined tx ${txHash.toString()}`;
|
|
86
|
-
this.logger?.warn(message, { txHash: txHash.toString(), blockNumber });
|
|
87
|
-
throw new Error(message);
|
|
88
|
-
}
|
|
69
|
+
const data = this.data.get(txHash.toString())!;
|
|
89
70
|
data.blocknumber = blockNumber;
|
|
90
71
|
data.minedAt = Number(block.header.globalVariables.timestamp);
|
|
91
72
|
data.attestedAt = -1;
|