@aztec/cli-wallet 0.0.1-commit.fce3e4f → 0.0.1-commit.ffe5b04ea

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 (59) hide show
  1. package/dest/cmds/authorize_action.d.ts +2 -2
  2. package/dest/cmds/authorize_action.d.ts.map +1 -1
  3. package/dest/cmds/authorize_action.js +4 -2
  4. package/dest/cmds/bridge_fee_juice.d.ts +2 -2
  5. package/dest/cmds/bridge_fee_juice.d.ts.map +1 -1
  6. package/dest/cmds/bridge_fee_juice.js +3 -2
  7. package/dest/cmds/check_tx.js +10 -6
  8. package/dest/cmds/create_account.d.ts +4 -3
  9. package/dest/cmds/create_account.d.ts.map +1 -1
  10. package/dest/cmds/create_account.js +32 -18
  11. package/dest/cmds/create_authwit.d.ts +2 -2
  12. package/dest/cmds/create_authwit.d.ts.map +1 -1
  13. package/dest/cmds/deploy.d.ts +1 -1
  14. package/dest/cmds/deploy.d.ts.map +1 -1
  15. package/dest/cmds/deploy.js +50 -24
  16. package/dest/cmds/deploy_account.d.ts +1 -1
  17. package/dest/cmds/deploy_account.d.ts.map +1 -1
  18. package/dest/cmds/deploy_account.js +31 -17
  19. package/dest/cmds/index.js +2 -2
  20. package/dest/cmds/send.d.ts +2 -2
  21. package/dest/cmds/send.d.ts.map +1 -1
  22. package/dest/cmds/send.js +32 -17
  23. package/dest/cmds/simulate.d.ts +1 -1
  24. package/dest/cmds/simulate.d.ts.map +1 -1
  25. package/dest/cmds/simulate.js +3 -3
  26. package/dest/storage/wallet_db.d.ts +3 -3
  27. package/dest/storage/wallet_db.d.ts.map +1 -1
  28. package/dest/storage/wallet_db.js +47 -32
  29. package/dest/utils/constants.d.ts +4 -0
  30. package/dest/utils/constants.d.ts.map +1 -0
  31. package/dest/utils/constants.js +7 -0
  32. package/dest/utils/options/fees.d.ts +1 -1
  33. package/dest/utils/options/fees.d.ts.map +1 -1
  34. package/dest/utils/options/fees.js +5 -3
  35. package/dest/utils/options/options.d.ts +2 -2
  36. package/dest/utils/options/options.d.ts.map +1 -1
  37. package/dest/utils/options/options.js +1 -1
  38. package/dest/utils/profiling.d.ts +1 -1
  39. package/dest/utils/profiling.d.ts.map +1 -1
  40. package/dest/utils/profiling.js +9 -1
  41. package/dest/utils/wallet.d.ts +11 -7
  42. package/dest/utils/wallet.d.ts.map +1 -1
  43. package/dest/utils/wallet.js +56 -43
  44. package/package.json +17 -17
  45. package/src/cmds/authorize_action.ts +1 -1
  46. package/src/cmds/bridge_fee_juice.ts +3 -2
  47. package/src/cmds/check_tx.ts +8 -9
  48. package/src/cmds/create_account.ts +32 -20
  49. package/src/cmds/deploy.ts +45 -23
  50. package/src/cmds/deploy_account.ts +29 -18
  51. package/src/cmds/index.ts +3 -3
  52. package/src/cmds/send.ts +26 -11
  53. package/src/cmds/simulate.ts +4 -7
  54. package/src/storage/wallet_db.ts +51 -38
  55. package/src/utils/constants.ts +4 -0
  56. package/src/utils/options/fees.ts +9 -3
  57. package/src/utils/options/options.ts +1 -1
  58. package/src/utils/profiling.ts +15 -1
  59. package/src/utils/wallet.ts +80 -56
@@ -1,17 +1,18 @@
1
- import { Fr } from '@aztec/foundation/fields';
1
+ import { Fr } from '@aztec/foundation/curves/bn254';
2
2
  import type { LogFn } from '@aztec/foundation/log';
3
3
  import type { AztecAsyncKVStore, AztecAsyncMap } from '@aztec/kv-store';
4
4
  import type { AuthWitness } from '@aztec/stdlib/auth-witness';
5
5
  import type { AztecAddress } from '@aztec/stdlib/aztec-address';
6
6
  import type { TxHash } from '@aztec/stdlib/tx';
7
7
 
8
+ import type { AccountType } from '../utils/constants.js';
8
9
  import { extractECDSAPublicKeyFromBase64String } from '../utils/ecdsa.js';
9
- import type { AccountType } from '../utils/wallet.js';
10
10
 
11
11
  export const Aliases = ['accounts', 'contracts', 'artifacts', 'secrets', 'transactions', 'authwits'] as const;
12
12
  export type AliasType = (typeof Aliases)[number];
13
13
 
14
14
  export class WalletDB {
15
+ #store!: AztecAsyncKVStore;
15
16
  #accounts!: AztecAsyncMap<string, Buffer>;
16
17
  #aliases!: AztecAsyncMap<string, Buffer>;
17
18
  #bridgedFeeJuice!: AztecAsyncMap<string, Buffer>;
@@ -29,6 +30,7 @@ export class WalletDB {
29
30
  }
30
31
 
31
32
  async init(store: AztecAsyncKVStore) {
33
+ this.#store = store;
32
34
  this.#accounts = store.openMap('accounts');
33
35
  this.#aliases = store.openMap('aliases');
34
36
  this.#bridgedFeeJuice = store.openMap('bridgedFeeJuice');
@@ -41,14 +43,17 @@ export class WalletDB {
41
43
  }
42
44
 
43
45
  async pushBridgedFeeJuice(recipient: AztecAddress, secret: Fr, amount: bigint, leafIndex: bigint, log: LogFn) {
44
- let stackPointer = (await this.#bridgedFeeJuice.getAsync(`${recipient.toString()}:stackPointer`))?.readInt8() || 0;
45
- stackPointer++;
46
- await this.#bridgedFeeJuice.set(
47
- `${recipient.toString()}:${stackPointer}`,
48
- Buffer.from(`${amount.toString()}:${secret.toString()}:${leafIndex.toString()}`),
49
- );
50
- await this.#bridgedFeeJuice.set(`${recipient.toString()}:stackPointer`, Buffer.from([stackPointer]));
51
- log(`Pushed ${amount} fee juice for recipient ${recipient.toString()}. Stack pointer ${stackPointer}`);
46
+ await this.#store.transactionAsync(async () => {
47
+ let stackPointer =
48
+ (await this.#bridgedFeeJuice.getAsync(`${recipient.toString()}:stackPointer`))?.readInt8() || 0;
49
+ stackPointer++;
50
+ await this.#bridgedFeeJuice.set(
51
+ `${recipient.toString()}:${stackPointer}`,
52
+ Buffer.from(`${amount.toString()}:${secret.toString()}:${leafIndex.toString()}`),
53
+ );
54
+ await this.#bridgedFeeJuice.set(`${recipient.toString()}:stackPointer`, Buffer.from([stackPointer]));
55
+ log(`Pushed ${amount} fee juice for recipient ${recipient.toString()}. Stack pointer ${stackPointer}`);
56
+ });
52
57
  }
53
58
 
54
59
  async popBridgedFeeJuice(recipient: AztecAddress, log: LogFn) {
@@ -76,19 +81,24 @@ export class WalletDB {
76
81
  }: { type: AccountType; secretKey: Fr; salt: Fr; alias: string | undefined; publicKey: string | undefined },
77
82
  log: LogFn,
78
83
  ) {
79
- if (alias) {
80
- await this.#aliases.set(`accounts:${alias}`, Buffer.from(address.toString()));
81
- }
82
- await this.#accounts.set(`${address.toString()}:type`, Buffer.from(type));
83
- await this.#accounts.set(`${address.toString()}:sk`, secretKey.toBuffer());
84
- await this.#accounts.set(`${address.toString()}:salt`, salt.toBuffer());
84
+ let publicSigningKey: Buffer | undefined;
85
85
  if (type === 'ecdsasecp256r1ssh' && publicKey) {
86
- const publicSigningKey = extractECDSAPublicKeyFromBase64String(publicKey);
87
- await this.storeAccountMetadata(address, 'publicSigningKey', publicSigningKey);
86
+ publicSigningKey = extractECDSAPublicKeyFromBase64String(publicKey);
88
87
  }
89
- await this.#aliases.set('accounts:last', Buffer.from(address.toString()));
90
- log(`Account stored in database with alias${alias ? `es last & ${alias}` : ' last'}`);
91
88
 
89
+ await this.#store.transactionAsync(async () => {
90
+ if (alias) {
91
+ await this.#aliases.set(`accounts:${alias}`, Buffer.from(address.toString()));
92
+ }
93
+ await this.#accounts.set(`${address.toString()}:type`, Buffer.from(type));
94
+ await this.#accounts.set(`${address.toString()}:sk`, secretKey.toBuffer());
95
+ await this.#accounts.set(`${address.toString()}:salt`, salt.toBuffer());
96
+ if (publicSigningKey) {
97
+ await this.#accounts.set(`${address.toString()}:publicSigningKey`, publicSigningKey);
98
+ }
99
+ await this.#aliases.set('accounts:last', Buffer.from(address.toString()));
100
+ });
101
+ log(`Account stored in database with alias${alias ? `es last & ${alias}` : ' last'}`);
92
102
  await this.refreshAliasCache();
93
103
  }
94
104
 
@@ -100,35 +110,38 @@ export class WalletDB {
100
110
  }
101
111
 
102
112
  async storeContract(address: AztecAddress, artifactPath: string, log: LogFn, alias?: string) {
103
- if (alias) {
104
- await this.#aliases.set(`contracts:${alias}`, Buffer.from(address.toString()));
105
- await this.#aliases.set(`artifacts:${alias}`, Buffer.from(artifactPath));
106
- }
107
- await this.#aliases.set(`contracts:last`, Buffer.from(address.toString()));
108
- await this.#aliases.set(`artifacts:last`, Buffer.from(artifactPath));
109
- await this.#aliases.set(`artifacts:${address.toString()}`, Buffer.from(artifactPath));
113
+ await this.#store.transactionAsync(async () => {
114
+ if (alias) {
115
+ await this.#aliases.set(`contracts:${alias}`, Buffer.from(address.toString()));
116
+ await this.#aliases.set(`artifacts:${alias}`, Buffer.from(artifactPath));
117
+ }
118
+ await this.#aliases.set(`contracts:last`, Buffer.from(address.toString()));
119
+ await this.#aliases.set(`artifacts:last`, Buffer.from(artifactPath));
120
+ await this.#aliases.set(`artifacts:${address.toString()}`, Buffer.from(artifactPath));
121
+ });
110
122
  log(`Contract stored in database with alias${alias ? `es last & ${alias}` : ' last'}`);
111
-
112
123
  await this.refreshAliasCache();
113
124
  }
114
125
 
115
126
  async storeAuthwitness(authWit: AuthWitness, log: LogFn, alias?: string) {
116
- if (alias) {
117
- await this.#aliases.set(`authwits:${alias}`, Buffer.from(authWit.toString()));
118
- }
119
- await this.#aliases.set(`authwits:last`, Buffer.from(authWit.toString()));
127
+ await this.#store.transactionAsync(async () => {
128
+ if (alias) {
129
+ await this.#aliases.set(`authwits:${alias}`, Buffer.from(authWit.toString()));
130
+ }
131
+ await this.#aliases.set(`authwits:last`, Buffer.from(authWit.toString()));
132
+ });
120
133
  log(`Authorization witness stored in database with alias${alias ? `es last & ${alias}` : ' last'}`);
121
-
122
134
  await this.refreshAliasCache();
123
135
  }
124
136
 
125
137
  async storeTx({ txHash }: { txHash: TxHash }, log: LogFn, alias?: string) {
126
- if (alias) {
127
- await this.#aliases.set(`transactions:${alias}`, Buffer.from(txHash.toString()));
128
- }
129
- await this.#aliases.set(`transactions:last`, Buffer.from(txHash.toString()));
138
+ await this.#store.transactionAsync(async () => {
139
+ if (alias) {
140
+ await this.#aliases.set(`transactions:${alias}`, Buffer.from(txHash.toString()));
141
+ }
142
+ await this.#aliases.set(`transactions:last`, Buffer.from(txHash.toString()));
143
+ });
130
144
  log(`Transaction hash stored in database with alias${alias ? `es last & ${alias}` : ' last'}`);
131
-
132
145
  await this.refreshAliasCache();
133
146
  }
134
147
 
@@ -0,0 +1,4 @@
1
+ export const MIN_FEE_PADDING = 0.5;
2
+
3
+ export const AccountTypes = ['schnorr', 'ecdsasecp256r1', 'ecdsasecp256r1ssh', 'ecdsasecp256k1'] as const;
4
+ export type AccountType = (typeof AccountTypes)[number];
@@ -1,7 +1,7 @@
1
1
  import type { FeePaymentMethod } from '@aztec/aztec.js/fee';
2
2
  import type { AztecNode } from '@aztec/aztec.js/node';
3
3
  import type { Wallet } from '@aztec/aztec.js/wallet';
4
- import { Fr } from '@aztec/foundation/fields';
4
+ import { Fr } from '@aztec/foundation/curves/bn254';
5
5
  import type { LogFn } from '@aztec/foundation/log';
6
6
  import type { FieldsOf } from '@aztec/foundation/types';
7
7
  import { AztecAddress } from '@aztec/stdlib/aztec-address';
@@ -11,7 +11,7 @@ import type { FeeOptions } from '@aztec/wallet-sdk/base-wallet';
11
11
  import { Option } from 'commander';
12
12
 
13
13
  import type { WalletDB } from '../../storage/wallet_db.js';
14
- import { BASE_FEE_PADDING } from '../wallet.js';
14
+ import { MIN_FEE_PADDING } from '../constants.js';
15
15
  import { aliasedAddressParser } from './options.js';
16
16
 
17
17
  export type RawCliFeeArgs = {
@@ -171,6 +171,9 @@ export function parsePaymentMethod(
171
171
  case 'fpc-public': {
172
172
  const fpc = getFpc();
173
173
  const asset = getAsset();
174
+ log(
175
+ `WARNING: fpc-public is deprecated and will not work on mainnet alpha. Use fee_juice or fpc-sponsored instead.`,
176
+ );
174
177
  log(`Using public fee payment with asset ${asset} via paymaster ${fpc}`);
175
178
  const { PublicFeePaymentMethod } = await import('@aztec/aztec.js/fee');
176
179
  return new PublicFeePaymentMethod(fpc, from, wallet, gasSettings);
@@ -178,6 +181,9 @@ export function parsePaymentMethod(
178
181
  case 'fpc-private': {
179
182
  const fpc = getFpc();
180
183
  const asset = getAsset();
184
+ log(
185
+ `WARNING: fpc-private is deprecated and will not work on mainnet alpha. Use fee_juice or fpc-sponsored instead.`,
186
+ );
181
187
  log(`Using private fee payment with asset ${asset} via paymaster ${fpc}`);
182
188
  const { PrivateFeePaymentMethod } = await import('@aztec/aztec.js/fee');
183
189
  return new PrivateFeePaymentMethod(fpc, from, wallet, gasSettings);
@@ -250,7 +256,7 @@ export class CLIFeeArgs {
250
256
  ) {}
251
257
 
252
258
  async toUserFeeOptions(node: AztecNode, wallet: Wallet, from: AztecAddress): Promise<ParsedFeeOptions> {
253
- const maxFeesPerGas = (await node.getCurrentBaseFees()).mul(1 + BASE_FEE_PADDING);
259
+ const maxFeesPerGas = (await node.getCurrentMinFees()).mul(1 + MIN_FEE_PADDING);
254
260
  const gasSettings = GasSettings.default({ ...this.gasSettings, maxFeesPerGas });
255
261
  const paymentMethod = await this.paymentMethod(wallet, from, gasSettings);
256
262
  return {
@@ -7,7 +7,7 @@ import { Option } from 'commander';
7
7
  import { readdir, stat } from 'fs/promises';
8
8
 
9
9
  import type { AliasType, WalletDB } from '../../storage/wallet_db.js';
10
- import { AccountTypes } from '../wallet.js';
10
+ import { AccountTypes } from '../constants.js';
11
11
 
12
12
  const TARGET_DIR = 'target';
13
13
 
@@ -95,7 +95,7 @@ export function printProfileResult(
95
95
 
96
96
  if (stats.nodeRPCCalls) {
97
97
  log(format('\nRPC calls:\n'));
98
- for (const [method, { times }] of Object.entries(stats.nodeRPCCalls)) {
98
+ for (const [method, { times }] of Object.entries(stats.nodeRPCCalls.perMethod)) {
99
99
  const calls = times.length;
100
100
  const total = times.reduce((acc, time) => acc + time, 0);
101
101
  const avg = total / calls;
@@ -112,6 +112,20 @@ export function printProfileResult(
112
112
  ),
113
113
  );
114
114
  }
115
+
116
+ const { roundTrips } = stats.nodeRPCCalls;
117
+ log(format('\nRound trips (actual blocking waits):\n'));
118
+ log(format('Round trips:'.padEnd(25), `${roundTrips.roundTrips}`.padStart(COLUMN_MAX_WIDTH)));
119
+ log(
120
+ format(
121
+ 'Total blocking time:'.padEnd(25),
122
+ `${roundTrips.totalBlockingTime.toFixed(2)}ms`.padStart(COLUMN_MAX_WIDTH),
123
+ ),
124
+ );
125
+ if (roundTrips.roundTrips > 0) {
126
+ const avgRoundTrip = roundTrips.totalBlockingTime / roundTrips.roundTrips;
127
+ log(format('Avg round trip:'.padEnd(25), `${avgRoundTrip.toFixed(2)}ms`.padStart(COLUMN_MAX_WIDTH)));
128
+ }
115
129
  }
116
130
 
117
131
  log(format('\nSync time:'.padEnd(25), `${timings.sync?.toFixed(2)}ms`.padStart(16)));
@@ -11,28 +11,24 @@ import {
11
11
  import type { AztecNode } from '@aztec/aztec.js/node';
12
12
  import { AccountManager, type Aliased, type SimulateOptions } from '@aztec/aztec.js/wallet';
13
13
  import type { DefaultAccountEntrypointOptions } from '@aztec/entrypoints/account';
14
- import { Fr } from '@aztec/foundation/fields';
14
+ import { Fr } from '@aztec/foundation/curves/bn254';
15
15
  import type { LogFn } from '@aztec/foundation/log';
16
+ import type { AccessScopes, NotesFilter } from '@aztec/pxe/client/lazy';
16
17
  import type { PXEConfig } from '@aztec/pxe/config';
17
18
  import type { PXE } from '@aztec/pxe/server';
18
19
  import { createPXE, getPXEConfig } from '@aztec/pxe/server';
19
20
  import { AztecAddress } from '@aztec/stdlib/aztec-address';
20
21
  import { deriveSigningKey } from '@aztec/stdlib/keys';
21
22
  import { NoteDao } from '@aztec/stdlib/note';
22
- import type { NotesFilter } from '@aztec/stdlib/note';
23
23
  import type { TxProvingResult, TxSimulationResult } from '@aztec/stdlib/tx';
24
24
  import { ExecutionPayload, mergeExecutionPayloads } from '@aztec/stdlib/tx';
25
- import { BaseWallet } from '@aztec/wallet-sdk/base-wallet';
25
+ import { BaseWallet, type FeeOptions } from '@aztec/wallet-sdk/base-wallet';
26
26
 
27
27
  import type { WalletDB } from '../storage/wallet_db.js';
28
+ import type { AccountType } from './constants.js';
28
29
  import { extractECDSAPublicKeyFromBase64String } from './ecdsa.js';
29
30
  import { printGasEstimates } from './options/fees.js';
30
31
 
31
- export const AccountTypes = ['schnorr', 'ecdsasecp256r1', 'ecdsasecp256r1ssh', 'ecdsasecp256k1'] as const;
32
- export type AccountType = (typeof AccountTypes)[number];
33
-
34
- export const BASE_FEE_PADDING = 0.5;
35
-
36
32
  export class CLIWallet extends BaseWallet {
37
33
  private accountCache = new Map<string, Account>();
38
34
 
@@ -71,6 +67,7 @@ export class CLIWallet extends BaseWallet {
71
67
  const feeOptions = await this.completeFeeOptions(from, executionPayload.feePayer, increasedFee.gasSettings);
72
68
  const feeExecutionPayload = await feeOptions.walletFeePaymentMethod?.getExecutionPayload();
73
69
  const fromAccount = await this.getAccountFromAddress(from);
70
+ const chainInfo = await this.getChainInfo();
74
71
  const executionOptions: DefaultAccountEntrypointOptions = {
75
72
  txNonce,
76
73
  cancellable: this.cancellableTransactions,
@@ -79,6 +76,7 @@ export class CLIWallet extends BaseWallet {
79
76
  return await fromAccount.createTxExecutionRequest(
80
77
  feeExecutionPayload ?? executionPayload,
81
78
  feeOptions.gasSettings,
79
+ chainInfo,
82
80
  executionOptions,
83
81
  );
84
82
  }
@@ -89,14 +87,13 @@ export class CLIWallet extends BaseWallet {
89
87
  increasedFee: InteractionFeeOptions,
90
88
  ): Promise<TxProvingResult> {
91
89
  const cancellationTxRequest = await this.createCancellationTxExecutionRequest(from, txNonce, increasedFee);
92
- return await this.pxe.proveTx(cancellationTxRequest);
90
+ return await this.pxe.proveTx(cancellationTxRequest, this.scopesFrom(from));
93
91
  }
94
92
 
95
93
  override async getAccountFromAddress(address: AztecAddress) {
96
94
  let account: Account | undefined;
97
95
  if (address.equals(AztecAddress.ZERO)) {
98
- const chainInfo = await this.getChainInfo();
99
- account = new SignerlessAccount(chainInfo);
96
+ account = new SignerlessAccount();
100
97
  } else if (this.accountCache.has(address.toString())) {
101
98
  return this.accountCache.get(address.toString())!;
102
99
  } else {
@@ -180,15 +177,26 @@ export class CLIWallet extends BaseWallet {
180
177
  return account;
181
178
  }
182
179
 
180
+ /**
181
+ * Creates a stub account that impersonates the given address, allowing kernelless simulations
182
+ * to bypass the account's authorization mechanisms via contract overrides.
183
+ * @param address - The address of the account to impersonate
184
+ * @returns The stub account, contract instance, and artifact for simulation
185
+ */
183
186
  private async getFakeAccountDataFor(address: AztecAddress) {
184
- const chainInfo = await this.getChainInfo();
185
187
  const originalAccount = await this.getAccountFromAddress(address);
186
- const originalAddress = originalAccount.getCompleteAddress();
187
- const { contractInstance } = await this.pxe.getContractMetadata(originalAddress.address);
188
+ // Account contracts can only be overridden if they have an associated address
189
+ // Overwriting SignerlessAccount is not supported, and does not really make sense
190
+ // since it has no authorization mechanism.
191
+ if (originalAccount instanceof SignerlessAccount) {
192
+ throw new Error(`Cannot create fake account data for SignerlessAccount at address: ${address}`);
193
+ }
194
+ const originalAddress = (originalAccount as Account).getCompleteAddress();
195
+ const contractInstance = await this.pxe.getContractInstance(originalAddress.address);
188
196
  if (!contractInstance) {
189
197
  throw new Error(`No contract instance found for address: ${originalAddress.address}`);
190
198
  }
191
- const stubAccount = createStubAccount(originalAddress, chainInfo);
199
+ const stubAccount = createStubAccount(originalAddress);
192
200
  const instance = await getContractInstanceFromInstantiationParams(StubAccountContractArtifact, {
193
201
  salt: Fr.random(),
194
202
  });
@@ -200,10 +208,39 @@ export class CLIWallet extends BaseWallet {
200
208
  }
201
209
 
202
210
  override async simulateTx(executionPayload: ExecutionPayload, opts: SimulateOptions): Promise<TxSimulationResult> {
203
- let simulationResults;
204
- const feeOptions = opts.fee?.estimateGas
205
- ? await this.completeFeeOptionsForEstimation(opts.from, executionPayload.feePayer, opts.fee?.gasSettings)
206
- : await this.completeFeeOptions(opts.from, executionPayload.feePayer, opts.fee?.gasSettings);
211
+ const simulationResults = await super.simulateTx(executionPayload, opts);
212
+
213
+ if (opts.fee?.estimateGas) {
214
+ const feeOptions = await this.completeFeeOptions(opts.from, executionPayload.feePayer, opts.fee?.gasSettings);
215
+ const limits = getGasLimits(simulationResults, opts.fee?.estimatedGasPadding);
216
+ printGasEstimates(feeOptions, limits, this.userLog);
217
+ }
218
+ return simulationResults;
219
+ }
220
+
221
+ /**
222
+ * Uses a stub account for kernelless simulation, bypassing real account authorization.
223
+ * Falls through to the standard entrypoint path for SignerlessAccount (ZERO address).
224
+ */
225
+ protected override async simulateViaEntrypoint(
226
+ executionPayload: ExecutionPayload,
227
+ from: AztecAddress,
228
+ feeOptions: FeeOptions,
229
+ scopes: AccessScopes,
230
+ skipTxValidation?: boolean,
231
+ skipFeeEnforcement?: boolean,
232
+ ): Promise<TxSimulationResult> {
233
+ if (from.equals(AztecAddress.ZERO)) {
234
+ return super.simulateViaEntrypoint(
235
+ executionPayload,
236
+ from,
237
+ feeOptions,
238
+ scopes,
239
+ skipTxValidation,
240
+ skipFeeEnforcement,
241
+ );
242
+ }
243
+
207
244
  const feeExecutionPayload = await feeOptions.walletFeePaymentMethod?.getExecutionPayload();
208
245
  const executionOptions: DefaultAccountEntrypointOptions = {
209
246
  txNonce: Fr.random(),
@@ -214,42 +251,23 @@ export class CLIWallet extends BaseWallet {
214
251
  ? mergeExecutionPayloads([feeExecutionPayload, executionPayload])
215
252
  : executionPayload;
216
253
 
217
- // Kernelless simulations using the multicall entrypoints are not currently supported,
218
- // since we only override proper account contracts.
219
- // TODO: allow disabling kernels even when no overrides are necessary
220
- if (opts.from.equals(AztecAddress.ZERO)) {
221
- const fromAccount = await this.getAccountFromAddress(opts.from);
222
- const txRequest = await fromAccount.createTxExecutionRequest(
223
- finalExecutionPayload,
224
- feeOptions.gasSettings,
225
- executionOptions,
226
- );
227
- simulationResults = await this.pxe.simulateTx(
228
- txRequest,
229
- true /* simulatePublic */,
230
- opts?.skipTxValidation,
231
- opts?.skipFeeEnforcement ?? true,
232
- );
233
- } else {
234
- const { account: fromAccount, instance, artifact } = await this.getFakeAccountDataFor(opts.from);
235
- const txRequest = await fromAccount.createTxExecutionRequest(
236
- finalExecutionPayload,
237
- feeOptions.gasSettings,
238
- executionOptions,
239
- );
240
- const contractOverrides = {
241
- [opts.from.toString()]: { instance, artifact },
242
- };
243
- simulationResults = await this.pxe.simulateTx(txRequest, true /* simulatePublic */, true, true, {
244
- contracts: contractOverrides,
245
- });
246
- }
247
-
248
- if (opts.fee?.estimateGas) {
249
- const limits = getGasLimits(simulationResults, opts.fee?.estimatedGasPadding);
250
- printGasEstimates(feeOptions, limits, this.userLog);
251
- }
252
- return simulationResults;
254
+ const { account: fromAccount, instance, artifact } = await this.getFakeAccountDataFor(from);
255
+ const chainInfo = await this.getChainInfo();
256
+ const txRequest = await fromAccount.createTxExecutionRequest(
257
+ finalExecutionPayload,
258
+ feeOptions.gasSettings,
259
+ chainInfo,
260
+ executionOptions,
261
+ );
262
+ return this.pxe.simulateTx(txRequest, {
263
+ simulatePublic: true,
264
+ skipFeeEnforcement: true,
265
+ skipTxValidation: true,
266
+ overrides: {
267
+ contracts: { [from.toString()]: { instance, artifact } },
268
+ },
269
+ scopes,
270
+ });
253
271
  }
254
272
 
255
273
  // Exposed because of the `aztec-wallet get-tx` command. It has been decided that it's fine to keep around because
@@ -261,6 +279,12 @@ export class CLIWallet extends BaseWallet {
261
279
  // Exposed because of the `aztec-wallet get-tx` command. It has been decided that it's fine to keep around because
262
280
  // this is just a CLI wallet.
263
281
  getNotes(filter: NotesFilter): Promise<NoteDao[]> {
264
- return this.pxe.getNotes(filter);
282
+ return this.pxe.debug.getNotes(filter);
283
+ }
284
+
285
+ // Exposed because of the `aztec-wallet get-tx` command. It has been decided that it's fine to keep around because
286
+ // this is just a CLI wallet.
287
+ getContractArtifact(id: Fr) {
288
+ return this.pxe.getContractArtifact(id);
265
289
  }
266
290
  }