@aztec/ethereum 3.0.0-nightly.20251005 → 3.0.0-nightly.20251008
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/dest/config.d.ts.map +1 -1
- package/dest/config.js +5 -0
- package/dest/contracts/governance.js +6 -2
- package/dest/deploy_l1_contracts.d.ts +2 -2
- package/dest/deploy_l1_contracts.d.ts.map +1 -1
- package/dest/deploy_l1_contracts.js +14 -3
- package/dest/l1_artifacts.d.ts +1 -1
- package/dest/l1_tx_utils/factory.d.ts +18 -3
- package/dest/l1_tx_utils/factory.d.ts.map +1 -1
- package/dest/l1_tx_utils/factory.js +4 -6
- package/dest/l1_tx_utils/index.d.ts +1 -0
- package/dest/l1_tx_utils/index.d.ts.map +1 -1
- package/dest/l1_tx_utils/index.js +1 -0
- package/dest/l1_tx_utils/interfaces.d.ts +76 -0
- package/dest/l1_tx_utils/interfaces.d.ts.map +1 -0
- package/dest/l1_tx_utils/interfaces.js +4 -0
- package/dest/l1_tx_utils/l1_tx_utils.d.ts +18 -3
- package/dest/l1_tx_utils/l1_tx_utils.d.ts.map +1 -1
- package/dest/l1_tx_utils/l1_tx_utils.js +130 -70
- package/dest/l1_tx_utils/l1_tx_utils_with_blobs.d.ts +14 -3
- package/dest/l1_tx_utils/l1_tx_utils_with_blobs.d.ts.map +1 -1
- package/dest/l1_tx_utils/l1_tx_utils_with_blobs.js +4 -6
- package/dest/l1_tx_utils/readonly_l1_tx_utils.d.ts.map +1 -1
- package/dest/l1_tx_utils/readonly_l1_tx_utils.js +1 -1
- package/dest/l1_tx_utils/types.d.ts +1 -0
- package/dest/l1_tx_utils/types.d.ts.map +1 -1
- package/dest/publisher_manager.d.ts +2 -0
- package/dest/publisher_manager.d.ts.map +1 -1
- package/dest/publisher_manager.js +11 -1
- package/package.json +5 -5
- package/src/config.ts +5 -0
- package/src/contracts/governance.ts +2 -2
- package/src/deploy_l1_contracts.ts +10 -8
- package/src/l1_tx_utils/factory.ts +35 -15
- package/src/l1_tx_utils/index.ts +1 -0
- package/src/l1_tx_utils/interfaces.ts +86 -0
- package/src/l1_tx_utils/l1_tx_utils.ts +135 -70
- package/src/l1_tx_utils/l1_tx_utils_with_blobs.ts +31 -10
- package/src/l1_tx_utils/readonly_l1_tx_utils.ts +1 -1
- package/src/l1_tx_utils/types.ts +1 -0
- package/src/publisher_manager.ts +14 -1
|
@@ -19,11 +19,12 @@ export class L1TxUtils extends ReadOnlyL1TxUtils {
|
|
|
19
19
|
client;
|
|
20
20
|
address;
|
|
21
21
|
signer;
|
|
22
|
-
|
|
22
|
+
store;
|
|
23
|
+
metrics;
|
|
23
24
|
nonceManager;
|
|
24
25
|
txs;
|
|
25
|
-
constructor(client, address, signer, logger = createLogger('
|
|
26
|
-
super(client, logger, dateProvider, config, debugMaxGasLimit), this.client = client, this.address = address, this.signer = signer, this.
|
|
26
|
+
constructor(client, address, signer, logger = createLogger('ethereum:publisher'), dateProvider = new DateProvider(), config, debugMaxGasLimit = false, store, metrics){
|
|
27
|
+
super(client, logger, dateProvider, config, debugMaxGasLimit), this.client = client, this.address = address, this.signer = signer, this.store = store, this.metrics = metrics, this.txs = [];
|
|
27
28
|
this.nonceManager = createNonceManager({
|
|
28
29
|
source: jsonRpc()
|
|
29
30
|
});
|
|
@@ -35,11 +36,19 @@ export class L1TxUtils extends ReadOnlyL1TxUtils {
|
|
|
35
36
|
const minedBlockNumbers = this.txs.map((tx)=>tx.receipt?.blockNumber).filter((bn)=>bn !== undefined);
|
|
36
37
|
return minedBlockNumbers.length === 0 ? undefined : maxBigint(...minedBlockNumbers);
|
|
37
38
|
}
|
|
38
|
-
updateState(l1TxState, newState) {
|
|
39
|
+
async updateState(l1TxState, newState, l1Timestamp) {
|
|
39
40
|
const oldState = l1TxState.status;
|
|
40
41
|
l1TxState.status = newState;
|
|
41
42
|
const sender = this.getSenderAddress().toString();
|
|
42
43
|
this.logger.debug(`Tx state changed from ${TxUtilsState[oldState]} to ${TxUtilsState[newState]} for nonce ${l1TxState.nonce} account ${sender}`);
|
|
44
|
+
// Record metrics
|
|
45
|
+
if (newState === TxUtilsState.MINED && l1Timestamp !== undefined) {
|
|
46
|
+
this.metrics?.recordMinedTx(l1TxState, new Date(l1Timestamp));
|
|
47
|
+
} else if (newState === TxUtilsState.NOT_MINED) {
|
|
48
|
+
this.metrics?.recordDroppedTx(l1TxState);
|
|
49
|
+
}
|
|
50
|
+
// Update state in the store
|
|
51
|
+
await this.store?.saveState(sender, l1TxState).catch((err)=>this.logger.error('Failed to persist L1 tx state', err));
|
|
43
52
|
}
|
|
44
53
|
updateConfig(newConfig) {
|
|
45
54
|
this.config = merge(this.config, newConfig);
|
|
@@ -53,6 +62,43 @@ export class L1TxUtils extends ReadOnlyL1TxUtils {
|
|
|
53
62
|
address: this.getSenderAddress().toString()
|
|
54
63
|
});
|
|
55
64
|
}
|
|
65
|
+
/**
|
|
66
|
+
* Rehydrates transaction states from the store and resumes monitoring for pending transactions.
|
|
67
|
+
* This should be called on startup to restore state and resume monitoring of any in-flight transactions.
|
|
68
|
+
*/ async loadStateAndResumeMonitoring() {
|
|
69
|
+
if (!this.store) {
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
const account = this.getSenderAddress().toString();
|
|
73
|
+
const loadedStates = await this.store.loadStates(account);
|
|
74
|
+
if (loadedStates.length === 0) {
|
|
75
|
+
this.logger.debug(`No states to rehydrate for account ${account}`);
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
// Convert loaded states (which have id) to the txs format
|
|
79
|
+
this.txs = loadedStates;
|
|
80
|
+
this.logger.info(`Rehydrated ${loadedStates.length} tx states for account ${account}`);
|
|
81
|
+
// Find all pending states and resume monitoring
|
|
82
|
+
const pendingStates = loadedStates.filter((state)=>!TerminalTxUtilsState.includes(state.status));
|
|
83
|
+
if (pendingStates.length === 0) {
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
this.logger.info(`Resuming monitoring for ${pendingStates.length} pending transactions for account ${account}`, {
|
|
87
|
+
txs: pendingStates.map((s)=>({
|
|
88
|
+
id: s.id,
|
|
89
|
+
nonce: s.nonce,
|
|
90
|
+
status: TxUtilsState[s.status]
|
|
91
|
+
}))
|
|
92
|
+
});
|
|
93
|
+
for (const state of pendingStates){
|
|
94
|
+
void this.monitorTransaction(state).catch((err)=>{
|
|
95
|
+
this.logger.error(`Error monitoring rehydrated tx with nonce ${state.nonce} for account ${account}`, formatViemError(err), {
|
|
96
|
+
nonce: state.nonce,
|
|
97
|
+
account
|
|
98
|
+
});
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
}
|
|
56
102
|
async signTransaction(txRequest) {
|
|
57
103
|
const signature = await this.signer(txRequest, this.getSenderAddress());
|
|
58
104
|
return serializeTransaction(txRequest, signature);
|
|
@@ -86,53 +132,56 @@ export class L1TxUtils extends ReadOnlyL1TxUtils {
|
|
|
86
132
|
...request
|
|
87
133
|
});
|
|
88
134
|
const gasPrice = await this.getGasPrice(gasConfig, !!blobInputs);
|
|
135
|
+
if (this.interrupted) {
|
|
136
|
+
throw new InterruptError(`Transaction sending is interrupted`);
|
|
137
|
+
}
|
|
89
138
|
const nonce = await this.nonceManager.consume({
|
|
90
139
|
client: this.client,
|
|
91
140
|
address: account,
|
|
92
141
|
chainId: this.client.chain.id
|
|
93
142
|
});
|
|
94
|
-
const
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
143
|
+
const baseState = {
|
|
144
|
+
request,
|
|
145
|
+
gasLimit,
|
|
146
|
+
blobInputs,
|
|
147
|
+
gasPrice,
|
|
99
148
|
nonce
|
|
100
149
|
};
|
|
101
|
-
const txData =
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
maxFeePerBlobGas: gasPrice.maxFeePerBlobGas
|
|
105
|
-
} : baseTxData;
|
|
150
|
+
const txData = this.makeTxData(baseState, {
|
|
151
|
+
isCancelTx: false
|
|
152
|
+
});
|
|
106
153
|
const now = new Date(await this.getL1Timestamp());
|
|
107
154
|
if (gasConfig.txTimeoutAt && now > gasConfig.txTimeoutAt) {
|
|
108
155
|
throw new TimeoutError(`Transaction timed out before sending (now ${now.toISOString()} > timeoutAt ${gasConfig.txTimeoutAt.toISOString()})`);
|
|
109
156
|
}
|
|
110
|
-
|
|
111
|
-
throw new InterruptError(`Transaction sending is interrupted`);
|
|
112
|
-
}
|
|
157
|
+
// Send the new tx
|
|
113
158
|
const signedRequest = await this.prepareSignedTransaction(txData);
|
|
114
159
|
const txHash = await this.client.sendRawTransaction({
|
|
115
160
|
serializedTransaction: signedRequest
|
|
116
161
|
});
|
|
162
|
+
// Create the new state for monitoring
|
|
117
163
|
const l1TxState = {
|
|
164
|
+
...baseState,
|
|
165
|
+
id: await this.store?.consumeNextStateId(account) ?? Math.max(...this.txs.map((tx)=>tx.id), 0),
|
|
118
166
|
txHashes: [
|
|
119
167
|
txHash
|
|
120
168
|
],
|
|
121
169
|
cancelTxHashes: [],
|
|
122
|
-
gasPrice,
|
|
123
|
-
request,
|
|
124
170
|
status: TxUtilsState.IDLE,
|
|
125
|
-
nonce,
|
|
126
|
-
gasLimit,
|
|
127
171
|
txConfigOverrides: gasConfigOverrides ?? {},
|
|
128
|
-
blobInputs,
|
|
129
172
|
sentAtL1Ts: now,
|
|
130
173
|
lastSentAtL1Ts: now
|
|
131
174
|
};
|
|
132
|
-
|
|
175
|
+
// And persist it
|
|
176
|
+
await this.updateState(l1TxState, stateChange);
|
|
177
|
+
await this.store?.saveBlobs(account, l1TxState.id, blobInputs);
|
|
133
178
|
this.txs.push(l1TxState);
|
|
179
|
+
// Clean up stale states
|
|
134
180
|
if (this.txs.length > MAX_L1_TX_STATES) {
|
|
135
|
-
this.txs.shift();
|
|
181
|
+
const removed = this.txs.shift();
|
|
182
|
+
if (removed && this.store) {
|
|
183
|
+
await this.store.deleteState(account, removed.id);
|
|
184
|
+
}
|
|
136
185
|
}
|
|
137
186
|
this.logger.info(`Sent L1 transaction ${txHash}`, {
|
|
138
187
|
to: request.to,
|
|
@@ -236,7 +285,7 @@ export class L1TxUtils extends ReadOnlyL1TxUtils {
|
|
|
236
285
|
/**
|
|
237
286
|
* Monitors a transaction until completion, handling speed-ups if needed
|
|
238
287
|
*/ async monitorTransaction(state) {
|
|
239
|
-
const {
|
|
288
|
+
const { nonce, gasLimit, blobInputs, txConfigOverrides: gasConfigOverrides } = state;
|
|
240
289
|
const gasConfig = merge(this.config, gasConfigOverrides);
|
|
241
290
|
const { maxSpeedUpAttempts, stallTimeMs } = gasConfig;
|
|
242
291
|
const isCancelTx = state.cancelTxHashes.length > 0;
|
|
@@ -244,7 +293,7 @@ export class L1TxUtils extends ReadOnlyL1TxUtils {
|
|
|
244
293
|
const isBlobTx = !!blobInputs;
|
|
245
294
|
const account = this.getSenderAddress().toString();
|
|
246
295
|
const initialTxHash = txHashes[0];
|
|
247
|
-
let currentTxHash =
|
|
296
|
+
let currentTxHash = txHashes.at(-1);
|
|
248
297
|
let l1Timestamp;
|
|
249
298
|
while(true){
|
|
250
299
|
l1Timestamp = await this.getL1Timestamp();
|
|
@@ -265,13 +314,13 @@ export class L1TxUtils extends ReadOnlyL1TxUtils {
|
|
|
265
314
|
// We try getting the receipt twice, since sometimes anvil fails to return it if the tx has just been mined
|
|
266
315
|
const receipt = await this.tryGetTxReceipt(state.cancelTxHashes, nonce, true) ?? await this.tryGetTxReceipt(state.txHashes, nonce, false) ?? await sleep(500) ?? await this.tryGetTxReceipt(state.cancelTxHashes, nonce, true) ?? await this.tryGetTxReceipt(state.txHashes, nonce, false);
|
|
267
316
|
if (receipt) {
|
|
268
|
-
this.updateState(state, TxUtilsState.MINED);
|
|
269
317
|
state.receipt = receipt;
|
|
318
|
+
await this.updateState(state, TxUtilsState.MINED, l1Timestamp);
|
|
270
319
|
return receipt;
|
|
271
320
|
}
|
|
272
321
|
// If we get here then we have checked all of our tx versions and not found anything.
|
|
273
322
|
// We should consider the nonce as MINED
|
|
274
|
-
this.updateState(state, TxUtilsState.MINED);
|
|
323
|
+
await this.updateState(state, TxUtilsState.MINED, l1Timestamp);
|
|
275
324
|
throw new UnknownMinedTxError(nonce, account);
|
|
276
325
|
}
|
|
277
326
|
// If this is a cancel tx and its nonce is no longer on the mempool, we consider it dropped and stop monitoring
|
|
@@ -283,7 +332,7 @@ export class L1TxUtils extends ReadOnlyL1TxUtils {
|
|
|
283
332
|
pendingNonce,
|
|
284
333
|
timePassed
|
|
285
334
|
});
|
|
286
|
-
this.updateState(state, TxUtilsState.NOT_MINED);
|
|
335
|
+
await this.updateState(state, TxUtilsState.NOT_MINED);
|
|
287
336
|
this.nonceManager.reset({
|
|
288
337
|
address: account,
|
|
289
338
|
chainId: this.client.chain.id
|
|
@@ -308,25 +357,13 @@ export class L1TxUtils extends ReadOnlyL1TxUtils {
|
|
|
308
357
|
maxFeePerBlobGas: formatGwei(newGasPrice.maxFeePerBlobGas)
|
|
309
358
|
}
|
|
310
359
|
});
|
|
311
|
-
const
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
maxFeePerGas: newGasPrice.maxFeePerGas,
|
|
315
|
-
maxPriorityFeePerGas: newGasPrice.maxPriorityFeePerGas,
|
|
316
|
-
nonce
|
|
317
|
-
};
|
|
318
|
-
const txData = blobInputs ? {
|
|
319
|
-
...baseTxData,
|
|
320
|
-
...blobInputs,
|
|
321
|
-
maxFeePerBlobGas: newGasPrice.maxFeePerBlobGas
|
|
322
|
-
} : baseTxData;
|
|
360
|
+
const txData = this.makeTxData(state, {
|
|
361
|
+
isCancelTx
|
|
362
|
+
});
|
|
323
363
|
const signedRequest = await this.prepareSignedTransaction(txData);
|
|
324
364
|
const newHash = await this.client.sendRawTransaction({
|
|
325
365
|
serializedTransaction: signedRequest
|
|
326
366
|
});
|
|
327
|
-
if (!isCancelTx) {
|
|
328
|
-
this.updateState(state, TxUtilsState.SPEED_UP);
|
|
329
|
-
}
|
|
330
367
|
this.logger.verbose(`Sent L1 speed-up tx ${newHash} replacing ${currentTxHash} for nonce ${nonce} from ${account}`, {
|
|
331
368
|
nonce,
|
|
332
369
|
account,
|
|
@@ -341,6 +378,7 @@ export class L1TxUtils extends ReadOnlyL1TxUtils {
|
|
|
341
378
|
currentTxHash = newHash;
|
|
342
379
|
txHashes.push(currentTxHash);
|
|
343
380
|
state.lastSentAtL1Ts = new Date(l1Timestamp);
|
|
381
|
+
await this.updateState(state, isCancelTx ? TxUtilsState.CANCELLED : TxUtilsState.SPEED_UP);
|
|
344
382
|
await sleep(gasConfig.checkIntervalMs);
|
|
345
383
|
continue;
|
|
346
384
|
}
|
|
@@ -374,7 +412,7 @@ export class L1TxUtils extends ReadOnlyL1TxUtils {
|
|
|
374
412
|
// and reset the nonce manager, so the next tx that comes along can reuse the nonce if/when this tx gets dropped.
|
|
375
413
|
// This is the nastiest scenario for us, since the new tx could acquire the next nonce, but then this tx is dropped,
|
|
376
414
|
// and the new tx would never get mined. Eventually, the new tx would also drop.
|
|
377
|
-
this.updateState(state, TxUtilsState.NOT_MINED);
|
|
415
|
+
await this.updateState(state, TxUtilsState.NOT_MINED);
|
|
378
416
|
this.nonceManager.reset({
|
|
379
417
|
address: account,
|
|
380
418
|
chainId: this.client.chain.id
|
|
@@ -382,8 +420,8 @@ export class L1TxUtils extends ReadOnlyL1TxUtils {
|
|
|
382
420
|
} else {
|
|
383
421
|
// Otherwise we fire the cancellation without awaiting to avoid blocking the caller,
|
|
384
422
|
// and monitor it in the background so we can speed it up as needed.
|
|
385
|
-
void this.attemptTxCancellation(state).catch((err)=>{
|
|
386
|
-
this.updateState(state, TxUtilsState.NOT_MINED);
|
|
423
|
+
void this.attemptTxCancellation(state).catch(async (err)=>{
|
|
424
|
+
await this.updateState(state, TxUtilsState.NOT_MINED);
|
|
387
425
|
this.logger.error(`Failed to send cancellation for timed out tx ${initialTxHash} with nonce ${nonce}`, err, {
|
|
388
426
|
account,
|
|
389
427
|
nonce,
|
|
@@ -407,6 +445,41 @@ export class L1TxUtils extends ReadOnlyL1TxUtils {
|
|
|
407
445
|
});
|
|
408
446
|
throw new TimeoutError(`L1 transaction ${initialTxHash} timed out`);
|
|
409
447
|
}
|
|
448
|
+
/**
|
|
449
|
+
* Creates tx data to be signed by viem signTransaction method, using the state as input.
|
|
450
|
+
* If isCancelTx is true, creates a 0-value tx to self with 21k gas and no data instead,
|
|
451
|
+
* and an empty blob input if the original tx also had blobs.
|
|
452
|
+
*/ makeTxData(state, opts) {
|
|
453
|
+
const { request, gasLimit, blobInputs, gasPrice, nonce } = state;
|
|
454
|
+
const isBlobTx = blobInputs !== undefined;
|
|
455
|
+
const baseTxOpts = {
|
|
456
|
+
nonce,
|
|
457
|
+
...pick(gasPrice, 'maxFeePerGas', 'maxPriorityFeePerGas')
|
|
458
|
+
};
|
|
459
|
+
if (opts.isCancelTx) {
|
|
460
|
+
const baseTxData = {
|
|
461
|
+
to: this.getSenderAddress().toString(),
|
|
462
|
+
value: 0n,
|
|
463
|
+
data: '0x',
|
|
464
|
+
gas: 21_000n,
|
|
465
|
+
...baseTxOpts
|
|
466
|
+
};
|
|
467
|
+
return isBlobTx ? {
|
|
468
|
+
...baseTxData,
|
|
469
|
+
...this.makeEmptyBlobInputs(gasPrice.maxFeePerBlobGas)
|
|
470
|
+
} : baseTxData;
|
|
471
|
+
}
|
|
472
|
+
const baseTxData = {
|
|
473
|
+
...request,
|
|
474
|
+
...baseTxOpts,
|
|
475
|
+
gas: gasLimit
|
|
476
|
+
};
|
|
477
|
+
return blobInputs ? {
|
|
478
|
+
...baseTxData,
|
|
479
|
+
...blobInputs,
|
|
480
|
+
maxFeePerBlobGas: gasPrice.maxFeePerBlobGas
|
|
481
|
+
} : baseTxData;
|
|
482
|
+
}
|
|
410
483
|
/** Returns when all monitor loops have stopped. */ async waitMonitoringStopped(timeoutSeconds = 10) {
|
|
411
484
|
const account = this.getSenderAddress().toString();
|
|
412
485
|
await retryUntil(()=>this.txs.every((tx)=>TerminalTxUtilsState.includes(tx.status)), `monitoring stopped for ${account}`, timeoutSeconds, 0.1).catch(()=>this.logger.warn(`Timeout waiting for monitoring loops to stop for ${account}`));
|
|
@@ -458,7 +531,7 @@ export class L1TxUtils extends ReadOnlyL1TxUtils {
|
|
|
458
531
|
nonce,
|
|
459
532
|
account
|
|
460
533
|
});
|
|
461
|
-
this.updateState(state, TxUtilsState.NOT_MINED);
|
|
534
|
+
await this.updateState(state, TxUtilsState.NOT_MINED);
|
|
462
535
|
this.nonceManager.reset({
|
|
463
536
|
address: account,
|
|
464
537
|
chainId: this.client.chain.id
|
|
@@ -476,7 +549,7 @@ export class L1TxUtils extends ReadOnlyL1TxUtils {
|
|
|
476
549
|
account,
|
|
477
550
|
currentNonce
|
|
478
551
|
});
|
|
479
|
-
this.updateState(state, TxUtilsState.NOT_MINED);
|
|
552
|
+
await this.updateState(state, TxUtilsState.NOT_MINED);
|
|
480
553
|
this.nonceManager.reset({
|
|
481
554
|
address: account,
|
|
482
555
|
chainId: this.client.chain.id
|
|
@@ -497,34 +570,21 @@ export class L1TxUtils extends ReadOnlyL1TxUtils {
|
|
|
497
570
|
maxFeePerBlobGas: formatGwei(maxFeePerBlobGas)
|
|
498
571
|
}
|
|
499
572
|
});
|
|
500
|
-
const request = {
|
|
501
|
-
to: this.getSenderAddress().toString(),
|
|
502
|
-
value: 0n
|
|
503
|
-
};
|
|
504
573
|
// Send 0-value tx to self with higher gas price
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
maxPriorityFeePerGas
|
|
511
|
-
};
|
|
512
|
-
const txData = isBlobTx ? {
|
|
513
|
-
...baseTxData,
|
|
514
|
-
...this.makeEmptyBlobInputs(maxFeePerBlobGas)
|
|
515
|
-
} : baseTxData;
|
|
574
|
+
state.gasPrice = cancelGasPrice;
|
|
575
|
+
state.lastSentAtL1Ts = new Date(await this.getL1Timestamp());
|
|
576
|
+
const txData = this.makeTxData(state, {
|
|
577
|
+
isCancelTx: true
|
|
578
|
+
});
|
|
516
579
|
const signedRequest = await this.prepareSignedTransaction(txData);
|
|
517
580
|
const cancelTxHash = await this.client.sendRawTransaction({
|
|
518
581
|
serializedTransaction: signedRequest
|
|
519
582
|
});
|
|
520
|
-
state.gasPrice = cancelGasPrice;
|
|
521
|
-
state.gasLimit = 21_000n;
|
|
522
583
|
state.cancelTxHashes.push(cancelTxHash);
|
|
523
|
-
|
|
524
|
-
this.updateState(state, TxUtilsState.CANCELLED);
|
|
584
|
+
await this.updateState(state, TxUtilsState.CANCELLED);
|
|
525
585
|
this.logger.warn(`Sent cancellation tx ${cancelTxHash} for timed out tx from ${account} with nonce ${nonce}`, {
|
|
526
586
|
nonce,
|
|
527
|
-
|
|
587
|
+
cancelGasPrice,
|
|
528
588
|
isBlobTx,
|
|
529
589
|
txHashes: state.txHashes
|
|
530
590
|
});
|
|
@@ -537,7 +597,7 @@ export class L1TxUtils extends ReadOnlyL1TxUtils {
|
|
|
537
597
|
});
|
|
538
598
|
});
|
|
539
599
|
}
|
|
540
|
-
async getL1Timestamp() {
|
|
600
|
+
/** Returns L1 timestamps in milliseconds */ async getL1Timestamp() {
|
|
541
601
|
const { timestamp } = await this.client.getBlock({
|
|
542
602
|
blockTag: 'latest',
|
|
543
603
|
includeTransactions: false
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { Logger } from '@aztec/foundation/log';
|
|
2
2
|
import { DateProvider } from '@aztec/foundation/timer';
|
|
3
3
|
import type { EthSigner } from '../eth-signer/eth-signer.js';
|
|
4
4
|
import type { ExtendedViemWalletClient, ViemClient } from '../types.js';
|
|
5
5
|
import type { L1TxUtilsConfig } from './config.js';
|
|
6
|
+
import type { IL1TxMetrics, IL1TxStore } from './interfaces.js';
|
|
6
7
|
import { L1TxUtils } from './l1_tx_utils.js';
|
|
7
8
|
import type { L1BlobInputs } from './types.js';
|
|
8
9
|
/** 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. */
|
|
@@ -10,6 +11,16 @@ export declare class L1TxUtilsWithBlobs extends L1TxUtils {
|
|
|
10
11
|
/** Makes empty blob inputs for the cancellation tx. */
|
|
11
12
|
protected makeEmptyBlobInputs(maxFeePerBlobGas: bigint): Required<L1BlobInputs>;
|
|
12
13
|
}
|
|
13
|
-
export declare function createL1TxUtilsWithBlobsFromViemWallet(client: ExtendedViemWalletClient,
|
|
14
|
-
|
|
14
|
+
export declare function createL1TxUtilsWithBlobsFromViemWallet(client: ExtendedViemWalletClient, deps?: {
|
|
15
|
+
logger?: Logger;
|
|
16
|
+
dateProvider?: DateProvider;
|
|
17
|
+
store?: IL1TxStore;
|
|
18
|
+
metrics?: IL1TxMetrics;
|
|
19
|
+
}, config?: Partial<L1TxUtilsConfig>, debugMaxGasLimit?: boolean): L1TxUtilsWithBlobs;
|
|
20
|
+
export declare function createL1TxUtilsWithBlobsFromEthSigner(client: ViemClient, signer: EthSigner, deps?: {
|
|
21
|
+
logger?: Logger;
|
|
22
|
+
dateProvider?: DateProvider;
|
|
23
|
+
store?: IL1TxStore;
|
|
24
|
+
metrics?: IL1TxMetrics;
|
|
25
|
+
}, config?: Partial<L1TxUtilsConfig>, debugMaxGasLimit?: boolean): L1TxUtilsWithBlobs;
|
|
15
26
|
//# sourceMappingURL=l1_tx_utils_with_blobs.d.ts.map
|
|
@@ -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,
|
|
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,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAIvD,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,KAAK,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAChE,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAE7C,OAAO,KAAK,EAAE,YAAY,EAAmB,MAAM,YAAY,CAAC;AAEhE,2JAA2J;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,IAAI,GAAE;IACJ,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB,OAAO,CAAC,EAAE,YAAY,CAAC;CACnB,EACN,MAAM,GAAE,OAAO,CAAC,eAAe,CAAM,EACrC,gBAAgB,GAAE,OAAe,sBAalC;AAED,wBAAgB,qCAAqC,CACnD,MAAM,EAAE,UAAU,EAClB,MAAM,EAAE,SAAS,EACjB,IAAI,GAAE;IACJ,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB,OAAO,CAAC,EAAE,YAAY,CAAC;CACnB,EACN,MAAM,GAAE,OAAO,CAAC,eAAe,CAAM,EACrC,gBAAgB,GAAE,OAAe,sBAiBlC"}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { Blob } from '@aztec/blob-lib';
|
|
2
2
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
3
|
-
import { createLogger } from '@aztec/foundation/log';
|
|
4
|
-
import { DateProvider } from '@aztec/foundation/timer';
|
|
5
3
|
import { L1TxUtils } from './l1_tx_utils.js';
|
|
6
4
|
import { createViemSigner } from './signer.js';
|
|
7
5
|
/** 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 {
|
|
@@ -17,12 +15,12 @@ import { createViemSigner } from './signer.js';
|
|
|
17
15
|
};
|
|
18
16
|
}
|
|
19
17
|
}
|
|
20
|
-
export function createL1TxUtilsWithBlobsFromViemWallet(client,
|
|
21
|
-
return new L1TxUtilsWithBlobs(client, EthAddress.fromString(client.account.address), createViemSigner(client), logger, dateProvider, config, debugMaxGasLimit);
|
|
18
|
+
export function createL1TxUtilsWithBlobsFromViemWallet(client, deps = {}, config = {}, debugMaxGasLimit = false) {
|
|
19
|
+
return new L1TxUtilsWithBlobs(client, EthAddress.fromString(client.account.address), createViemSigner(client), deps.logger, deps.dateProvider, config, debugMaxGasLimit, deps.store, deps.metrics);
|
|
22
20
|
}
|
|
23
|
-
export function createL1TxUtilsWithBlobsFromEthSigner(client, signer,
|
|
21
|
+
export function createL1TxUtilsWithBlobsFromEthSigner(client, signer, deps = {}, config = {}, debugMaxGasLimit = false) {
|
|
24
22
|
const callback = async (transaction, _signingAddress)=>{
|
|
25
23
|
return (await signer.signTransaction(transaction)).toViemTransactionSignature();
|
|
26
24
|
};
|
|
27
|
-
return new L1TxUtilsWithBlobs(client, signer.address, callback, logger, dateProvider, config, debugMaxGasLimit);
|
|
25
|
+
return new L1TxUtilsWithBlobs(client, signer.address, callback, deps.logger, deps.dateProvider, config, debugMaxGasLimit, deps.store, deps.metrics);
|
|
28
26
|
}
|
|
@@ -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,O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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;CAY5E"}
|
|
@@ -14,7 +14,7 @@ export class ReadOnlyL1TxUtils {
|
|
|
14
14
|
debugMaxGasLimit;
|
|
15
15
|
config;
|
|
16
16
|
interrupted;
|
|
17
|
-
constructor(client, logger = createLogger('
|
|
17
|
+
constructor(client, logger = createLogger('ethereum:readonly-l1-utils'), dateProvider, config, debugMaxGasLimit = false){
|
|
18
18
|
this.client = client;
|
|
19
19
|
this.logger = logger;
|
|
20
20
|
this.dateProvider = dateProvider;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/l1_tx_utils/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,EAAE,UAAU,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AAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,IAAI,CAAC;IACjB,cAAc,EAAE,IAAI,CAAC;IACrB,OAAO,CAAC,EAAE,kBAAkB,CAAC;IAC7B,UAAU,EAAE,YAAY,GAAG,SAAS,CAAC;CACtC,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG,CAC5B,WAAW,EAAE,uBAAuB,EACpC,cAAc,EAAE,UAAU,KACvB,OAAO,CAAC,wBAAwB,CAAC,CAAC;AAEvC,qBAAa,mBAAoB,SAAQ,KAAK;gBAChC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM;CAI3C;AAED,qBAAa,uBAAwB,SAAQ,KAAK;gBACpC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM;CAI3C"}
|
|
@@ -7,6 +7,8 @@ export declare class PublisherManager<UtilsType extends L1TxUtils = L1TxUtils> {
|
|
|
7
7
|
constructor(publishers: UtilsType[], config: {
|
|
8
8
|
publisherAllowInvalidStates?: boolean;
|
|
9
9
|
});
|
|
10
|
+
/** Loads the state of all publishers and resumes monitoring any pending txs */
|
|
11
|
+
loadState(): Promise<void>;
|
|
10
12
|
getAvailablePublisher(filter?: PublisherFilter<UtilsType>): Promise<UtilsType>;
|
|
11
13
|
interrupt(): void;
|
|
12
14
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"publisher_manager.d.ts","sourceRoot":"","sources":["../src/publisher_manager.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAgB,MAAM,wBAAwB,CAAC;AAwBjE,MAAM,MAAM,eAAe,CAAC,SAAS,SAAS,SAAS,IAAI,CAAC,KAAK,EAAE,SAAS,KAAK,OAAO,CAAC;AAEzF,qBAAa,gBAAgB,CAAC,SAAS,SAAS,SAAS,GAAG,SAAS;IAKjE,OAAO,CAAC,UAAU;IAJpB,OAAO,CAAC,GAAG,
|
|
1
|
+
{"version":3,"file":"publisher_manager.d.ts","sourceRoot":"","sources":["../src/publisher_manager.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAgB,MAAM,wBAAwB,CAAC;AAwBjE,MAAM,MAAM,eAAe,CAAC,SAAS,SAAS,SAAS,IAAI,CAAC,KAAK,EAAE,SAAS,KAAK,OAAO,CAAC;AAEzF,qBAAa,gBAAgB,CAAC,SAAS,SAAS,SAAS,GAAG,SAAS;IAKjE,OAAO,CAAC,UAAU;IAJpB,OAAO,CAAC,GAAG,CAAqC;IAChD,OAAO,CAAC,MAAM,CAA4C;gBAGhD,UAAU,EAAE,SAAS,EAAE,EAC/B,MAAM,EAAE;QAAE,2BAA2B,CAAC,EAAE,OAAO,CAAA;KAAE;IAOnD,+EAA+E;IAClE,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC;IAU1B,qBAAqB,CAAC,MAAM,GAAE,eAAe,CAAC,SAAS,CAAc,GAAG,OAAO,CAAC,SAAS,CAAC;IAiDhG,SAAS;CAGjB"}
|
|
@@ -27,11 +27,14 @@ export class PublisherManager {
|
|
|
27
27
|
config;
|
|
28
28
|
constructor(publishers, config){
|
|
29
29
|
this.publishers = publishers;
|
|
30
|
-
this.log = createLogger('
|
|
30
|
+
this.log = createLogger('publisher:manager');
|
|
31
31
|
this.log.info(`PublisherManager initialized with ${publishers.length} publishers.`);
|
|
32
32
|
this.publishers = publishers;
|
|
33
33
|
this.config = pick(config, 'publisherAllowInvalidStates');
|
|
34
34
|
}
|
|
35
|
+
/** Loads the state of all publishers and resumes monitoring any pending txs */ async loadState() {
|
|
36
|
+
await Promise.all(this.publishers.map((pub)=>pub.loadStateAndResumeMonitoring()));
|
|
37
|
+
}
|
|
35
38
|
// Finds and prioritises available publishers based on
|
|
36
39
|
// 1. Validity as per the provided filter function
|
|
37
40
|
// 2. Validity based on the state the publisher is in
|
|
@@ -39,6 +42,13 @@ export class PublisherManager {
|
|
|
39
42
|
// 4. Then priority based on highest balance
|
|
40
43
|
// 5. Then priority based on least recently used
|
|
41
44
|
async getAvailablePublisher(filter = ()=>true) {
|
|
45
|
+
this.log.debug(`Getting available publisher`, {
|
|
46
|
+
publishers: this.publishers.map((p)=>({
|
|
47
|
+
address: p.getSenderAddress(),
|
|
48
|
+
state: p.state,
|
|
49
|
+
lastMined: p.lastMinedAtBlockNumber
|
|
50
|
+
}))
|
|
51
|
+
});
|
|
42
52
|
// Extract the valid publishers
|
|
43
53
|
let validPublishers = this.publishers.filter((pub)=>!busyStates.includes(pub.state) && filter(pub));
|
|
44
54
|
// If none found but we allow invalid (busy) states, try again including them
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/ethereum",
|
|
3
|
-
"version": "3.0.0-nightly.
|
|
3
|
+
"version": "3.0.0-nightly.20251008",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./dest/index.js",
|
|
@@ -31,10 +31,10 @@
|
|
|
31
31
|
"../package.common.json"
|
|
32
32
|
],
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@aztec/blob-lib": "3.0.0-nightly.
|
|
35
|
-
"@aztec/constants": "3.0.0-nightly.
|
|
36
|
-
"@aztec/foundation": "3.0.0-nightly.
|
|
37
|
-
"@aztec/l1-artifacts": "3.0.0-nightly.
|
|
34
|
+
"@aztec/blob-lib": "3.0.0-nightly.20251008",
|
|
35
|
+
"@aztec/constants": "3.0.0-nightly.20251008",
|
|
36
|
+
"@aztec/foundation": "3.0.0-nightly.20251008",
|
|
37
|
+
"@aztec/l1-artifacts": "3.0.0-nightly.20251008",
|
|
38
38
|
"@viem/anvil": "^0.0.10",
|
|
39
39
|
"dotenv": "^16.0.3",
|
|
40
40
|
"lodash.chunk": "^4.2.0",
|
package/src/config.ts
CHANGED
|
@@ -160,6 +160,8 @@ export const getGovernanceConfiguration = (networkName: NetworkNames) => {
|
|
|
160
160
|
switch (networkName) {
|
|
161
161
|
case 'local':
|
|
162
162
|
return LocalGovernanceConfiguration;
|
|
163
|
+
case 'next-net':
|
|
164
|
+
return LocalGovernanceConfiguration;
|
|
163
165
|
case 'staging-public':
|
|
164
166
|
return StagingPublicGovernanceConfiguration;
|
|
165
167
|
case 'testnet':
|
|
@@ -185,6 +187,7 @@ const DefaultRewardConfig = {
|
|
|
185
187
|
export const getRewardConfig = (networkName: NetworkNames) => {
|
|
186
188
|
switch (networkName) {
|
|
187
189
|
case 'local':
|
|
190
|
+
case 'next-net':
|
|
188
191
|
case 'staging-public':
|
|
189
192
|
case 'testnet':
|
|
190
193
|
case 'staging-ignition':
|
|
@@ -243,6 +246,8 @@ export const getEntryQueueConfig = (networkName: NetworkNames) => {
|
|
|
243
246
|
switch (networkName) {
|
|
244
247
|
case 'local':
|
|
245
248
|
return LocalEntryQueueConfig;
|
|
249
|
+
case 'next-net':
|
|
250
|
+
return LocalEntryQueueConfig;
|
|
246
251
|
case 'staging-public':
|
|
247
252
|
return StagingPublicEntryQueueConfig;
|
|
248
253
|
case 'testnet':
|
|
@@ -187,7 +187,7 @@ export class GovernanceContract extends ReadOnlyGovernanceContract {
|
|
|
187
187
|
retries: number;
|
|
188
188
|
logger: Logger;
|
|
189
189
|
}) {
|
|
190
|
-
const l1TxUtils = createL1TxUtilsFromViemWallet(this.client, logger);
|
|
190
|
+
const l1TxUtils = createL1TxUtilsFromViemWallet(this.client, { logger });
|
|
191
191
|
const retryDelaySeconds = 12;
|
|
192
192
|
|
|
193
193
|
voteAmount = voteAmount ?? (await this.getPower());
|
|
@@ -244,7 +244,7 @@ export class GovernanceContract extends ReadOnlyGovernanceContract {
|
|
|
244
244
|
retries: number;
|
|
245
245
|
logger: Logger;
|
|
246
246
|
}) {
|
|
247
|
-
const l1TxUtils = createL1TxUtilsFromViemWallet(this.client, logger);
|
|
247
|
+
const l1TxUtils = createL1TxUtilsFromViemWallet(this.client, { logger });
|
|
248
248
|
const retryDelaySeconds = 12;
|
|
249
249
|
let success = false;
|
|
250
250
|
for (let i = 0; i < retries; i++) {
|
|
@@ -147,8 +147,8 @@ export type VerificationRecord = {
|
|
|
147
147
|
export interface DeployL1ContractsArgs extends Omit<L1ContractsConfig, keyof L1TxUtilsConfig> {
|
|
148
148
|
/** The vk tree root. */
|
|
149
149
|
vkTreeRoot: Fr;
|
|
150
|
-
/** The
|
|
151
|
-
|
|
150
|
+
/** The hash of the protocol contracts. */
|
|
151
|
+
protocolContractsHash: Fr;
|
|
152
152
|
/** The genesis root of the archive tree. */
|
|
153
153
|
genesisArchiveRoot: Fr;
|
|
154
154
|
/** The salt for CREATE2 deployment. */
|
|
@@ -657,7 +657,7 @@ export const deployRollup = async (
|
|
|
657
657
|
|
|
658
658
|
const genesisStateArgs = {
|
|
659
659
|
vkTreeRoot: args.vkTreeRoot.toString(),
|
|
660
|
-
|
|
660
|
+
protocolContractsHash: args.protocolContractsHash.toString(),
|
|
661
661
|
genesisArchiveRoot: args.genesisArchiveRoot.toString(),
|
|
662
662
|
};
|
|
663
663
|
|
|
@@ -1473,10 +1473,8 @@ export class L1Deployer {
|
|
|
1473
1473
|
this.salt = maybeSalt ? padHex(numberToHex(maybeSalt), { size: 32 }) : undefined;
|
|
1474
1474
|
this.l1TxUtils = createL1TxUtilsFromViemWallet(
|
|
1475
1475
|
this.client,
|
|
1476
|
-
this.logger,
|
|
1477
|
-
|
|
1478
|
-
this.txUtilsConfig,
|
|
1479
|
-
this.acceleratedTestDeployments,
|
|
1476
|
+
{ logger: this.logger, dateProvider },
|
|
1477
|
+
{ ...this.txUtilsConfig, debugMaxGasLimit: acceleratedTestDeployments },
|
|
1480
1478
|
);
|
|
1481
1479
|
}
|
|
1482
1480
|
|
|
@@ -1604,7 +1602,11 @@ export async function deployL1Contract(
|
|
|
1604
1602
|
|
|
1605
1603
|
if (!l1TxUtils) {
|
|
1606
1604
|
const config = getL1TxUtilsConfigEnvVars();
|
|
1607
|
-
l1TxUtils = createL1TxUtilsFromViemWallet(
|
|
1605
|
+
l1TxUtils = createL1TxUtilsFromViemWallet(
|
|
1606
|
+
extendedClient,
|
|
1607
|
+
{ logger },
|
|
1608
|
+
{ ...config, debugMaxGasLimit: acceleratedTestDeployments },
|
|
1609
|
+
);
|
|
1608
1610
|
}
|
|
1609
1611
|
|
|
1610
1612
|
if (libraries) {
|