@aztec/end-to-end 0.0.0-test.1 → 0.0.1-fake-ceab37513c

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.
Files changed (156) hide show
  1. package/dest/bench/client_flows/benchmark.d.ts +60 -0
  2. package/dest/bench/client_flows/benchmark.d.ts.map +1 -0
  3. package/dest/bench/client_flows/benchmark.js +261 -0
  4. package/dest/bench/client_flows/client_flows_benchmark.d.ts +69 -0
  5. package/dest/bench/client_flows/client_flows_benchmark.d.ts.map +1 -0
  6. package/dest/bench/client_flows/client_flows_benchmark.js +315 -0
  7. package/dest/bench/client_flows/config.d.ts +14 -0
  8. package/dest/bench/client_flows/config.d.ts.map +1 -0
  9. package/dest/bench/client_flows/config.js +106 -0
  10. package/dest/bench/client_flows/data_extractor.d.ts +2 -0
  11. package/dest/bench/client_flows/data_extractor.d.ts.map +1 -0
  12. package/dest/bench/client_flows/data_extractor.js +99 -0
  13. package/dest/bench/utils.d.ts +10 -27
  14. package/dest/bench/utils.d.ts.map +1 -1
  15. package/dest/bench/utils.js +27 -43
  16. package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts +15 -7
  17. package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts.map +1 -1
  18. package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.js +66 -38
  19. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts +10 -18
  20. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts.map +1 -1
  21. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.js +34 -53
  22. package/dest/e2e_deploy_contract/deploy_test.d.ts +4 -2
  23. package/dest/e2e_deploy_contract/deploy_test.d.ts.map +1 -1
  24. package/dest/e2e_deploy_contract/deploy_test.js +9 -6
  25. package/dest/e2e_epochs/epochs_test.d.ts +56 -17
  26. package/dest/e2e_epochs/epochs_test.d.ts.map +1 -1
  27. package/dest/e2e_epochs/epochs_test.js +222 -42
  28. package/dest/e2e_fees/bridging_race.notest.d.ts +2 -0
  29. package/dest/e2e_fees/bridging_race.notest.d.ts.map +1 -0
  30. package/dest/e2e_fees/bridging_race.notest.js +60 -0
  31. package/dest/e2e_fees/fees_test.d.ts +16 -5
  32. package/dest/e2e_fees/fees_test.d.ts.map +1 -1
  33. package/dest/e2e_fees/fees_test.js +87 -88
  34. package/dest/e2e_l1_publisher/write_json.d.ts +8 -0
  35. package/dest/e2e_l1_publisher/write_json.d.ts.map +1 -0
  36. package/dest/e2e_l1_publisher/write_json.js +57 -0
  37. package/dest/e2e_multi_validator/utils.d.ts +12 -0
  38. package/dest/e2e_multi_validator/utils.d.ts.map +1 -0
  39. package/dest/e2e_multi_validator/utils.js +214 -0
  40. package/dest/e2e_nested_contract/nested_contract_test.d.ts +5 -5
  41. package/dest/e2e_nested_contract/nested_contract_test.d.ts.map +1 -1
  42. package/dest/e2e_nested_contract/nested_contract_test.js +19 -14
  43. package/dest/e2e_p2p/inactivity_slash_test.d.ts +31 -0
  44. package/dest/e2e_p2p/inactivity_slash_test.d.ts.map +1 -0
  45. package/dest/e2e_p2p/inactivity_slash_test.js +132 -0
  46. package/dest/e2e_p2p/p2p_network.d.ts +56 -21
  47. package/dest/e2e_p2p/p2p_network.d.ts.map +1 -1
  48. package/dest/e2e_p2p/p2p_network.js +154 -125
  49. package/dest/e2e_p2p/shared.d.ts +41 -3
  50. package/dest/e2e_p2p/shared.d.ts.map +1 -1
  51. package/dest/e2e_p2p/shared.js +146 -6
  52. package/dest/e2e_token_contract/token_contract_test.d.ts +10 -5
  53. package/dest/e2e_token_contract/token_contract_test.d.ts.map +1 -1
  54. package/dest/e2e_token_contract/token_contract_test.js +51 -24
  55. package/dest/{e2e_prover → fixtures}/e2e_prover_test.d.ts +7 -4
  56. package/dest/fixtures/e2e_prover_test.d.ts.map +1 -0
  57. package/dest/{e2e_prover → fixtures}/e2e_prover_test.js +67 -62
  58. package/dest/fixtures/fixtures.d.ts +5 -6
  59. package/dest/fixtures/fixtures.d.ts.map +1 -1
  60. package/dest/fixtures/fixtures.js +4 -3
  61. package/dest/fixtures/get_acvm_config.d.ts.map +1 -1
  62. package/dest/fixtures/get_acvm_config.js +2 -14
  63. package/dest/fixtures/get_bb_config.d.ts.map +1 -1
  64. package/dest/fixtures/get_bb_config.js +8 -15
  65. package/dest/fixtures/l1_to_l2_messaging.d.ts +8 -5
  66. package/dest/fixtures/l1_to_l2_messaging.d.ts.map +1 -1
  67. package/dest/fixtures/l1_to_l2_messaging.js +44 -18
  68. package/dest/fixtures/setup_l1_contracts.d.ts +3 -3
  69. package/dest/fixtures/setup_l1_contracts.d.ts.map +1 -1
  70. package/dest/fixtures/setup_l1_contracts.js +3 -3
  71. package/dest/fixtures/setup_p2p_test.d.ts +14 -6
  72. package/dest/fixtures/setup_p2p_test.d.ts.map +1 -1
  73. package/dest/fixtures/setup_p2p_test.js +73 -21
  74. package/dest/fixtures/snapshot_manager.d.ts +8 -3
  75. package/dest/fixtures/snapshot_manager.d.ts.map +1 -1
  76. package/dest/fixtures/snapshot_manager.js +120 -104
  77. package/dest/fixtures/token_utils.d.ts +4 -3
  78. package/dest/fixtures/token_utils.d.ts.map +1 -1
  79. package/dest/fixtures/token_utils.js +24 -7
  80. package/dest/fixtures/utils.d.ts +65 -22
  81. package/dest/fixtures/utils.d.ts.map +1 -1
  82. package/dest/fixtures/utils.js +439 -318
  83. package/dest/fixtures/web3signer.d.ts +5 -0
  84. package/dest/fixtures/web3signer.d.ts.map +1 -0
  85. package/dest/fixtures/web3signer.js +42 -0
  86. package/dest/shared/cross_chain_test_harness.d.ts +28 -18
  87. package/dest/shared/cross_chain_test_harness.d.ts.map +1 -1
  88. package/dest/shared/cross_chain_test_harness.js +97 -41
  89. package/dest/shared/gas_portal_test_harness.d.ts +23 -18
  90. package/dest/shared/gas_portal_test_harness.d.ts.map +1 -1
  91. package/dest/shared/gas_portal_test_harness.js +43 -25
  92. package/dest/shared/submit-transactions.d.ts.map +1 -1
  93. package/dest/shared/uniswap_l1_l2.d.ts +5 -6
  94. package/dest/shared/uniswap_l1_l2.d.ts.map +1 -1
  95. package/dest/shared/uniswap_l1_l2.js +136 -90
  96. package/dest/simulators/lending_simulator.d.ts +5 -6
  97. package/dest/simulators/lending_simulator.d.ts.map +1 -1
  98. package/dest/simulators/lending_simulator.js +11 -15
  99. package/dest/simulators/token_simulator.d.ts +2 -1
  100. package/dest/simulators/token_simulator.d.ts.map +1 -1
  101. package/dest/simulators/token_simulator.js +16 -13
  102. package/dest/spartan/setup_test_wallets.d.ts +8 -1
  103. package/dest/spartan/setup_test_wallets.d.ts.map +1 -1
  104. package/dest/spartan/setup_test_wallets.js +108 -22
  105. package/dest/spartan/utils.d.ts +60 -307
  106. package/dest/spartan/utils.d.ts.map +1 -1
  107. package/dest/spartan/utils.js +200 -115
  108. package/package.json +60 -56
  109. package/src/bench/client_flows/benchmark.ts +341 -0
  110. package/src/bench/client_flows/client_flows_benchmark.ts +422 -0
  111. package/src/bench/client_flows/config.ts +61 -0
  112. package/src/bench/client_flows/data_extractor.ts +111 -0
  113. package/src/bench/utils.ts +26 -52
  114. package/src/e2e_blacklist_token_contract/blacklist_token_contract_test.ts +60 -40
  115. package/src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts +47 -75
  116. package/src/e2e_deploy_contract/deploy_test.ts +11 -8
  117. package/src/e2e_epochs/epochs_test.ts +276 -54
  118. package/src/e2e_fees/bridging_race.notest.ts +75 -0
  119. package/src/e2e_fees/fees_test.ts +121 -108
  120. package/src/e2e_l1_publisher/write_json.ts +74 -0
  121. package/src/e2e_multi_validator/utils.ts +258 -0
  122. package/src/e2e_nested_contract/nested_contract_test.ts +22 -14
  123. package/src/e2e_p2p/inactivity_slash_test.ts +174 -0
  124. package/src/e2e_p2p/p2p_network.ts +212 -144
  125. package/src/e2e_p2p/shared.ts +234 -14
  126. package/src/e2e_token_contract/token_contract_test.ts +42 -38
  127. package/src/fixtures/dumps/epoch_proof_result.json +1 -1
  128. package/src/{e2e_prover → fixtures}/e2e_prover_test.ts +62 -69
  129. package/src/fixtures/fixtures.ts +4 -3
  130. package/src/fixtures/get_acvm_config.ts +2 -10
  131. package/src/fixtures/get_bb_config.ts +15 -11
  132. package/src/fixtures/l1_to_l2_messaging.ts +53 -23
  133. package/src/fixtures/setup_l1_contracts.ts +5 -6
  134. package/src/fixtures/setup_p2p_test.ts +112 -30
  135. package/src/fixtures/snapshot_manager.ts +150 -102
  136. package/src/fixtures/token_utils.ts +33 -8
  137. package/src/fixtures/utils.ts +530 -352
  138. package/src/fixtures/web3signer.ts +46 -0
  139. package/src/guides/up_quick_start.sh +4 -4
  140. package/src/shared/cross_chain_test_harness.ts +92 -52
  141. package/src/shared/gas_portal_test_harness.ts +47 -31
  142. package/src/shared/uniswap_l1_l2.ts +127 -124
  143. package/src/simulators/lending_simulator.ts +11 -15
  144. package/src/simulators/token_simulator.ts +17 -12
  145. package/src/spartan/DEVELOP.md +116 -0
  146. package/src/spartan/setup_test_wallets.ts +144 -29
  147. package/src/spartan/utils.ts +194 -116
  148. package/dest/e2e_prover/e2e_prover_test.d.ts.map +0 -1
  149. package/dest/sample-dapp/connect.js +0 -12
  150. package/dest/sample-dapp/contracts.js +0 -10
  151. package/dest/sample-dapp/deploy.js +0 -35
  152. package/dest/sample-dapp/index.js +0 -98
  153. package/src/sample-dapp/connect.mjs +0 -16
  154. package/src/sample-dapp/contracts.mjs +0 -14
  155. package/src/sample-dapp/deploy.mjs +0 -40
  156. package/src/sample-dapp/index.mjs +0 -128
@@ -1,11 +1,14 @@
1
- import { type AccountWallet, type AztecAddress, type AztecNode, ChainMonitor, CheatCodes, type Logger, type PXE } from '@aztec/aztec.js';
2
- import { type DeployL1ContractsArgs } from '@aztec/ethereum';
1
+ import { type AccountWallet, type AztecAddress, type AztecNode, type Logger, type PXE } from '@aztec/aztec.js';
2
+ import { CheatCodes } from '@aztec/aztec/testing';
3
+ import { type DeployL1ContractsArgs, RollupContract } from '@aztec/ethereum';
4
+ import { ChainMonitor } from '@aztec/ethereum/test';
3
5
  import { EthAddress } from '@aztec/foundation/eth-address';
4
6
  import { AppSubscriptionContract } from '@aztec/noir-contracts.js/AppSubscription';
5
- import { CounterContract } from '@aztec/noir-contracts.js/Counter';
6
7
  import { FPCContract } from '@aztec/noir-contracts.js/FPC';
7
8
  import { FeeJuiceContract } from '@aztec/noir-contracts.js/FeeJuice';
9
+ import { SponsoredFPCContract } from '@aztec/noir-contracts.js/SponsoredFPC';
8
10
  import { TokenContract as BananaCoin } from '@aztec/noir-contracts.js/Token';
11
+ import { CounterContract } from '@aztec/noir-test-contracts.js/Counter';
9
12
  import { GasSettings } from '@aztec/stdlib/gas';
10
13
  import { type SubsystemsContext } from '../fixtures/snapshot_manager.js';
11
14
  import { type BalancesFn, type SetupOptions } from '../fixtures/utils.js';
@@ -16,6 +19,7 @@ import { type GasBridgingTestHarness } from '../shared/gas_portal_test_harness.j
16
19
  * PublicDeployAccounts: Deploys the accounts publicly.
17
20
  * DeployFeeJuice: Deploys the Fee Juice contract.
18
21
  * FPCSetup: Deploys BananaCoin and FPC contracts, and bridges gas from L1.
22
+ * SponsoredFPCSetup: Deploys Sponsored FPC contract, and bridges gas from L1.
19
23
  * FundAlice: Mints private and public bananas to Alice.
20
24
  * SetupSubscription: Deploys a counter contract and a subscription contract, and mints Fee Juice to the subscription contract.
21
25
  */
@@ -23,6 +27,7 @@ export declare class FeesTest {
23
27
  private numberOfAccounts;
24
28
  private snapshotManager;
25
29
  private wallets;
30
+ private accounts;
26
31
  logger: Logger;
27
32
  pxe: PXE;
28
33
  aztecNode: AztecNode;
@@ -35,9 +40,11 @@ export declare class FeesTest {
35
40
  coinbase: EthAddress;
36
41
  fpcAdmin: AztecAddress;
37
42
  gasSettings: GasSettings;
43
+ rollupContract: RollupContract;
38
44
  feeJuiceContract: FeeJuiceContract;
39
45
  bananaCoin: BananaCoin;
40
46
  bananaFPC: FPCContract;
47
+ sponsoredFPC: SponsoredFPCContract;
41
48
  counterContract: CounterContract;
42
49
  subscriptionContract: AppSubscriptionContract;
43
50
  feeJuiceBridgeTestHarness: GasBridgingTestHarness;
@@ -57,7 +64,11 @@ export declare class FeesTest {
57
64
  teardown(): Promise<void>;
58
65
  setIsMarkingAsProven(b: boolean): void;
59
66
  catchUpProvenChain(): Promise<void>;
60
- mintAndBridgeFeeJuice(address: AztecAddress, amount: bigint): Promise<void>;
67
+ getBlockRewards(): Promise<{
68
+ sequencerBlockRewards: bigint;
69
+ proverBlockRewards: bigint;
70
+ }>;
71
+ mintAndBridgeFeeJuice(minter: AztecAddress, recipient: AztecAddress): Promise<void>;
61
72
  /** Alice mints bananaCoin tokens privately to the target address and redeems them. */
62
73
  mintPrivateBananas(amount: bigint, address: AztecAddress): Promise<void>;
63
74
  applyBaseSnapshots(): Promise<void>;
@@ -66,8 +77,8 @@ export declare class FeesTest {
66
77
  applySetupFeeJuiceSnapshot(): Promise<void>;
67
78
  applyDeployBananaTokenSnapshot(): Promise<void>;
68
79
  applyFPCSetupSnapshot(): Promise<void>;
80
+ applySponsoredFPCSetupSnapshot(): Promise<void>;
69
81
  applyFundAliceWithBananas(): Promise<void>;
70
82
  applyFundAliceWithPrivateBananas(): Promise<void>;
71
- applySetupSubscription(): Promise<void>;
72
83
  }
73
84
  //# sourceMappingURL=fees_test.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"fees_test.d.ts","sourceRoot":"","sources":["../../src/e2e_fees/fees_test.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,aAAa,EAClB,KAAK,YAAY,EACjB,KAAK,SAAS,EACd,YAAY,EACZ,UAAU,EACV,KAAK,MAAM,EACX,KAAK,GAAG,EAGT,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAE,KAAK,qBAAqB,EAAmC,MAAM,iBAAiB,CAAC;AAC9F,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAE3D,OAAO,EAAE,uBAAuB,EAAE,MAAM,0CAA0C,CAAC;AAC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ep } from '@aztec/aztec.js';
3
- import { FEE_FUNDING_FOR_TESTER_ACCOUNT } from '@aztec/constants';
4
- import { RollupContract, createL1Clients } from '@aztec/ethereum';
2
+ import { createLogger, sleep } from '@aztec/aztec.js';
3
+ import { CheatCodes } from '@aztec/aztec/testing';
4
+ import { RollupContract, createExtendedL1Client } from '@aztec/ethereum';
5
+ import { ChainMonitor } from '@aztec/ethereum/test';
5
6
  import { EthAddress } from '@aztec/foundation/eth-address';
6
- import { RollupAbi, TestERC20Abi } from '@aztec/l1-artifacts';
7
- import { AppSubscriptionContract } from '@aztec/noir-contracts.js/AppSubscription';
8
- import { CounterContract } from '@aztec/noir-contracts.js/Counter';
7
+ import { TestERC20Abi } from '@aztec/l1-artifacts';
9
8
  import { FPCContract } from '@aztec/noir-contracts.js/FPC';
10
9
  import { FeeJuiceContract } from '@aztec/noir-contracts.js/FeeJuice';
10
+ import { SponsoredFPCContract } from '@aztec/noir-contracts.js/SponsoredFPC';
11
11
  import { TokenContract as BananaCoin } from '@aztec/noir-contracts.js/Token';
12
12
  import { ProtocolContractAddress } from '@aztec/protocol-contracts';
13
13
  import { getCanonicalFeeJuice } from '@aztec/protocol-contracts/fee-juice';
14
- import { computePartialAddress } from '@aztec/stdlib/contract';
15
14
  import { GasSettings } from '@aztec/stdlib/gas';
16
15
  import { getContract } from 'viem';
17
16
  import { MNEMONIC } from '../fixtures/fixtures.js';
18
17
  import { createSnapshotManager, deployAccounts } from '../fixtures/snapshot_manager.js';
19
18
  import { mintTokensToPrivate } from '../fixtures/token_utils.js';
20
- import { ensureAccountsPubliclyDeployed, getBalancesFn, setupCanonicalFeeJuice } from '../fixtures/utils.js';
19
+ import { ensureAccountContractsPublished, getBalancesFn, setupSponsoredFPC } from '../fixtures/utils.js';
21
20
  import { FeeJuicePortalTestingHarnessFactory } from '../shared/gas_portal_test_harness.js';
22
21
  const { E2E_DATA_PATH: dataPath } = process.env;
23
22
  /**
@@ -26,12 +25,14 @@ const { E2E_DATA_PATH: dataPath } = process.env;
26
25
  * PublicDeployAccounts: Deploys the accounts publicly.
27
26
  * DeployFeeJuice: Deploys the Fee Juice contract.
28
27
  * FPCSetup: Deploys BananaCoin and FPC contracts, and bridges gas from L1.
28
+ * SponsoredFPCSetup: Deploys Sponsored FPC contract, and bridges gas from L1.
29
29
  * FundAlice: Mints private and public bananas to Alice.
30
30
  * SetupSubscription: Deploys a counter contract and a subscription contract, and mints Fee Juice to the subscription contract.
31
31
  */ export class FeesTest {
32
32
  numberOfAccounts;
33
33
  snapshotManager;
34
34
  wallets;
35
+ accounts;
35
36
  logger;
36
37
  pxe;
37
38
  aztecNode;
@@ -44,9 +45,11 @@ const { E2E_DATA_PATH: dataPath } = process.env;
44
45
  coinbase;
45
46
  fpcAdmin;
46
47
  gasSettings;
48
+ rollupContract;
47
49
  feeJuiceContract;
48
50
  bananaCoin;
49
51
  bananaFPC;
52
+ sponsoredFPC;
50
53
  counterContract;
51
54
  subscriptionContract;
52
55
  feeJuiceBridgeTestHarness;
@@ -64,12 +67,15 @@ const { E2E_DATA_PATH: dataPath } = process.env;
64
67
  constructor(testName, numberOfAccounts = 3, setupOptions = {}){
65
68
  this.numberOfAccounts = numberOfAccounts;
66
69
  this.wallets = [];
70
+ this.accounts = [];
67
71
  this.ALICE_INITIAL_BANANAS = BigInt(1e22);
68
72
  this.SUBSCRIPTION_AMOUNT = BigInt(1e19);
69
73
  this.APP_SPONSORED_TX_GAS_LIMIT = BigInt(10e9);
70
74
  if (!numberOfAccounts) {
71
75
  throw new Error('There must be at least 1 initial account.');
72
76
  }
77
+ setupOptions.coinbase ??= EthAddress.random();
78
+ this.coinbase = setupOptions.coinbase;
73
79
  this.logger = createLogger(`e2e:e2e_fees:${testName}`);
74
80
  this.snapshotManager = createSnapshotManager(`e2e_fees/${testName}-${numberOfAccounts}`, dataPath, {
75
81
  startProverNode: true,
@@ -80,16 +86,12 @@ const { E2E_DATA_PATH: dataPath } = process.env;
80
86
  }
81
87
  async setup() {
82
88
  const context = await this.snapshotManager.setup();
83
- await context.aztecNode.setConfig({
84
- feeRecipient: this.sequencerAddress,
85
- coinbase: this.coinbase
86
- });
87
- const rollupContract = RollupContract.getFromConfig(context.aztecNodeConfig);
88
- this.chainMonitor = new ChainMonitor(rollupContract, this.logger, 200).start();
89
+ this.rollupContract = RollupContract.getFromConfig(context.aztecNodeConfig);
90
+ this.chainMonitor = new ChainMonitor(this.rollupContract, context.dateProvider, this.logger, 200).start();
89
91
  return this;
90
92
  }
91
93
  async teardown() {
92
- this.chainMonitor.stop();
94
+ await this.chainMonitor.stop();
93
95
  await this.snapshotManager.teardown();
94
96
  }
95
97
  setIsMarkingAsProven(b) {
@@ -101,15 +103,33 @@ const { E2E_DATA_PATH: dataPath } = process.env;
101
103
  await sleep(1000);
102
104
  }
103
105
  }
104
- async mintAndBridgeFeeJuice(address, amount) {
105
- const claim = await this.feeJuiceBridgeTestHarness.prepareTokensOnL1(amount, address);
106
+ async getBlockRewards() {
107
+ const blockReward = await this.rollupContract.getBlockReward();
108
+ const rewardConfig = await this.rollupContract.getRewardConfig();
109
+ const balance = await this.feeJuiceBridgeTestHarness.getL1FeeJuiceBalance(EthAddress.fromString(rewardConfig.rewardDistributor));
110
+ const toDistribute = balance > blockReward ? blockReward : balance;
111
+ const sequencerBlockRewards = toDistribute * BigInt(rewardConfig.sequencerBps) / 10000n;
112
+ const proverBlockRewards = toDistribute - sequencerBlockRewards;
113
+ return {
114
+ sequencerBlockRewards,
115
+ proverBlockRewards
116
+ };
117
+ }
118
+ async mintAndBridgeFeeJuice(minter, recipient) {
119
+ const claim = await this.feeJuiceBridgeTestHarness.prepareTokensOnL1(recipient);
106
120
  const { claimSecret: secret, messageLeafIndex: index } = claim;
107
- await this.feeJuiceContract.methods.claim(address, amount, secret, index).send().wait();
121
+ await this.feeJuiceContract.methods.claim(recipient, claim.claimAmount, secret, index).send({
122
+ from: minter
123
+ }).wait();
108
124
  }
109
125
  /** Alice mints bananaCoin tokens privately to the target address and redeems them. */ async mintPrivateBananas(amount, address) {
110
- const balanceBefore = await this.bananaCoin.methods.balance_of_private(address).simulate();
111
- await mintTokensToPrivate(this.bananaCoin, this.aliceWallet, address, amount);
112
- const balanceAfter = await this.bananaCoin.methods.balance_of_private(address).simulate();
126
+ const balanceBefore = await this.bananaCoin.methods.balance_of_private(address).simulate({
127
+ from: this.aliceAddress
128
+ });
129
+ await mintTokensToPrivate(this.bananaCoin, this.aliceAddress, this.aliceWallet, address, amount);
130
+ const balanceAfter = await this.bananaCoin.methods.balance_of_private(address).simulate({
131
+ from: this.aliceAddress
132
+ });
113
133
  expect(balanceAfter).toEqual(balanceBefore + amount);
114
134
  }
115
135
  async applyBaseSnapshots() {
@@ -128,44 +148,28 @@ const { E2E_DATA_PATH: dataPath } = process.env;
128
148
  this.cheatCodes = await CheatCodes.create(aztecNodeConfig.l1RpcUrls, pxe);
129
149
  this.wallets = await Promise.all(deployedAccounts.map((a)=>getSchnorrWallet(pxe, a.address, a.signingKey)));
130
150
  this.wallets.forEach((w, i)=>this.logger.verbose(`Wallet ${i} address: ${w.getAddress()}`));
151
+ this.accounts = this.wallets.map((w)=>w.getAddress());
131
152
  [this.aliceWallet, this.bobWallet] = this.wallets.slice(0, 2);
132
- [this.aliceAddress, this.bobAddress, this.sequencerAddress] = this.wallets.map((w)=>w.getAddress());
153
+ [this.aliceAddress, this.bobAddress, this.sequencerAddress] = this.accounts;
133
154
  // We set Alice as the FPC admin to avoid the need for deployment of another account.
134
155
  this.fpcAdmin = this.aliceAddress;
135
156
  const canonicalFeeJuice = await getCanonicalFeeJuice();
136
157
  this.feeJuiceContract = await FeeJuiceContract.at(canonicalFeeJuice.address, this.aliceWallet);
137
- if (this.numberOfAccounts > 1) {
138
- const bobInstance = (await this.bobWallet.getContractMetadata(this.bobAddress)).contractInstance;
139
- await this.aliceWallet.registerAccount(deployedAccounts[1].secret, await computePartialAddress(bobInstance));
140
- }
141
- this.coinbase = EthAddress.random();
142
- const { publicClient, walletClient } = createL1Clients(aztecNodeConfig.l1RpcUrls, MNEMONIC);
143
- this.feeJuiceBridgeTestHarness = await FeeJuicePortalTestingHarnessFactory.create({
144
- aztecNode: aztecNode,
145
- pxeService: pxe,
146
- publicClient: publicClient,
147
- walletClient: walletClient,
148
- wallet: this.aliceWallet,
149
- logger: this.logger
150
- });
151
158
  });
152
159
  }
153
160
  async applyPublicDeployAccountsSnapshot() {
154
- await this.snapshotManager.snapshot('public_deploy_accounts', ()=>ensureAccountsPubliclyDeployed(this.aliceWallet, this.wallets));
161
+ await this.snapshotManager.snapshot('public_deploy_accounts', ()=>ensureAccountContractsPublished(this.aliceWallet, this.wallets));
155
162
  }
156
163
  async applySetupFeeJuiceSnapshot() {
157
- await this.snapshotManager.snapshot('setup_fee_juice', async (context)=>{
158
- await setupCanonicalFeeJuice(context.pxe);
159
- }, async (_data, context)=>{
164
+ await this.snapshotManager.snapshot('setup_fee_juice', async ()=>{}, async (_data, context)=>{
160
165
  this.context = context;
161
166
  this.feeJuiceContract = await FeeJuiceContract.at(ProtocolContractAddress.FeeJuice, this.aliceWallet);
162
- this.getGasBalanceFn = getBalancesFn('⛽', this.feeJuiceContract.methods.balance_of_public, this.logger);
163
- const { publicClient, walletClient } = createL1Clients(context.aztecNodeConfig.l1RpcUrls, MNEMONIC);
167
+ this.getGasBalanceFn = getBalancesFn('⛽', this.feeJuiceContract.methods.balance_of_public, this.aliceAddress, this.logger);
164
168
  this.feeJuiceBridgeTestHarness = await FeeJuicePortalTestingHarnessFactory.create({
165
169
  aztecNode: context.aztecNode,
170
+ aztecNodeAdmin: context.aztecNode,
166
171
  pxeService: context.pxe,
167
- publicClient: publicClient,
168
- walletClient: walletClient,
172
+ l1Client: context.deployL1ContractsValues.l1Client,
169
173
  wallet: this.aliceWallet,
170
174
  logger: this.logger
171
175
  });
@@ -173,23 +177,30 @@ const { E2E_DATA_PATH: dataPath } = process.env;
173
177
  }
174
178
  async applyDeployBananaTokenSnapshot() {
175
179
  await this.snapshotManager.snapshot('deploy_banana_token', async ()=>{
176
- const bananaCoin = await BananaCoin.deploy(this.aliceWallet, this.aliceAddress, 'BC', 'BC', 18n).send().deployed();
180
+ const bananaCoin = await BananaCoin.deploy(this.aliceWallet, this.aliceAddress, 'BC', 'BC', 18n).send({
181
+ from: this.aliceAddress
182
+ }).deployed();
177
183
  this.logger.info(`BananaCoin deployed at ${bananaCoin.address}`);
178
184
  return {
179
185
  bananaCoinAddress: bananaCoin.address
180
186
  };
181
187
  }, async ({ bananaCoinAddress })=>{
182
188
  this.bananaCoin = await BananaCoin.at(bananaCoinAddress, this.aliceWallet);
189
+ const logger = this.logger;
190
+ this.getBananaPublicBalanceFn = getBalancesFn('🍌.public', this.bananaCoin.methods.balance_of_public, this.aliceAddress, logger);
191
+ this.getBananaPrivateBalanceFn = getBalancesFn('🍌.private', this.bananaCoin.methods.balance_of_private, this.aliceAddress, logger);
183
192
  });
184
193
  }
185
194
  async applyFPCSetupSnapshot() {
186
195
  await this.snapshotManager.snapshot('fpc_setup', async (context)=>{
187
196
  const feeJuiceContract = this.feeJuiceBridgeTestHarness.feeJuice;
188
- expect((await context.pxe.getContractMetadata(feeJuiceContract.address)).isContractPubliclyDeployed).toBe(true);
197
+ expect((await context.pxe.getContractMetadata(feeJuiceContract.address)).isContractPublished).toBe(true);
189
198
  const bananaCoin = this.bananaCoin;
190
- const bananaFPC = await FPCContract.deploy(this.aliceWallet, bananaCoin.address, this.fpcAdmin).send().deployed();
199
+ const bananaFPC = await FPCContract.deploy(this.aliceWallet, bananaCoin.address, this.fpcAdmin).send({
200
+ from: this.aliceAddress
201
+ }).deployed();
191
202
  this.logger.info(`BananaPay deployed at ${bananaFPC.address}`);
192
- await this.feeJuiceBridgeTestHarness.bridgeFromL1ToL2(FEE_FUNDING_FOR_TESTER_ACCOUNT, bananaFPC.address);
203
+ await this.feeJuiceBridgeTestHarness.bridgeFromL1ToL2(bananaFPC.address, this.aliceAddress);
193
204
  return {
194
205
  bananaFPCAddress: bananaFPC.address,
195
206
  feeJuiceAddress: feeJuiceContract.address,
@@ -199,49 +210,54 @@ const { E2E_DATA_PATH: dataPath } = process.env;
199
210
  }, async (data, context)=>{
200
211
  const bananaFPC = await FPCContract.at(data.bananaFPCAddress, this.aliceWallet);
201
212
  this.bananaFPC = bananaFPC;
202
- const logger = this.logger;
203
- this.getBananaPublicBalanceFn = getBalancesFn('🍌.public', this.bananaCoin.methods.balance_of_public, logger);
204
- this.getBananaPrivateBalanceFn = getBalancesFn('🍌.private', this.bananaCoin.methods.balance_of_private, logger);
205
213
  this.getCoinbaseBalance = async ()=>{
206
- const { walletClient } = createL1Clients(context.aztecNodeConfig.l1RpcUrls, MNEMONIC);
214
+ const l1Client = createExtendedL1Client(context.aztecNodeConfig.l1RpcUrls, MNEMONIC);
207
215
  const gasL1 = getContract({
208
216
  address: data.l1FeeJuiceAddress.toString(),
209
217
  abi: TestERC20Abi,
210
- client: walletClient
218
+ client: l1Client
211
219
  });
212
220
  return await gasL1.read.balanceOf([
213
221
  this.coinbase.toString()
214
222
  ]);
215
223
  };
216
224
  this.getCoinbaseSequencerRewards = async ()=>{
217
- const { walletClient } = createL1Clients(context.aztecNodeConfig.l1RpcUrls, MNEMONIC);
218
- const rollup = getContract({
219
- address: data.rollupAddress.toString(),
220
- abi: RollupAbi,
221
- client: walletClient
222
- });
223
- return await rollup.read.getSequencerRewards([
224
- this.coinbase.toString()
225
- ]);
225
+ return await this.rollupContract.getSequencerRewards(this.coinbase);
226
226
  };
227
227
  this.getProverFee = async (blockNumber)=>{
228
- const { walletClient } = createL1Clients(context.aztecNodeConfig.l1RpcUrls, MNEMONIC);
229
- const rollup = getContract({
230
- address: data.rollupAddress.toString(),
231
- abi: RollupAbi,
232
- client: walletClient
233
- });
234
- const provingCostPerMana = await rollup.read.getProvingCostPerManaInFeeAsset();
235
228
  const block = await this.pxe.getBlock(blockNumber);
229
+ // @todo @lherskind As we deal with #13601
230
+ // Right now the value is from `FeeLib.sol`
231
+ const L1_GAS_PER_EPOCH_VERIFIED = 1000000n;
232
+ // We round up
233
+ const mulDiv = (a, b, c)=>a * b / c + (a * b % c > 0n ? 1n : 0n);
234
+ const { baseFee } = await this.rollupContract.getL1FeesAt(block.header.globalVariables.timestamp);
235
+ const proverCost = mulDiv(mulDiv(L1_GAS_PER_EPOCH_VERIFIED, baseFee, await this.rollupContract.getEpochDuration()), 1n, await this.rollupContract.getManaTarget()) + await this.rollupContract.getProvingCostPerMana();
236
+ const price = await this.rollupContract.getFeeAssetPerEth();
236
237
  const mana = block.header.totalManaUsed.toBigInt();
237
- return mana * provingCostPerMana;
238
+ return mulDiv(mana * proverCost, price, 10n ** 9n);
238
239
  };
239
240
  });
240
241
  }
242
+ async applySponsoredFPCSetupSnapshot() {
243
+ await this.snapshotManager.snapshot('sponsored_fpc_setup', async (context)=>{
244
+ const feeJuiceContract = this.feeJuiceBridgeTestHarness.feeJuice;
245
+ expect((await context.pxe.getContractMetadata(feeJuiceContract.address)).isContractPublished).toBe(true);
246
+ const sponsoredFPC = await setupSponsoredFPC(context.pxe);
247
+ this.logger.info(`SponsoredFPC at ${sponsoredFPC.address}`);
248
+ return {
249
+ sponsoredFPCAddress: sponsoredFPC.address
250
+ };
251
+ }, async (data)=>{
252
+ this.sponsoredFPC = await SponsoredFPCContract.at(data.sponsoredFPCAddress, this.aliceWallet);
253
+ });
254
+ }
241
255
  async applyFundAliceWithBananas() {
242
256
  await this.snapshotManager.snapshot('fund_alice', async ()=>{
243
257
  await this.mintPrivateBananas(this.ALICE_INITIAL_BANANAS, this.aliceAddress);
244
- await this.bananaCoin.methods.mint_to_public(this.aliceAddress, this.ALICE_INITIAL_BANANAS).send().wait();
258
+ await this.bananaCoin.methods.mint_to_public(this.aliceAddress, this.ALICE_INITIAL_BANANAS).send({
259
+ from: this.aliceAddress
260
+ }).wait();
245
261
  }, ()=>Promise.resolve());
246
262
  }
247
263
  async applyFundAliceWithPrivateBananas() {
@@ -249,21 +265,4 @@ const { E2E_DATA_PATH: dataPath } = process.env;
249
265
  await this.mintPrivateBananas(this.ALICE_INITIAL_BANANAS, this.aliceAddress);
250
266
  }, ()=>Promise.resolve());
251
267
  }
252
- async applySetupSubscription() {
253
- await this.snapshotManager.snapshot('setup_subscription', async ()=>{
254
- const counterContract = await CounterContract.deploy(this.bobWallet, 0, this.bobAddress).send().deployed();
255
- // Deploy subscription contract, that allows subscriptions for SUBSCRIPTION_AMOUNT of bananas
256
- const subscriptionContract = await AppSubscriptionContract.deploy(this.bobWallet, counterContract.address, this.bobAddress, this.bananaCoin.address, this.SUBSCRIPTION_AMOUNT, this.APP_SPONSORED_TX_GAS_LIMIT).send().deployed();
257
- // Mint some Fee Juice to the subscription contract
258
- // Could also use bridgeFromL1ToL2 from the harness, but this is more direct
259
- await this.mintAndBridgeFeeJuice(subscriptionContract.address, FEE_FUNDING_FOR_TESTER_ACCOUNT);
260
- return {
261
- counterContractAddress: counterContract.address,
262
- subscriptionContractAddress: subscriptionContract.address
263
- };
264
- }, async ({ counterContractAddress, subscriptionContractAddress })=>{
265
- this.counterContract = await CounterContract.at(counterContractAddress, this.bobWallet);
266
- this.subscriptionContract = await AppSubscriptionContract.at(subscriptionContractAddress, this.bobWallet);
267
- });
268
- }
269
268
  }
@@ -0,0 +1,8 @@
1
+ import { AztecAddress, Fr, type L2Block } from '@aztec/aztec.js';
2
+ import { BatchedBlob, Blob } from '@aztec/blob-lib';
3
+ /**
4
+ * Creates a json object that can be used to test the solidity contract.
5
+ * The json object must be put into
6
+ */
7
+ export declare function writeJson(fileName: string, block: L2Block, l1ToL2Content: Fr[], blobs: Blob[], batchedBlob: BatchedBlob, recipientAddress: AztecAddress, deployerAddress: `0x${string}`): Promise<void>;
8
+ //# sourceMappingURL=write_json.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"write_json.d.ts","sourceRoot":"","sources":["../../src/e2e_l1_publisher/write_json.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,EAAE,EAAE,KAAK,OAAO,EAAE,MAAM,iBAAiB,CAAC;AACjE,OAAO,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAOpD;;;GAGG;AACH,wBAAsB,SAAS,CAC7B,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,OAAO,EACd,aAAa,EAAE,EAAE,EAAE,EACnB,KAAK,EAAE,IAAI,EAAE,EACb,WAAW,EAAE,WAAW,EACxB,gBAAgB,EAAE,YAAY,EAC9B,eAAe,EAAE,KAAK,MAAM,EAAE,GAC7B,OAAO,CAAC,IAAI,CAAC,CAqDf"}
@@ -0,0 +1,57 @@
1
+ import { Blob } from '@aztec/blob-lib';
2
+ import { writeFile } from 'fs/promises';
3
+ const AZTEC_GENERATE_TEST_DATA = !!process.env.AZTEC_GENERATE_TEST_DATA;
4
+ /**
5
+ * Creates a json object that can be used to test the solidity contract.
6
+ * The json object must be put into
7
+ */ export async function writeJson(fileName, block, l1ToL2Content, blobs, batchedBlob, recipientAddress, deployerAddress) {
8
+ if (!AZTEC_GENERATE_TEST_DATA) {
9
+ return;
10
+ }
11
+ // Path relative to the package.json in the end-to-end folder
12
+ const path = `../../l1-contracts/test/fixtures/${fileName}.json`;
13
+ const asHex = (value, size = 64)=>{
14
+ const buffer = Buffer.isBuffer(value) ? value : value.toBuffer();
15
+ return `0x${buffer.toString('hex').padStart(size, '0')}`;
16
+ };
17
+ const jsonObject = {
18
+ populate: {
19
+ l1ToL2Content: l1ToL2Content.map(asHex),
20
+ recipient: asHex(recipientAddress.toField()),
21
+ sender: deployerAddress
22
+ },
23
+ messages: {
24
+ l2ToL1Messages: block.body.txEffects.flatMap((txEffect)=>txEffect.l2ToL1Msgs).map(asHex)
25
+ },
26
+ block: {
27
+ // The json formatting in forge is a bit brittle, so we convert Fr to a number in the few values below.
28
+ // This should not be a problem for testing as long as the values are not larger than u32.
29
+ archive: asHex(block.archive.root),
30
+ blobCommitments: Blob.getPrefixedEthBlobCommitments(blobs),
31
+ batchedBlobInputs: batchedBlob.getEthBlobEvaluationInputs(),
32
+ blockNumber: block.number,
33
+ body: `0x${block.body.toBuffer().toString('hex')}`,
34
+ header: {
35
+ lastArchiveRoot: asHex(block.header.lastArchive.root),
36
+ contentCommitment: {
37
+ blobsHash: asHex(block.header.contentCommitment.blobsHash),
38
+ inHash: asHex(block.header.contentCommitment.inHash),
39
+ outHash: asHex(block.header.contentCommitment.outHash)
40
+ },
41
+ slotNumber: Number(block.header.globalVariables.slotNumber),
42
+ timestamp: Number(block.header.globalVariables.timestamp),
43
+ coinbase: asHex(block.header.globalVariables.coinbase, 40),
44
+ feeRecipient: asHex(block.header.globalVariables.feeRecipient),
45
+ gasFees: {
46
+ feePerDaGas: Number(block.header.globalVariables.gasFees.feePerDaGas),
47
+ feePerL2Gas: Number(block.header.globalVariables.gasFees.feePerL2Gas)
48
+ },
49
+ totalManaUsed: block.header.totalManaUsed.toNumber()
50
+ },
51
+ headerHash: asHex(block.header.toPropose().hash()),
52
+ numTxs: block.body.txEffects.length
53
+ }
54
+ };
55
+ const output = JSON.stringify(jsonObject, null, 2);
56
+ await writeFile(path, output, 'utf8');
57
+ }
@@ -0,0 +1,12 @@
1
+ import type { AztecAddress } from '@aztec/aztec.js';
2
+ import { EthAddress } from '@aztec/foundation/eth-address';
3
+ import type { EthPrivateKey } from '@aztec/node-keystore';
4
+ export declare function createJSONRPCSigner(keyLookup: Map<string, EthPrivateKey>, stats: Map<string, number>): import("http").Server<typeof import("http").IncomingMessage, typeof import("http").ServerResponse>;
5
+ export declare function createKeyFile1(fileName: string, mnemonic: string, validatorIndex: number, publisher1Key: EthPrivateKey, publisher2Key: EthPrivateKey, coinbase: EthAddress, feeRecipient: AztecAddress): Promise<void>;
6
+ export declare function createKeyFile2(fileName: string, validatorKey: EthPrivateKey, publisherMnemonic: string, publisher1Index: number, coinbase: EthAddress, feeRecipient: AztecAddress): Promise<void>;
7
+ export declare function createKeyFile3(fileName: string, validatorAddress: EthAddress, publisher1Key: EthPrivateKey, publisher2Key: EthPrivateKey, coinbase: EthAddress, remoteSignerUrl: string, feeRecipient: AztecAddress): Promise<void>;
8
+ export declare function createKeyFile4(fileName: string, validator1Address: EthAddress, validator2Address: EthAddress, publisher1Index: number, publisher2Key: EthPrivateKey, mnemonic: string, publisher3Key: EthPrivateKey, coinbase1: EthAddress, coinbase2: EthAddress, remoteSignerUrl: string, feeRecipient1: AztecAddress, feeRecipient2: AztecAddress): Promise<void>;
9
+ export declare function createKeyFile5(fileName: string, proverAddress: EthAddress, remoteSignerUrl: string): Promise<void>;
10
+ export declare function createKeyFile6(fileName: string, mnemonic: string, validator1Index: number, coinbase: EthAddress, feeRecipient: AztecAddress): Promise<void>;
11
+ export declare function addressForPrivateKey(privateKey: EthPrivateKey): EthAddress;
12
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/e2e_multi_validator/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAEpD,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAC3D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAW1D,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,GAAG,CAAC,MAAM,EAAE,aAAa,CAAC,EAAE,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,sGA0EpG;AAGD,wBAAsB,cAAc,CAClC,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,EAChB,cAAc,EAAE,MAAM,EACtB,aAAa,EAAE,aAAa,EAC5B,aAAa,EAAE,aAAa,EAC5B,QAAQ,EAAE,UAAU,EACpB,YAAY,EAAE,YAAY,iBAmB3B;AAED,wBAAsB,cAAc,CAClC,QAAQ,EAAE,MAAM,EAChB,YAAY,EAAE,aAAa,EAC3B,iBAAiB,EAAE,MAAM,EACzB,eAAe,EAAE,MAAM,EACvB,QAAQ,EA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