@aztec/ethereum 3.0.0-nightly.20250929 → 3.0.0-nightly.20251001
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/client.d.ts +1 -1
- package/dest/client.d.ts.map +1 -1
- package/dest/config.js +2 -2
- package/dest/contracts/fee_asset_handler.d.ts +2 -2
- package/dest/contracts/governance_proposer.d.ts +1 -2
- package/dest/contracts/governance_proposer.d.ts.map +1 -1
- package/dest/contracts/governance_proposer.js +1 -2
- package/dest/contracts/multicall.d.ts +0 -2
- package/dest/contracts/multicall.d.ts.map +1 -1
- package/dest/contracts/multicall.js +2 -4
- package/dest/contracts/rollup.d.ts +2 -2
- package/dest/deploy_l1_contracts.d.ts.map +1 -1
- package/dest/deploy_l1_contracts.js +6 -3
- package/dest/l1_reader.d.ts +1 -1
- package/dest/l1_reader.d.ts.map +1 -1
- package/dest/l1_reader.js +1 -1
- package/dest/l1_tx_utils/factory.d.ts.map +1 -1
- package/dest/l1_tx_utils/factory.js +2 -2
- package/dest/l1_tx_utils/l1_tx_utils.d.ts +14 -26
- package/dest/l1_tx_utils/l1_tx_utils.d.ts.map +1 -1
- package/dest/l1_tx_utils/l1_tx_utils.js +140 -136
- package/dest/l1_tx_utils/l1_tx_utils_with_blobs.d.ts +4 -11
- 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 +10 -70
- package/dest/l1_tx_utils/readonly_l1_tx_utils.d.ts +1 -1
- package/dest/l1_tx_utils/readonly_l1_tx_utils.d.ts.map +1 -1
- package/dest/l1_tx_utils/types.d.ts +15 -2
- package/dest/l1_tx_utils/types.d.ts.map +1 -1
- package/package.json +5 -5
- package/src/client.ts +1 -1
- package/src/config.ts +2 -2
- package/src/contracts/governance_proposer.ts +3 -4
- package/src/contracts/multicall.ts +4 -4
- package/src/deploy_l1_contracts.ts +5 -4
- package/src/l1_reader.ts +2 -2
- package/src/l1_tx_utils/factory.ts +2 -2
- package/src/l1_tx_utils/l1_tx_utils.ts +159 -157
- package/src/l1_tx_utils/l1_tx_utils_with_blobs.ts +8 -99
- package/src/l1_tx_utils/readonly_l1_tx_utils.ts +1 -1
- package/src/l1_tx_utils/types.ts +16 -2
|
@@ -3,113 +3,22 @@ import { EthAddress } from '@aztec/foundation/eth-address';
|
|
|
3
3
|
import { type Logger, createLogger } from '@aztec/foundation/log';
|
|
4
4
|
import { DateProvider } from '@aztec/foundation/timer';
|
|
5
5
|
|
|
6
|
-
import
|
|
6
|
+
import type { TransactionSerializable } from 'viem';
|
|
7
7
|
|
|
8
8
|
import type { EthSigner } from '../eth-signer/eth-signer.js';
|
|
9
9
|
import type { ExtendedViemWalletClient, ViemClient } from '../types.js';
|
|
10
10
|
import type { L1TxUtilsConfig } from './config.js';
|
|
11
11
|
import { L1TxUtils } from './l1_tx_utils.js';
|
|
12
12
|
import { createViemSigner } from './signer.js';
|
|
13
|
-
import type {
|
|
13
|
+
import type { L1BlobInputs, SigningCallback } from './types.js';
|
|
14
14
|
|
|
15
|
+
/** 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. */
|
|
15
16
|
export class L1TxUtilsWithBlobs extends L1TxUtils {
|
|
16
|
-
/**
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
* @param attempts - The number of attempts to cancel the transaction
|
|
22
|
-
* @returns The hash of the cancellation transaction
|
|
23
|
-
*/
|
|
24
|
-
protected override async attemptTxCancellation(
|
|
25
|
-
currentTxHash: Hex,
|
|
26
|
-
nonce: number,
|
|
27
|
-
allVersions: Set<Hex>,
|
|
28
|
-
isBlobTx = false,
|
|
29
|
-
previousGasPrice?: GasPrice,
|
|
30
|
-
attempts = 0,
|
|
31
|
-
) {
|
|
32
|
-
// Get gas price with higher priority fee for cancellation
|
|
33
|
-
const cancelGasPrice = await this.getGasPrice(
|
|
34
|
-
{
|
|
35
|
-
...this.config,
|
|
36
|
-
// Use high bump for cancellation to ensure it replaces the original tx
|
|
37
|
-
priorityFeeRetryBumpPercentage: 150, // 150% bump should be enough to replace any tx
|
|
38
|
-
},
|
|
39
|
-
isBlobTx,
|
|
40
|
-
attempts + 1,
|
|
41
|
-
previousGasPrice,
|
|
42
|
-
);
|
|
43
|
-
|
|
44
|
-
this.logger?.info(`Attempting to cancel blob L1 transaction ${currentTxHash} with nonce ${nonce}`, {
|
|
45
|
-
maxFeePerGas: formatGwei(cancelGasPrice.maxFeePerGas),
|
|
46
|
-
maxPriorityFeePerGas: formatGwei(cancelGasPrice.maxPriorityFeePerGas),
|
|
47
|
-
maxFeePerBlobGas:
|
|
48
|
-
cancelGasPrice.maxFeePerBlobGas === undefined ? undefined : formatGwei(cancelGasPrice.maxFeePerBlobGas),
|
|
49
|
-
});
|
|
50
|
-
const request = {
|
|
51
|
-
to: this.getSenderAddress().toString(),
|
|
52
|
-
value: 0n,
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
// Send 0-value tx to self with higher gas price
|
|
56
|
-
if (!isBlobTx) {
|
|
57
|
-
const txData = {
|
|
58
|
-
...request,
|
|
59
|
-
nonce,
|
|
60
|
-
gas: 21_000n, // Standard ETH transfer gas
|
|
61
|
-
maxFeePerGas: cancelGasPrice.maxFeePerGas,
|
|
62
|
-
maxPriorityFeePerGas: cancelGasPrice.maxPriorityFeePerGas,
|
|
63
|
-
};
|
|
64
|
-
const signedRequest = await this.prepareSignedTransaction(txData);
|
|
65
|
-
const cancelTxHash = await this.client.sendRawTransaction({ serializedTransaction: signedRequest });
|
|
66
|
-
|
|
67
|
-
this.logger?.info(`Sent cancellation tx ${cancelTxHash} for timed out tx ${currentTxHash}`);
|
|
68
|
-
|
|
69
|
-
const receipt = await this.monitorTransaction(
|
|
70
|
-
request,
|
|
71
|
-
cancelTxHash,
|
|
72
|
-
allVersions,
|
|
73
|
-
{ gasLimit: 21_000n },
|
|
74
|
-
undefined,
|
|
75
|
-
undefined,
|
|
76
|
-
true,
|
|
77
|
-
);
|
|
78
|
-
|
|
79
|
-
return receipt.transactionHash;
|
|
80
|
-
} else {
|
|
81
|
-
const blobData = new Uint8Array(131072).fill(0);
|
|
82
|
-
const kzg = Blob.getViemKzgInstance();
|
|
83
|
-
const blobInputs = {
|
|
84
|
-
blobs: [blobData],
|
|
85
|
-
kzg,
|
|
86
|
-
maxFeePerBlobGas: cancelGasPrice.maxFeePerBlobGas!,
|
|
87
|
-
};
|
|
88
|
-
const txData = {
|
|
89
|
-
...request,
|
|
90
|
-
...blobInputs,
|
|
91
|
-
nonce,
|
|
92
|
-
gas: 21_000n,
|
|
93
|
-
maxFeePerGas: cancelGasPrice.maxFeePerGas,
|
|
94
|
-
maxPriorityFeePerGas: cancelGasPrice.maxPriorityFeePerGas,
|
|
95
|
-
};
|
|
96
|
-
const signedRequest = await this.prepareSignedTransaction(txData);
|
|
97
|
-
const cancelTxHash = await this.client.sendRawTransaction({ serializedTransaction: signedRequest });
|
|
98
|
-
|
|
99
|
-
this.logger?.info(`Sent cancellation tx ${cancelTxHash} for timed out tx ${currentTxHash}`);
|
|
100
|
-
|
|
101
|
-
const receipt = await this.monitorTransaction(
|
|
102
|
-
request,
|
|
103
|
-
cancelTxHash,
|
|
104
|
-
allVersions,
|
|
105
|
-
{ gasLimit: 21_000n },
|
|
106
|
-
undefined,
|
|
107
|
-
blobInputs,
|
|
108
|
-
true,
|
|
109
|
-
);
|
|
110
|
-
|
|
111
|
-
return receipt.transactionHash;
|
|
112
|
-
}
|
|
17
|
+
/** Makes empty blob inputs for the cancellation tx. */
|
|
18
|
+
protected override makeEmptyBlobInputs(maxFeePerBlobGas: bigint): Required<L1BlobInputs> {
|
|
19
|
+
const blobData = new Uint8Array(131072).fill(0);
|
|
20
|
+
const kzg = Blob.getViemKzgInstance();
|
|
21
|
+
return { blobs: [blobData], kzg, maxFeePerBlobGas };
|
|
113
22
|
}
|
|
114
23
|
}
|
|
115
24
|
|
|
@@ -34,7 +34,7 @@ import type { GasPrice, L1BlobInputs, L1TxRequest, TransactionStats } from './ty
|
|
|
34
34
|
import { getCalldataGasUsage, tryGetCustomErrorNameContractFunction } from './utils.js';
|
|
35
35
|
|
|
36
36
|
export class ReadOnlyL1TxUtils {
|
|
37
|
-
public
|
|
37
|
+
public config: L1TxUtilsConfig;
|
|
38
38
|
protected interrupted = false;
|
|
39
39
|
|
|
40
40
|
constructor(
|
package/src/l1_tx_utils/types.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
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
4
|
|
|
4
|
-
import type { Abi, Address, Hex, TransactionSerializable } from 'viem';
|
|
5
|
+
import type { Abi, Address, Hex, TransactionReceipt, TransactionSerializable } from 'viem';
|
|
5
6
|
|
|
6
7
|
import type { L1TxUtilsConfig } from './config.js';
|
|
7
8
|
|
|
@@ -16,7 +17,7 @@ export type L1GasConfig = Partial<L1TxUtilsConfig> & { gasLimit?: bigint; txTime
|
|
|
16
17
|
|
|
17
18
|
export interface L1BlobInputs {
|
|
18
19
|
blobs: Uint8Array[];
|
|
19
|
-
kzg:
|
|
20
|
+
kzg: BlobKzgInstance;
|
|
20
21
|
maxFeePerBlobGas?: bigint;
|
|
21
22
|
}
|
|
22
23
|
|
|
@@ -46,6 +47,19 @@ export enum TxUtilsState {
|
|
|
46
47
|
MINED,
|
|
47
48
|
}
|
|
48
49
|
|
|
50
|
+
export type L1TxState = {
|
|
51
|
+
txHashes: Hex[];
|
|
52
|
+
cancelTxHashes: Hex[];
|
|
53
|
+
gasLimit: bigint;
|
|
54
|
+
gasPrice: GasPrice;
|
|
55
|
+
txConfig: L1GasConfig;
|
|
56
|
+
request: L1TxRequest;
|
|
57
|
+
status: TxUtilsState;
|
|
58
|
+
nonce: number;
|
|
59
|
+
receipt?: TransactionReceipt;
|
|
60
|
+
blobInputs: L1BlobInputs | undefined;
|
|
61
|
+
};
|
|
62
|
+
|
|
49
63
|
export type SigningCallback = (
|
|
50
64
|
transaction: TransactionSerializable,
|
|
51
65
|
signingAddress: EthAddress,
|