@aztec/end-to-end 1.0.0-nightly.20250810 → 1.0.0-nightly.20250812
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/benchmark.d.ts +1 -1
- package/dest/bench/client_flows/benchmark.d.ts.map +1 -1
- package/dest/bench/client_flows/client_flows_benchmark.d.ts.map +1 -1
- package/dest/bench/client_flows/client_flows_benchmark.js +30 -12
- package/dest/bench/utils.d.ts.map +1 -1
- package/dest/bench/utils.js +6 -2
- package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts +3 -0
- 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 +47 -15
- package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts +2 -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 +12 -9
- package/dest/e2e_deploy_contract/deploy_test.d.ts +1 -1
- package/dest/e2e_deploy_contract/deploy_test.d.ts.map +1 -1
- package/dest/e2e_deploy_contract/deploy_test.js +5 -4
- package/dest/e2e_fees/bridging_race.notest.js +3 -1
- package/dest/e2e_fees/fees_test.d.ts +2 -2
- package/dest/e2e_fees/fees_test.d.ts.map +1 -1
- package/dest/e2e_fees/fees_test.js +29 -33
- package/dest/e2e_nested_contract/nested_contract_test.d.ts +3 -3
- package/dest/e2e_nested_contract/nested_contract_test.d.ts.map +1 -1
- package/dest/e2e_nested_contract/nested_contract_test.js +17 -12
- package/dest/e2e_p2p/p2p_network.d.ts +2 -1
- package/dest/e2e_p2p/p2p_network.d.ts.map +1 -1
- package/dest/e2e_p2p/p2p_network.js +5 -1
- package/dest/e2e_p2p/shared.d.ts +2 -2
- package/dest/e2e_p2p/shared.d.ts.map +1 -1
- package/dest/e2e_p2p/shared.js +7 -3
- package/dest/e2e_token_contract/token_contract_test.d.ts +8 -4
- package/dest/e2e_token_contract/token_contract_test.d.ts.map +1 -1
- package/dest/e2e_token_contract/token_contract_test.js +48 -23
- package/dest/fixtures/e2e_prover_test.d.ts.map +1 -1
- package/dest/fixtures/e2e_prover_test.js +22 -8
- package/dest/fixtures/snapshot_manager.js +3 -1
- package/dest/fixtures/token_utils.d.ts +3 -3
- package/dest/fixtures/token_utils.d.ts.map +1 -1
- package/dest/fixtures/token_utils.js +13 -7
- package/dest/fixtures/utils.d.ts +4 -3
- package/dest/fixtures/utils.d.ts.map +1 -1
- package/dest/fixtures/utils.js +14 -6
- package/dest/sample-dapp/connect.d.mts +2 -0
- package/dest/sample-dapp/connect.d.mts.map +1 -0
- package/dest/sample-dapp/connect.js +1 -1
- package/dest/sample-dapp/contracts.d.mts +3 -0
- package/dest/sample-dapp/contracts.d.mts.map +1 -0
- package/dest/sample-dapp/contracts.js +1 -1
- package/dest/sample-dapp/deploy.d.mts +3 -0
- package/dest/sample-dapp/deploy.d.mts.map +1 -0
- package/dest/sample-dapp/deploy.js +4 -1
- package/dest/sample-dapp/index.d.mts +2 -0
- package/dest/sample-dapp/index.d.mts.map +1 -0
- package/dest/sample-dapp/index.js +18 -7
- package/dest/shared/cross_chain_test_harness.d.ts +6 -3
- package/dest/shared/cross_chain_test_harness.d.ts.map +1 -1
- package/dest/shared/cross_chain_test_harness.js +50 -20
- package/dest/shared/gas_portal_test_harness.d.ts +3 -3
- package/dest/shared/gas_portal_test_harness.d.ts.map +1 -1
- package/dest/shared/gas_portal_test_harness.js +9 -5
- package/dest/shared/uniswap_l1_l2.d.ts.map +1 -1
- package/dest/shared/uniswap_l1_l2.js +37 -14
- package/dest/simulators/lending_simulator.js +6 -2
- package/dest/simulators/token_simulator.d.ts +2 -1
- package/dest/simulators/token_simulator.d.ts.map +1 -1
- package/dest/simulators/token_simulator.js +12 -4
- package/dest/spartan/setup_test_wallets.d.ts +2 -0
- package/dest/spartan/setup_test_wallets.d.ts.map +1 -1
- package/dest/spartan/setup_test_wallets.js +15 -5
- package/package.json +35 -35
- package/src/bench/client_flows/benchmark.ts +1 -1
- package/src/bench/client_flows/client_flows_benchmark.ts +20 -11
- package/src/bench/utils.ts +4 -2
- package/src/e2e_blacklist_token_contract/blacklist_token_contract_test.ts +28 -17
- package/src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts +13 -8
- package/src/e2e_deploy_contract/deploy_test.ts +5 -5
- package/src/e2e_fees/bridging_race.notest.ts +1 -1
- package/src/e2e_fees/fees_test.ts +37 -46
- package/src/e2e_nested_contract/nested_contract_test.ts +16 -11
- package/src/e2e_p2p/p2p_network.ts +6 -2
- package/src/e2e_p2p/shared.ts +4 -2
- package/src/e2e_token_contract/token_contract_test.ts +38 -36
- package/src/fixtures/e2e_prover_test.ts +13 -7
- package/src/fixtures/snapshot_manager.ts +1 -1
- package/src/fixtures/token_utils.ts +13 -6
- package/src/fixtures/utils.ts +14 -7
- package/src/sample-dapp/connect.mjs +1 -1
- package/src/sample-dapp/contracts.mjs +1 -1
- package/src/sample-dapp/deploy.mjs +3 -3
- package/src/sample-dapp/index.mjs +11 -7
- package/src/shared/cross_chain_test_harness.ts +31 -18
- package/src/shared/gas_portal_test_harness.ts +6 -6
- package/src/shared/uniswap_l1_l2.ts +19 -15
- package/src/simulators/lending_simulator.ts +2 -2
- package/src/simulators/token_simulator.ts +12 -3
- package/src/spartan/setup_test_wallets.ts +40 -16
|
@@ -33,7 +33,7 @@ export const uniswapL1L2TestSuite = (setup, cleanup, expectedForkBlockNumber = 1
|
|
|
33
33
|
let ownerEthAddress;
|
|
34
34
|
// does transactions on behalf of owner on Aztec:
|
|
35
35
|
let sponsorWallet;
|
|
36
|
-
|
|
36
|
+
let sponsorAddress;
|
|
37
37
|
let daiCrossChainHarness;
|
|
38
38
|
let wethCrossChainHarness;
|
|
39
39
|
let deployL1ContractsValues;
|
|
@@ -54,16 +54,16 @@ export const uniswapL1L2TestSuite = (setup, cleanup, expectedForkBlockNumber = 1
|
|
|
54
54
|
rollup = new RollupContract(deployL1ContractsValues.l1Client, deployL1ContractsValues.l1ContractAddresses.rollupAddress);
|
|
55
55
|
version = Number(await rollup.getVersion());
|
|
56
56
|
ownerAddress = ownerWallet.getAddress();
|
|
57
|
-
|
|
57
|
+
sponsorAddress = sponsorWallet.getAddress();
|
|
58
58
|
ownerEthAddress = EthAddress.fromString((await l1Client.getAddresses())[0]);
|
|
59
59
|
await ensureAccountContractsPublished(ownerWallet, [
|
|
60
60
|
ownerWallet,
|
|
61
61
|
sponsorWallet
|
|
62
62
|
]);
|
|
63
63
|
logger.info('Deploying DAI Portal, initializing and deploying l2 contract...');
|
|
64
|
-
daiCrossChainHarness = await CrossChainTestHarness.new(aztecNode, pxe, deployL1ContractsValues.l1Client, ownerWallet, logger, DAI_ADDRESS);
|
|
64
|
+
daiCrossChainHarness = await CrossChainTestHarness.new(aztecNode, pxe, deployL1ContractsValues.l1Client, ownerWallet, ownerAddress, logger, DAI_ADDRESS);
|
|
65
65
|
logger.info('Deploying WETH Portal, initializing and deploying l2 contract...');
|
|
66
|
-
wethCrossChainHarness = await CrossChainTestHarness.new(aztecNode, pxe, l1Client, ownerWallet, logger, WETH9_ADDRESS);
|
|
66
|
+
wethCrossChainHarness = await CrossChainTestHarness.new(aztecNode, pxe, l1Client, ownerWallet, ownerAddress, logger, WETH9_ADDRESS);
|
|
67
67
|
logger.info('Deploy Uniswap portal on L1 and L2...');
|
|
68
68
|
uniswapPortalAddress = await deployL1Contract(l1Client, UniswapPortalAbi, UniswapPortalBytecode).then(({ address })=>address);
|
|
69
69
|
uniswapPortal = getContract({
|
|
@@ -72,7 +72,9 @@ export const uniswapL1L2TestSuite = (setup, cleanup, expectedForkBlockNumber = 1
|
|
|
72
72
|
client: l1Client
|
|
73
73
|
});
|
|
74
74
|
// deploy l2 uniswap contract and attach to portal
|
|
75
|
-
uniswapL2Contract = await UniswapContract.deploy(ownerWallet, uniswapPortalAddress).send(
|
|
75
|
+
uniswapL2Contract = await UniswapContract.deploy(ownerWallet, uniswapPortalAddress).send({
|
|
76
|
+
from: ownerAddress
|
|
77
|
+
}).deployed();
|
|
76
78
|
const registryAddress = (await pxe.getNodeInfo()).l1ContractAddresses.registryAddress;
|
|
77
79
|
await uniswapPortal.write.initialize([
|
|
78
80
|
registryAddress.toString(),
|
|
@@ -121,6 +123,7 @@ export const uniswapL1L2TestSuite = (setup, cleanup, expectedForkBlockNumber = 1
|
|
|
121
123
|
logger.info('Withdrawing weth to L1 and sending message to swap to dai');
|
|
122
124
|
const [secretForDepositingSwappedDai, secretHashForDepositingSwappedDai] = await generateClaimSecret();
|
|
123
125
|
const l2UniswapInteractionReceipt = await uniswapL2Contract.methods.swap_private(wethCrossChainHarness.l2Token.address, wethCrossChainHarness.l2Bridge.address, wethAmountToBridge, daiCrossChainHarness.l2Bridge.address, nonceForWETHTransferToPublicApproval, uniswapFeeTier, minimumOutputAmount, secretHashForDepositingSwappedDai, ownerEthAddress).send({
|
|
126
|
+
from: ownerAddress,
|
|
124
127
|
authWitnesses: [
|
|
125
128
|
transferToPublicAuhtwit
|
|
126
129
|
]
|
|
@@ -444,7 +447,9 @@ export const uniswapL1L2TestSuite = (setup, cleanup, expectedForkBlockNumber = 1
|
|
|
444
447
|
chainId: ownerWallet.getChainId(),
|
|
445
448
|
version: ownerWallet.getVersion()
|
|
446
449
|
});
|
|
447
|
-
await expect(uniswapL2Contract.methods.swap_private(wethCrossChainHarness.l2Token.address, wethCrossChainHarness.l2Bridge.address, wethAmountToBridge, daiCrossChainHarness.l2Bridge.address, nonceForWETHTransferToPublicApproval, uniswapFeeTier, minimumOutputAmount, Fr.random(), ownerEthAddress).simulate(
|
|
450
|
+
await expect(uniswapL2Contract.methods.swap_private(wethCrossChainHarness.l2Token.address, wethCrossChainHarness.l2Bridge.address, wethAmountToBridge, daiCrossChainHarness.l2Bridge.address, nonceForWETHTransferToPublicApproval, uniswapFeeTier, minimumOutputAmount, Fr.random(), ownerEthAddress).simulate({
|
|
451
|
+
from: ownerAddress
|
|
452
|
+
})).rejects.toThrow(`Unknown auth witness for message hash ${expectedMessageHash.toString()}`);
|
|
448
453
|
});
|
|
449
454
|
it("can't swap if user passes a token different to what the bridge tracks", async ()=>{
|
|
450
455
|
// 1. give user private funds on L2:
|
|
@@ -460,6 +465,7 @@ export const uniswapL1L2TestSuite = (setup, cleanup, expectedForkBlockNumber = 1
|
|
|
460
465
|
// 3. Swap but send the wrong token address
|
|
461
466
|
logger.info('Swap but send the wrong token address');
|
|
462
467
|
await expect(uniswapL2Contract.methods.swap_private(wethCrossChainHarness.l2Token.address, daiCrossChainHarness.l2Bridge.address, wethAmountToBridge, daiCrossChainHarness.l2Bridge.address, nonceForWETHTransferToPublicApproval, uniswapFeeTier, minimumOutputAmount, Fr.random(), ownerEthAddress).prove({
|
|
468
|
+
from: ownerAddress,
|
|
463
469
|
authWitnesses: [
|
|
464
470
|
transferToPublicAuthwith
|
|
465
471
|
]
|
|
@@ -475,10 +481,14 @@ export const uniswapL1L2TestSuite = (setup, cleanup, expectedForkBlockNumber = 1
|
|
|
475
481
|
caller: uniswapL2Contract.address,
|
|
476
482
|
action: wethCrossChainHarness.l2Token.methods.transfer_in_public(ownerAddress, uniswapL2Contract.address, wethAmountToBridge, nonceForWETHTransferApproval)
|
|
477
483
|
}, true);
|
|
478
|
-
await validateActionInteraction.send(
|
|
484
|
+
await validateActionInteraction.send({
|
|
485
|
+
from: ownerAddress
|
|
486
|
+
}).wait();
|
|
479
487
|
// No approval to call `swap` but should work even without it:
|
|
480
488
|
const [_, secretHashForDepositingSwappedDai] = await generateClaimSecret();
|
|
481
|
-
await uniswapL2Contract.methods.swap_public(ownerAddress, wethCrossChainHarness.l2Bridge.address, wethAmountToBridge, daiCrossChainHarness.l2Bridge.address, nonceForWETHTransferApproval, uniswapFeeTier, minimumOutputAmount, ownerAddress, secretHashForDepositingSwappedDai, ownerEthAddress, Fr.ZERO).send(
|
|
489
|
+
await uniswapL2Contract.methods.swap_public(ownerAddress, wethCrossChainHarness.l2Bridge.address, wethAmountToBridge, daiCrossChainHarness.l2Bridge.address, nonceForWETHTransferApproval, uniswapFeeTier, minimumOutputAmount, ownerAddress, secretHashForDepositingSwappedDai, ownerEthAddress, Fr.ZERO).send({
|
|
490
|
+
from: ownerAddress
|
|
491
|
+
}).wait();
|
|
482
492
|
// check weth balance of owner on L2 (we first bridged `wethAmountToBridge` into L2 and now withdrew it!)
|
|
483
493
|
await wethCrossChainHarness.expectPublicBalanceOnL2(ownerAddress, 0n);
|
|
484
494
|
});
|
|
@@ -493,8 +503,12 @@ export const uniswapL1L2TestSuite = (setup, cleanup, expectedForkBlockNumber = 1
|
|
|
493
503
|
caller: approvedUser,
|
|
494
504
|
action
|
|
495
505
|
}, true);
|
|
496
|
-
await validateActionInteraction.send(
|
|
497
|
-
|
|
506
|
+
await validateActionInteraction.send({
|
|
507
|
+
from: sponsorAddress
|
|
508
|
+
}).wait();
|
|
509
|
+
await expect(action.simulate({
|
|
510
|
+
from: sponsorAddress
|
|
511
|
+
})).rejects.toThrow(/unauthorized/);
|
|
498
512
|
});
|
|
499
513
|
it("uniswap can't pull funds without transfer approval", async ()=>{
|
|
500
514
|
// swap should fail since no transfer approval to uniswap:
|
|
@@ -503,8 +517,12 @@ export const uniswapL1L2TestSuite = (setup, cleanup, expectedForkBlockNumber = 1
|
|
|
503
517
|
caller: uniswapL2Contract.address,
|
|
504
518
|
action: wethCrossChainHarness.l2Token.methods.transfer_in_public(ownerAddress, uniswapL2Contract.address, wethAmountToBridge, nonceForWETHTransferApproval)
|
|
505
519
|
}, true);
|
|
506
|
-
await validateActionInteraction.send(
|
|
507
|
-
|
|
520
|
+
await validateActionInteraction.send({
|
|
521
|
+
from: ownerAddress
|
|
522
|
+
}).wait();
|
|
523
|
+
await expect(uniswapL2Contract.methods.swap_public(ownerAddress, wethCrossChainHarness.l2Bridge.address, wethAmountToBridge, daiCrossChainHarness.l2Bridge.address, new Fr(420), uniswapFeeTier, minimumOutputAmount, ownerAddress, Fr.random(), ownerEthAddress, Fr.ZERO).simulate({
|
|
524
|
+
from: ownerAddress
|
|
525
|
+
})).rejects.toThrow(/unauthorized/);
|
|
508
526
|
});
|
|
509
527
|
// tests when trying to mix private and public flows:
|
|
510
528
|
it("can't call swap_public on L1 if called swap_private on L2", async ()=>{
|
|
@@ -523,6 +541,7 @@ export const uniswapL1L2TestSuite = (setup, cleanup, expectedForkBlockNumber = 1
|
|
|
523
541
|
logger.info('Withdrawing weth to L1 and sending message to swap to dai');
|
|
524
542
|
const [, secretHashForDepositingSwappedDai] = await generateClaimSecret();
|
|
525
543
|
const withdrawReceipt = await uniswapL2Contract.methods.swap_private(wethCrossChainHarness.l2Token.address, wethCrossChainHarness.l2Bridge.address, wethAmountToBridge, daiCrossChainHarness.l2Bridge.address, nonceForWETHTransferToPublicApproval, uniswapFeeTier, minimumOutputAmount, secretHashForDepositingSwappedDai, ownerEthAddress).send({
|
|
544
|
+
from: ownerAddress,
|
|
526
545
|
authWitnesses: [
|
|
527
546
|
transferToPublicAuhtwit
|
|
528
547
|
]
|
|
@@ -606,10 +625,14 @@ export const uniswapL1L2TestSuite = (setup, cleanup, expectedForkBlockNumber = 1
|
|
|
606
625
|
caller: uniswapL2Contract.address,
|
|
607
626
|
action: wethCrossChainHarness.l2Token.methods.transfer_in_public(ownerAddress, uniswapL2Contract.address, wethAmountToBridge, nonceForWETHTransferApproval)
|
|
608
627
|
}, true);
|
|
609
|
-
await validateActionInteraction.send(
|
|
628
|
+
await validateActionInteraction.send({
|
|
629
|
+
from: ownerAddress
|
|
630
|
+
}).wait();
|
|
610
631
|
// Call swap_public on L2
|
|
611
632
|
const secretHashForDepositingSwappedDai = Fr.random();
|
|
612
|
-
const withdrawReceipt = await uniswapL2Contract.methods.swap_public(ownerAddress, wethCrossChainHarness.l2Bridge.address, wethAmountToBridge, daiCrossChainHarness.l2Bridge.address, nonceForWETHTransferApproval, uniswapFeeTier, minimumOutputAmount, ownerAddress, secretHashForDepositingSwappedDai, ownerEthAddress, Fr.ZERO).send(
|
|
633
|
+
const withdrawReceipt = await uniswapL2Contract.methods.swap_public(ownerAddress, wethCrossChainHarness.l2Bridge.address, wethAmountToBridge, daiCrossChainHarness.l2Bridge.address, nonceForWETHTransferApproval, uniswapFeeTier, minimumOutputAmount, ownerAddress, secretHashForDepositingSwappedDai, ownerEthAddress, Fr.ZERO).send({
|
|
634
|
+
from: ownerAddress
|
|
635
|
+
}).wait();
|
|
613
636
|
const swapPublicContent = sha256ToField([
|
|
614
637
|
Buffer.from(toFunctionSelector('swap_public(address,uint256,uint24,address,uint256,bytes32,bytes32,address)').substring(2), 'hex'),
|
|
615
638
|
wethCrossChainHarness.tokenPortalAddress.toBuffer32(),
|
|
@@ -149,7 +149,9 @@ const computeMultiplier = (rate, dt)=>{
|
|
|
149
149
|
const totalCollateral = Object.values(this.collateral).reduce((a, b)=>new Fr(a.value + b.value), Fr.ZERO);
|
|
150
150
|
expect(totalCollateral).toEqual(new Fr(this.collateralAsset.balanceOfPublic(this.lendingContract.address)));
|
|
151
151
|
expect(this.borrowed).toEqual(this.stableCoin.totalSupply - this.mintedOutside);
|
|
152
|
-
const asset = await this.lendingContract.methods.get_asset(0).simulate(
|
|
152
|
+
const asset = await this.lendingContract.methods.get_asset(0).simulate({
|
|
153
|
+
from: this.account.address
|
|
154
|
+
});
|
|
153
155
|
const interestAccumulator = asset['interest_accumulator'];
|
|
154
156
|
expect(interestAccumulator).toEqual(this.accumulator);
|
|
155
157
|
expect(asset['last_updated_ts']).toEqual(BigInt(this.time));
|
|
@@ -157,7 +159,9 @@ const computeMultiplier = (rate, dt)=>{
|
|
|
157
159
|
this.account.address,
|
|
158
160
|
AztecAddress.fromField(await this.account.key())
|
|
159
161
|
]){
|
|
160
|
-
const privatePos = await this.lendingContract.methods.get_position(key).simulate(
|
|
162
|
+
const privatePos = await this.lendingContract.methods.get_position(key).simulate({
|
|
163
|
+
from: key
|
|
164
|
+
});
|
|
161
165
|
expect(new Fr(privatePos['collateral'])).toEqual(this.collateral[key.toString()] ?? Fr.ZERO);
|
|
162
166
|
expect(new Fr(privatePos['static_debt'])).toEqual(this.staticDebt[key.toString()] ?? Fr.ZERO);
|
|
163
167
|
expect(privatePos['debt']).toEqual(muldivUp((this.staticDebt[key.toString()] ?? Fr.ZERO).value, this.accumulator, BASE));
|
|
@@ -3,13 +3,14 @@ import type { TokenContract } from '@aztec/noir-contracts.js/Token';
|
|
|
3
3
|
export declare class TokenSimulator {
|
|
4
4
|
protected token: TokenContract;
|
|
5
5
|
protected defaultWallet: Wallet;
|
|
6
|
+
protected defaultAddress: AztecAddress;
|
|
6
7
|
protected logger: Logger;
|
|
7
8
|
protected accounts: AztecAddress[];
|
|
8
9
|
private balancesPrivate;
|
|
9
10
|
private balancePublic;
|
|
10
11
|
totalSupply: bigint;
|
|
11
12
|
private lookupProvider;
|
|
12
|
-
constructor(token: TokenContract, defaultWallet: Wallet, logger: Logger, accounts: AztecAddress[]);
|
|
13
|
+
constructor(token: TokenContract, defaultWallet: Wallet, defaultAddress: AztecAddress, logger: Logger, accounts: AztecAddress[]);
|
|
13
14
|
addAccount(account: AztecAddress): void;
|
|
14
15
|
setLookupProvider(account: AztecAddress, wallet: Wallet): void;
|
|
15
16
|
mintPrivate(to: AztecAddress, amount: bigint): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"token_simulator.d.ts","sourceRoot":"","sources":["../../src/simulators/token_simulator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,YAAY,EAAa,KAAK,MAAM,EAAE,KAAK,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAIpE,qBAAa,cAAc;IAQvB,SAAS,CAAC,KAAK,EAAE,aAAa;IAC9B,SAAS,CAAC,aAAa,EAAE,MAAM;IAC/B,SAAS,CAAC,MAAM,EAAE,MAAM;IACxB,SAAS,CAAC,QAAQ,EAAE,YAAY,EAAE;
|
|
1
|
+
{"version":3,"file":"token_simulator.d.ts","sourceRoot":"","sources":["../../src/simulators/token_simulator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,YAAY,EAAa,KAAK,MAAM,EAAE,KAAK,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAIpE,qBAAa,cAAc;IAQvB,SAAS,CAAC,KAAK,EAAE,aAAa;IAC9B,SAAS,CAAC,aAAa,EAAE,MAAM;IAC/B,SAAS,CAAC,cAAc,EAAE,YAAY;IACtC,SAAS,CAAC,MAAM,EAAE,MAAM;IACxB,SAAS,CAAC,QAAQ,EAAE,YAAY,EAAE;IAXpC,OAAO,CAAC,eAAe,CAAkC;IACzD,OAAO,CAAC,aAAa,CAAkC;IAChD,WAAW,EAAE,MAAM,CAAM;IAEhC,OAAO,CAAC,cAAc,CAAkC;gBAG5C,KAAK,EAAE,aAAa,EACpB,aAAa,EAAE,MAAM,EACrB,cAAc,EAAE,YAAY,EAC5B,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,YAAY,EAAE;IAG7B,UAAU,CAAC,OAAO,EAAE,YAAY;IAIhC,iBAAiB,CAAC,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM;IAIvD,WAAW,CAAC,EAAE,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM;IAK5C,UAAU,CAAC,EAAE,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM;IAM3C,cAAc,CAAC,IAAI,EAAE,YAAY,EAAE,EAAE,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM;IASnE,eAAe,CAAC,IAAI,EAAE,YAAY,EAAE,EAAE,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM;IASpE,iBAAiB,CAAC,IAAI,EAAE,YAAY,EAAE,EAAE,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM;IAQtE,gBAAgB,CAAC,IAAI,EAAE,YAAY,EAAE,EAAE,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM;IAQrE,WAAW,CAAC,IAAI,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM;IAQ9C,UAAU,CAAC,IAAI,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM;IAQ7C,eAAe,CAAC,OAAO,EAAE,YAAY;IAIrC,gBAAgB,CAAC,OAAO,EAAE,YAAY;IAIvC,WAAW;IAoBX,YAAY;IAsCL,KAAK;CAInB"}
|
|
@@ -3,15 +3,17 @@ import chunk from 'lodash.chunk';
|
|
|
3
3
|
export class TokenSimulator {
|
|
4
4
|
token;
|
|
5
5
|
defaultWallet;
|
|
6
|
+
defaultAddress;
|
|
6
7
|
logger;
|
|
7
8
|
accounts;
|
|
8
9
|
balancesPrivate;
|
|
9
10
|
balancePublic;
|
|
10
11
|
totalSupply;
|
|
11
12
|
lookupProvider;
|
|
12
|
-
constructor(token, defaultWallet, logger, accounts){
|
|
13
|
+
constructor(token, defaultWallet, defaultAddress, logger, accounts){
|
|
13
14
|
this.token = token;
|
|
14
15
|
this.defaultWallet = defaultWallet;
|
|
16
|
+
this.defaultAddress = defaultAddress;
|
|
15
17
|
this.logger = logger;
|
|
16
18
|
this.accounts = accounts;
|
|
17
19
|
this.balancesPrivate = new Map();
|
|
@@ -86,7 +88,9 @@ export class TokenSimulator {
|
|
|
86
88
|
this.token.methods.total_supply(),
|
|
87
89
|
...this.accounts.map((address)=>this.token.methods.balance_of_public(address))
|
|
88
90
|
];
|
|
89
|
-
const results = (await Promise.all(chunk(calls, 4).map((batch)=>new BatchCall(this.defaultWallet, batch).simulate(
|
|
91
|
+
const results = (await Promise.all(chunk(calls, 4).map((batch)=>new BatchCall(this.defaultWallet, batch).simulate({
|
|
92
|
+
from: this.defaultAddress
|
|
93
|
+
})))).flat();
|
|
90
94
|
expect(results[0]).toEqual(this.totalSupply);
|
|
91
95
|
// Check that all our balances match
|
|
92
96
|
for(let i = 0; i < this.accounts.length; i++){
|
|
@@ -105,7 +109,9 @@ export class TokenSimulator {
|
|
|
105
109
|
}
|
|
106
110
|
}
|
|
107
111
|
const defaultCalls = defaultLookups.map((address)=>this.token.methods.balance_of_private(address));
|
|
108
|
-
const results = (await Promise.all(chunk(defaultCalls, 4).map((batch)=>new BatchCall(this.defaultWallet, batch).simulate(
|
|
112
|
+
const results = (await Promise.all(chunk(defaultCalls, 4).map((batch)=>new BatchCall(this.defaultWallet, batch).simulate({
|
|
113
|
+
from: this.defaultAddress
|
|
114
|
+
})))).flat();
|
|
109
115
|
for(let i = 0; i < defaultLookups.length; i++){
|
|
110
116
|
expect(results[i]).toEqual(this.balanceOfPrivate(defaultLookups[i]));
|
|
111
117
|
}
|
|
@@ -116,7 +122,9 @@ export class TokenSimulator {
|
|
|
116
122
|
const asset = wallet ? this.token.withWallet(wallet) : this.token;
|
|
117
123
|
const actualPrivateBalance = await asset.methods.balance_of_private({
|
|
118
124
|
address
|
|
119
|
-
}).simulate(
|
|
125
|
+
}).simulate({
|
|
126
|
+
from: this.defaultAddress
|
|
127
|
+
});
|
|
120
128
|
expect(actualPrivateBalance).toEqual(this.balanceOfPrivate(address));
|
|
121
129
|
}
|
|
122
130
|
}
|
|
@@ -5,8 +5,10 @@ export interface TestWallets {
|
|
|
5
5
|
pxe: PXE;
|
|
6
6
|
wallets: AccountWalletWithSecretKey[];
|
|
7
7
|
tokenAdminWallet: TokenContract;
|
|
8
|
+
tokenAdminAddress: AztecAddress;
|
|
8
9
|
tokenName: string;
|
|
9
10
|
recipientWallet: AccountWalletWithSecretKey;
|
|
11
|
+
recipientAddress: AztecAddress;
|
|
10
12
|
tokenAddress: AztecAddress;
|
|
11
13
|
}
|
|
12
14
|
export declare function setupTestWalletsWithTokens(pxeUrl: string, mintAmount: bigint, logger: Logger): Promise<TestWallets>;
|
|
@@ -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,EAMjB,KAAK,GAAG,EAKT,MAAM,iBAAiB,CAAC;AAEzB,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAQ/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,
|
|
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,EAMjB,KAAK,GAAG,EAKT,MAAM,iBAAiB,CAAC;AAEzB,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAQ/D,MAAM,WAAW,WAAW;IAC1B,GAAG,EAAE,GAAG,CAAC;IACT,OAAO,EAAE,0BAA0B,EAAE,CAAC;IACtC,gBAAgB,EAAE,aAAa,CAAC;IAChC,iBAAiB,EAAE,YAAY,CAAC;IAChC,SAAS,EAAE,MAAM,CAAC;IAClB,eAAe,EAAE,0BAA0B,CAAC;IAC5C,gBAAgB,EAAE,YAAY,CAAC;IAC/B,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,CAqBtB;AAED,wBAAsB,0BAA0B,CAC9C,GAAG,EAAE,GAAG,EACR,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,MAAM,EACd,qBAAqB,SAAI,GACxB,OAAO,CAAC,WAAW,CAAC,CA0CtB;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,CA8CtB;AA6ED,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,iBAeA;AAED,wBAAsB,kBAAkB,CACtC,OAAO,EAAE,MAAM,EACf,aAAa,EAAE,OAAO,EACtB,MAAM,EAAE,MAAM,GACb,OAAO,CAAC;IAAE,GAAG,EAAE,GAAG,CAAC;IAAC,OAAO,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;CAAE,CAAC,CAmBrD"}
|
|
@@ -21,8 +21,10 @@ export async function setupTestWalletsWithTokens(pxeUrl, mintAmount, logger) {
|
|
|
21
21
|
pxe,
|
|
22
22
|
wallets,
|
|
23
23
|
tokenAdminWallet,
|
|
24
|
+
tokenAdminAddress: tokenAdmin.getAddress(),
|
|
24
25
|
tokenName: TOKEN_NAME,
|
|
25
26
|
tokenAddress,
|
|
27
|
+
recipientAddress: recipientWallet.getAddress(),
|
|
26
28
|
recipientWallet
|
|
27
29
|
};
|
|
28
30
|
}
|
|
@@ -50,10 +52,12 @@ export async function deploySponsoredTestWallets(pxe, mintAmount, logger, number
|
|
|
50
52
|
return {
|
|
51
53
|
pxe,
|
|
52
54
|
wallets,
|
|
55
|
+
tokenAdminAddress: tokenAdmin.getAddress(),
|
|
53
56
|
tokenAdminWallet,
|
|
54
57
|
tokenName: TOKEN_NAME,
|
|
55
58
|
tokenAddress,
|
|
56
|
-
recipientWallet
|
|
59
|
+
recipientWallet,
|
|
60
|
+
recipientAddress: recipientWallet.getAddress()
|
|
57
61
|
};
|
|
58
62
|
}
|
|
59
63
|
export async function deployTestWalletWithTokens(pxeUrl, nodeUrl, l1RpcUrls, mnemonicOrPrivateKey, mintAmount, logger, numberOfFundedWallets = 1) {
|
|
@@ -84,10 +88,12 @@ export async function deployTestWalletWithTokens(pxeUrl, nodeUrl, l1RpcUrls, mne
|
|
|
84
88
|
return {
|
|
85
89
|
pxe,
|
|
86
90
|
wallets,
|
|
91
|
+
tokenAdminAddress: tokenAdmin.getAddress(),
|
|
87
92
|
tokenAdminWallet,
|
|
88
93
|
tokenName: TOKEN_NAME,
|
|
89
94
|
tokenAddress,
|
|
90
|
-
recipientWallet
|
|
95
|
+
recipientWallet,
|
|
96
|
+
recipientAddress: recipientWallet.getAddress()
|
|
91
97
|
};
|
|
92
98
|
}
|
|
93
99
|
async function bridgeL1FeeJuice(l1RpcUrls, mnemonicOrPrivateKey, pxe, recipient, amount, log) {
|
|
@@ -122,6 +128,7 @@ async function advanceL2Block(node, nodeAdmin) {
|
|
|
122
128
|
async function deployTokenAndMint(wallets, admin, mintAmount, paymentMethod, logger) {
|
|
123
129
|
logger.verbose(`Deploying TokenContract...`);
|
|
124
130
|
const tokenContract = await TokenContract.deploy(wallets[0], admin, TOKEN_NAME, TOKEN_SYMBOL, TOKEN_DECIMALS).send({
|
|
131
|
+
from: admin,
|
|
125
132
|
fee: {
|
|
126
133
|
paymentMethod
|
|
127
134
|
}
|
|
@@ -131,6 +138,7 @@ async function deployTokenAndMint(wallets, admin, mintAmount, paymentMethod, log
|
|
|
131
138
|
const tokenAddress = tokenContract.address;
|
|
132
139
|
logger.verbose(`Minting ${mintAmount} public assets to the ${wallets.length} wallets...`);
|
|
133
140
|
await Promise.all(wallets.map(async (w)=>(await TokenContract.at(tokenAddress, w)).methods.mint_to_public(w.getAddress(), mintAmount).send({
|
|
141
|
+
from: admin,
|
|
134
142
|
fee: {
|
|
135
143
|
paymentMethod
|
|
136
144
|
}
|
|
@@ -143,9 +151,11 @@ async function deployTokenAndMint(wallets, admin, mintAmount, paymentMethod, log
|
|
|
143
151
|
export async function performTransfers({ testWallets, rounds, transferAmount, logger }) {
|
|
144
152
|
const recipient = testWallets.recipientWallet.getAddress();
|
|
145
153
|
for(let i = 0; i < rounds; i++){
|
|
146
|
-
const
|
|
147
|
-
|
|
148
|
-
|
|
154
|
+
const txs = testWallets.wallets.map(async (w)=>(await TokenContract.at(testWallets.tokenAddress, w)).methods.transfer_in_public(w.getAddress(), recipient, transferAmount, 0).prove({
|
|
155
|
+
from: w.getAddress()
|
|
156
|
+
}));
|
|
157
|
+
const provenTxs = await Promise.all(txs);
|
|
158
|
+
await Promise.all(provenTxs.map((t)=>t.send().wait({
|
|
149
159
|
timeout: 600
|
|
150
160
|
})));
|
|
151
161
|
logger.info(`Completed round ${i + 1} / ${rounds}`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/end-to-end",
|
|
3
|
-
"version": "1.0.0-nightly.
|
|
3
|
+
"version": "1.0.0-nightly.20250812",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": "./dest/index.js",
|
|
6
6
|
"inherits": [
|
|
@@ -25,40 +25,40 @@
|
|
|
25
25
|
"formatting": "run -T prettier --check ./src && run -T eslint ./src"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@aztec/accounts": "1.0.0-nightly.
|
|
29
|
-
"@aztec/archiver": "1.0.0-nightly.
|
|
30
|
-
"@aztec/aztec": "1.0.0-nightly.
|
|
31
|
-
"@aztec/aztec-node": "1.0.0-nightly.
|
|
32
|
-
"@aztec/aztec.js": "1.0.0-nightly.
|
|
33
|
-
"@aztec/bb-prover": "1.0.0-nightly.
|
|
34
|
-
"@aztec/blob-lib": "1.0.0-nightly.
|
|
35
|
-
"@aztec/blob-sink": "1.0.0-nightly.
|
|
36
|
-
"@aztec/bot": "1.0.0-nightly.
|
|
37
|
-
"@aztec/cli": "1.0.0-nightly.
|
|
38
|
-
"@aztec/constants": "1.0.0-nightly.
|
|
39
|
-
"@aztec/entrypoints": "1.0.0-nightly.
|
|
40
|
-
"@aztec/epoch-cache": "1.0.0-nightly.
|
|
41
|
-
"@aztec/ethereum": "1.0.0-nightly.
|
|
42
|
-
"@aztec/foundation": "1.0.0-nightly.
|
|
43
|
-
"@aztec/kv-store": "1.0.0-nightly.
|
|
44
|
-
"@aztec/l1-artifacts": "1.0.0-nightly.
|
|
45
|
-
"@aztec/merkle-tree": "1.0.0-nightly.
|
|
46
|
-
"@aztec/noir-contracts.js": "1.0.0-nightly.
|
|
47
|
-
"@aztec/noir-noirc_abi": "1.0.0-nightly.
|
|
48
|
-
"@aztec/noir-protocol-circuits-types": "1.0.0-nightly.
|
|
49
|
-
"@aztec/noir-test-contracts.js": "1.0.0-nightly.
|
|
50
|
-
"@aztec/p2p": "1.0.0-nightly.
|
|
51
|
-
"@aztec/protocol-contracts": "1.0.0-nightly.
|
|
52
|
-
"@aztec/prover-client": "1.0.0-nightly.
|
|
53
|
-
"@aztec/prover-node": "1.0.0-nightly.
|
|
54
|
-
"@aztec/pxe": "1.0.0-nightly.
|
|
55
|
-
"@aztec/sequencer-client": "1.0.0-nightly.
|
|
56
|
-
"@aztec/simulator": "1.0.0-nightly.
|
|
57
|
-
"@aztec/slasher": "1.0.0-nightly.
|
|
58
|
-
"@aztec/stdlib": "1.0.0-nightly.
|
|
59
|
-
"@aztec/telemetry-client": "1.0.0-nightly.
|
|
60
|
-
"@aztec/validator-client": "1.0.0-nightly.
|
|
61
|
-
"@aztec/world-state": "1.0.0-nightly.
|
|
28
|
+
"@aztec/accounts": "1.0.0-nightly.20250812",
|
|
29
|
+
"@aztec/archiver": "1.0.0-nightly.20250812",
|
|
30
|
+
"@aztec/aztec": "1.0.0-nightly.20250812",
|
|
31
|
+
"@aztec/aztec-node": "1.0.0-nightly.20250812",
|
|
32
|
+
"@aztec/aztec.js": "1.0.0-nightly.20250812",
|
|
33
|
+
"@aztec/bb-prover": "1.0.0-nightly.20250812",
|
|
34
|
+
"@aztec/blob-lib": "1.0.0-nightly.20250812",
|
|
35
|
+
"@aztec/blob-sink": "1.0.0-nightly.20250812",
|
|
36
|
+
"@aztec/bot": "1.0.0-nightly.20250812",
|
|
37
|
+
"@aztec/cli": "1.0.0-nightly.20250812",
|
|
38
|
+
"@aztec/constants": "1.0.0-nightly.20250812",
|
|
39
|
+
"@aztec/entrypoints": "1.0.0-nightly.20250812",
|
|
40
|
+
"@aztec/epoch-cache": "1.0.0-nightly.20250812",
|
|
41
|
+
"@aztec/ethereum": "1.0.0-nightly.20250812",
|
|
42
|
+
"@aztec/foundation": "1.0.0-nightly.20250812",
|
|
43
|
+
"@aztec/kv-store": "1.0.0-nightly.20250812",
|
|
44
|
+
"@aztec/l1-artifacts": "1.0.0-nightly.20250812",
|
|
45
|
+
"@aztec/merkle-tree": "1.0.0-nightly.20250812",
|
|
46
|
+
"@aztec/noir-contracts.js": "1.0.0-nightly.20250812",
|
|
47
|
+
"@aztec/noir-noirc_abi": "1.0.0-nightly.20250812",
|
|
48
|
+
"@aztec/noir-protocol-circuits-types": "1.0.0-nightly.20250812",
|
|
49
|
+
"@aztec/noir-test-contracts.js": "1.0.0-nightly.20250812",
|
|
50
|
+
"@aztec/p2p": "1.0.0-nightly.20250812",
|
|
51
|
+
"@aztec/protocol-contracts": "1.0.0-nightly.20250812",
|
|
52
|
+
"@aztec/prover-client": "1.0.0-nightly.20250812",
|
|
53
|
+
"@aztec/prover-node": "1.0.0-nightly.20250812",
|
|
54
|
+
"@aztec/pxe": "1.0.0-nightly.20250812",
|
|
55
|
+
"@aztec/sequencer-client": "1.0.0-nightly.20250812",
|
|
56
|
+
"@aztec/simulator": "1.0.0-nightly.20250812",
|
|
57
|
+
"@aztec/slasher": "1.0.0-nightly.20250812",
|
|
58
|
+
"@aztec/stdlib": "1.0.0-nightly.20250812",
|
|
59
|
+
"@aztec/telemetry-client": "1.0.0-nightly.20250812",
|
|
60
|
+
"@aztec/validator-client": "1.0.0-nightly.20250812",
|
|
61
|
+
"@aztec/world-state": "1.0.0-nightly.20250812",
|
|
62
62
|
"@iarna/toml": "^2.2.5",
|
|
63
63
|
"@jest/globals": "^30.0.0",
|
|
64
64
|
"@noble/curves": "=1.0.0",
|
|
@@ -301,7 +301,7 @@ export function convertProfileToGHBenchmark(benchmark: ClientFlowBenchmark): Git
|
|
|
301
301
|
export async function captureProfile(
|
|
302
302
|
label: string,
|
|
303
303
|
interaction: ContractFunctionInteraction | DeployMethod,
|
|
304
|
-
opts
|
|
304
|
+
opts: Omit<ProfileMethodOptions & DeployOptions, 'profileMode'>,
|
|
305
305
|
expectedSteps?: number,
|
|
306
306
|
) {
|
|
307
307
|
// Make sure the proxy logger starts from a clean slate
|
|
@@ -158,16 +158,20 @@ export class ClientFlowsBenchmark {
|
|
|
158
158
|
async mintAndBridgeFeeJuice(address: AztecAddress, amount: bigint) {
|
|
159
159
|
const claim = await this.feeJuiceBridgeTestHarness.prepareTokensOnL1(amount, address);
|
|
160
160
|
const { claimSecret: secret, messageLeafIndex: index } = claim;
|
|
161
|
-
await this.feeJuiceContract.methods.claim(address, amount, secret, index).send().wait();
|
|
161
|
+
await this.feeJuiceContract.methods.claim(address, amount, secret, index).send({ from: this.adminAddress }).wait();
|
|
162
162
|
}
|
|
163
163
|
|
|
164
164
|
/** Admin mints bananaCoin tokens privately to the target address and redeems them. */
|
|
165
165
|
async mintPrivateBananas(amount: bigint, address: AztecAddress) {
|
|
166
|
-
const balanceBefore = await this.bananaCoin.methods
|
|
166
|
+
const balanceBefore = await this.bananaCoin.methods
|
|
167
|
+
.balance_of_private(address)
|
|
168
|
+
.simulate({ from: this.adminAddress });
|
|
167
169
|
|
|
168
|
-
await mintTokensToPrivate(this.bananaCoin, this.adminWallet, address, amount);
|
|
170
|
+
await mintTokensToPrivate(this.bananaCoin, this.adminAddress, this.adminWallet, address, amount);
|
|
169
171
|
|
|
170
|
-
const balanceAfter = await this.bananaCoin.methods
|
|
172
|
+
const balanceAfter = await this.bananaCoin.methods
|
|
173
|
+
.balance_of_private(address)
|
|
174
|
+
.simulate({ from: this.adminAddress });
|
|
171
175
|
expect(balanceAfter).toEqual(balanceBefore + amount);
|
|
172
176
|
}
|
|
173
177
|
|
|
@@ -259,7 +263,7 @@ export class ClientFlowsBenchmark {
|
|
|
259
263
|
'deploy_banana_token',
|
|
260
264
|
async () => {
|
|
261
265
|
const bananaCoin = await BananaCoin.deploy(this.adminWallet, this.adminAddress, 'BC', 'BC', 18n)
|
|
262
|
-
.send()
|
|
266
|
+
.send({ from: this.adminAddress })
|
|
263
267
|
.deployed();
|
|
264
268
|
this.logger.info(`BananaCoin deployed at ${bananaCoin.address}`);
|
|
265
269
|
return { bananaCoinAddress: bananaCoin.address };
|
|
@@ -275,7 +279,7 @@ export class ClientFlowsBenchmark {
|
|
|
275
279
|
'deploy_candy_bar_token',
|
|
276
280
|
async () => {
|
|
277
281
|
const candyBarCoin = await TokenContract.deploy(this.adminWallet, this.adminAddress, 'CBC', 'CBC', 18n)
|
|
278
|
-
.send()
|
|
282
|
+
.send({ from: this.adminAddress })
|
|
279
283
|
.deployed();
|
|
280
284
|
this.logger.info(`CandyBarCoin deployed at ${candyBarCoin.address}`);
|
|
281
285
|
return { candyBarCoinAddress: candyBarCoin.address };
|
|
@@ -295,12 +299,16 @@ export class ClientFlowsBenchmark {
|
|
|
295
299
|
|
|
296
300
|
const bananaCoin = this.bananaCoin;
|
|
297
301
|
const bananaFPC = await FPCContract.deploy(this.adminWallet, bananaCoin.address, this.adminAddress)
|
|
298
|
-
.send()
|
|
302
|
+
.send({ from: this.adminAddress })
|
|
299
303
|
.deployed();
|
|
300
304
|
|
|
301
305
|
this.logger.info(`BananaPay deployed at ${bananaFPC.address}`);
|
|
302
306
|
|
|
303
|
-
await this.feeJuiceBridgeTestHarness.bridgeFromL1ToL2(
|
|
307
|
+
await this.feeJuiceBridgeTestHarness.bridgeFromL1ToL2(
|
|
308
|
+
FEE_FUNDING_FOR_TESTER_ACCOUNT,
|
|
309
|
+
bananaFPC.address,
|
|
310
|
+
this.adminAddress,
|
|
311
|
+
);
|
|
304
312
|
|
|
305
313
|
return { bananaFPCAddress: bananaFPC.address };
|
|
306
314
|
},
|
|
@@ -339,6 +347,7 @@ export class ClientFlowsBenchmark {
|
|
|
339
347
|
this.pxe,
|
|
340
348
|
l1Client,
|
|
341
349
|
owner,
|
|
350
|
+
owner.getAddress(),
|
|
342
351
|
this.logger,
|
|
343
352
|
underlyingERC20Address,
|
|
344
353
|
);
|
|
@@ -378,7 +387,7 @@ export class ClientFlowsBenchmark {
|
|
|
378
387
|
'deploy_amm',
|
|
379
388
|
async () => {
|
|
380
389
|
const liquidityToken = await TokenContract.deploy(this.adminWallet, this.adminAddress, 'LPT', 'LPT', 18n)
|
|
381
|
-
.send()
|
|
390
|
+
.send({ from: this.adminAddress })
|
|
382
391
|
.deployed();
|
|
383
392
|
const amm = await AMMContract.deploy(
|
|
384
393
|
this.adminWallet,
|
|
@@ -386,10 +395,10 @@ export class ClientFlowsBenchmark {
|
|
|
386
395
|
this.candyBarCoin.address,
|
|
387
396
|
liquidityToken.address,
|
|
388
397
|
)
|
|
389
|
-
.send()
|
|
398
|
+
.send({ from: this.adminAddress })
|
|
390
399
|
.deployed();
|
|
391
400
|
this.logger.info(`AMM deployed at ${amm.address}`);
|
|
392
|
-
await liquidityToken.methods.set_minter(amm.address, true).send().wait();
|
|
401
|
+
await liquidityToken.methods.set_minter(amm.address, true).send({ from: this.adminAddress }).wait();
|
|
393
402
|
return { ammAddress: amm.address, liquidityTokenAddress: liquidityToken.address };
|
|
394
403
|
},
|
|
395
404
|
async ({ ammAddress, liquidityTokenAddress }) => {
|
package/src/bench/utils.ts
CHANGED
|
@@ -22,7 +22,9 @@ export async function benchmarkSetup(
|
|
|
22
22
|
},
|
|
23
23
|
) {
|
|
24
24
|
const context = await setup(1, { ...opts, telemetryConfig: { benchmark: true } });
|
|
25
|
-
const contract = await BenchmarkingContract.deploy(context.wallet)
|
|
25
|
+
const contract = await BenchmarkingContract.deploy(context.wallet)
|
|
26
|
+
.send({ from: context.wallet.getAddress() })
|
|
27
|
+
.deployed();
|
|
26
28
|
context.logger.info(`Deployed benchmarking contract at ${contract.address}`);
|
|
27
29
|
const sequencer = (context.aztecNode as AztecNodeService).getSequencer()!;
|
|
28
30
|
const telemetry = context.telemetryClient! as BenchmarkTelemetryClient;
|
|
@@ -137,7 +139,7 @@ export async function sendTxs(
|
|
|
137
139
|
): Promise<SentTx[]> {
|
|
138
140
|
const calls = times(txCount, index => makeCall(index, context, contract, heavyPublicCompute));
|
|
139
141
|
context.logger.info(`Creating ${txCount} txs`);
|
|
140
|
-
const provenTxs = await Promise.all(calls.map(call => call.prove()));
|
|
142
|
+
const provenTxs = await Promise.all(calls.map(call => call.prove({ from: context.wallet.getAddress() })));
|
|
141
143
|
context.logger.info(`Sending ${txCount} txs`);
|
|
142
144
|
return provenTxs.map(tx => tx.send());
|
|
143
145
|
}
|