@aztec/end-to-end 0.0.1-commit.d1da697d6 → 0.0.1-commit.d20b825a7

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 (84) hide show
  1. package/dest/bench/client_flows/client_flows_benchmark.js +2 -2
  2. package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts +3 -2
  3. package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts.map +1 -1
  4. package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.js +1 -1
  5. package/dest/e2e_epochs/epochs_test.d.ts +16 -1
  6. package/dest/e2e_epochs/epochs_test.d.ts.map +1 -1
  7. package/dest/e2e_epochs/epochs_test.js +56 -8
  8. package/dest/e2e_fees/fees_test.d.ts +1 -1
  9. package/dest/e2e_fees/fees_test.d.ts.map +1 -1
  10. package/dest/e2e_fees/fees_test.js +2 -2
  11. package/dest/e2e_p2p/inactivity_slash_test.js +2 -2
  12. package/dest/e2e_p2p/p2p_network.d.ts +10 -9
  13. package/dest/e2e_p2p/p2p_network.d.ts.map +1 -1
  14. package/dest/e2e_p2p/p2p_network.js +46 -27
  15. package/dest/e2e_p2p/reqresp/utils.js +1 -1
  16. package/dest/e2e_p2p/shared.d.ts +5 -7
  17. package/dest/e2e_p2p/shared.d.ts.map +1 -1
  18. package/dest/e2e_p2p/shared.js +36 -47
  19. package/dest/fixtures/e2e_prover_test.d.ts +1 -1
  20. package/dest/fixtures/e2e_prover_test.d.ts.map +1 -1
  21. package/dest/fixtures/e2e_prover_test.js +2 -2
  22. package/dest/fixtures/fixtures.d.ts +12 -1
  23. package/dest/fixtures/fixtures.d.ts.map +1 -1
  24. package/dest/fixtures/fixtures.js +10 -0
  25. package/dest/fixtures/ha_setup.d.ts +2 -2
  26. package/dest/fixtures/ha_setup.d.ts.map +1 -1
  27. package/dest/fixtures/ha_setup.js +1 -1
  28. package/dest/fixtures/schnorr_hardcoded_account_contract.d.ts +25 -0
  29. package/dest/fixtures/schnorr_hardcoded_account_contract.d.ts.map +1 -0
  30. package/dest/fixtures/schnorr_hardcoded_account_contract.js +39 -0
  31. package/dest/fixtures/setup.d.ts +17 -10
  32. package/dest/fixtures/setup.d.ts.map +1 -1
  33. package/dest/fixtures/setup.js +28 -12
  34. package/dest/fixtures/setup_p2p_test.d.ts +6 -6
  35. package/dest/fixtures/setup_p2p_test.d.ts.map +1 -1
  36. package/dest/fixtures/setup_p2p_test.js +8 -8
  37. package/dest/forward-compatibility/wallet_rpc_client.d.ts +7 -0
  38. package/dest/forward-compatibility/wallet_rpc_client.d.ts.map +1 -0
  39. package/dest/forward-compatibility/wallet_rpc_client.js +15 -0
  40. package/dest/forward-compatibility/wallet_service.d.ts +3 -0
  41. package/dest/forward-compatibility/wallet_service.d.ts.map +1 -0
  42. package/dest/forward-compatibility/wallet_service.js +109 -0
  43. package/dest/shared/gas_portal_test_harness.js +1 -1
  44. package/dest/shared/uniswap_l1_l2.d.ts +1 -1
  45. package/dest/shared/uniswap_l1_l2.d.ts.map +1 -1
  46. package/dest/shared/uniswap_l1_l2.js +0 -4
  47. package/dest/spartan/setup_test_wallets.d.ts +1 -1
  48. package/dest/spartan/setup_test_wallets.d.ts.map +1 -1
  49. package/dest/spartan/setup_test_wallets.js +6 -37
  50. package/dest/spartan/tx_metrics.d.ts +1 -1
  51. package/dest/spartan/tx_metrics.d.ts.map +1 -1
  52. package/dest/spartan/tx_metrics.js +15 -1
  53. package/dest/test-wallet/test_wallet.d.ts +13 -4
  54. package/dest/test-wallet/test_wallet.d.ts.map +1 -1
  55. package/dest/test-wallet/test_wallet.js +60 -27
  56. package/dest/test-wallet/worker_wallet.d.ts +4 -4
  57. package/dest/test-wallet/worker_wallet.d.ts.map +1 -1
  58. package/dest/test-wallet/worker_wallet_schema.d.ts +7 -2
  59. package/dest/test-wallet/worker_wallet_schema.d.ts.map +1 -1
  60. package/package.json +39 -39
  61. package/src/bench/client_flows/client_flows_benchmark.ts +2 -2
  62. package/src/e2e_blacklist_token_contract/blacklist_token_contract_test.ts +3 -6
  63. package/src/e2e_epochs/epochs_test.ts +56 -7
  64. package/src/e2e_fees/fees_test.ts +4 -2
  65. package/src/e2e_p2p/inactivity_slash_test.ts +2 -2
  66. package/src/e2e_p2p/p2p_network.ts +57 -39
  67. package/src/e2e_p2p/reqresp/utils.ts +1 -1
  68. package/src/e2e_p2p/shared.ts +33 -61
  69. package/src/fixtures/e2e_prover_test.ts +5 -2
  70. package/src/fixtures/fixtures.ts +22 -0
  71. package/src/fixtures/ha_setup.ts +4 -2
  72. package/src/fixtures/schnorr_hardcoded_account_contract.ts +49 -0
  73. package/src/fixtures/setup.ts +43 -17
  74. package/src/fixtures/setup_p2p_test.ts +9 -9
  75. package/src/forward-compatibility/wallet_rpc_client.ts +14 -0
  76. package/src/forward-compatibility/wallet_service.ts +104 -0
  77. package/src/guides/up_quick_start.sh +0 -2
  78. package/src/legacy-jest-resolver.cjs +2 -2
  79. package/src/shared/gas_portal_test_harness.ts +0 -1
  80. package/src/shared/uniswap_l1_l2.ts +0 -4
  81. package/src/spartan/setup_test_wallets.ts +4 -30
  82. package/src/spartan/tx_metrics.ts +13 -1
  83. package/src/test-wallet/test_wallet.ts +61 -30
  84. package/src/test-wallet/worker_wallet.ts +3 -2
@@ -1,7 +1,9 @@
1
1
  import { EcdsaKAccountContract, EcdsaRAccountContract } from '@aztec/accounts/ecdsa';
2
2
  import { SchnorrAccountContract } from '@aztec/accounts/schnorr';
3
- import { StubAccountContractArtifact, createStubAccount } from '@aztec/accounts/stub';
3
+ import { StubEcdsaAccountContractArtifact, createStubEcdsaAccount } from '@aztec/accounts/stub/ecdsa';
4
+ import { StubSchnorrAccountContractArtifact, createStubSchnorrAccount } from '@aztec/accounts/stub/schnorr';
4
5
  import { type Account, type AccountContract, NO_FROM } from '@aztec/aztec.js/account';
6
+ import type { CompleteAddress } from '@aztec/aztec.js/addresses';
5
7
  import {
6
8
  type CallIntent,
7
9
  type ContractFunctionInteractionCallIntent,
@@ -13,6 +15,7 @@ import {
13
15
  } from '@aztec/aztec.js/authorization';
14
16
  import type { AztecNode } from '@aztec/aztec.js/node';
15
17
  import { AccountManager, type SendOptions } from '@aztec/aztec.js/wallet';
18
+ import { TxSimulationResultWithAppOffset } from '@aztec/aztec.js/wallet';
16
19
  import type { DefaultAccountEntrypointOptions } from '@aztec/entrypoints/account';
17
20
  import { DefaultEntrypoint } from '@aztec/entrypoints/default';
18
21
  import { Fq, Fr } from '@aztec/foundation/curves/bn254';
@@ -32,11 +35,12 @@ import {
32
35
  type TxExecutionRequest,
33
36
  type TxHash,
34
37
  type TxReceipt,
35
- type TxSimulationResult,
36
38
  } from '@aztec/stdlib/tx';
37
39
  import { ExecutionPayload, mergeExecutionPayloads } from '@aztec/stdlib/tx';
38
40
  import { BaseWallet, type SimulateViaEntrypointOptions } from '@aztec/wallet-sdk/base-wallet';
41
+ import type { AccountType } from '@aztec/wallets/embedded';
39
42
 
43
+ import { DEFAULT_MIN_FEE_PADDING } from '../fixtures/fixtures.js';
40
44
  import { AztecNodeProxy, ProvenTx } from './utils.js';
41
45
 
42
46
  /**
@@ -45,6 +49,7 @@ import { AztecNodeProxy, ProvenTx } from './utils.js';
45
49
  export interface AccountData {
46
50
  secret: Fr;
47
51
  salt: Fr;
52
+ type?: AccountType;
48
53
  contract: AccountContract;
49
54
  }
50
55
 
@@ -59,6 +64,7 @@ export class TestWallet extends BaseWallet {
59
64
  private readonly nodeRef: AztecNodeProxy,
60
65
  ) {
61
66
  super(pxe, nodeRef);
67
+ this.minFeePadding = DEFAULT_MIN_FEE_PADDING;
62
68
  }
63
69
 
64
70
  static async create(
@@ -85,30 +91,25 @@ export class TestWallet extends BaseWallet {
85
91
 
86
92
  createSchnorrAccount(secret: Fr, salt: Fr, signingKey?: Fq): Promise<AccountManager> {
87
93
  signingKey = signingKey ?? deriveSigningKey(secret);
88
- const accountData = {
89
- secret,
90
- salt,
91
- contract: new SchnorrAccountContract(signingKey),
92
- };
93
- return this.createAccount(accountData);
94
+ return this.createAccount({ secret, salt, type: 'schnorr', contract: new SchnorrAccountContract(signingKey) });
94
95
  }
95
96
 
96
97
  createECDSARAccount(secret: Fr, salt: Fr, signingKey: Buffer): Promise<AccountManager> {
97
- const accountData = {
98
+ return this.createAccount({
98
99
  secret,
99
100
  salt,
101
+ type: 'ecdsasecp256r1',
100
102
  contract: new EcdsaRAccountContract(signingKey),
101
- };
102
- return this.createAccount(accountData);
103
+ });
103
104
  }
104
105
 
105
106
  createECDSAKAccount(secret: Fr, salt: Fr, signingKey: Buffer): Promise<AccountManager> {
106
- const accountData = {
107
+ return this.createAccount({
107
108
  secret,
108
109
  salt,
110
+ type: 'ecdsasecp256k1',
109
111
  contract: new EcdsaKAccountContract(signingKey),
110
- };
111
- return this.createAccount(accountData);
112
+ });
112
113
  }
113
114
 
114
115
  /**
@@ -131,20 +132,40 @@ export class TestWallet extends BaseWallet {
131
132
  );
132
133
  }
133
134
 
134
- const stubInstance = await getContractInstanceFromInstantiationParams(StubAccountContractArtifact, {
135
+ const stubArtifact = this.getStubArtifactFor(address);
136
+ const stubConstructorArgs =
137
+ this.getTypeFor(address) === 'schnorr' ? [Fr.ZERO, Fr.ZERO] : [Buffer.alloc(32), Buffer.alloc(32)];
138
+ const stubInstance = await getContractInstanceFromInstantiationParams(stubArtifact, {
135
139
  salt: Fr.random(),
140
+ constructorArgs: stubConstructorArgs,
136
141
  });
137
142
 
138
143
  contracts[address.toString()] = {
139
144
  instance: stubInstance,
140
- artifact: StubAccountContractArtifact,
145
+ artifact: stubArtifact,
141
146
  };
142
147
  }
143
148
 
144
149
  return contracts;
145
150
  }
146
151
 
147
- protected accounts: Map<string, Account> = new Map();
152
+ protected accounts: Map<string, { account: Account; type: AccountType }> = new Map();
153
+
154
+ private getTypeFor(address: AztecAddress): AccountType {
155
+ return this.accounts.get(address.toString())?.type ?? 'schnorr';
156
+ }
157
+
158
+ private getStubArtifactFor(address: AztecAddress) {
159
+ return this.getTypeFor(address) === 'schnorr'
160
+ ? StubSchnorrAccountContractArtifact
161
+ : StubEcdsaAccountContractArtifact;
162
+ }
163
+
164
+ private getStubAccountFor(address: AztecAddress, completeAddress: CompleteAddress) {
165
+ return this.getTypeFor(address) === 'schnorr'
166
+ ? createStubSchnorrAccount(completeAddress)
167
+ : createStubEcdsaAccount(completeAddress);
168
+ }
148
169
 
149
170
  /**
150
171
  * Controls how the test wallet simulates transactions:
@@ -159,26 +180,29 @@ export class TestWallet extends BaseWallet {
159
180
  }
160
181
 
161
182
  setMinFeePadding(value?: number) {
162
- this.minFeePadding = value ?? 0.5;
183
+ this.minFeePadding = value ?? DEFAULT_MIN_FEE_PADDING;
163
184
  }
164
185
 
165
186
  protected getAccountFromAddress(address: AztecAddress): Promise<Account> {
166
- const account = this.accounts.get(address?.toString() ?? '');
187
+ const entry = this.accounts.get(address?.toString() ?? '');
167
188
 
168
- if (!account) {
189
+ if (!entry) {
169
190
  throw new Error(`Account not found in wallet for address: ${address}`);
170
191
  }
171
192
 
172
- return Promise.resolve(account);
193
+ return Promise.resolve(entry.account);
173
194
  }
174
195
 
175
196
  getAccounts() {
176
- return Promise.resolve(Array.from(this.accounts.values()).map(acc => ({ alias: '', item: acc.getAddress() })));
197
+ return Promise.resolve(
198
+ Array.from(this.accounts.values()).map(entry => ({ alias: '', item: entry.account.getAddress() })),
199
+ );
177
200
  }
178
201
 
179
202
  async createAccount(accountData?: AccountData): Promise<AccountManager> {
180
203
  const secret = accountData?.secret ?? Fr.random();
181
204
  const salt = accountData?.salt ?? Fr.random();
205
+ const type = accountData?.type ?? 'schnorr';
182
206
  const contract = accountData?.contract ?? new SchnorrAccountContract(GrumpkinScalar.random());
183
207
 
184
208
  const accountManager = await AccountManager.create(this, secret, contract, salt);
@@ -188,7 +212,8 @@ export class TestWallet extends BaseWallet {
188
212
 
189
213
  await this.registerContract(instance, artifact, secret);
190
214
 
191
- this.accounts.set(accountManager.address.toString(), await accountManager.getAccount());
215
+ const address = accountManager.address.toString();
216
+ this.accounts.set(address, { account: await accountManager.getAccount(), type });
192
217
 
193
218
  return accountManager;
194
219
  }
@@ -234,8 +259,9 @@ export class TestWallet extends BaseWallet {
234
259
  protected override async simulateViaEntrypoint(
235
260
  executionPayload: ExecutionPayload,
236
261
  opts: SimulateViaEntrypointOptions,
237
- ): Promise<TxSimulationResult> {
238
- const { from, feeOptions, scopes, skipTxValidation, skipFeeEnforcement } = opts;
262
+ ): Promise<TxSimulationResultWithAppOffset> {
263
+ const { from, feeOptions, additionalScopes, skipTxValidation, skipFeeEnforcement, sendMessagesAs } = opts;
264
+ const scopes = this.scopesFrom(from, additionalScopes);
239
265
  const skipKernels = this.simulationMode !== 'full';
240
266
  const useOverride = this.simulationMode === 'kernelless-override';
241
267
 
@@ -248,7 +274,7 @@ export class TestWallet extends BaseWallet {
248
274
  let overrides: SimulationOverrides | undefined;
249
275
  let txRequest: TxExecutionRequest;
250
276
  if (useOverride) {
251
- const accountOverrides = await this.buildAccountOverrides(this.scopesFrom(from, opts.additionalScopes));
277
+ const accountOverrides = await this.buildAccountOverrides(scopes);
252
278
  overrides = new SimulationOverrides(accountOverrides);
253
279
  }
254
280
 
@@ -259,8 +285,7 @@ export class TestWallet extends BaseWallet {
259
285
  let fromAccount: Account;
260
286
  if (useOverride) {
261
287
  const originalAccount = await this.getAccountFromAddress(from);
262
- const completeAddress = originalAccount.getCompleteAddress();
263
- fromAccount = createStubAccount(completeAddress);
288
+ fromAccount = this.getStubAccountFor(from, originalAccount.getCompleteAddress());
264
289
  } else {
265
290
  fromAccount = await this.getAccountFromAddress(from);
266
291
  }
@@ -278,14 +303,17 @@ export class TestWallet extends BaseWallet {
278
303
  );
279
304
  }
280
305
 
281
- return this.pxe.simulateTx(txRequest, {
306
+ const result = await this.pxe.simulateTx(txRequest, {
282
307
  simulatePublic: true,
283
308
  skipKernels,
284
309
  skipFeeEnforcement,
285
310
  skipTxValidation,
286
311
  overrides,
287
312
  scopes,
313
+ senderForTags: this.senderForTagsFrom(from, sendMessagesAs),
288
314
  });
315
+ const appCallOffset = await this.computeAppCallOffset(from, feeOptions);
316
+ return TxSimulationResultWithAppOffset.fromResultAndOffset(result, appCallOffset);
289
317
  }
290
318
 
291
319
  async proveTx(exec: ExecutionPayload, opts: Omit<SendOptions, 'wait'>): Promise<ProvenTx> {
@@ -295,7 +323,10 @@ export class TestWallet extends BaseWallet {
295
323
  gasSettings: opts.fee?.gasSettings,
296
324
  });
297
325
  const txRequest = await this.createTxExecutionRequestFromPayloadAndFee(exec, opts.from, fee);
298
- const txProvingResult = await this.pxe.proveTx(txRequest, this.scopesFrom(opts.from, opts.additionalScopes));
326
+ const txProvingResult = await this.pxe.proveTx(txRequest, {
327
+ scopes: this.scopesFrom(opts.from, opts.additionalScopes),
328
+ senderForTags: this.senderForTagsFrom(opts.from, opts.sendMessagesAs),
329
+ });
299
330
  return new ProvenTx(
300
331
  this.aztecNode,
301
332
  await txProvingResult.toTx(),
@@ -13,6 +13,7 @@ import type {
13
13
  ProfileOptions,
14
14
  SendOptions,
15
15
  SimulateOptions,
16
+ TxSimulationResultWithAppOffset,
16
17
  Wallet,
17
18
  WalletCapabilities,
18
19
  } from '@aztec/aztec.js/wallet';
@@ -29,7 +30,7 @@ import type { ContractArtifact, EventMetadataDefinition, FunctionCall } from '@a
29
30
  import type { AuthWitness } from '@aztec/stdlib/auth-witness';
30
31
  import type { AztecAddress } from '@aztec/stdlib/aztec-address';
31
32
  import type { ContractInstanceWithAddress } from '@aztec/stdlib/contract';
32
- import type { ExecutionPayload, TxProfileResult, TxSimulationResult, UtilityExecutionResult } from '@aztec/stdlib/tx';
33
+ import type { ExecutionPayload, TxProfileResult, UtilityExecutionResult } from '@aztec/stdlib/tx';
33
34
  import { Tx } from '@aztec/stdlib/tx';
34
35
 
35
36
  import { Worker } from 'worker_threads';
@@ -165,7 +166,7 @@ export class WorkerWallet implements Wallet {
165
166
  return this.call('registerContract', instance, artifact, secretKey);
166
167
  }
167
168
 
168
- simulateTx(exec: ExecutionPayload, opts: SimulateOptions): Promise<TxSimulationResult> {
169
+ simulateTx(exec: ExecutionPayload, opts: SimulateOptions): Promise<TxSimulationResultWithAppOffset> {
169
170
  return this.call('simulateTx', exec, opts);
170
171
  }
171
172