@aztec/wallet-sdk 0.0.1-commit.2f68f620 → 0.0.1-commit.3100065

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -324,7 +324,7 @@ function useWalletDiscovery(chainInfo: ChainInfo, appId: string) {
324
324
 
325
325
  Your wallet and the PXE it embeds persist state through a pluggable key-value store (`@aztec/kv-store`). In the browser there are two backends:
326
326
 
327
- - **IndexedDB** (`@aztec/kv-store/indexeddb`): the default in browser environments up to Aztec Alpha v4. Please keep in mind we plan to deprecate support of this backend, so we strongly recommend you use the SQLite backend.
327
+ - **IndexedDB** (`@aztec/kv-store/deprecated/indexeddb`): the default in browser environments up to Aztec Alpha v4, now moved to a deprecated subpath. We plan to remove this backend, so new browser code should use the SQLite backend below.
328
328
  - **SQLite-OPFS** (`@aztec/kv-store/sqlite-opfs`): the default KV store backend from Aztec Alpha v5 on. It's backed by the durable Origin Private File System web standard, and it offers a number of advantages over IndexedDB: a sane transaction model (IDB transactions auto-close the moment the event loop yields, which constrains the store layer), support for encryption at rest, and better performance in the access patterns we exercise the most from both wallet and PXE.
329
329
 
330
330
  The backend is chosen by *which store you construct and hand to the wallet* there is no runtime flag or environment variable.
@@ -11,9 +11,10 @@ import type { PXE } from '@aztec/pxe/server';
11
11
  import { type ContractArtifact, type EventMetadataDefinition, type FunctionCall } from '@aztec/stdlib/abi';
12
12
  import type { AuthWitness } from '@aztec/stdlib/auth-witness';
13
13
  import { AztecAddress } from '@aztec/stdlib/aztec-address';
14
- import { type ContractInstanceWithAddress } from '@aztec/stdlib/contract';
15
- import { GasFees, GasSettings, ManaUsageEstimate } from '@aztec/stdlib/gas';
14
+ import { type ContractInstancePreimage } from '@aztec/stdlib/contract';
15
+ import { Gas, GasFees, GasSettings, ManaUsageEstimate } from '@aztec/stdlib/gas';
16
16
  import type { AztecNode } from '@aztec/stdlib/interfaces/client';
17
+ import { type MasterSecretKeys } from '@aztec/stdlib/keys';
17
18
  import { ExecutionPayload, type TxExecutionRequest, type TxProfileResult, type UtilityExecutionResult } from '@aztec/stdlib/tx';
18
19
  /**
19
20
  * Options to configure fee payment for a transaction
@@ -59,6 +60,7 @@ export declare abstract class BaseWallet implements Wallet {
59
60
  protected log: import("@aztec/foundation/log").Logger;
60
61
  protected minFeePadding: number;
61
62
  protected cancellableTransactions: boolean;
63
+ protected defaultWaitInterval?: number;
62
64
  private nodeInfoPromise;
63
65
  protected constructor(pxe: PXE, aztecNode: AztecNode, log?: import("@aztec/foundation/log").Logger);
64
66
  protected scopesFrom(from: AztecAddress | NoFrom, additionalScopes?: AztecAddress[]): AztecAddress[];
@@ -80,7 +82,21 @@ export declare abstract class BaseWallet implements Wallet {
80
82
  * @returns The aliased collection of AztecAddresses that form this wallet's address book
81
83
  */
82
84
  getAddressBook(): Promise<Aliased<AztecAddress>[]>;
85
+ /**
86
+ * Fetches and caches the node info for the wallet's lifetime, since a wallet talks to a single network and
87
+ * node info never changes. A rejected fetch clears the cache so the next call retries instead of replaying
88
+ * the cached rejection forever — important because the gas-limit fill-in and validation (run on every send)
89
+ * depend on it.
90
+ */
91
+ private getNodeInfo;
83
92
  getChainInfo(): Promise<ChainInfo>;
93
+ /**
94
+ * Returns the maximum gas limits a single transaction may declare on this wallet's network (the
95
+ * node-advertised `txsLimits.gas`). Internal helper used to fill in default gas limits when sending a
96
+ * transaction without explicit limits, and to validate caller-provided limits before sending. Backed by
97
+ * the cached node info, since a wallet talks to a single network.
98
+ */
99
+ protected getMaxTxGasLimits(): Promise<Gas>;
84
100
  protected createTxExecutionRequestFromPayloadAndFee(executionPayload: ExecutionPayload, from: AztecAddress | NoFrom, feeOptions: FeeOptions): Promise<TxExecutionRequest>;
85
101
  createAuthWit(from: AztecAddress, messageHashOrIntent: IntentInnerHash | CallIntent): Promise<AuthWitness>;
86
102
  /**
@@ -110,7 +126,7 @@ export declare abstract class BaseWallet implements Wallet {
110
126
  */
111
127
  protected getMinFees(estimate?: ManaUsageEstimate): Promise<GasFees>;
112
128
  registerSender(address: AztecAddress, _alias?: string): Promise<AztecAddress>;
113
- registerContract(instance: ContractInstanceWithAddress, artifact?: ContractArtifact, secretKey?: Fr): Promise<ContractInstanceWithAddress>;
129
+ registerContract(instance: ContractInstancePreimage, artifact?: ContractArtifact, secretKeyOrKeys?: Fr | MasterSecretKeys): Promise<void>;
114
130
  registerContractClass(artifact: ContractArtifact): Promise<void>;
115
131
  /**
116
132
  * Simulates calls through the standard PXE path (account entrypoint).
@@ -149,7 +165,7 @@ export declare abstract class BaseWallet implements Wallet {
149
165
  * @param address - The contract address to query.
150
166
  */
151
167
  getContractMetadata(address: AztecAddress): Promise<{
152
- instance: ContractInstanceWithAddress | undefined;
168
+ instance: import("@aztec/stdlib/contract").ContractInstancePreimageWithAddress | undefined;
153
169
  initializationStatus: ContractInitializationStatus;
154
170
  isContractPublished: boolean;
155
171
  isContractUpdated: boolean;
@@ -160,4 +176,4 @@ export declare abstract class BaseWallet implements Wallet {
160
176
  isContractClassPubliclyRegistered: boolean;
161
177
  }>;
162
178
  }
163
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYmFzZV93YWxsZXQuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9iYXNlLXdhbGxldC9iYXNlX3dhbGxldC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEtBQUssRUFBRSxPQUFPLEVBQUUsTUFBTSxFQUFFLE1BQU0seUJBQXlCLENBQUM7QUFFL0QsT0FBTyxLQUFLLEVBQUUsVUFBVSxFQUFFLGVBQWUsRUFBRSxNQUFNLCtCQUErQixDQUFDO0FBQ2pGLE9BQU8sRUFDTCxLQUFLLHNCQUFzQixFQUUzQixLQUFLLFVBQVUsRUFFaEIsTUFBTSwyQkFBMkIsQ0FBQztBQUNuQyxPQUFPLEtBQUssRUFBRSxnQkFBZ0IsRUFB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E,gBAAgB,EAClC,IAAI,EAAE,eAAe,GACpB,OAAO,CAAC,+BAA+B,CAAC,CAkD1C;IAEK,SAAS,CAAC,gBAAgB,EAAE,gBAAgB,EAAE,IAAI,EAAE,cAAc,GAAG,OAAO,CAAC,eAAe,CAAC,CAclG;IAEY,MAAM,CAAC,CAAC,SAAS,sBAAsB,GAAG,SAAS,EAC9D,gBAAgB,EAAE,gBAAgB,EAClC,IAAI,EAAE,WAAW,CAAC,CAAC,CAAC,GACnB,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CA8CxB;IAED;;;OAGG;IACH,UAAgB,eAAe,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAWlF;IAED,SAAS,CAAC,kBAAkB,CAAC,GAAG,EAAE,KAAK,EAAE,GAAG,OAAO,EAAE,MAAM,EAAE,GAAG,KAAK,CAYpE;IAED,cAAc,CAAC,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,qBAAqB,GAAG,OAAO,CAAC,sBAAsB,CAAC,CAE/F;IAEK,gBAAgB,CAAC,CAAC,EACtB,QAAQ,EAAE,uBAAuB,EACjC,WAAW,EAAE,kBAAkB,GAC9B,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,CAAC,CAe5B;IAED;;;OAGG;IACG,mBAAmB,CAAC,OAAO,EAAE,YAAY;;;;;;OAiC9C;IAEK,wBAAwB,CAAC,EAAE,EAAE,EAAE;;;OAMpC;CACF"}
@@ -9,12 +9,14 @@ import { createLogger } from '@aztec/foundation/log';
9
9
  import { displayDebugLogs } from '@aztec/pxe/client/lazy';
10
10
  import { decodeFromAbi } from '@aztec/stdlib/abi';
11
11
  import { AztecAddress } from '@aztec/stdlib/aztec-address';
12
- import { computePartialAddress, getContractClassFromArtifact } from '@aztec/stdlib/contract';
12
+ import { computePartialAddress } from '@aztec/stdlib/contract';
13
13
  import { SimulationError } from '@aztec/stdlib/errors';
14
14
  import { Gas, GasFees, GasSettings, ManaUsageEstimate } from '@aztec/stdlib/gas';
15
15
  import { computeSiloedPrivateInitializationNullifier, computeSiloedPublicInitializationNullifier } from '@aztec/stdlib/hash';
16
+ import { deriveKeys, deriveKeysFromMasterSecretKeys } from '@aztec/stdlib/keys';
16
17
  import { mergeExecutionPayloads } from '@aztec/stdlib/tx';
17
18
  import { inspect } from 'util';
19
+ import { assertGasLimitsWithinNetworkLimits } from './get_gas_limits.js';
18
20
  import { buildMergedSimulationResult, extractOptimizablePublicStaticCalls, simulateViaNode } from './utils.js';
19
21
  /**
20
22
  * A base class for Wallet implementations
@@ -24,6 +26,9 @@ import { buildMergedSimulationResult, extractOptimizablePublicStaticCalls, simul
24
26
  log;
25
27
  minFeePadding;
26
28
  cancellableTransactions;
29
+ // Poll interval (in seconds) injected into sendTx waits when the caller does not specify one. Left undefined on
30
+ // production wallets so the DefaultWaitOpts 1s cadence stands; test wallets talking to in-process nodes lower it.
31
+ defaultWaitInterval;
27
32
  // A wallet is instantiated for a particular chain, so chain info never changes during its lifetime.
28
33
  // We cache it here because getChainInfo is called frequently (every tx simulation, send, auth wit, etc.).
29
34
  nodeInfoPromise;
@@ -43,7 +48,7 @@ import { buildMergedSimulationResult, extractOptimizablePublicStaticCalls, simul
43
48
  const scopeSet = new Set(allScopes.map((address)=>address.toString()));
44
49
  return [
45
50
  ...scopeSet
46
- ].map(AztecAddress.fromString);
51
+ ].map(AztecAddress.fromStringUnsafe);
47
52
  }
48
53
  /**
49
54
  * Picks the sender address PXE should tag private messages with. Returns `undefined` when there is no signing
@@ -61,22 +66,44 @@ import { buildMergedSimulationResult, extractOptimizablePublicStaticCalls, simul
61
66
  * - Contacts: more general concept akin to a phone's contact list.
62
67
  * @returns The aliased collection of AztecAddresses that form this wallet's address book
63
68
  */ async getAddressBook() {
64
- const senders = await this.pxe.getSenders();
65
- return senders.map((sender)=>({
66
- item: sender,
69
+ const sources = await this.pxe.getTaggingSecretSources({
70
+ kind: 'address-derived'
71
+ });
72
+ return sources.map((source)=>({
73
+ item: source.sender,
67
74
  alias: ''
68
75
  }));
69
76
  }
70
- async getChainInfo() {
77
+ /**
78
+ * Fetches and caches the node info for the wallet's lifetime, since a wallet talks to a single network and
79
+ * node info never changes. A rejected fetch clears the cache so the next call retries instead of replaying
80
+ * the cached rejection forever — important because the gas-limit fill-in and validation (run on every send)
81
+ * depend on it.
82
+ */ getNodeInfo() {
71
83
  if (!this.nodeInfoPromise) {
72
- this.nodeInfoPromise = this.aztecNode.getNodeInfo();
84
+ this.nodeInfoPromise = this.aztecNode.getNodeInfo().catch((err)=>{
85
+ this.nodeInfoPromise = undefined;
86
+ throw err;
87
+ });
73
88
  }
74
- const { l1ChainId, rollupVersion } = await this.nodeInfoPromise;
89
+ return this.nodeInfoPromise;
90
+ }
91
+ async getChainInfo() {
92
+ const { l1ChainId, rollupVersion } = await this.getNodeInfo();
75
93
  return {
76
94
  chainId: new Fr(l1ChainId),
77
95
  version: new Fr(rollupVersion)
78
96
  };
79
97
  }
98
+ /**
99
+ * Returns the maximum gas limits a single transaction may declare on this wallet's network (the
100
+ * node-advertised `txsLimits.gas`). Internal helper used to fill in default gas limits when sending a
101
+ * transaction without explicit limits, and to validate caller-provided limits before sending. Backed by
102
+ * the cached node info, since a wallet talks to a single network.
103
+ */ async getMaxTxGasLimits() {
104
+ const { txsLimits } = await this.getNodeInfo();
105
+ return new Gas(txsLimits.gas.daGas, txsLimits.gas.l2Gas);
106
+ }
80
107
  async createTxExecutionRequestFromPayloadAndFee(executionPayload, from, feeOptions) {
81
108
  const feeExecutionPayload = await feeOptions.walletFeePaymentMethod?.getExecutionPayload();
82
109
  const finalExecutionPayload = feeExecutionPayload ? mergeExecutionPayloads([
@@ -164,8 +191,25 @@ import { buildMergedSimulationResult, extractOptimizablePublicStaticCalls, simul
164
191
  maxPriorityFeesPerGas: gasSettings?.maxPriorityFeesPerGas ?? GasFees.empty()
165
192
  };
166
193
  // When estimating gas (simulation), use high limits so the simulation doesn't run out of gas.
167
- // When sending for real, use protocol max limits that the network will actually accept.
168
- const fullGasSettings = forEstimation ? GasSettings.forEstimation(gasSettingsOverrides) : GasSettings.fallback(gasSettingsOverrides);
194
+ // When sending for real without explicit limits, declare the most a single tx may use on this network
195
+ // (the node's per-tx admission limit), so the proposer does not skip the tx for over-declaring gas.
196
+ let fullGasSettings;
197
+ if (forEstimation) {
198
+ // Estimation deliberately uses very high internal limits and skips tx validation, so we do not
199
+ // validate against the network admission limit here.
200
+ fullGasSettings = GasSettings.forEstimation(gasSettingsOverrides);
201
+ } else {
202
+ const maxTxGasLimits = await this.getMaxTxGasLimits();
203
+ // If the caller declared explicit gas limits, reject them up front when they exceed the network's
204
+ // per-tx admission limit (mirroring the node's GasLimitsValidator). Otherwise fill in the limit.
205
+ if (gasSettingsOverrides.gasLimits) {
206
+ assertGasLimitsWithinNetworkLimits(gasSettingsOverrides.gasLimits, maxTxGasLimits);
207
+ }
208
+ fullGasSettings = GasSettings.fallback({
209
+ ...gasSettingsOverrides,
210
+ gasLimits: gasSettingsOverrides.gasLimits ?? maxTxGasLimits
211
+ });
212
+ }
169
213
  this.log.debug(`Using L2 gas settings`, fullGasSettings);
170
214
  return {
171
215
  gasSettings: fullGasSettings,
@@ -193,40 +237,34 @@ import { buildMergedSimulationResult, extractOptimizablePublicStaticCalls, simul
193
237
  throw err;
194
238
  }
195
239
  }
196
- registerSender(address, _alias = '') {
197
- return this.pxe.registerSender(address);
240
+ async registerSender(address, _alias = '') {
241
+ await this.pxe.registerTaggingSecretSource({
242
+ kind: 'address-derived',
243
+ sender: address
244
+ });
245
+ return address;
198
246
  }
199
- async registerContract(instance, artifact, secretKey) {
200
- const existingInstance = await this.pxe.getContractInstance(instance.address);
201
- if (existingInstance) {
202
- // Instance already registered in the wallet
203
- if (artifact) {
204
- const thisContractClass = await getContractClassFromArtifact(artifact);
205
- if (!thisContractClass.id.equals(existingInstance.currentContractClassId)) {
206
- // wallet holds an outdated version of this contract
207
- await this.pxe.updateContract(instance.address, artifact);
208
- instance.currentContractClassId = thisContractClass.id;
209
- }
210
- }
211
- // If no artifact provided, we just use the existing registration
212
- } else {
213
- // Instance not registered yet
214
- if (!artifact) {
215
- // Try to get the artifact from the wallet's contract class storage
216
- artifact = await this.pxe.getContractArtifact(instance.currentContractClassId);
217
- if (!artifact) {
218
- throw new Error(`Cannot register contract at ${instance.address.toString()}: artifact is required but not provided, and wallet does not have the artifact for contract class ${instance.currentContractClassId.toString()}`);
219
- }
220
- }
221
- await this.pxe.registerContract({
222
- artifact,
223
- instance
224
- });
247
+ async registerContract(instance, artifact, secretKeyOrKeys) {
248
+ // Classes and instances are registered independently: register the artifact (if provided) then the instance.
249
+ // Neither call validates that the artifact matches the class the instance runs, a missing artifact only surfaces
250
+ // when the contract is later simulated.
251
+ if (artifact) {
252
+ await this.pxe.registerContractClass(artifact);
225
253
  }
226
- if (secretKey) {
227
- await this.pxe.registerAccount(secretKey, await computePartialAddress(instance));
254
+ const contractAddress = await this.pxe.registerContract(instance);
255
+ if (secretKeyOrKeys) {
256
+ // PXE never receives the account seed (from which the message-signing/fallback secret keys could be re-derived):
257
+ // the wallet derives the keys here. Of these, PXE only reads and stores the four privacy secret keys and the
258
+ // message-signing and fallback *public* keys — it never touches the message-signing or fallback secret keys.
259
+ //
260
+ // Since PXE recomputes the address from those keys, we assert it matches the instance's address: a mismatch means
261
+ // the provided keys don't correspond to this account.
262
+ const derivedKeys = secretKeyOrKeys instanceof Fr ? await deriveKeys(secretKeyOrKeys) : await deriveKeysFromMasterSecretKeys(secretKeyOrKeys);
263
+ const { address } = await this.pxe.registerAccount(derivedKeys, await computePartialAddress(instance));
264
+ if (!address.equals(contractAddress)) {
265
+ throw new Error(`Registered account address ${address.toString()} does not match contract instance address ${contractAddress.toString()}: the provided keys do not correspond to this account.`);
266
+ }
228
267
  }
229
- return instance;
230
268
  }
231
269
  registerContractClass(artifact) {
232
270
  return this.pxe.registerContractClass(artifact);
@@ -350,7 +388,11 @@ import { buildMergedSimulationResult, extractOptimizablePublicStaticCalls, simul
350
388
  };
351
389
  }
352
390
  // Otherwise, wait for the full receipt (default behavior on wait: undefined)
353
- const waitOpts = typeof opts.wait === 'object' ? opts.wait : undefined;
391
+ const callerWaitOpts = typeof opts.wait === 'object' ? opts.wait : undefined;
392
+ const waitOpts = this.defaultWaitInterval !== undefined && callerWaitOpts?.interval === undefined ? {
393
+ ...callerWaitOpts,
394
+ interval: this.defaultWaitInterval
395
+ } : callerWaitOpts;
354
396
  const receipt = await waitForTx(this.aztecNode, txHash, waitOpts);
355
397
  // Display debug logs from public execution if present (served in test mode only)
356
398
  if (receipt.isMined() && receipt.debugLogs?.length) {
@@ -369,7 +411,11 @@ import { buildMergedSimulationResult, extractOptimizablePublicStaticCalls, simul
369
411
  if (!instance) {
370
412
  return undefined;
371
413
  }
372
- const artifact = await this.pxe.getContractArtifact(instance.currentContractClassId);
414
+ // Contract names are class-stable (an upgrade preserves the contract name), so the original class artifact is a
415
+ // sufficient source for the display name without resolving the current class against the node.
416
+ // TODO: if a contract were to be upgraded and its original artifact never registered, then this would fail and we'd
417
+ // want to fallback to the current class.
418
+ const artifact = await this.pxe.getContractArtifact(instance.originalContractClassId);
373
419
  return artifact?.name;
374
420
  }
375
421
  contextualizeError(err, ...context) {
@@ -0,0 +1,36 @@
1
+ import { Gas, type GasUsed } from '@aztec/stdlib/gas';
2
+ /**
3
+ * Returns suggested total and teardown gas limits for a simulated tx, clamped to the network's per-tx
4
+ * admission limits.
5
+ *
6
+ * The network only admits transactions that declare up to `maxTxGasLimits` per dimension (the
7
+ * node-advertised `txsLimits.gas`). Wallets pass the value read from their own node info, but since node info
8
+ * is remote input it is defensively clamped here to the per-tx protocol maxima so a value above them is never
9
+ * honored. If the simulated usage already exceeds the resulting admission limits the tx can never be included,
10
+ * so this throws a descriptive error instead of returning a limit the node would reject. Otherwise it pads the
11
+ * usage and clamps each dimension to the admission limit.
12
+ * @param gasUsed - The gas actually consumed during simulation.
13
+ * @param maxTxGasLimits - The maximum gas a single tx may declare on this network (the node-advertised `txsLimits.gas`).
14
+ * @param pad - Fraction to pad the suggested gas limits by (as a decimal, e.g. 0.1 for 10%). The effective
15
+ * padding shrinks to zero as usage approaches the network limit, since the network will not admit a higher
16
+ * declared limit regardless of the buffer.
17
+ */
18
+ export declare function getGasLimits(gasUsed: GasUsed, maxTxGasLimits: Gas, pad?: number): {
19
+ /**
20
+ * Gas limit for the tx, excluding teardown gas
21
+ */
22
+ gasLimits: Gas;
23
+ /**
24
+ * Gas limit for the teardown phase
25
+ */
26
+ teardownGasLimits: Gas;
27
+ };
28
+ /**
29
+ * Validates that caller-declared gas limits do not exceed the network's per-tx admission limits, throwing a
30
+ * descriptive error per dimension when they do. The node's inbound validation checks declared
31
+ * `gasSettings.gasLimits`, so we mirror that here to surface the rejection locally before the tx is sent.
32
+ * @param gasLimits - The gas limits the transaction will declare.
33
+ * @param maxTxGasLimits - The maximum gas a single tx may declare on this network (the node-advertised `txsLimits.gas`).
34
+ */
35
+ export declare function assertGasLimitsWithinNetworkLimits(gasLimits: Gas, maxTxGasLimits: Gas): void;
36
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZ2V0X2dhc19saW1pdHMuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9iYXNlLXdhbGxldC9nZXRfZ2FzX2xpbWl0cy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFDQSxPQUFPLEVBQUUsR0FBRyxFQUFFLEtBQUssT0FBTyxFQUFFLE1BQU0sbUJBQW1CLENBQUM7QUFFdEQ7Ozs7Ozs7Ozs7Ozs7OztHQWVHO0FBQ0gsd0JBQWdCLFlBQVksQ0FDMUIsT0FBTyxFQUFFLE9BQU8sRUFDaEIsY0FBYyxFQUFFLEdBQUcsRUFDbkIsR0FBRyxTQUFNLEdBQ1I7SUFDRDs7T0FFRztJQUNILFNBQVMsRUFBRSxHQUFHLENBQUM7SUFDZjs7T0FFRztJQUNILGlCQUFpQixFQUFFLEdBQUcsQ0FBQztDQUN4QixDQTZCQTtBQVFEOzs7Ozs7R0FNRztBQUNILHdCQUFnQixrQ0FBa0MsQ0FBQyxTQUFTLEVBQUUsR0FBRyxFQUFFLGNBQWMsRUFBRSxHQUFHLEdBQUcsSUFBSSxDQVc1RiJ9
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get_gas_limits.d.ts","sourceRoot":"","sources":["../../src/base-wallet/get_gas_limits.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,GAAG,EAAE,KAAK,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAEtD;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,YAAY,CAC1B,OAAO,EAAE,OAAO,EAChB,cAAc,EAAE,GAAG,EACnB,GAAG,SAAM,GACR;IACD;;OAEG;IACH,SAAS,EAAE,GAAG,CAAC;IACf;;OAEG;IACH,iBAAiB,EAAE,GAAG,CAAC;CACxB,CA6BA;AAQD;;;;;;GAMG;AACH,wBAAgB,kCAAkC,CAAC,SAAS,EAAE,GAAG,EAAE,cAAc,EAAE,GAAG,GAAG,IAAI,CAW5F"}
@@ -0,0 +1,55 @@
1
+ import { MAX_PROCESSABLE_L2_GAS, MAX_TX_DA_GAS } from '@aztec/constants';
2
+ import { Gas } from '@aztec/stdlib/gas';
3
+ /**
4
+ * Returns suggested total and teardown gas limits for a simulated tx, clamped to the network's per-tx
5
+ * admission limits.
6
+ *
7
+ * The network only admits transactions that declare up to `maxTxGasLimits` per dimension (the
8
+ * node-advertised `txsLimits.gas`). Wallets pass the value read from their own node info, but since node info
9
+ * is remote input it is defensively clamped here to the per-tx protocol maxima so a value above them is never
10
+ * honored. If the simulated usage already exceeds the resulting admission limits the tx can never be included,
11
+ * so this throws a descriptive error instead of returning a limit the node would reject. Otherwise it pads the
12
+ * usage and clamps each dimension to the admission limit.
13
+ * @param gasUsed - The gas actually consumed during simulation.
14
+ * @param maxTxGasLimits - The maximum gas a single tx may declare on this network (the node-advertised `txsLimits.gas`).
15
+ * @param pad - Fraction to pad the suggested gas limits by (as a decimal, e.g. 0.1 for 10%). The effective
16
+ * padding shrinks to zero as usage approaches the network limit, since the network will not admit a higher
17
+ * declared limit regardless of the buffer.
18
+ */ export function getGasLimits(gasUsed, maxTxGasLimits, pad = 0.1) {
19
+ const { totalGas, teardownGas } = gasUsed;
20
+ // `maxTxGasLimits` is the node-advertised admission limit. Node info is remote input, so we defensively
21
+ // clamp to the per-tx protocol maxima so a value above them can never be honored.
22
+ const maxLimits = new Gas(Math.min(maxTxGasLimits.daGas, MAX_TX_DA_GAS), Math.min(maxTxGasLimits.l2Gas, MAX_PROCESSABLE_L2_GAS));
23
+ // The simulated usage must fit within the admission limits, otherwise the tx can never be included.
24
+ if (totalGas.daGas > maxLimits.daGas) {
25
+ throw new Error(`Transaction consumes ${totalGas.daGas} DA gas but the network only admits transactions declaring up to ${maxLimits.daGas} DA gas`);
26
+ }
27
+ if (totalGas.l2Gas > maxLimits.l2Gas) {
28
+ throw new Error(`Transaction consumes ${totalGas.l2Gas} L2 gas but the network only admits transactions declaring up to ${maxLimits.l2Gas} L2 gas`);
29
+ }
30
+ // Pad the limits by the buffer, then cap each dimension at the admission limit so the buffer cannot push a
31
+ // declared limit past what inbound validation accepts. Teardown is part of the total, so clamping it to the
32
+ // admission limit is safe.
33
+ return {
34
+ gasLimits: padGas(totalGas, pad, maxLimits),
35
+ teardownGasLimits: padGas(teardownGas, pad, maxLimits)
36
+ };
37
+ }
38
+ /** Pads each gas dimension, capping it at the network admission limit. */ function padGas(gas, pad, cap) {
39
+ const padded = gas.mul(1 + pad);
40
+ return new Gas(Math.min(padded.daGas, cap.daGas), Math.min(padded.l2Gas, cap.l2Gas));
41
+ }
42
+ /**
43
+ * Validates that caller-declared gas limits do not exceed the network's per-tx admission limits, throwing a
44
+ * descriptive error per dimension when they do. The node's inbound validation checks declared
45
+ * `gasSettings.gasLimits`, so we mirror that here to surface the rejection locally before the tx is sent.
46
+ * @param gasLimits - The gas limits the transaction will declare.
47
+ * @param maxTxGasLimits - The maximum gas a single tx may declare on this network (the node-advertised `txsLimits.gas`).
48
+ */ export function assertGasLimitsWithinNetworkLimits(gasLimits, maxTxGasLimits) {
49
+ if (gasLimits.daGas > maxTxGasLimits.daGas) {
50
+ throw new Error(`Declared DA gas limit (${gasLimits.daGas}) exceeds the maximum this network allows per tx (${maxTxGasLimits.daGas})`);
51
+ }
52
+ if (gasLimits.l2Gas > maxTxGasLimits.l2Gas) {
53
+ throw new Error(`Declared L2 gas limit (${gasLimits.l2Gas}) exceeds the maximum this network allows per tx (${maxTxGasLimits.l2Gas})`);
54
+ }
55
+ }
@@ -1,3 +1,4 @@
1
1
  export { BaseWallet, type CompleteFeeOptionsConfig, type FeeOptions, type SimulateViaEntrypointOptions, } from './base_wallet.js';
2
2
  export { simulateViaNode, buildMergedSimulationResult, extractOptimizablePublicStaticCalls } from './utils.js';
3
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9iYXNlLXdhbGxldC9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQ0wsVUFBVSxFQUNWLEtBQUssd0JBQXdCLEVBQzdCLEtBQUssVUFBVSxFQUNmLEtBQUssNEJBQTRCLEdBQ2xDLE1BQU0sa0JBQWtCLENBQUM7QUFDMUIsT0FBTyxFQUFFLGVBQWUsRUFBRSwyQkFBMkIsRUFBRSxtQ0FBbUMsRUFBRSxNQUFNLFlBQVksQ0FBQyJ9
3
+ export { getGasLimits, assertGasLimitsWithinNetworkLimits } from './get_gas_limits.js';
4
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9iYXNlLXdhbGxldC9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQ0wsVUFBVSxFQUNWLEtBQUssd0JBQXdCLEVBQzdCLEtBQUssVUFBVSxFQUNmLEtBQUssNEJBQTRCLEdBQ2xDLE1BQU0sa0JBQWtCLENBQUM7QUFDMUIsT0FBTyxFQUFFLGVBQWUsRUFBRSwyQkFBMkIsRUFBRSxtQ0FBbUMsRUFBRSxNQUFNLFlBQVksQ0FBQztBQUMvRyxPQUFPLEVBQUUsWUFBWSxFQUFFLGtDQUFrQyxFQUFFLE1BQU0scUJBQXFCLENBQUMifQ==
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/base-wallet/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,KAAK,wBAAwB,EAC7B,KAAK,UAAU,EACf,KAAK,4BAA4B,GAClC,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,eAAe,EAAE,2BAA2B,EAAE,mCAAmC,EAAE,MAAM,YAAY,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/base-wallet/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,KAAK,wBAAwB,EAC7B,KAAK,UAAU,EACf,KAAK,4BAA4B,GAClC,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,eAAe,EAAE,2BAA2B,EAAE,mCAAmC,EAAE,MAAM,YAAY,CAAC;AAC/G,OAAO,EAAE,YAAY,EAAE,kCAAkC,EAAE,MAAM,qBAAqB,CAAC"}
@@ -1,2 +1,3 @@
1
1
  export { BaseWallet } from './base_wallet.js';
2
2
  export { simulateViaNode, buildMergedSimulationResult, extractOptimizablePublicStaticCalls } from './utils.js';
3
+ export { getGasLimits, assertGasLimitsWithinNetworkLimits } from './get_gas_limits.js';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@aztec/wallet-sdk",
3
3
  "homepage": "https://github.com/AztecProtocol/aztec-packages/tree/master/yarn-project/wallet-sdk",
4
- "version": "0.0.1-commit.2f68f620",
4
+ "version": "0.0.1-commit.3100065",
5
5
  "type": "module",
6
6
  "exports": {
7
7
  "./base-wallet": "./dest/base-wallet/index.js",
@@ -75,15 +75,15 @@
75
75
  ]
76
76
  },
77
77
  "dependencies": {
78
- "@aztec/aztec.js": "0.0.1-commit.2f68f620",
79
- "@aztec/constants": "0.0.1-commit.2f68f620",
80
- "@aztec/entrypoints": "0.0.1-commit.2f68f620",
81
- "@aztec/foundation": "0.0.1-commit.2f68f620",
82
- "@aztec/pxe": "0.0.1-commit.2f68f620",
83
- "@aztec/stdlib": "0.0.1-commit.2f68f620"
78
+ "@aztec/aztec.js": "0.0.1-commit.3100065",
79
+ "@aztec/constants": "0.0.1-commit.3100065",
80
+ "@aztec/entrypoints": "0.0.1-commit.3100065",
81
+ "@aztec/foundation": "0.0.1-commit.3100065",
82
+ "@aztec/pxe": "0.0.1-commit.3100065",
83
+ "@aztec/stdlib": "0.0.1-commit.3100065"
84
84
  },
85
85
  "devDependencies": {
86
- "@aztec/noir-contracts.js": "0.0.1-commit.2f68f620",
86
+ "@aztec/noir-contracts.js": "0.0.1-commit.3100065",
87
87
  "@jest/globals": "^30.0.0",
88
88
  "@types/jest": "^30.0.0",
89
89
  "@types/node": "^22.15.17",
@@ -41,12 +41,7 @@ import {
41
41
  } from '@aztec/stdlib/abi';
42
42
  import type { AuthWitness } from '@aztec/stdlib/auth-witness';
43
43
  import { AztecAddress } from '@aztec/stdlib/aztec-address';
44
- import {
45
- type ContractInstanceWithAddress,
46
- type NodeInfo,
47
- computePartialAddress,
48
- getContractClassFromArtifact,
49
- } from '@aztec/stdlib/contract';
44
+ import { type ContractInstancePreimage, type NodeInfo, computePartialAddress } from '@aztec/stdlib/contract';
50
45
  import { SimulationError } from '@aztec/stdlib/errors';
51
46
  import { Gas, GasFees, GasSettings, ManaUsageEstimate } from '@aztec/stdlib/gas';
52
47
  import {
@@ -54,6 +49,7 @@ import {
54
49
  computeSiloedPublicInitializationNullifier,
55
50
  } from '@aztec/stdlib/hash';
56
51
  import type { AztecNode } from '@aztec/stdlib/interfaces/client';
52
+ import { type MasterSecretKeys, deriveKeys, deriveKeysFromMasterSecretKeys } from '@aztec/stdlib/keys';
57
53
  import {
58
54
  BlockHeader,
59
55
  ExecutionPayload,
@@ -65,6 +61,7 @@ import {
65
61
 
66
62
  import { inspect } from 'util';
67
63
 
64
+ import { assertGasLimitsWithinNetworkLimits } from './get_gas_limits.js';
68
65
  import { buildMergedSimulationResult, extractOptimizablePublicStaticCalls, simulateViaNode } from './utils.js';
69
66
 
70
67
  /**
@@ -114,6 +111,9 @@ export type CompleteFeeOptionsConfig = {
114
111
  export abstract class BaseWallet implements Wallet {
115
112
  protected minFeePadding = 0.5;
116
113
  protected cancellableTransactions = false;
114
+ // Poll interval (in seconds) injected into sendTx waits when the caller does not specify one. Left undefined on
115
+ // production wallets so the DefaultWaitOpts 1s cadence stands; test wallets talking to in-process nodes lower it.
116
+ protected defaultWaitInterval?: number;
117
117
  // A wallet is instantiated for a particular chain, so chain info never changes during its lifetime.
118
118
  // We cache it here because getChainInfo is called frequently (every tx simulation, send, auth wit, etc.).
119
119
  private nodeInfoPromise: Promise<NodeInfo> | undefined;
@@ -128,7 +128,7 @@ export abstract class BaseWallet implements Wallet {
128
128
  protected scopesFrom(from: AztecAddress | NoFrom, additionalScopes: AztecAddress[] = []): AztecAddress[] {
129
129
  const allScopes = from === NO_FROM ? additionalScopes : [from, ...additionalScopes];
130
130
  const scopeSet = new Set(allScopes.map(address => address.toString()));
131
- return [...scopeSet].map(AztecAddress.fromString);
131
+ return [...scopeSet].map(AztecAddress.fromStringUnsafe);
132
132
  }
133
133
 
134
134
  /**
@@ -154,18 +154,42 @@ export abstract class BaseWallet implements Wallet {
154
154
  * @returns The aliased collection of AztecAddresses that form this wallet's address book
155
155
  */
156
156
  async getAddressBook(): Promise<Aliased<AztecAddress>[]> {
157
- const senders: AztecAddress[] = await this.pxe.getSenders();
158
- return senders.map(sender => ({ item: sender, alias: '' }));
157
+ const sources = await this.pxe.getTaggingSecretSources({ kind: 'address-derived' });
158
+ return sources.map(source => ({ item: source.sender, alias: '' }));
159
159
  }
160
160
 
161
- async getChainInfo(): Promise<ChainInfo> {
161
+ /**
162
+ * Fetches and caches the node info for the wallet's lifetime, since a wallet talks to a single network and
163
+ * node info never changes. A rejected fetch clears the cache so the next call retries instead of replaying
164
+ * the cached rejection forever — important because the gas-limit fill-in and validation (run on every send)
165
+ * depend on it.
166
+ */
167
+ private getNodeInfo(): Promise<NodeInfo> {
162
168
  if (!this.nodeInfoPromise) {
163
- this.nodeInfoPromise = this.aztecNode.getNodeInfo();
169
+ this.nodeInfoPromise = this.aztecNode.getNodeInfo().catch(err => {
170
+ this.nodeInfoPromise = undefined;
171
+ throw err;
172
+ });
164
173
  }
165
- const { l1ChainId, rollupVersion } = await this.nodeInfoPromise;
174
+ return this.nodeInfoPromise;
175
+ }
176
+
177
+ async getChainInfo(): Promise<ChainInfo> {
178
+ const { l1ChainId, rollupVersion } = await this.getNodeInfo();
166
179
  return { chainId: new Fr(l1ChainId), version: new Fr(rollupVersion) };
167
180
  }
168
181
 
182
+ /**
183
+ * Returns the maximum gas limits a single transaction may declare on this wallet's network (the
184
+ * node-advertised `txsLimits.gas`). Internal helper used to fill in default gas limits when sending a
185
+ * transaction without explicit limits, and to validate caller-provided limits before sending. Backed by
186
+ * the cached node info, since a wallet talks to a single network.
187
+ */
188
+ protected async getMaxTxGasLimits(): Promise<Gas> {
189
+ const { txsLimits } = await this.getNodeInfo();
190
+ return new Gas(txsLimits.gas.daGas, txsLimits.gas.l2Gas);
191
+ }
192
+
169
193
  protected async createTxExecutionRequestFromPayloadAndFee(
170
194
  executionPayload: ExecutionPayload,
171
195
  from: AztecAddress | NoFrom,
@@ -272,10 +296,25 @@ export abstract class BaseWallet implements Wallet {
272
296
  maxPriorityFeesPerGas: gasSettings?.maxPriorityFeesPerGas ?? GasFees.empty(),
273
297
  };
274
298
  // When estimating gas (simulation), use high limits so the simulation doesn't run out of gas.
275
- // When sending for real, use protocol max limits that the network will actually accept.
276
- const fullGasSettings = forEstimation
277
- ? GasSettings.forEstimation(gasSettingsOverrides)
278
- : GasSettings.fallback(gasSettingsOverrides);
299
+ // When sending for real without explicit limits, declare the most a single tx may use on this network
300
+ // (the node's per-tx admission limit), so the proposer does not skip the tx for over-declaring gas.
301
+ let fullGasSettings;
302
+ if (forEstimation) {
303
+ // Estimation deliberately uses very high internal limits and skips tx validation, so we do not
304
+ // validate against the network admission limit here.
305
+ fullGasSettings = GasSettings.forEstimation(gasSettingsOverrides);
306
+ } else {
307
+ const maxTxGasLimits = await this.getMaxTxGasLimits();
308
+ // If the caller declared explicit gas limits, reject them up front when they exceed the network's
309
+ // per-tx admission limit (mirroring the node's GasLimitsValidator). Otherwise fill in the limit.
310
+ if (gasSettingsOverrides.gasLimits) {
311
+ assertGasLimitsWithinNetworkLimits(gasSettingsOverrides.gasLimits, maxTxGasLimits);
312
+ }
313
+ fullGasSettings = GasSettings.fallback({
314
+ ...gasSettingsOverrides,
315
+ gasLimits: gasSettingsOverrides.gasLimits ?? maxTxGasLimits,
316
+ });
317
+ }
279
318
  this.log.debug(`Using L2 gas settings`, fullGasSettings);
280
319
  return {
281
320
  gasSettings: fullGasSettings,
@@ -306,46 +345,42 @@ export abstract class BaseWallet implements Wallet {
306
345
  }
307
346
  }
308
347
 
309
- registerSender(address: AztecAddress, _alias: string = ''): Promise<AztecAddress> {
310
- return this.pxe.registerSender(address);
348
+ async registerSender(address: AztecAddress, _alias: string = ''): Promise<AztecAddress> {
349
+ await this.pxe.registerTaggingSecretSource({ kind: 'address-derived', sender: address });
350
+ return address;
311
351
  }
312
352
 
313
353
  async registerContract(
314
- instance: ContractInstanceWithAddress,
354
+ instance: ContractInstancePreimage,
315
355
  artifact?: ContractArtifact,
316
- secretKey?: Fr,
317
- ): Promise<ContractInstanceWithAddress> {
318
- const existingInstance = await this.pxe.getContractInstance(instance.address);
319
-
320
- if (existingInstance) {
321
- // Instance already registered in the wallet
322
- if (artifact) {
323
- const thisContractClass = await getContractClassFromArtifact(artifact);
324
- if (!thisContractClass.id.equals(existingInstance.currentContractClassId)) {
325
- // wallet holds an outdated version of this contract
326
- await this.pxe.updateContract(instance.address, artifact);
327
- instance.currentContractClassId = thisContractClass.id;
328
- }
329
- }
330
- // If no artifact provided, we just use the existing registration
331
- } else {
332
- // Instance not registered yet
333
- if (!artifact) {
334
- // Try to get the artifact from the wallet's contract class storage
335
- artifact = await this.pxe.getContractArtifact(instance.currentContractClassId);
336
- if (!artifact) {
337
- throw new Error(
338
- `Cannot register contract at ${instance.address.toString()}: artifact is required but not provided, and wallet does not have the artifact for contract class ${instance.currentContractClassId.toString()}`,
339
- );
340
- }
341
- }
342
- await this.pxe.registerContract({ artifact, instance });
356
+ secretKeyOrKeys?: Fr | MasterSecretKeys,
357
+ ): Promise<void> {
358
+ // Classes and instances are registered independently: register the artifact (if provided) then the instance.
359
+ // Neither call validates that the artifact matches the class the instance runs, a missing artifact only surfaces
360
+ // when the contract is later simulated.
361
+ if (artifact) {
362
+ await this.pxe.registerContractClass(artifact);
343
363
  }
344
-
345
- if (secretKey) {
346
- await this.pxe.registerAccount(secretKey, await computePartialAddress(instance));
364
+ const contractAddress = await this.pxe.registerContract(instance);
365
+
366
+ if (secretKeyOrKeys) {
367
+ // PXE never receives the account seed (from which the message-signing/fallback secret keys could be re-derived):
368
+ // the wallet derives the keys here. Of these, PXE only reads and stores the four privacy secret keys and the
369
+ // message-signing and fallback *public* keys — it never touches the message-signing or fallback secret keys.
370
+ //
371
+ // Since PXE recomputes the address from those keys, we assert it matches the instance's address: a mismatch means
372
+ // the provided keys don't correspond to this account.
373
+ const derivedKeys =
374
+ secretKeyOrKeys instanceof Fr
375
+ ? await deriveKeys(secretKeyOrKeys)
376
+ : await deriveKeysFromMasterSecretKeys(secretKeyOrKeys);
377
+ const { address } = await this.pxe.registerAccount(derivedKeys, await computePartialAddress(instance));
378
+ if (!address.equals(contractAddress)) {
379
+ throw new Error(
380
+ `Registered account address ${address.toString()} does not match contract instance address ${contractAddress.toString()}: the provided keys do not correspond to this account.`,
381
+ );
382
+ }
347
383
  }
348
- return instance;
349
384
  }
350
385
 
351
386
  registerContractClass(artifact: ContractArtifact): Promise<void> {
@@ -504,7 +539,11 @@ export abstract class BaseWallet implements Wallet {
504
539
  }
505
540
 
506
541
  // Otherwise, wait for the full receipt (default behavior on wait: undefined)
507
- const waitOpts = typeof opts.wait === 'object' ? opts.wait : undefined;
542
+ const callerWaitOpts = typeof opts.wait === 'object' ? opts.wait : undefined;
543
+ const waitOpts =
544
+ this.defaultWaitInterval !== undefined && callerWaitOpts?.interval === undefined
545
+ ? { ...callerWaitOpts, interval: this.defaultWaitInterval }
546
+ : callerWaitOpts;
508
547
  const receipt = await waitForTx(this.aztecNode, txHash, waitOpts);
509
548
 
510
549
  // Display debug logs from public execution if present (served in test mode only)
@@ -524,7 +563,11 @@ export abstract class BaseWallet implements Wallet {
524
563
  if (!instance) {
525
564
  return undefined;
526
565
  }
527
- const artifact = await this.pxe.getContractArtifact(instance.currentContractClassId);
566
+ // Contract names are class-stable (an upgrade preserves the contract name), so the original class artifact is a
567
+ // sufficient source for the display name without resolving the current class against the node.
568
+ // TODO: if a contract were to be upgraded and its original artifact never registered, then this would fail and we'd
569
+ // want to fallback to the current class.
570
+ const artifact = await this.pxe.getContractArtifact(instance.originalContractClassId);
528
571
  return artifact?.name;
529
572
  }
530
573
 
@@ -0,0 +1,88 @@
1
+ import { MAX_PROCESSABLE_L2_GAS, MAX_TX_DA_GAS } from '@aztec/constants';
2
+ import { Gas, type GasUsed } from '@aztec/stdlib/gas';
3
+
4
+ /**
5
+ * Returns suggested total and teardown gas limits for a simulated tx, clamped to the network's per-tx
6
+ * admission limits.
7
+ *
8
+ * The network only admits transactions that declare up to `maxTxGasLimits` per dimension (the
9
+ * node-advertised `txsLimits.gas`). Wallets pass the value read from their own node info, but since node info
10
+ * is remote input it is defensively clamped here to the per-tx protocol maxima so a value above them is never
11
+ * honored. If the simulated usage already exceeds the resulting admission limits the tx can never be included,
12
+ * so this throws a descriptive error instead of returning a limit the node would reject. Otherwise it pads the
13
+ * usage and clamps each dimension to the admission limit.
14
+ * @param gasUsed - The gas actually consumed during simulation.
15
+ * @param maxTxGasLimits - The maximum gas a single tx may declare on this network (the node-advertised `txsLimits.gas`).
16
+ * @param pad - Fraction to pad the suggested gas limits by (as a decimal, e.g. 0.1 for 10%). The effective
17
+ * padding shrinks to zero as usage approaches the network limit, since the network will not admit a higher
18
+ * declared limit regardless of the buffer.
19
+ */
20
+ export function getGasLimits(
21
+ gasUsed: GasUsed,
22
+ maxTxGasLimits: Gas,
23
+ pad = 0.1,
24
+ ): {
25
+ /**
26
+ * Gas limit for the tx, excluding teardown gas
27
+ */
28
+ gasLimits: Gas;
29
+ /**
30
+ * Gas limit for the teardown phase
31
+ */
32
+ teardownGasLimits: Gas;
33
+ } {
34
+ const { totalGas, teardownGas } = gasUsed;
35
+
36
+ // `maxTxGasLimits` is the node-advertised admission limit. Node info is remote input, so we defensively
37
+ // clamp to the per-tx protocol maxima so a value above them can never be honored.
38
+ const maxLimits = new Gas(
39
+ Math.min(maxTxGasLimits.daGas, MAX_TX_DA_GAS),
40
+ Math.min(maxTxGasLimits.l2Gas, MAX_PROCESSABLE_L2_GAS),
41
+ );
42
+
43
+ // The simulated usage must fit within the admission limits, otherwise the tx can never be included.
44
+ if (totalGas.daGas > maxLimits.daGas) {
45
+ throw new Error(
46
+ `Transaction consumes ${totalGas.daGas} DA gas but the network only admits transactions declaring up to ${maxLimits.daGas} DA gas`,
47
+ );
48
+ }
49
+ if (totalGas.l2Gas > maxLimits.l2Gas) {
50
+ throw new Error(
51
+ `Transaction consumes ${totalGas.l2Gas} L2 gas but the network only admits transactions declaring up to ${maxLimits.l2Gas} L2 gas`,
52
+ );
53
+ }
54
+
55
+ // Pad the limits by the buffer, then cap each dimension at the admission limit so the buffer cannot push a
56
+ // declared limit past what inbound validation accepts. Teardown is part of the total, so clamping it to the
57
+ // admission limit is safe.
58
+ return {
59
+ gasLimits: padGas(totalGas, pad, maxLimits),
60
+ teardownGasLimits: padGas(teardownGas, pad, maxLimits),
61
+ };
62
+ }
63
+
64
+ /** Pads each gas dimension, capping it at the network admission limit. */
65
+ function padGas(gas: Gas, pad: number, cap: Gas): Gas {
66
+ const padded = gas.mul(1 + pad);
67
+ return new Gas(Math.min(padded.daGas, cap.daGas), Math.min(padded.l2Gas, cap.l2Gas));
68
+ }
69
+
70
+ /**
71
+ * Validates that caller-declared gas limits do not exceed the network's per-tx admission limits, throwing a
72
+ * descriptive error per dimension when they do. The node's inbound validation checks declared
73
+ * `gasSettings.gasLimits`, so we mirror that here to surface the rejection locally before the tx is sent.
74
+ * @param gasLimits - The gas limits the transaction will declare.
75
+ * @param maxTxGasLimits - The maximum gas a single tx may declare on this network (the node-advertised `txsLimits.gas`).
76
+ */
77
+ export function assertGasLimitsWithinNetworkLimits(gasLimits: Gas, maxTxGasLimits: Gas): void {
78
+ if (gasLimits.daGas > maxTxGasLimits.daGas) {
79
+ throw new Error(
80
+ `Declared DA gas limit (${gasLimits.daGas}) exceeds the maximum this network allows per tx (${maxTxGasLimits.daGas})`,
81
+ );
82
+ }
83
+ if (gasLimits.l2Gas > maxTxGasLimits.l2Gas) {
84
+ throw new Error(
85
+ `Declared L2 gas limit (${gasLimits.l2Gas}) exceeds the maximum this network allows per tx (${maxTxGasLimits.l2Gas})`,
86
+ );
87
+ }
88
+ }
@@ -5,3 +5,4 @@ export {
5
5
  type SimulateViaEntrypointOptions,
6
6
  } from './base_wallet.js';
7
7
  export { simulateViaNode, buildMergedSimulationResult, extractOptimizablePublicStaticCalls } from './utils.js';
8
+ export { getGasLimits, assertGasLimitsWithinNetworkLimits } from './get_gas_limits.js';