@aztec/ethereum 3.0.0-nightly.20250930 → 3.0.0-nightly.20251002

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 (42) hide show
  1. package/dest/config.js +2 -2
  2. package/dest/contracts/fee_asset_handler.d.ts +2 -2
  3. package/dest/contracts/governance_proposer.d.ts +1 -2
  4. package/dest/contracts/governance_proposer.d.ts.map +1 -1
  5. package/dest/contracts/governance_proposer.js +1 -2
  6. package/dest/contracts/multicall.d.ts +0 -2
  7. package/dest/contracts/multicall.d.ts.map +1 -1
  8. package/dest/contracts/multicall.js +2 -4
  9. package/dest/contracts/rollup.d.ts +2 -2
  10. package/dest/deploy_l1_contracts.d.ts +11 -1
  11. package/dest/deploy_l1_contracts.d.ts.map +1 -1
  12. package/dest/deploy_l1_contracts.js +174 -54
  13. package/dest/l1_artifacts.d.ts +1978 -0
  14. package/dest/l1_artifacts.d.ts.map +1 -1
  15. package/dest/l1_artifacts.js +6 -1
  16. package/dest/l1_contract_addresses.d.ts +5 -1
  17. package/dest/l1_contract_addresses.d.ts.map +1 -1
  18. package/dest/l1_contract_addresses.js +2 -1
  19. package/dest/l1_tx_utils/factory.d.ts.map +1 -1
  20. package/dest/l1_tx_utils/factory.js +2 -2
  21. package/dest/l1_tx_utils/l1_tx_utils.d.ts +14 -26
  22. package/dest/l1_tx_utils/l1_tx_utils.d.ts.map +1 -1
  23. package/dest/l1_tx_utils/l1_tx_utils.js +140 -136
  24. package/dest/l1_tx_utils/l1_tx_utils_with_blobs.d.ts +4 -11
  25. package/dest/l1_tx_utils/l1_tx_utils_with_blobs.d.ts.map +1 -1
  26. package/dest/l1_tx_utils/l1_tx_utils_with_blobs.js +10 -70
  27. package/dest/l1_tx_utils/readonly_l1_tx_utils.d.ts +1 -1
  28. package/dest/l1_tx_utils/readonly_l1_tx_utils.d.ts.map +1 -1
  29. package/dest/l1_tx_utils/types.d.ts +15 -2
  30. package/dest/l1_tx_utils/types.d.ts.map +1 -1
  31. package/package.json +5 -5
  32. package/src/config.ts +2 -2
  33. package/src/contracts/governance_proposer.ts +3 -4
  34. package/src/contracts/multicall.ts +4 -4
  35. package/src/deploy_l1_contracts.ts +161 -51
  36. package/src/l1_artifacts.ts +8 -0
  37. package/src/l1_contract_addresses.ts +3 -1
  38. package/src/l1_tx_utils/factory.ts +2 -2
  39. package/src/l1_tx_utils/l1_tx_utils.ts +159 -157
  40. package/src/l1_tx_utils/l1_tx_utils_with_blobs.ts +8 -99
  41. package/src/l1_tx_utils/readonly_l1_tx_utils.ts +1 -1
  42. package/src/l1_tx_utils/types.ts +16 -2
@@ -1,3 +1,4 @@
1
+ import { maxBigint } from '@aztec/foundation/bigint';
1
2
  import { times } from '@aztec/foundation/collection';
2
3
  import { TimeoutError } from '@aztec/foundation/error';
3
4
  import { createLogger } from '@aztec/foundation/log';
@@ -13,32 +14,39 @@ import { l1TxUtilsConfigMappings } from './config.js';
13
14
  import { LARGE_GAS_LIMIT } from './constants.js';
14
15
  import { ReadOnlyL1TxUtils } from './readonly_l1_tx_utils.js';
15
16
  import { TxUtilsState } from './types.js';
17
+ const MAX_L1_TX_STATES = 32;
16
18
  export class L1TxUtils extends ReadOnlyL1TxUtils {
17
19
  client;
18
20
  address;
19
21
  signer;
20
22
  logger;
21
- txUtilsState;
22
- lastMinedBlockNumber;
23
23
  nonceManager;
24
+ txs;
24
25
  constructor(client, address, signer, logger = createLogger('L1TxUtils'), dateProvider = new DateProvider(), config, debugMaxGasLimit = false){
25
- super(client, logger, dateProvider, config, debugMaxGasLimit), this.client = client, this.address = address, this.signer = signer, this.logger = logger, this.txUtilsState = TxUtilsState.IDLE, this.lastMinedBlockNumber = undefined;
26
+ super(client, logger, dateProvider, config, debugMaxGasLimit), this.client = client, this.address = address, this.signer = signer, this.logger = logger, this.txs = [];
26
27
  this.nonceManager = createNonceManager({
27
28
  source: jsonRpc()
28
29
  });
29
30
  }
30
31
  get state() {
31
- return this.txUtilsState;
32
+ return this.txs.at(-1)?.status ?? TxUtilsState.IDLE;
32
33
  }
33
34
  get lastMinedAtBlockNumber() {
34
- return this.lastMinedBlockNumber;
35
+ const minedBlockNumbers = this.txs.map((tx)=>tx.receipt?.blockNumber).filter((bn)=>bn !== undefined);
36
+ return minedBlockNumbers.length === 0 ? undefined : maxBigint(...minedBlockNumbers);
35
37
  }
36
- set lastMinedAtBlockNumber(blockNumber) {
37
- this.lastMinedBlockNumber = blockNumber;
38
+ updateState(l1TxState, newState) {
39
+ const oldState = l1TxState.status;
40
+ l1TxState.status = newState;
41
+ const sender = this.getSenderAddress().toString();
42
+ this.logger.debug(`State changed from ${TxUtilsState[oldState]} to ${TxUtilsState[newState]} for nonce ${l1TxState.nonce} account ${sender}`);
38
43
  }
39
- set state(state) {
40
- this.txUtilsState = state;
41
- this.logger?.debug(`L1TxUtils state changed to ${TxUtilsState[state]} for sender: ${this.getSenderAddress().toString()}`);
44
+ updateConfig(newConfig) {
45
+ this.config = {
46
+ ...this.config,
47
+ ...newConfig
48
+ };
49
+ this.logger.info('Updated L1TxUtils config', pickBy(newConfig, (_, key)=>key in l1TxUtilsConfigMappings));
42
50
  }
43
51
  getSenderAddress() {
44
52
  return this.address;
@@ -61,11 +69,11 @@ export class L1TxUtils extends ReadOnlyL1TxUtils {
61
69
  * @param request - The transaction request (to, data, value)
62
70
  * @param gasConfig - Optional gas configuration
63
71
  * @returns The transaction hash and parameters used
64
- */ async sendTransaction(request, _gasConfig, blobInputs, stateChange = TxUtilsState.SENT) {
72
+ */ async sendTransaction(request, gasConfigOverrides, blobInputs, stateChange = TxUtilsState.SENT) {
65
73
  try {
66
74
  const gasConfig = {
67
75
  ...this.config,
68
- ..._gasConfig
76
+ ...gasConfigOverrides
69
77
  };
70
78
  const account = this.getSenderAddress().toString();
71
79
  let gasLimit;
@@ -89,35 +97,39 @@ export class L1TxUtils extends ReadOnlyL1TxUtils {
89
97
  address: account,
90
98
  chainId: this.client.chain.id
91
99
  });
92
- let txHash;
93
- if (blobInputs) {
94
- const txData = {
95
- ...request,
96
- ...blobInputs,
97
- gas: gasLimit,
98
- maxFeePerGas: gasPrice.maxFeePerGas,
99
- maxPriorityFeePerGas: gasPrice.maxPriorityFeePerGas,
100
- maxFeePerBlobGas: gasPrice.maxFeePerBlobGas,
101
- nonce
102
- };
103
- const signedRequest = await this.prepareSignedTransaction(txData);
104
- txHash = await this.client.sendRawTransaction({
105
- serializedTransaction: signedRequest
106
- });
107
- } else {
108
- const txData = {
109
- ...request,
110
- gas: gasLimit,
111
- maxFeePerGas: gasPrice.maxFeePerGas,
112
- maxPriorityFeePerGas: gasPrice.maxPriorityFeePerGas,
113
- nonce
114
- };
115
- const signedRequest = await this.prepareSignedTransaction(txData);
116
- txHash = await this.client.sendRawTransaction({
117
- serializedTransaction: signedRequest
118
- });
100
+ const l1TxState = {
101
+ txHashes: [],
102
+ cancelTxHashes: [],
103
+ gasPrice,
104
+ request,
105
+ status: TxUtilsState.IDLE,
106
+ nonce,
107
+ gasLimit,
108
+ txConfig: gasConfig,
109
+ blobInputs
110
+ };
111
+ this.updateState(l1TxState, stateChange);
112
+ const baseTxData = {
113
+ ...request,
114
+ gas: gasLimit,
115
+ maxFeePerGas: gasPrice.maxFeePerGas,
116
+ maxPriorityFeePerGas: gasPrice.maxPriorityFeePerGas,
117
+ nonce
118
+ };
119
+ const txData = blobInputs ? {
120
+ ...baseTxData,
121
+ ...blobInputs,
122
+ maxFeePerBlobGas: gasPrice.maxFeePerBlobGas
123
+ } : baseTxData;
124
+ const signedRequest = await this.prepareSignedTransaction(txData);
125
+ const txHash = await this.client.sendRawTransaction({
126
+ serializedTransaction: signedRequest
127
+ });
128
+ l1TxState.txHashes.push(txHash);
129
+ this.txs.push(l1TxState);
130
+ if (this.txs.length > MAX_L1_TX_STATES) {
131
+ this.txs.shift();
119
132
  }
120
- this.state = stateChange;
121
133
  const cleanGasConfig = pickBy(gasConfig, (_, key)=>key in l1TxUtilsConfigMappings);
122
134
  this.logger?.info(`Sent L1 transaction ${txHash}`, {
123
135
  gasLimit,
@@ -130,8 +142,7 @@ export class L1TxUtils extends ReadOnlyL1TxUtils {
130
142
  });
131
143
  return {
132
144
  txHash,
133
- gasLimit,
134
- gasPrice
145
+ state: l1TxState
135
146
  };
136
147
  } catch (err) {
137
148
  const viemError = formatViemError(err, request.abi);
@@ -141,42 +152,42 @@ export class L1TxUtils extends ReadOnlyL1TxUtils {
141
152
  throw viemError;
142
153
  }
143
154
  }
155
+ async tryGetTxReceipt(txHashes, nonce, isCancelTx) {
156
+ for (const hash of txHashes){
157
+ try {
158
+ const receipt = await this.client.getTransactionReceipt({
159
+ hash
160
+ });
161
+ if (receipt) {
162
+ const what = isCancelTx ? 'Cancellation L1 transaction' : 'L1 transaction';
163
+ if (receipt.status === 'reverted') {
164
+ this.logger?.warn(`${what} ${hash} with nonce ${nonce} reverted`, receipt);
165
+ } else {
166
+ this.logger?.verbose(`${what} ${hash} with nonce ${nonce} mined`, receipt);
167
+ }
168
+ return receipt;
169
+ }
170
+ } catch (err) {
171
+ if (err instanceof Error && err.name === 'TransactionReceiptNotFoundError') {
172
+ continue;
173
+ } else {
174
+ this.logger.error(`Error getting receipt for tx ${hash}`, err);
175
+ continue;
176
+ }
177
+ }
178
+ }
179
+ }
144
180
  /**
145
181
  * Monitors a transaction until completion, handling speed-ups if needed
146
- * @param request - Original transaction request (needed for speed-ups)
147
- * @param initialTxHash - Hash of the initial transaction
148
- * @param allVersions - Hashes of all transactions submitted under the same nonce (any of them could mine)
149
- * @param params - Parameters used in the initial transaction
150
- * @param gasConfig - Optional gas configuration
151
- */ async monitorTransaction(request, initialTxHash, allVersions, params, _gasConfig, _blobInputs, isCancelTx = false) {
152
- const isBlobTx = !!_blobInputs;
153
- const gasConfig = {
154
- ...this.config,
155
- ..._gasConfig
156
- };
182
+ */ async monitorTransaction(state) {
183
+ const { request, nonce, txHashes, cancelTxHashes, gasLimit, blobInputs, txConfig: gasConfig } = state;
184
+ const isCancelTx = cancelTxHashes.length > 0;
185
+ const isBlobTx = !!blobInputs;
157
186
  const account = this.getSenderAddress().toString();
158
- const blobInputs = _blobInputs || {};
159
187
  const makeGetTransactionBackoff = ()=>makeBackoff(times(gasConfig.txPropagationMaxQueryAttempts ?? 3, (i)=>i + 1));
160
- // Retry a few times, in case the tx is not yet propagated.
161
- const tx = await retry(()=>this.client.getTransaction({
162
- hash: initialTxHash
163
- }), `Getting L1 transaction ${initialTxHash}`, makeGetTransactionBackoff(), this.logger, true);
164
- if (!tx) {
165
- throw new Error(`Failed to get L1 transaction ${initialTxHash} to monitor`);
166
- }
167
- if (tx?.nonce === undefined || tx?.nonce === null) {
168
- throw new Error(`Failed to get L1 transaction ${initialTxHash} nonce`);
169
- }
170
- const nonce = tx.nonce;
171
- allVersions.add(initialTxHash);
172
- let currentTxHash = initialTxHash;
188
+ let currentTxHash = isCancelTx ? cancelTxHashes[0] : txHashes[0];
173
189
  let attempts = 0;
174
190
  let lastAttemptSent = this.dateProvider.now();
175
- let lastGasPrice = {
176
- maxFeePerGas: tx.maxFeePerGas,
177
- maxPriorityFeePerGas: tx.maxPriorityFeePerGas,
178
- maxFeePerBlobGas: tx.maxFeePerBlobGas
179
- };
180
191
  const initialTxTime = lastAttemptSent;
181
192
  let txTimedOut = false;
182
193
  let latestBlockTimestamp;
@@ -195,30 +206,15 @@ export class L1TxUtils extends ReadOnlyL1TxUtils {
195
206
  });
196
207
  // If the current nonce on our account is greater than our transaction's nonce then a tx with the same nonce has been mined.
197
208
  if (currentNonce > nonce) {
198
- for (const hash of allVersions){
199
- try {
200
- const receipt = await this.client.getTransactionReceipt({
201
- hash
202
- });
203
- if (receipt) {
204
- if (receipt.status === 'reverted') {
205
- this.logger?.error(`L1 transaction ${hash} reverted`, receipt);
206
- } else {
207
- this.logger?.debug(`L1 transaction ${hash} mined`);
208
- }
209
- this.state = TxUtilsState.MINED;
210
- this.lastMinedAtBlockNumber = receipt.blockNumber;
211
- return receipt;
212
- }
213
- } catch (err) {
214
- if (err instanceof Error && err.message.includes('reverted')) {
215
- throw formatViemError(err);
216
- }
217
- }
209
+ const receipt = await this.tryGetTxReceipt(cancelTxHashes, nonce, true) ?? await this.tryGetTxReceipt(txHashes, nonce, false);
210
+ if (receipt) {
211
+ this.updateState(state, TxUtilsState.MINED);
212
+ state.receipt = receipt;
213
+ return receipt;
218
214
  }
219
215
  // If we get here then we have checked all of our tx versions and not found anything.
220
216
  // We should consider the nonce as MINED
221
- this.state = TxUtilsState.MINED;
217
+ this.updateState(state, TxUtilsState.MINED);
222
218
  throw new Error(`Nonce ${nonce} is MINED but not by one of our expected transactions`);
223
219
  }
224
220
  this.logger?.trace(`Tx timeout check for ${currentTxHash}: ${isTimedOut()}`, {
@@ -252,7 +248,7 @@ export class L1TxUtils extends ReadOnlyL1TxUtils {
252
248
  maxPriorityFeePerGas: tx.maxPriorityFeePerGas,
253
249
  maxFeePerBlobGas: tx.maxFeePerBlobGas
254
250
  } : undefined);
255
- lastGasPrice = newGasPrice;
251
+ state.gasPrice = newGasPrice;
256
252
  this.logger?.debug(`L1 transaction ${currentTxHash} appears stuck. Attempting speed-up ${attempts}/${gasConfig.maxAttempts} ` + `with new priority fee ${formatGwei(newGasPrice.maxPriorityFeePerGas)} gwei`, {
257
253
  maxFeePerGas: formatGwei(newGasPrice.maxFeePerGas),
258
254
  maxPriorityFeePerGas: formatGwei(newGasPrice.maxPriorityFeePerGas),
@@ -260,27 +256,28 @@ export class L1TxUtils extends ReadOnlyL1TxUtils {
260
256
  maxFeePerBlobGas: formatGwei(newGasPrice.maxFeePerBlobGas)
261
257
  }
262
258
  });
263
- const txData = {
259
+ const baseTxData = {
264
260
  ...request,
265
- ...blobInputs,
266
- nonce,
267
- gas: params.gasLimit,
261
+ gas: gasLimit,
268
262
  maxFeePerGas: newGasPrice.maxFeePerGas,
269
- maxPriorityFeePerGas: newGasPrice.maxPriorityFeePerGas
263
+ maxPriorityFeePerGas: newGasPrice.maxPriorityFeePerGas,
264
+ nonce
270
265
  };
271
- if (isBlobTx && newGasPrice.maxFeePerBlobGas) {
272
- txData.maxFeePerBlobGas = newGasPrice.maxFeePerBlobGas;
273
- }
266
+ const txData = blobInputs ? {
267
+ ...baseTxData,
268
+ ...blobInputs,
269
+ maxFeePerBlobGas: newGasPrice.maxFeePerBlobGas
270
+ } : baseTxData;
274
271
  const signedRequest = await this.prepareSignedTransaction(txData);
275
272
  const newHash = await this.client.sendRawTransaction({
276
273
  serializedTransaction: signedRequest
277
274
  });
278
275
  if (!isCancelTx) {
279
- this.state = TxUtilsState.SPEED_UP;
276
+ this.updateState(state, TxUtilsState.SPEED_UP);
280
277
  }
281
278
  const cleanGasConfig = pickBy(gasConfig, (_, key)=>key in l1TxUtilsConfigMappings);
282
279
  this.logger?.verbose(`Sent L1 speed-up tx ${newHash}, replacing ${currentTxHash}`, {
283
- gasLimit: params.gasLimit,
280
+ gasLimit,
284
281
  maxFeePerGas: formatGwei(newGasPrice.maxFeePerGas),
285
282
  maxPriorityFeePerGas: formatGwei(newGasPrice.maxPriorityFeePerGas),
286
283
  gasConfig: cleanGasConfig,
@@ -289,7 +286,7 @@ export class L1TxUtils extends ReadOnlyL1TxUtils {
289
286
  }
290
287
  });
291
288
  currentTxHash = newHash;
292
- allVersions.add(currentTxHash);
289
+ (isCancelTx ? cancelTxHashes : txHashes).push(currentTxHash);
293
290
  lastAttemptSent = this.dateProvider.now();
294
291
  }
295
292
  await sleep(gasConfig.checkIntervalMs);
@@ -307,25 +304,24 @@ export class L1TxUtils extends ReadOnlyL1TxUtils {
307
304
  // The transaction has timed out. If it's a cancellation then we are giving up on it.
308
305
  // Otherwise we may attempt to cancel it if configured to do so.
309
306
  if (isCancelTx) {
310
- this.state = TxUtilsState.NOT_MINED;
307
+ this.updateState(state, TxUtilsState.NOT_MINED);
311
308
  } else if (gasConfig.cancelTxOnTimeout) {
312
309
  // Fire cancellation without awaiting to avoid blocking the main thread
313
- this.attemptTxCancellation(currentTxHash, nonce, allVersions, isBlobTx, lastGasPrice, attempts).catch((err)=>{
310
+ this.attemptTxCancellation(state, attempts).catch((err)=>{
314
311
  const viemError = formatViemError(err);
315
312
  this.logger?.error(`Failed to send cancellation for timed out tx ${currentTxHash}:`, viemError.message, {
316
313
  metaMessages: viemError.metaMessages
317
314
  });
318
315
  });
319
316
  }
320
- this.logger?.error(`L1 transaction ${currentTxHash} timed out`, undefined, {
317
+ this.logger?.warn(`L1 transaction ${currentTxHash} timed out`, {
321
318
  txHash: currentTxHash,
322
319
  txTimeoutAt: gasConfig.txTimeoutAt,
323
320
  txTimeoutMs: gasConfig.txTimeoutMs,
324
321
  txInitialTime: initialTxTime,
325
322
  now: this.dateProvider.now(),
326
323
  attempts,
327
- isInterrupted: this.interrupted,
328
- ...tx
324
+ isInterrupted: this.interrupted
329
325
  });
330
326
  throw new TimeoutError(`L1 transaction ${currentTxHash} timed out`);
331
327
  }
@@ -335,13 +331,11 @@ export class L1TxUtils extends ReadOnlyL1TxUtils {
335
331
  * @param gasConfig - Optional gas configuration
336
332
  * @returns The receipt of the successful transaction
337
333
  */ async sendAndMonitorTransaction(request, gasConfig, blobInputs) {
338
- const { txHash, gasLimit, gasPrice } = await this.sendTransaction(request, gasConfig, blobInputs);
339
- const receipt = await this.monitorTransaction(request, txHash, new Set(), {
340
- gasLimit
341
- }, gasConfig, blobInputs);
334
+ const { state } = await this.sendTransaction(request, gasConfig, blobInputs);
335
+ const receipt = await this.monitorTransaction(state);
342
336
  return {
343
337
  receipt,
344
- gasPrice
338
+ state
345
339
  };
346
340
  }
347
341
  async simulate(request, _blockOverrides = {}, stateOverrides = [], abi = RollupAbi, _gasConfig) {
@@ -369,48 +363,58 @@ export class L1TxUtils extends ReadOnlyL1TxUtils {
369
363
  }
370
364
  /**
371
365
  * Attempts to cancel a transaction by sending a 0-value tx to self with same nonce but higher gas prices
372
- * @param nonce - The nonce of the transaction to cancel
373
- * @param allVersions - Hashes of all transactions submitted under the same nonce (any of them could mine)
374
- * @param previousGasPrice - The gas price of the previous transaction
375
- * @param attempts - The number of attempts to cancel the transaction
376
366
  * @returns The hash of the cancellation transaction
377
- */ async attemptTxCancellation(currentTxHash, nonce, allVersions, isBlobTx = false, previousGasPrice, attempts = 0) {
378
- if (isBlobTx) {
379
- throw new Error('Cannot cancel blob transactions, please use L1TxUtilsWithBlobsClass');
380
- }
367
+ */ async attemptTxCancellation(state, attempts) {
368
+ const isBlobTx = state.blobInputs !== undefined;
369
+ const { nonce, gasPrice: previousGasPrice } = state;
381
370
  // Get gas price with higher priority fee for cancellation
382
371
  const cancelGasPrice = await this.getGasPrice({
383
372
  ...this.config,
384
373
  // Use high bump for cancellation to ensure it replaces the original tx
385
374
  priorityFeeRetryBumpPercentage: 150
386
375
  }, isBlobTx, attempts + 1, previousGasPrice);
387
- this.logger?.info(`Attempting to cancel L1 transaction ${currentTxHash} with nonce ${nonce}`, {
388
- maxFeePerGas: formatGwei(cancelGasPrice.maxFeePerGas),
389
- maxPriorityFeePerGas: formatGwei(cancelGasPrice.maxPriorityFeePerGas)
376
+ const { maxFeePerGas, maxPriorityFeePerGas, maxFeePerBlobGas } = cancelGasPrice;
377
+ this.logger?.info(`Attempting to cancel L1 ${isBlobTx ? 'blob' : 'vanilla'} transaction ${state.txHashes[0]} with nonce ${nonce}`, {
378
+ maxFeePerGas: formatGwei(maxFeePerGas),
379
+ maxPriorityFeePerGas: formatGwei(maxPriorityFeePerGas),
380
+ ...maxFeePerBlobGas && {
381
+ maxFeePerBlobGas: formatGwei(maxFeePerBlobGas)
382
+ }
390
383
  });
391
384
  const request = {
392
385
  to: this.getSenderAddress().toString(),
393
386
  value: 0n
394
387
  };
395
388
  // Send 0-value tx to self with higher gas price
396
- const txData = {
389
+ const baseTxData = {
397
390
  ...request,
398
391
  nonce,
399
392
  gas: 21_000n,
400
- maxFeePerGas: cancelGasPrice.maxFeePerGas,
401
- maxPriorityFeePerGas: cancelGasPrice.maxPriorityFeePerGas
393
+ maxFeePerGas,
394
+ maxPriorityFeePerGas
402
395
  };
396
+ const txData = isBlobTx ? {
397
+ ...baseTxData,
398
+ ...this.makeEmptyBlobInputs(maxFeePerBlobGas)
399
+ } : baseTxData;
403
400
  const signedRequest = await this.prepareSignedTransaction(txData);
404
401
  const cancelTxHash = await this.client.sendRawTransaction({
405
402
  serializedTransaction: signedRequest
406
403
  });
407
- this.state = TxUtilsState.CANCELLED;
408
- this.logger?.info(`Sent cancellation tx ${cancelTxHash} for timed out tx ${currentTxHash}`, {
409
- nonce
404
+ state.gasPrice = cancelGasPrice;
405
+ state.gasLimit = 21_000n;
406
+ state.cancelTxHashes.push(cancelTxHash);
407
+ this.updateState(state, TxUtilsState.CANCELLED);
408
+ this.logger?.info(`Sent cancellation tx ${cancelTxHash} for timed out tx with nonce ${nonce}`, {
409
+ nonce,
410
+ txData,
411
+ isBlobTx,
412
+ txHashes: state.txHashes
410
413
  });
411
- const receipt = await this.monitorTransaction(request, cancelTxHash, allVersions, {
412
- gasLimit: 21_000n
413
- }, undefined, undefined, true);
414
- return receipt.transactionHash;
414
+ const { transactionHash } = await this.monitorTransaction(state);
415
+ return transactionHash;
416
+ }
417
+ /** Makes empty blob inputs for the cancellation tx. To be overridden in L1TxUtilsWithBlobs. */ makeEmptyBlobInputs(_maxFeePerBlobGas) {
418
+ throw new Error('Cannot make empty blob inputs for cancellation');
415
419
  }
416
420
  }
@@ -1,21 +1,14 @@
1
1
  import { type Logger } from '@aztec/foundation/log';
2
2
  import { DateProvider } from '@aztec/foundation/timer';
3
- import { type Hex } from 'viem';
4
3
  import type { EthSigner } from '../eth-signer/eth-signer.js';
5
4
  import type { ExtendedViemWalletClient, ViemClient } from '../types.js';
6
5
  import type { L1TxUtilsConfig } from './config.js';
7
6
  import { L1TxUtils } from './l1_tx_utils.js';
8
- import type { GasPrice } from './types.js';
7
+ import type { L1BlobInputs } from './types.js';
8
+ /** Extends L1TxUtils with the capability to cancel blobs. This needs to be a separate class so we don't require a dependency on blob-lib unnecessarily. */
9
9
  export declare class L1TxUtilsWithBlobs extends L1TxUtils {
10
- /**
11
- * Attempts to cancel a transaction by sending a 0-value tx to self with same nonce but higher gas prices
12
- * @param nonce - The nonce of the transaction to cancel
13
- * @param allVersions - Hashes of all transactions submitted under the same nonce (any of them could mine)
14
- * @param previousGasPrice - The gas price of the previous transaction
15
- * @param attempts - The number of attempts to cancel the transaction
16
- * @returns The hash of the cancellation transaction
17
- */
18
- protected attemptTxCancellation(currentTxHash: Hex, nonce: number, allVersions: Set<Hex>, isBlobTx?: boolean, previousGasPrice?: GasPrice, attempts?: number): Promise<`0x${string}`>;
10
+ /** Makes empty blob inputs for the cancellation tx. */
11
+ protected makeEmptyBlobInputs(maxFeePerBlobGas: bigint): Required<L1BlobInputs>;
19
12
  }
20
13
  export declare function createL1TxUtilsWithBlobsFromViemWallet(client: ExtendedViemWalletClient, logger?: Logger, dateProvider?: DateProvider, config?: Partial<L1TxUtilsConfig>, debugMaxGasLimit?: boolean): L1TxUtilsWithBlobs;
21
14
  export declare function createL1TxUtilsWithBlobsFromEthSigner(client: ViemClient, signer: EthSigner, logger?: Logger, dateProvider?: DateProvider, config?: Partial<L1TxUtilsConfig>, debugMaxGasLimit?: boolean): L1TxUtilsWithBlobs;
@@ -1 +1 @@
1
- {"version":3,"file":"l1_tx_utils_with_blobs.d.ts","sourceRoot":"","sources":["../../src/l1_tx_utils/l1_tx_utils_with_blobs.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,MAAM,EAAgB,MAAM,uBAAuB,CAAC;AAClE,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAEvD,OAAO,EAAE,KAAK,GAAG,EAA4C,MAAM,MAAM,CAAC;AAE1E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,KAAK,EAAE,wBAAwB,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACxE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EAAE,SAAS,EAAE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2J;AAC3J,qBAAa,kBAAmB,SAAQ,SAAS;IAC/C,uDAAuD;cACpC,mBAAmB,CAAC,gBAAgB,EAAE,MAAM,GAAG,QAAQ,CAAC,YAAY,CAAC;CAKzF;AAED,wBAAgB,sCAAsC,CACpD,MAAM,EAAE,wBAAwB,EAChC,MAAM,GAAE,MAAkC,EAC1C,YAAY,GAAE,YAAiC,EAC/C,MAAM,CAAC,EAAE,OAAO,CAAC,eAAe,CAAC,EACjC,gBAAgB,GAAE,OAAe,sBAWlC;AAED,wBAAgB,qCAAqC,CACnD,MAAM,EAAE,UAAU,EAClB,MAAM,EAAE,SAAS,EACjB,MAAM,GAAE,MAAkC,EAC1C,YAAY,GAAE,YAAiC,EAC/C,MAAM,CAAC,EAAE,OAAO,CAAC,eAAe,CAAC,EACjC,gBAAgB,GAAE,OAAe,sBAOlC"}
@@ -2,79 +2,19 @@ import { Blob } from '@aztec/blob-lib';
2
2
  import { EthAddress } from '@aztec/foundation/eth-address';
3
3
  import { createLogger } from '@aztec/foundation/log';
4
4
  import { DateProvider } from '@aztec/foundation/timer';
5
- import { formatGwei } from 'viem';
6
5
  import { L1TxUtils } from './l1_tx_utils.js';
7
6
  import { createViemSigner } from './signer.js';
8
- export class L1TxUtilsWithBlobs extends L1TxUtils {
9
- /**
10
- * Attempts to cancel a transaction by sending a 0-value tx to self with same nonce but higher gas prices
11
- * @param nonce - The nonce of the transaction to cancel
12
- * @param allVersions - Hashes of all transactions submitted under the same nonce (any of them could mine)
13
- * @param previousGasPrice - The gas price of the previous transaction
14
- * @param attempts - The number of attempts to cancel the transaction
15
- * @returns The hash of the cancellation transaction
16
- */ async attemptTxCancellation(currentTxHash, nonce, allVersions, isBlobTx = false, previousGasPrice, attempts = 0) {
17
- // Get gas price with higher priority fee for cancellation
18
- const cancelGasPrice = await this.getGasPrice({
19
- ...this.config,
20
- // Use high bump for cancellation to ensure it replaces the original tx
21
- priorityFeeRetryBumpPercentage: 150
22
- }, isBlobTx, attempts + 1, previousGasPrice);
23
- this.logger?.info(`Attempting to cancel blob L1 transaction ${currentTxHash} with nonce ${nonce}`, {
24
- maxFeePerGas: formatGwei(cancelGasPrice.maxFeePerGas),
25
- maxPriorityFeePerGas: formatGwei(cancelGasPrice.maxPriorityFeePerGas),
26
- maxFeePerBlobGas: cancelGasPrice.maxFeePerBlobGas === undefined ? undefined : formatGwei(cancelGasPrice.maxFeePerBlobGas)
27
- });
28
- const request = {
29
- to: this.getSenderAddress().toString(),
30
- value: 0n
7
+ /** Extends L1TxUtils with the capability to cancel blobs. This needs to be a separate class so we don't require a dependency on blob-lib unnecessarily. */ export class L1TxUtilsWithBlobs extends L1TxUtils {
8
+ /** Makes empty blob inputs for the cancellation tx. */ makeEmptyBlobInputs(maxFeePerBlobGas) {
9
+ const blobData = new Uint8Array(131072).fill(0);
10
+ const kzg = Blob.getViemKzgInstance();
11
+ return {
12
+ blobs: [
13
+ blobData
14
+ ],
15
+ kzg,
16
+ maxFeePerBlobGas
31
17
  };
32
- // Send 0-value tx to self with higher gas price
33
- if (!isBlobTx) {
34
- const txData = {
35
- ...request,
36
- nonce,
37
- gas: 21_000n,
38
- maxFeePerGas: cancelGasPrice.maxFeePerGas,
39
- maxPriorityFeePerGas: cancelGasPrice.maxPriorityFeePerGas
40
- };
41
- const signedRequest = await this.prepareSignedTransaction(txData);
42
- const cancelTxHash = await this.client.sendRawTransaction({
43
- serializedTransaction: signedRequest
44
- });
45
- this.logger?.info(`Sent cancellation tx ${cancelTxHash} for timed out tx ${currentTxHash}`);
46
- const receipt = await this.monitorTransaction(request, cancelTxHash, allVersions, {
47
- gasLimit: 21_000n
48
- }, undefined, undefined, true);
49
- return receipt.transactionHash;
50
- } else {
51
- const blobData = new Uint8Array(131072).fill(0);
52
- const kzg = Blob.getViemKzgInstance();
53
- const blobInputs = {
54
- blobs: [
55
- blobData
56
- ],
57
- kzg,
58
- maxFeePerBlobGas: cancelGasPrice.maxFeePerBlobGas
59
- };
60
- const txData = {
61
- ...request,
62
- ...blobInputs,
63
- nonce,
64
- gas: 21_000n,
65
- maxFeePerGas: cancelGasPrice.maxFeePerGas,
66
- maxPriorityFeePerGas: cancelGasPrice.maxPriorityFeePerGas
67
- };
68
- const signedRequest = await this.prepareSignedTransaction(txData);
69
- const cancelTxHash = await this.client.sendRawTransaction({
70
- serializedTransaction: signedRequest
71
- });
72
- this.logger?.info(`Sent cancellation tx ${cancelTxHash} for timed out tx ${currentTxHash}`);
73
- const receipt = await this.monitorTransaction(request, cancelTxHash, allVersions, {
74
- gasLimit: 21_000n
75
- }, undefined, blobInputs, true);
76
- return receipt.transactionHash;
77
- }
78
18
  }
79
19
  }
80
20
  export function createL1TxUtilsWithBlobsFromViemWallet(client, logger = createLogger('L1TxUtils'), dateProvider = new DateProvider(), config, debugMaxGasLimit = false) {
@@ -9,7 +9,7 @@ export declare class ReadOnlyL1TxUtils {
9
9
  protected logger: Logger;
10
10
  readonly dateProvider: DateProvider;
11
11
  protected debugMaxGasLimit: boolean;
12
- readonly config: L1TxUtilsConfig;
12
+ config: L1TxUtilsConfig;
13
13
  protected interrupted: boolean;
14
14
  constructor(client: ViemClient, logger: Logger | undefined, dateProvider: DateProvider, config?: Partial<L1TxUtilsConfig>, debugMaxGasLimit?: boolean);
15
15
  interrupt(): void;
@@ -1 +1 @@
1
- {"version":3,"file":"readonly_l1_tx_utils.d.ts","sourceRoot":"","sources":["../../src/l1_tx_utils/readonly_l1_tx_utils.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,MAAM,EAAgB,MAAM,uBAAuB,CAAC;AAElE,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAIvD,OAAO,EACL,KAAK,GAAG,EACR,KAAK,OAAO,EAEZ,KAAK,cAAc,EAEnB,KAAK,GAAG,EAGR,KAAK,aAAa,EAKnB,MAAM,MAAM,CAAC;AAEd,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,KAAK,eAAe,EAAmD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AY,EAAE,MAAM,CAAC;QACrB,GAAG,EAAE,GAAG,CAAC;QACT,OAAO,EAAE,GAAG,CAAC;KACd,EACD,UAAU,EAAE,CAAC,YAAY,GAAG;QAAE,gBAAgB,EAAE,MAAM,CAAA;KAAE,CAAC,GAAG,SAAS,EACrE,aAAa,GAAE,aAAkB;IAkDtB,QAAQ,CACnB,OAAO,EAAE,WAAW,GAAG;QAAE,GAAG,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,GAAG,CAAA;KAAE,EACnD,cAAc,GAAE,cAAc,CAAC,MAAM,EAAE,MAAM,CAAM,EACnD,cAAc,GAAE,aAAkB,EAClC,GAAG,GAAE,GAAe,EACpB,UAAU,CAAC,EAAE,eAAe,GAAG;QAAE,mBAAmB,CAAC,EAAE,MAAM,CAAA;KAAE,GAC9D,OAAO,CAAC;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,KAAK,MAAM,EAAE,CAAA;KAAE,CAAC;cAYtC,SAAS,CACvB,IAAI,EAAE,GAAG,EACT,cAAc,EAAE,cAAc,CAAC,MAAM,EAAE,MAAM,CAAC,YAAK,EACnD,cAAc,EAAE,aAAa,YAAK,EAClC,SAAS,EAAE,eAAe,GAAG;QAAE,mBAAmB,CAAC,EAAE,MAAM,CAAA;KAAE,EAC7D,GAAG,EAAE,GAAG;;gBAuBkE,KAAK,MAAM,EAAE;;IAelF,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,eAAe,GAAG,MAAM;CAQ5E"}
@@ -1,6 +1,7 @@
1
+ import type { BlobKzgInstance } from '@aztec/blob-lib/types';
1
2
  import { EthAddress } from '@aztec/foundation/eth-address';
2
3
  import type { ViemTransactionSignature } from '@aztec/foundation/eth-signature';
3
- import type { Abi, Address, Hex, TransactionSerializable } from 'viem';
4
+ import type { Abi, Address, Hex, TransactionReceipt, TransactionSerializable } from 'viem';
4
5
  import type { L1TxUtilsConfig } from './config.js';
5
6
  export interface L1TxRequest {
6
7
  to: Address | null;
@@ -14,7 +15,7 @@ export type L1GasConfig = Partial<L1TxUtilsConfig> & {
14
15
  };
15
16
  export interface L1BlobInputs {
16
17
  blobs: Uint8Array[];
17
- kzg: any;
18
+ kzg: BlobKzgInstance;
18
19
  maxFeePerBlobGas?: bigint;
19
20
  }
20
21
  export interface GasPrice {
@@ -40,5 +41,17 @@ export declare enum TxUtilsState {
40
41
  NOT_MINED = 4,
41
42
  MINED = 5
42
43
  }
44
+ export type L1TxState = {
45
+ txHashes: Hex[];
46
+ cancelTxHashes: Hex[];
47
+ gasLimit: bigint;
48
+ gasPrice: GasPrice;
49
+ txConfig: L1GasConfig;
50
+ request: L1TxRequest;
51
+ status: TxUtilsState;
52
+ nonce: number;
53
+ receipt?: TransactionReceipt;
54
+ blobInputs: L1BlobInputs | undefined;
55
+ };
43
56
  export type SigningCallback = (transaction: TransactionSerializable, signingAddress: EthAddress) => Promise<ViemTransactionSignature>;
44
57
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/l1_tx_utils/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAC3D,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,iCAAiC,CAAC;AAEhF,OAAO,KAAK,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,uBAAuB,EAAE,MAAM,MAAM,CAAC;AAEvE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEnD,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,OAAO,GAAG,IAAI,CAAC;IACnB,IAAI,CAAC,EAAE,GAAG,CAAC;IACX,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,GAAG,CAAC,EAAE,GAAG,CAAC;CACX;AAED,MAAM,MAAM,WAAW,GAAG,OAAO,CAAC,eAAe,CAAC,GAAG;IAAE,QAAQ,CA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