@aztec/end-to-end 0.0.1-commit.e588bc7e5 → 0.0.1-commit.e5a3663dd

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 (95) hide show
  1. package/README.md +27 -0
  2. package/dest/bench/client_flows/client_flows_benchmark.js +3 -3
  3. package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts +3 -2
  4. package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts.map +1 -1
  5. package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.js +1 -1
  6. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.js +1 -1
  7. package/dest/e2e_epochs/epochs_test.d.ts +16 -1
  8. package/dest/e2e_epochs/epochs_test.d.ts.map +1 -1
  9. package/dest/e2e_epochs/epochs_test.js +56 -8
  10. package/dest/e2e_fees/fees_test.d.ts +1 -1
  11. package/dest/e2e_fees/fees_test.d.ts.map +1 -1
  12. package/dest/e2e_fees/fees_test.js +4 -4
  13. package/dest/e2e_p2p/inactivity_slash_test.js +2 -2
  14. package/dest/e2e_p2p/p2p_network.d.ts +10 -9
  15. package/dest/e2e_p2p/p2p_network.d.ts.map +1 -1
  16. package/dest/e2e_p2p/p2p_network.js +46 -27
  17. package/dest/e2e_p2p/reqresp/utils.d.ts +1 -1
  18. package/dest/e2e_p2p/reqresp/utils.d.ts.map +1 -1
  19. package/dest/e2e_p2p/reqresp/utils.js +10 -7
  20. package/dest/e2e_p2p/shared.d.ts +5 -7
  21. package/dest/e2e_p2p/shared.d.ts.map +1 -1
  22. package/dest/e2e_p2p/shared.js +36 -47
  23. package/dest/fixtures/authwit_proxy.d.ts +1 -1
  24. package/dest/fixtures/authwit_proxy.d.ts.map +1 -1
  25. package/dest/fixtures/authwit_proxy.js +4 -0
  26. package/dest/fixtures/e2e_prover_test.d.ts +1 -1
  27. package/dest/fixtures/e2e_prover_test.d.ts.map +1 -1
  28. package/dest/fixtures/e2e_prover_test.js +2 -2
  29. package/dest/fixtures/fixtures.d.ts +12 -1
  30. package/dest/fixtures/fixtures.d.ts.map +1 -1
  31. package/dest/fixtures/fixtures.js +10 -0
  32. package/dest/fixtures/ha_setup.d.ts +2 -2
  33. package/dest/fixtures/ha_setup.d.ts.map +1 -1
  34. package/dest/fixtures/ha_setup.js +1 -1
  35. package/dest/fixtures/schnorr_hardcoded_account_contract.d.ts +25 -0
  36. package/dest/fixtures/schnorr_hardcoded_account_contract.d.ts.map +1 -0
  37. package/dest/fixtures/schnorr_hardcoded_account_contract.js +39 -0
  38. package/dest/fixtures/setup.d.ts +17 -10
  39. package/dest/fixtures/setup.d.ts.map +1 -1
  40. package/dest/fixtures/setup.js +29 -13
  41. package/dest/fixtures/setup_p2p_test.d.ts +6 -6
  42. package/dest/fixtures/setup_p2p_test.d.ts.map +1 -1
  43. package/dest/fixtures/setup_p2p_test.js +8 -8
  44. package/dest/forward-compatibility/wallet_rpc_client.d.ts +7 -0
  45. package/dest/forward-compatibility/wallet_rpc_client.d.ts.map +1 -0
  46. package/dest/forward-compatibility/wallet_rpc_client.js +15 -0
  47. package/dest/forward-compatibility/wallet_service.d.ts +3 -0
  48. package/dest/forward-compatibility/wallet_service.d.ts.map +1 -0
  49. package/dest/forward-compatibility/wallet_service.js +109 -0
  50. package/dest/legacy-jest-resolver.d.cts +3 -0
  51. package/dest/legacy-jest-resolver.d.cts.map +1 -0
  52. package/dest/shared/gas_portal_test_harness.js +1 -1
  53. package/dest/shared/uniswap_l1_l2.d.ts +1 -1
  54. package/dest/shared/uniswap_l1_l2.d.ts.map +1 -1
  55. package/dest/shared/uniswap_l1_l2.js +0 -4
  56. package/dest/spartan/setup_test_wallets.d.ts +1 -1
  57. package/dest/spartan/setup_test_wallets.d.ts.map +1 -1
  58. package/dest/spartan/setup_test_wallets.js +6 -37
  59. package/dest/spartan/tx_metrics.d.ts +1 -1
  60. package/dest/spartan/tx_metrics.d.ts.map +1 -1
  61. package/dest/spartan/tx_metrics.js +18 -2
  62. package/dest/test-wallet/test_wallet.d.ts +16 -8
  63. package/dest/test-wallet/test_wallet.d.ts.map +1 -1
  64. package/dest/test-wallet/test_wallet.js +91 -49
  65. package/dest/test-wallet/worker_wallet.d.ts +4 -4
  66. package/dest/test-wallet/worker_wallet.d.ts.map +1 -1
  67. package/dest/test-wallet/worker_wallet_schema.d.ts +7 -2
  68. package/dest/test-wallet/worker_wallet_schema.d.ts.map +1 -1
  69. package/package.json +40 -39
  70. package/src/bench/client_flows/client_flows_benchmark.ts +3 -3
  71. package/src/e2e_blacklist_token_contract/blacklist_token_contract_test.ts +3 -6
  72. package/src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts +1 -1
  73. package/src/e2e_epochs/epochs_test.ts +56 -7
  74. package/src/e2e_fees/fees_test.ts +5 -3
  75. package/src/e2e_p2p/inactivity_slash_test.ts +2 -2
  76. package/src/e2e_p2p/p2p_network.ts +57 -39
  77. package/src/e2e_p2p/reqresp/utils.ts +8 -7
  78. package/src/e2e_p2p/shared.ts +33 -61
  79. package/src/fixtures/authwit_proxy.ts +4 -0
  80. package/src/fixtures/e2e_prover_test.ts +5 -2
  81. package/src/fixtures/fixtures.ts +22 -0
  82. package/src/fixtures/ha_setup.ts +4 -2
  83. package/src/fixtures/schnorr_hardcoded_account_contract.ts +49 -0
  84. package/src/fixtures/setup.ts +44 -18
  85. package/src/fixtures/setup_p2p_test.ts +9 -9
  86. package/src/forward-compatibility/wallet_rpc_client.ts +14 -0
  87. package/src/forward-compatibility/wallet_service.ts +104 -0
  88. package/src/guides/up_quick_start.sh +0 -2
  89. package/src/legacy-jest-resolver.cjs +135 -0
  90. package/src/shared/gas_portal_test_harness.ts +0 -1
  91. package/src/shared/uniswap_l1_l2.ts +0 -4
  92. package/src/spartan/setup_test_wallets.ts +4 -30
  93. package/src/spartan/tx_metrics.ts +16 -4
  94. package/src/test-wallet/test_wallet.ts +108 -52
  95. package/src/test-wallet/worker_wallet.ts +3 -2
@@ -138,37 +138,11 @@ async function deployAccountWithDiagnostics(
138
138
  estimateGas?: boolean,
139
139
  ): Promise<void> {
140
140
  const deployMethod = await account.getDeployMethod();
141
- let txHash;
142
141
  let gasSettings: any;
143
- try {
144
- if (estimateGas) {
145
- const sim = await deployMethod.simulate({ from: NO_FROM, fee: { paymentMethod } });
146
- gasSettings = sim.estimatedGas;
147
- logger.info(`${accountLabel} estimated gas: DA=${gasSettings.gasLimits.daGas} L2=${gasSettings.gasLimits.l2Gas}`);
148
- }
149
- const deployResult = await deployMethod.send({
150
- from: NO_FROM,
151
- fee: { paymentMethod, gasSettings },
152
- wait: NO_WAIT,
153
- });
154
- txHash = deployResult.txHash;
155
- await waitForTx(aztecNode, txHash, { timeout: 2400 });
156
- logger.info(`${accountLabel} deployed at ${account.address}`);
157
- } catch (error) {
158
- const blockNumber = await aztecNode.getBlockNumber();
159
- let receipt;
160
- try {
161
- receipt = await aztecNode.getTxReceipt(txHash);
162
- } catch {
163
- receipt = 'unavailable';
164
- }
165
- logger.error(`${accountLabel} deployment failed`, {
166
- txHash: txHash.toString(),
167
- receipt: JSON.stringify(receipt),
168
- currentBlockNumber: blockNumber,
169
- error: String(error),
170
- });
171
- throw error;
142
+ if (estimateGas) {
143
+ const sim = await deployMethod.simulate({ from: NO_FROM, fee: { paymentMethod } });
144
+ gasSettings = sim.estimatedGas;
145
+ logger.info(`${accountLabel} estimated gas: DA=${gasSettings.gasLimits.daGas} L2=${gasSettings.gasLimits.l2Gas}`);
172
146
  }
173
147
 
174
148
  // Track the tx hash across retries so we don't re-send when the previous tx is still pending.
@@ -1,6 +1,6 @@
1
1
  import type { AztecNode } from '@aztec/aztec.js/node';
2
2
  import type { Logger } from '@aztec/foundation/log';
3
- import type { L2Block } from '@aztec/stdlib/block';
3
+ import type { BlockResponse } from '@aztec/stdlib/interfaces/client';
4
4
  import type { TopicType } from '@aztec/stdlib/p2p';
5
5
  import { Tx, type TxReceipt } from '@aztec/stdlib/tx';
6
6
 
@@ -147,7 +147,7 @@ export type TxInclusionData = {
147
147
  export class TxInclusionMetrics {
148
148
  private data = new Map<string, TxInclusionData>();
149
149
  private groups = new Set<string>();
150
- private blocks = new Map<number, Promise<L2Block | undefined>>();
150
+ private blocks = new Map<number, Promise<BlockResponse<{ includeTransactions: true }> | undefined>>();
151
151
 
152
152
  private p2pGossipLatencyByTopic: Partial<Record<TopicType, { p50: number; p95: number }>> = {};
153
153
 
@@ -198,7 +198,7 @@ export class TxInclusionMetrics {
198
198
  }
199
199
 
200
200
  if (!this.blocks.has(blockNumber)) {
201
- this.blocks.set(blockNumber, this.aztecNode.getBlock(blockNumber));
201
+ this.blocks.set(blockNumber, this.aztecNode.getBlock(blockNumber, { includeTransactions: true }));
202
202
  }
203
203
 
204
204
  const block = await this.blocks.get(blockNumber)!;
@@ -229,12 +229,24 @@ export class TxInclusionMetrics {
229
229
  p99: number;
230
230
  } {
231
231
  const histogram = createHistogram({});
232
+ let nonPositive = 0;
232
233
  for (const tx of this.data.values()) {
233
234
  if (!tx.blocknumber || tx.group !== group || tx.minedAt === -1) {
234
235
  continue;
235
236
  }
236
237
 
237
- histogram.record(tx.minedAt - tx.sentAt);
238
+ // `minedAt` is the block's L2 slot timestamp (seconds) while `sentAt` is the wall-clock
239
+ // send time. Because the slot timestamp can precede or equal the send time, the delta
240
+ // can be <= 0, which perf_hooks.createHistogram rejects. Skip those instead of crashing.
241
+ const delta = tx.minedAt - tx.sentAt;
242
+ if (delta <= 0) {
243
+ nonPositive++;
244
+ continue;
245
+ }
246
+ histogram.record(delta);
247
+ }
248
+ if (nonPositive > 0) {
249
+ this.logger?.debug(`Dropped ${nonPositive} tx inclusion samples with non-positive delta`, { group });
238
250
  }
239
251
 
240
252
  if (histogram.count === 0) {
@@ -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';
@@ -25,17 +28,19 @@ import { AztecAddress } from '@aztec/stdlib/aztec-address';
25
28
  import { getContractInstanceFromInstantiationParams } from '@aztec/stdlib/contract';
26
29
  import { deriveSigningKey } from '@aztec/stdlib/keys';
27
30
  import type { NoteDao } from '@aztec/stdlib/note';
28
- import type {
29
- BlockHeader,
31
+ import {
32
+ type BlockHeader,
33
+ type ContractOverrides,
30
34
  SimulationOverrides,
31
- TxExecutionRequest,
32
- TxHash,
33
- TxReceipt,
34
- TxSimulationResult,
35
+ type TxExecutionRequest,
36
+ type TxHash,
37
+ type TxReceipt,
35
38
  } from '@aztec/stdlib/tx';
36
39
  import { ExecutionPayload, mergeExecutionPayloads } from '@aztec/stdlib/tx';
37
40
  import { BaseWallet, type SimulateViaEntrypointOptions } from '@aztec/wallet-sdk/base-wallet';
41
+ import type { AccountType } from '@aztec/wallets/embedded';
38
42
 
43
+ import { DEFAULT_MIN_FEE_PADDING } from '../fixtures/fixtures.js';
39
44
  import { AztecNodeProxy, ProvenTx } from './utils.js';
40
45
 
41
46
  /**
@@ -44,6 +49,7 @@ import { AztecNodeProxy, ProvenTx } from './utils.js';
44
49
  export interface AccountData {
45
50
  secret: Fr;
46
51
  salt: Fr;
52
+ type?: AccountType;
47
53
  contract: AccountContract;
48
54
  }
49
55
 
@@ -58,6 +64,7 @@ export class TestWallet extends BaseWallet {
58
64
  private readonly nodeRef: AztecNodeProxy,
59
65
  ) {
60
66
  super(pxe, nodeRef);
67
+ this.minFeePadding = DEFAULT_MIN_FEE_PADDING;
61
68
  }
62
69
 
63
70
  static async create(
@@ -84,50 +91,81 @@ export class TestWallet extends BaseWallet {
84
91
 
85
92
  createSchnorrAccount(secret: Fr, salt: Fr, signingKey?: Fq): Promise<AccountManager> {
86
93
  signingKey = signingKey ?? deriveSigningKey(secret);
87
- const accountData = {
88
- secret,
89
- salt,
90
- contract: new SchnorrAccountContract(signingKey),
91
- };
92
- return this.createAccount(accountData);
94
+ return this.createAccount({ secret, salt, type: 'schnorr', contract: new SchnorrAccountContract(signingKey) });
93
95
  }
94
96
 
95
97
  createECDSARAccount(secret: Fr, salt: Fr, signingKey: Buffer): Promise<AccountManager> {
96
- const accountData = {
98
+ return this.createAccount({
97
99
  secret,
98
100
  salt,
101
+ type: 'ecdsasecp256r1',
99
102
  contract: new EcdsaRAccountContract(signingKey),
100
- };
101
- return this.createAccount(accountData);
103
+ });
102
104
  }
103
105
 
104
106
  createECDSAKAccount(secret: Fr, salt: Fr, signingKey: Buffer): Promise<AccountManager> {
105
- const accountData = {
107
+ return this.createAccount({
106
108
  secret,
107
109
  salt,
110
+ type: 'ecdsasecp256k1',
108
111
  contract: new EcdsaKAccountContract(signingKey),
109
- };
110
- return this.createAccount(accountData);
112
+ });
111
113
  }
112
114
 
113
- async getFakeAccountDataFor(address: AztecAddress) {
114
- const originalAccount = await this.getAccountFromAddress(address);
115
- const originalAddress = originalAccount.getCompleteAddress();
116
- const contractInstance = await this.pxe.getContractInstance(originalAddress.address);
117
- if (!contractInstance) {
118
- throw new Error(`No contract instance found for address: ${originalAddress.address}`);
115
+ /**
116
+ * Builds contract overrides for all provided addresses by replacing their account contracts with stub implementations.
117
+ */
118
+ protected async buildAccountOverrides(addresses: AztecAddress[]): Promise<ContractOverrides> {
119
+ const accounts = await this.getAccounts();
120
+ const contracts: ContractOverrides = {};
121
+
122
+ const filtered = accounts.filter(acc => addresses.some(addr => addr.equals(acc.item)));
123
+
124
+ for (const account of filtered) {
125
+ const address = account.item;
126
+ const originalAccount = await this.getAccountFromAddress(address);
127
+ const completeAddress = originalAccount.getCompleteAddress();
128
+ const contractInstance = await this.pxe.getContractInstance(completeAddress.address);
129
+ if (!contractInstance) {
130
+ throw new Error(
131
+ `No contract instance found for address: ${completeAddress.address} during account override building. This is a bug!`,
132
+ );
133
+ }
134
+
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, {
139
+ salt: Fr.random(),
140
+ constructorArgs: stubConstructorArgs,
141
+ });
142
+
143
+ contracts[address.toString()] = {
144
+ instance: stubInstance,
145
+ artifact: stubArtifact,
146
+ };
119
147
  }
120
- const stubAccount = createStubAccount(originalAddress);
121
- const instance = await getContractInstanceFromInstantiationParams(StubAccountContractArtifact, {
122
- salt: Fr.random(),
123
- });
124
- return {
125
- account: stubAccount,
126
- instance,
127
- artifact: StubAccountContractArtifact,
128
- };
148
+
149
+ return contracts;
150
+ }
151
+
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);
129
168
  }
130
- protected accounts: Map<string, Account> = new Map();
131
169
 
132
170
  /**
133
171
  * Controls how the test wallet simulates transactions:
@@ -142,26 +180,29 @@ export class TestWallet extends BaseWallet {
142
180
  }
143
181
 
144
182
  setMinFeePadding(value?: number) {
145
- this.minFeePadding = value ?? 0.5;
183
+ this.minFeePadding = value ?? DEFAULT_MIN_FEE_PADDING;
146
184
  }
147
185
 
148
186
  protected getAccountFromAddress(address: AztecAddress): Promise<Account> {
149
- const account = this.accounts.get(address?.toString() ?? '');
187
+ const entry = this.accounts.get(address?.toString() ?? '');
150
188
 
151
- if (!account) {
189
+ if (!entry) {
152
190
  throw new Error(`Account not found in wallet for address: ${address}`);
153
191
  }
154
192
 
155
- return Promise.resolve(account);
193
+ return Promise.resolve(entry.account);
156
194
  }
157
195
 
158
196
  getAccounts() {
159
- 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
+ );
160
200
  }
161
201
 
162
202
  async createAccount(accountData?: AccountData): Promise<AccountManager> {
163
203
  const secret = accountData?.secret ?? Fr.random();
164
204
  const salt = accountData?.salt ?? Fr.random();
205
+ const type = accountData?.type ?? 'schnorr';
165
206
  const contract = accountData?.contract ?? new SchnorrAccountContract(GrumpkinScalar.random());
166
207
 
167
208
  const accountManager = await AccountManager.create(this, secret, contract, salt);
@@ -171,7 +212,8 @@ export class TestWallet extends BaseWallet {
171
212
 
172
213
  await this.registerContract(instance, artifact, secret);
173
214
 
174
- 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 });
175
217
 
176
218
  return accountManager;
177
219
  }
@@ -217,9 +259,12 @@ export class TestWallet extends BaseWallet {
217
259
  protected override async simulateViaEntrypoint(
218
260
  executionPayload: ExecutionPayload,
219
261
  opts: SimulateViaEntrypointOptions,
220
- ): Promise<TxSimulationResult> {
221
- 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);
222
265
  const skipKernels = this.simulationMode !== 'full';
266
+ const useOverride = this.simulationMode === 'kernelless-override';
267
+
223
268
  const feeExecutionPayload = await feeOptions.walletFeePaymentMethod?.getExecutionPayload();
224
269
  const finalExecutionPayload = feeExecutionPayload
225
270
  ? mergeExecutionPayloads([feeExecutionPayload, executionPayload])
@@ -228,18 +273,19 @@ export class TestWallet extends BaseWallet {
228
273
 
229
274
  let overrides: SimulationOverrides | undefined;
230
275
  let txRequest: TxExecutionRequest;
276
+ if (useOverride) {
277
+ const accountOverrides = await this.buildAccountOverrides(scopes);
278
+ overrides = new SimulationOverrides(accountOverrides);
279
+ }
280
+
231
281
  if (from === NO_FROM) {
232
282
  const entrypoint = new DefaultEntrypoint();
233
283
  txRequest = await entrypoint.createTxExecutionRequest(finalExecutionPayload, feeOptions.gasSettings, chainInfo);
234
284
  } else {
235
- const useOverride = this.simulationMode === 'kernelless-override';
236
285
  let fromAccount: Account;
237
286
  if (useOverride) {
238
- const { account, instance, artifact } = await this.getFakeAccountDataFor(from);
239
- fromAccount = account;
240
- overrides = {
241
- contracts: { [from.toString()]: { instance, artifact } },
242
- };
287
+ const originalAccount = await this.getAccountFromAddress(from);
288
+ fromAccount = this.getStubAccountFor(from, originalAccount.getCompleteAddress());
243
289
  } else {
244
290
  fromAccount = await this.getAccountFromAddress(from);
245
291
  }
@@ -257,20 +303,30 @@ export class TestWallet extends BaseWallet {
257
303
  );
258
304
  }
259
305
 
260
- return this.pxe.simulateTx(txRequest, {
306
+ const result = await this.pxe.simulateTx(txRequest, {
261
307
  simulatePublic: true,
262
308
  skipKernels,
263
309
  skipFeeEnforcement,
264
310
  skipTxValidation,
265
311
  overrides,
266
312
  scopes,
313
+ senderForTags: this.senderForTagsFrom(from, sendMessagesAs),
267
314
  });
315
+ const appCallOffset = await this.computeAppCallOffset(from, feeOptions);
316
+ return TxSimulationResultWithAppOffset.fromResultAndOffset(result, appCallOffset);
268
317
  }
269
318
 
270
319
  async proveTx(exec: ExecutionPayload, opts: Omit<SendOptions, 'wait'>): Promise<ProvenTx> {
271
- const fee = await this.completeFeeOptions(opts.from, exec.feePayer, opts.fee?.gasSettings);
320
+ const fee = await this.completeFeeOptions({
321
+ from: opts.from,
322
+ feePayer: exec.feePayer,
323
+ gasSettings: opts.fee?.gasSettings,
324
+ });
272
325
  const txRequest = await this.createTxExecutionRequestFromPayloadAndFee(exec, opts.from, fee);
273
- 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
+ });
274
330
  return new ProvenTx(
275
331
  this.aztecNode,
276
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