@aztec/ethereum 3.0.0-nightly.20250924 → 3.0.0-nightly.20250926
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 +1 -1
- package/dest/config.d.ts.map +1 -1
- package/dest/config.js +4 -4
- package/dest/contracts/empire_base.d.ts +1 -1
- package/dest/contracts/empire_base.d.ts.map +1 -1
- package/dest/contracts/empire_slashing_proposer.d.ts +1 -1
- package/dest/contracts/empire_slashing_proposer.d.ts.map +1 -1
- package/dest/contracts/fee_asset_handler.d.ts +3 -3
- package/dest/contracts/fee_asset_handler.d.ts.map +1 -1
- package/dest/contracts/governance.js +1 -1
- package/dest/contracts/governance_proposer.d.ts +1 -1
- package/dest/contracts/governance_proposer.d.ts.map +1 -1
- package/dest/contracts/multicall.d.ts +4 -4
- package/dest/contracts/multicall.d.ts.map +1 -1
- package/dest/contracts/rollup.d.ts +3 -3
- package/dest/contracts/rollup.d.ts.map +1 -1
- package/dest/deploy_l1_contracts.d.ts +6 -2
- package/dest/deploy_l1_contracts.d.ts.map +1 -1
- package/dest/deploy_l1_contracts.js +43 -33
- package/dest/index.d.ts +1 -1
- package/dest/index.d.ts.map +1 -1
- package/dest/index.js +1 -1
- package/dest/l1_artifacts.d.ts +26 -1738
- package/dest/l1_artifacts.d.ts.map +1 -1
- package/dest/l1_tx_utils/config.d.ts +56 -0
- package/dest/l1_tx_utils/config.d.ts.map +1 -0
- package/dest/l1_tx_utils/config.js +67 -0
- package/dest/l1_tx_utils/constants.d.ts +6 -0
- package/dest/l1_tx_utils/constants.d.ts.map +1 -0
- package/dest/l1_tx_utils/constants.js +14 -0
- package/dest/l1_tx_utils/factory.d.ts +9 -0
- package/dest/l1_tx_utils/factory.d.ts.map +1 -0
- package/dest/l1_tx_utils/factory.js +14 -0
- package/dest/l1_tx_utils/index.d.ts +9 -0
- package/dest/l1_tx_utils/index.d.ts.map +1 -0
- package/dest/l1_tx_utils/index.js +9 -0
- package/dest/l1_tx_utils/l1_tx_utils.d.ts +80 -0
- package/dest/l1_tx_utils/l1_tx_utils.d.ts.map +1 -0
- package/dest/{l1_tx_utils.js → l1_tx_utils/l1_tx_utils.js} +14 -433
- package/dest/{l1_tx_utils_with_blobs.d.ts → l1_tx_utils/l1_tx_utils_with_blobs.d.ts} +6 -4
- package/dest/l1_tx_utils/l1_tx_utils_with_blobs.d.ts.map +1 -0
- package/dest/{l1_tx_utils_with_blobs.js → l1_tx_utils/l1_tx_utils_with_blobs.js} +2 -1
- package/dest/l1_tx_utils/readonly_l1_tx_utils.d.ts +81 -0
- package/dest/l1_tx_utils/readonly_l1_tx_utils.d.ts.map +1 -0
- package/dest/l1_tx_utils/readonly_l1_tx_utils.js +304 -0
- package/dest/l1_tx_utils/signer.d.ts +4 -0
- package/dest/l1_tx_utils/signer.d.ts.map +1 -0
- package/dest/l1_tx_utils/signer.js +16 -0
- package/dest/l1_tx_utils/types.d.ts +44 -0
- package/dest/l1_tx_utils/types.d.ts.map +1 -0
- package/dest/l1_tx_utils/types.js +9 -0
- package/dest/l1_tx_utils/utils.d.ts +4 -0
- package/dest/l1_tx_utils/utils.d.ts.map +1 -0
- package/dest/l1_tx_utils/utils.js +14 -0
- package/dest/publisher_manager.d.ts +1 -1
- package/dest/publisher_manager.d.ts.map +1 -1
- package/dest/publisher_manager.js +1 -1
- package/dest/test/delayed_tx_utils.d.ts +2 -2
- package/dest/test/delayed_tx_utils.d.ts.map +1 -1
- package/dest/test/delayed_tx_utils.js +2 -2
- package/dest/test/upgrade_utils.js +1 -1
- package/package.json +6 -6
- package/src/config.ts +4 -4
- package/src/contracts/empire_base.ts +1 -1
- package/src/contracts/empire_slashing_proposer.ts +1 -1
- package/src/contracts/fee_asset_handler.ts +1 -1
- package/src/contracts/governance.ts +1 -1
- package/src/contracts/governance_proposer.ts +1 -1
- package/src/contracts/multicall.ts +1 -1
- package/src/contracts/rollup.ts +1 -1
- package/src/deploy_l1_contracts.ts +90 -47
- package/src/index.ts +1 -1
- package/src/l1_tx_utils/config.ts +129 -0
- package/src/l1_tx_utils/constants.ts +18 -0
- package/src/l1_tx_utils/factory.ts +44 -0
- package/src/l1_tx_utils/index.ts +11 -0
- package/src/l1_tx_utils/l1_tx_utils.ts +527 -0
- package/src/{l1_tx_utils_with_blobs.ts → l1_tx_utils/l1_tx_utils_with_blobs.ts} +7 -10
- package/src/l1_tx_utils/readonly_l1_tx_utils.ts +368 -0
- package/src/l1_tx_utils/signer.ts +28 -0
- package/src/l1_tx_utils/types.ts +52 -0
- package/src/l1_tx_utils/utils.ts +16 -0
- package/src/publisher_manager.ts +1 -1
- package/src/test/delayed_tx_utils.ts +2 -2
- package/src/test/upgrade_utils.ts +1 -1
- package/dest/l1_tx_utils.d.ts +0 -252
- package/dest/l1_tx_utils.d.ts.map +0 -1
- package/dest/l1_tx_utils_with_blobs.d.ts.map +0 -1
- package/src/l1_tx_utils.ts +0 -1125
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { type Logger } from '@aztec/foundation/log';
|
|
2
|
+
import { DateProvider } from '@aztec/foundation/timer';
|
|
3
|
+
import { type Abi, type Account, type BlockOverrides, type Hex, type StateOverride } from 'viem';
|
|
4
|
+
import type { ViemClient } from '../types.js';
|
|
5
|
+
import { type L1TxUtilsConfig } from './config.js';
|
|
6
|
+
import type { GasPrice, L1BlobInputs, L1TxRequest, TransactionStats } from './types.js';
|
|
7
|
+
export declare class ReadOnlyL1TxUtils {
|
|
8
|
+
client: ViemClient;
|
|
9
|
+
protected logger: Logger;
|
|
10
|
+
readonly dateProvider: DateProvider;
|
|
11
|
+
protected debugMaxGasLimit: boolean;
|
|
12
|
+
readonly config: L1TxUtilsConfig;
|
|
13
|
+
protected interrupted: boolean;
|
|
14
|
+
constructor(client: ViemClient, logger: Logger | undefined, dateProvider: DateProvider, config?: Partial<L1TxUtilsConfig>, debugMaxGasLimit?: boolean);
|
|
15
|
+
interrupt(): void;
|
|
16
|
+
restart(): void;
|
|
17
|
+
getBlock(): Promise<{
|
|
18
|
+
number: bigint;
|
|
19
|
+
hash: `0x${string}`;
|
|
20
|
+
nonce: `0x${string}`;
|
|
21
|
+
logsBloom: `0x${string}`;
|
|
22
|
+
baseFeePerGas: bigint | null;
|
|
23
|
+
blobGasUsed: bigint;
|
|
24
|
+
difficulty: bigint;
|
|
25
|
+
excessBlobGas: bigint;
|
|
26
|
+
extraData: Hex;
|
|
27
|
+
gasLimit: bigint;
|
|
28
|
+
gasUsed: bigint;
|
|
29
|
+
miner: import("viem").Address;
|
|
30
|
+
mixHash: import("viem").Hash;
|
|
31
|
+
parentBeaconBlockRoot?: `0x${string}` | undefined;
|
|
32
|
+
parentHash: import("viem").Hash;
|
|
33
|
+
receiptsRoot: Hex;
|
|
34
|
+
sealFields: Hex[];
|
|
35
|
+
sha3Uncles: import("viem").Hash;
|
|
36
|
+
size: bigint;
|
|
37
|
+
stateRoot: import("viem").Hash;
|
|
38
|
+
timestamp: bigint;
|
|
39
|
+
totalDifficulty: bigint | null;
|
|
40
|
+
transactionsRoot: import("viem").Hash;
|
|
41
|
+
uncles: import("viem").Hash[];
|
|
42
|
+
withdrawals?: import("viem").Withdrawal[] | undefined | undefined;
|
|
43
|
+
withdrawalsRoot?: `0x${string}` | undefined;
|
|
44
|
+
transactions: `0x${string}`[];
|
|
45
|
+
}>;
|
|
46
|
+
getBlockNumber(): Promise<bigint>;
|
|
47
|
+
/**
|
|
48
|
+
* Gets the current gas price with bounds checking
|
|
49
|
+
*/
|
|
50
|
+
getGasPrice(_gasConfig?: L1TxUtilsConfig, isBlobTx?: boolean, attempt?: number, previousGasPrice?: typeof attempt extends 0 ? never : GasPrice): Promise<GasPrice>;
|
|
51
|
+
/**
|
|
52
|
+
* Estimates gas and adds buffer
|
|
53
|
+
*/
|
|
54
|
+
estimateGas(account: Account | Hex, request: L1TxRequest, _gasConfig?: L1TxUtilsConfig, _blobInputs?: L1BlobInputs): Promise<bigint>;
|
|
55
|
+
getTransactionStats(txHash: string): Promise<TransactionStats | undefined>;
|
|
56
|
+
tryGetErrorFromRevertedTx(data: Hex, args: {
|
|
57
|
+
args: readonly any[];
|
|
58
|
+
functionName: string;
|
|
59
|
+
abi: Abi;
|
|
60
|
+
address: Hex;
|
|
61
|
+
}, blobInputs: (L1BlobInputs & {
|
|
62
|
+
maxFeePerBlobGas: bigint;
|
|
63
|
+
}) | undefined, stateOverride?: StateOverride): Promise<string | undefined>;
|
|
64
|
+
simulate(request: L1TxRequest & {
|
|
65
|
+
gas?: bigint;
|
|
66
|
+
from?: Hex;
|
|
67
|
+
}, blockOverrides?: BlockOverrides<bigint, number>, stateOverrides?: StateOverride, abi?: Abi, _gasConfig?: L1TxUtilsConfig & {
|
|
68
|
+
fallbackGasEstimate?: bigint;
|
|
69
|
+
}): Promise<{
|
|
70
|
+
gasUsed: bigint;
|
|
71
|
+
result: `0x${string}`;
|
|
72
|
+
}>;
|
|
73
|
+
protected _simulate(call: any, blockOverrides: BlockOverrides<bigint, number> | undefined, stateOverrides: StateOverride | undefined, gasConfig: L1TxUtilsConfig & {
|
|
74
|
+
fallbackGasEstimate?: bigint;
|
|
75
|
+
}, abi: Abi): Promise<{
|
|
76
|
+
gasUsed: bigint;
|
|
77
|
+
result: `0x${string}`;
|
|
78
|
+
}>;
|
|
79
|
+
bumpGasLimit(gasLimit: bigint, _gasConfig?: L1TxUtilsConfig): bigint;
|
|
80
|
+
}
|
|
81
|
+
//# sourceMappingURL=readonly_l1_tx_utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"readonly_l1_tx_utils.d.ts","sourceRoot":"","sources":["../../src/l1_tx_utils/readonly_l1_tx_utils.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,304 @@
|
|
|
1
|
+
import { times } from '@aztec/foundation/collection';
|
|
2
|
+
import { createLogger } from '@aztec/foundation/log';
|
|
3
|
+
import { makeBackoff, retry } from '@aztec/foundation/retry';
|
|
4
|
+
import { RollupAbi } from '@aztec/l1-artifacts/RollupAbi';
|
|
5
|
+
import pickBy from 'lodash.pickby';
|
|
6
|
+
import { MethodNotFoundRpcError, MethodNotSupportedRpcError, decodeErrorResult, formatGwei, getContractError, hexToBytes } from 'viem';
|
|
7
|
+
import { defaultL1TxUtilsConfig, l1TxUtilsConfigMappings } from './config.js';
|
|
8
|
+
import { BLOCK_TIME_MS, LARGE_GAS_LIMIT, MIN_BLOB_REPLACEMENT_BUMP_PERCENTAGE, MIN_REPLACEMENT_BUMP_PERCENTAGE, WEI_CONST } from './constants.js';
|
|
9
|
+
import { getCalldataGasUsage, tryGetCustomErrorNameContractFunction } from './utils.js';
|
|
10
|
+
export class ReadOnlyL1TxUtils {
|
|
11
|
+
client;
|
|
12
|
+
logger;
|
|
13
|
+
dateProvider;
|
|
14
|
+
debugMaxGasLimit;
|
|
15
|
+
config;
|
|
16
|
+
interrupted;
|
|
17
|
+
constructor(client, logger = createLogger('ReadOnlyL1TxUtils'), dateProvider, config, debugMaxGasLimit = false){
|
|
18
|
+
this.client = client;
|
|
19
|
+
this.logger = logger;
|
|
20
|
+
this.dateProvider = dateProvider;
|
|
21
|
+
this.debugMaxGasLimit = debugMaxGasLimit;
|
|
22
|
+
this.interrupted = false;
|
|
23
|
+
this.config = {
|
|
24
|
+
...defaultL1TxUtilsConfig,
|
|
25
|
+
...config || {}
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
interrupt() {
|
|
29
|
+
this.interrupted = true;
|
|
30
|
+
}
|
|
31
|
+
restart() {
|
|
32
|
+
this.interrupted = false;
|
|
33
|
+
}
|
|
34
|
+
getBlock() {
|
|
35
|
+
return this.client.getBlock();
|
|
36
|
+
}
|
|
37
|
+
getBlockNumber() {
|
|
38
|
+
return this.client.getBlockNumber();
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Gets the current gas price with bounds checking
|
|
42
|
+
*/ async getGasPrice(_gasConfig, isBlobTx = false, attempt = 0, previousGasPrice) {
|
|
43
|
+
const gasConfig = {
|
|
44
|
+
...this.config,
|
|
45
|
+
..._gasConfig
|
|
46
|
+
};
|
|
47
|
+
const block = await this.client.getBlock({
|
|
48
|
+
blockTag: 'latest'
|
|
49
|
+
});
|
|
50
|
+
const baseFee = block.baseFeePerGas ?? 0n;
|
|
51
|
+
// Get blob base fee if available
|
|
52
|
+
let blobBaseFee = 0n;
|
|
53
|
+
if (isBlobTx) {
|
|
54
|
+
try {
|
|
55
|
+
blobBaseFee = await retry(()=>this.client.getBlobBaseFee(), 'Getting L1 blob base fee', makeBackoff(times(2, ()=>1)), this.logger, true);
|
|
56
|
+
this.logger?.debug('L1 Blob base fee:', {
|
|
57
|
+
blobBaseFee: formatGwei(blobBaseFee)
|
|
58
|
+
});
|
|
59
|
+
} catch {
|
|
60
|
+
this.logger?.warn('Failed to get L1 blob base fee', attempt);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
let priorityFee;
|
|
64
|
+
if (gasConfig.fixedPriorityFeePerGas) {
|
|
65
|
+
this.logger?.debug('Using fixed priority fee per L1 gas', {
|
|
66
|
+
fixedPriorityFeePerGas: gasConfig.fixedPriorityFeePerGas
|
|
67
|
+
});
|
|
68
|
+
// try to maintain precision up to 1000000 wei
|
|
69
|
+
priorityFee = BigInt(gasConfig.fixedPriorityFeePerGas * 1_000_000) * (WEI_CONST / 1_000_000n);
|
|
70
|
+
} else {
|
|
71
|
+
// Get initial priority fee from the network
|
|
72
|
+
priorityFee = await this.client.estimateMaxPriorityFeePerGas();
|
|
73
|
+
}
|
|
74
|
+
let maxFeePerGas = baseFee;
|
|
75
|
+
let maxFeePerBlobGas = blobBaseFee;
|
|
76
|
+
// Bump base fee so it's valid for next blocks if it stalls
|
|
77
|
+
const numBlocks = Math.ceil(gasConfig.stallTimeMs / BLOCK_TIME_MS);
|
|
78
|
+
for(let i = 0; i < numBlocks; i++){
|
|
79
|
+
// each block can go up 12.5% from previous baseFee
|
|
80
|
+
maxFeePerGas = maxFeePerGas * (1_000n + 125n) / 1_000n;
|
|
81
|
+
// same for blob gas fee
|
|
82
|
+
maxFeePerBlobGas = maxFeePerBlobGas * (1_000n + 125n) / 1_000n;
|
|
83
|
+
}
|
|
84
|
+
if (attempt > 0) {
|
|
85
|
+
const configBump = gasConfig.priorityFeeRetryBumpPercentage ?? defaultL1TxUtilsConfig.priorityFeeRetryBumpPercentage;
|
|
86
|
+
// if this is a blob tx, we have to use the blob bump percentage
|
|
87
|
+
const minBumpPercentage = isBlobTx ? MIN_BLOB_REPLACEMENT_BUMP_PERCENTAGE : MIN_REPLACEMENT_BUMP_PERCENTAGE;
|
|
88
|
+
const bumpPercentage = configBump > minBumpPercentage ? configBump : minBumpPercentage;
|
|
89
|
+
// Calculate minimum required fees based on previous attempt
|
|
90
|
+
// multiply by 100 & divide by 100 to maintain some precision
|
|
91
|
+
const minPriorityFee = previousGasPrice.maxPriorityFeePerGas * (100_00n + BigInt(bumpPercentage * 1_00)) / 100_00n;
|
|
92
|
+
const minMaxFee = previousGasPrice.maxFeePerGas * (100_00n + BigInt(bumpPercentage * 1_00)) / 100_00n;
|
|
93
|
+
// Add priority fee to maxFeePerGas
|
|
94
|
+
maxFeePerGas += priorityFee;
|
|
95
|
+
// Use maximum between current network values and minimum required values
|
|
96
|
+
priorityFee = priorityFee > minPriorityFee ? priorityFee : minPriorityFee;
|
|
97
|
+
maxFeePerGas = maxFeePerGas > minMaxFee ? maxFeePerGas : minMaxFee;
|
|
98
|
+
} else {
|
|
99
|
+
// first attempt, just bump priority fee, unless it's a fixed config
|
|
100
|
+
// multiply by 100 & divide by 100 to maintain some precision
|
|
101
|
+
if (!gasConfig.fixedPriorityFeePerGas) {
|
|
102
|
+
priorityFee = priorityFee * (100_00n + BigInt((gasConfig.priorityFeeBumpPercentage || 0) * 1_00)) / 100_00n;
|
|
103
|
+
}
|
|
104
|
+
maxFeePerGas += priorityFee;
|
|
105
|
+
}
|
|
106
|
+
// Ensure we don't exceed maxGwei
|
|
107
|
+
const maxGweiInWei = gasConfig.maxGwei * WEI_CONST;
|
|
108
|
+
maxFeePerGas = maxFeePerGas > maxGweiInWei ? maxGweiInWei : maxFeePerGas;
|
|
109
|
+
// Ensure we don't exceed maxBlobGwei
|
|
110
|
+
if (maxFeePerBlobGas) {
|
|
111
|
+
const maxBlobGweiInWei = gasConfig.maxBlobGwei * WEI_CONST;
|
|
112
|
+
maxFeePerBlobGas = maxFeePerBlobGas > maxBlobGweiInWei ? maxBlobGweiInWei : maxFeePerBlobGas;
|
|
113
|
+
}
|
|
114
|
+
// Ensure priority fee doesn't exceed max fee
|
|
115
|
+
const maxPriorityFeePerGas = priorityFee > maxFeePerGas ? maxFeePerGas : priorityFee;
|
|
116
|
+
if (attempt > 0 && previousGasPrice?.maxFeePerBlobGas) {
|
|
117
|
+
const bumpPercentage = gasConfig.priorityFeeRetryBumpPercentage > MIN_BLOB_REPLACEMENT_BUMP_PERCENTAGE ? gasConfig.priorityFeeRetryBumpPercentage : MIN_BLOB_REPLACEMENT_BUMP_PERCENTAGE;
|
|
118
|
+
// calculate min blob fee based on previous attempt
|
|
119
|
+
const minBlobFee = previousGasPrice.maxFeePerBlobGas * (100_00n + BigInt(bumpPercentage * 1_00)) / 100_00n;
|
|
120
|
+
// use max between current network values and min required values
|
|
121
|
+
maxFeePerBlobGas = maxFeePerBlobGas > minBlobFee ? maxFeePerBlobGas : minBlobFee;
|
|
122
|
+
}
|
|
123
|
+
this.logger?.debug(`Computed L1 gas price`, {
|
|
124
|
+
attempt,
|
|
125
|
+
baseFee: formatGwei(baseFee),
|
|
126
|
+
maxFeePerGas: formatGwei(maxFeePerGas),
|
|
127
|
+
maxPriorityFeePerGas: formatGwei(maxPriorityFeePerGas),
|
|
128
|
+
...maxFeePerBlobGas && {
|
|
129
|
+
maxFeePerBlobGas: formatGwei(maxFeePerBlobGas)
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
return {
|
|
133
|
+
maxFeePerGas,
|
|
134
|
+
maxPriorityFeePerGas,
|
|
135
|
+
...maxFeePerBlobGas && {
|
|
136
|
+
maxFeePerBlobGas: maxFeePerBlobGas
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Estimates gas and adds buffer
|
|
142
|
+
*/ async estimateGas(account, request, _gasConfig, _blobInputs) {
|
|
143
|
+
const gasConfig = {
|
|
144
|
+
...this.config,
|
|
145
|
+
..._gasConfig
|
|
146
|
+
};
|
|
147
|
+
let initialEstimate = 0n;
|
|
148
|
+
if (_blobInputs) {
|
|
149
|
+
// @note requests with blobs also require maxFeePerBlobGas to be set
|
|
150
|
+
const gasPrice = await this.getGasPrice(gasConfig, true, 0);
|
|
151
|
+
initialEstimate = await this.client.estimateGas({
|
|
152
|
+
account,
|
|
153
|
+
...request,
|
|
154
|
+
..._blobInputs,
|
|
155
|
+
maxFeePerBlobGas: gasPrice.maxFeePerBlobGas,
|
|
156
|
+
gas: LARGE_GAS_LIMIT
|
|
157
|
+
});
|
|
158
|
+
this.logger?.debug(`L1 gas used in estimateGas by blob tx: ${initialEstimate}`);
|
|
159
|
+
} else {
|
|
160
|
+
initialEstimate = await this.client.estimateGas({
|
|
161
|
+
account,
|
|
162
|
+
...request,
|
|
163
|
+
gas: LARGE_GAS_LIMIT
|
|
164
|
+
});
|
|
165
|
+
this.logger?.debug(`L1 gas used in estimateGas by non-blob tx: ${initialEstimate}`);
|
|
166
|
+
}
|
|
167
|
+
// Add buffer based on either fixed amount or percentage
|
|
168
|
+
const withBuffer = this.bumpGasLimit(initialEstimate, gasConfig);
|
|
169
|
+
return withBuffer;
|
|
170
|
+
}
|
|
171
|
+
async getTransactionStats(txHash) {
|
|
172
|
+
const tx = await this.client.getTransaction({
|
|
173
|
+
hash: txHash
|
|
174
|
+
});
|
|
175
|
+
if (!tx) {
|
|
176
|
+
return undefined;
|
|
177
|
+
}
|
|
178
|
+
const calldata = hexToBytes(tx.input);
|
|
179
|
+
return {
|
|
180
|
+
sender: tx.from.toString(),
|
|
181
|
+
transactionHash: tx.hash,
|
|
182
|
+
calldataSize: calldata.length,
|
|
183
|
+
calldataGas: getCalldataGasUsage(calldata)
|
|
184
|
+
};
|
|
185
|
+
}
|
|
186
|
+
async tryGetErrorFromRevertedTx(data, args, blobInputs, stateOverride = []) {
|
|
187
|
+
try {
|
|
188
|
+
await this.client.simulateContract({
|
|
189
|
+
...args,
|
|
190
|
+
account: this.client.account,
|
|
191
|
+
stateOverride
|
|
192
|
+
});
|
|
193
|
+
this.logger?.trace('Simulated blob tx', {
|
|
194
|
+
blobInputs
|
|
195
|
+
});
|
|
196
|
+
// If the above passes, we have a blob error. We cannot simulate blob txs, and failed txs no longer throw errors.
|
|
197
|
+
// Strangely, the only way to throw the revert reason as an error and provide blobs is prepareTransactionRequest.
|
|
198
|
+
// See: https://github.com/wevm/viem/issues/2075
|
|
199
|
+
// This throws a EstimateGasExecutionError with the custom error information:
|
|
200
|
+
const request = blobInputs ? {
|
|
201
|
+
account: this.client.account,
|
|
202
|
+
to: args.address,
|
|
203
|
+
data,
|
|
204
|
+
blobs: blobInputs.blobs,
|
|
205
|
+
kzg: blobInputs.kzg,
|
|
206
|
+
maxFeePerBlobGas: blobInputs.maxFeePerBlobGas
|
|
207
|
+
} : {
|
|
208
|
+
account: this.client.account,
|
|
209
|
+
to: args.address,
|
|
210
|
+
data
|
|
211
|
+
};
|
|
212
|
+
this.logger?.trace('Preparing tx', {
|
|
213
|
+
request
|
|
214
|
+
});
|
|
215
|
+
await this.client.prepareTransactionRequest(request);
|
|
216
|
+
this.logger?.trace('Prepared tx');
|
|
217
|
+
return undefined;
|
|
218
|
+
} catch (simulationErr) {
|
|
219
|
+
// If we don't have a ContractFunctionExecutionError, we have a blob related error => use getContractError to get the error msg.
|
|
220
|
+
const contractErr = simulationErr.name === 'ContractFunctionExecutionError' ? simulationErr : getContractError(simulationErr, {
|
|
221
|
+
args: [],
|
|
222
|
+
abi: args.abi,
|
|
223
|
+
functionName: args.functionName,
|
|
224
|
+
address: args.address
|
|
225
|
+
});
|
|
226
|
+
if (contractErr.name === 'ContractFunctionExecutionError') {
|
|
227
|
+
const execErr = contractErr;
|
|
228
|
+
return tryGetCustomErrorNameContractFunction(execErr);
|
|
229
|
+
}
|
|
230
|
+
this.logger?.error(`Error getting error from simulation`, simulationErr);
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
async simulate(request, blockOverrides = {}, stateOverrides = [], abi = RollupAbi, _gasConfig) {
|
|
234
|
+
const gasConfig = {
|
|
235
|
+
...this.config,
|
|
236
|
+
..._gasConfig
|
|
237
|
+
};
|
|
238
|
+
const call = {
|
|
239
|
+
to: request.to,
|
|
240
|
+
data: request.data,
|
|
241
|
+
...request.from && {
|
|
242
|
+
from: request.from
|
|
243
|
+
}
|
|
244
|
+
};
|
|
245
|
+
return await this._simulate(call, blockOverrides, stateOverrides, gasConfig, abi);
|
|
246
|
+
}
|
|
247
|
+
async _simulate(call, blockOverrides = {}, stateOverrides = [], gasConfig, abi) {
|
|
248
|
+
try {
|
|
249
|
+
const result = await this.client.simulateBlocks({
|
|
250
|
+
validation: false,
|
|
251
|
+
blocks: [
|
|
252
|
+
{
|
|
253
|
+
blockOverrides,
|
|
254
|
+
stateOverrides,
|
|
255
|
+
calls: [
|
|
256
|
+
call
|
|
257
|
+
]
|
|
258
|
+
}
|
|
259
|
+
]
|
|
260
|
+
});
|
|
261
|
+
if (result[0].calls[0].status === 'failure') {
|
|
262
|
+
this.logger?.error('L1 transaction simulation failed', result[0].calls[0].error);
|
|
263
|
+
const decodedError = decodeErrorResult({
|
|
264
|
+
abi,
|
|
265
|
+
data: result[0].calls[0].data
|
|
266
|
+
});
|
|
267
|
+
throw new Error(`L1 transaction simulation failed with error ${decodedError.errorName}(${decodedError.args?.join(',')})`);
|
|
268
|
+
}
|
|
269
|
+
this.logger?.debug(`L1 transaction simulation succeeded`, {
|
|
270
|
+
...result[0].calls[0]
|
|
271
|
+
});
|
|
272
|
+
return {
|
|
273
|
+
gasUsed: result[0].gasUsed,
|
|
274
|
+
result: result[0].calls[0].data
|
|
275
|
+
};
|
|
276
|
+
} catch (err) {
|
|
277
|
+
if (err instanceof MethodNotFoundRpcError || err instanceof MethodNotSupportedRpcError) {
|
|
278
|
+
if (gasConfig.fallbackGasEstimate) {
|
|
279
|
+
this.logger?.warn(`Node does not support eth_simulateV1 API. Using fallback gas estimate: ${gasConfig.fallbackGasEstimate}`);
|
|
280
|
+
return {
|
|
281
|
+
gasUsed: gasConfig.fallbackGasEstimate,
|
|
282
|
+
result: '0x'
|
|
283
|
+
};
|
|
284
|
+
}
|
|
285
|
+
this.logger?.error('Node does not support eth_simulateV1 API');
|
|
286
|
+
}
|
|
287
|
+
throw err;
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
bumpGasLimit(gasLimit, _gasConfig) {
|
|
291
|
+
const gasConfig = {
|
|
292
|
+
...this.config,
|
|
293
|
+
..._gasConfig
|
|
294
|
+
};
|
|
295
|
+
const bumpedGasLimit = gasLimit + gasLimit * BigInt((gasConfig?.gasLimitBufferPercentage || 0) * 1_00) / 100_00n;
|
|
296
|
+
const cleanGasConfig = pickBy(gasConfig, (_, key)=>key in l1TxUtilsConfigMappings);
|
|
297
|
+
this.logger?.debug('Bumping gas limit', {
|
|
298
|
+
gasLimit,
|
|
299
|
+
gasConfig: cleanGasConfig,
|
|
300
|
+
bumpedGasLimit
|
|
301
|
+
});
|
|
302
|
+
return bumpedGasLimit;
|
|
303
|
+
}
|
|
304
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"signer.d.ts","sourceRoot":"","sources":["../../src/l1_tx_utils/signer.ts"],"names":[],"mappings":"AAGA,OAAO,EAAgC,KAAK,YAAY,EAAoB,MAAM,MAAM,CAAC;AAEzF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAElD,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,YAAY,mBAoBpD"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { parseTransaction } from 'viem';
|
|
2
|
+
export function createViemSigner(client) {
|
|
3
|
+
const signer = async (tx, _address)=>{
|
|
4
|
+
const signedTx = await client.signTransaction(tx);
|
|
5
|
+
const parsed = parseTransaction(signedTx);
|
|
6
|
+
if (!parsed.r || !parsed.s || parsed.yParity !== 0 && parsed.yParity !== 1) {
|
|
7
|
+
throw new Error('Failed to extract signature from viem signed transaction');
|
|
8
|
+
}
|
|
9
|
+
return {
|
|
10
|
+
r: parsed.r,
|
|
11
|
+
s: parsed.s,
|
|
12
|
+
yParity: parsed.yParity
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
return signer;
|
|
16
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
2
|
+
import type { ViemTransactionSignature } from '@aztec/foundation/eth-signature';
|
|
3
|
+
import type { Abi, Address, Hex, TransactionSerializable } from 'viem';
|
|
4
|
+
import type { L1TxUtilsConfig } from './config.js';
|
|
5
|
+
export interface L1TxRequest {
|
|
6
|
+
to: Address | null;
|
|
7
|
+
data?: Hex;
|
|
8
|
+
value?: bigint;
|
|
9
|
+
abi?: Abi;
|
|
10
|
+
}
|
|
11
|
+
export type L1GasConfig = Partial<L1TxUtilsConfig> & {
|
|
12
|
+
gasLimit?: bigint;
|
|
13
|
+
txTimeoutAt?: Date;
|
|
14
|
+
};
|
|
15
|
+
export interface L1BlobInputs {
|
|
16
|
+
blobs: Uint8Array[];
|
|
17
|
+
kzg: any;
|
|
18
|
+
maxFeePerBlobGas?: bigint;
|
|
19
|
+
}
|
|
20
|
+
export interface GasPrice {
|
|
21
|
+
maxFeePerGas: bigint;
|
|
22
|
+
maxPriorityFeePerGas: bigint;
|
|
23
|
+
maxFeePerBlobGas?: bigint;
|
|
24
|
+
}
|
|
25
|
+
export type TransactionStats = {
|
|
26
|
+
/** Address of the sender. */
|
|
27
|
+
sender: string;
|
|
28
|
+
/** Hash of the transaction. */
|
|
29
|
+
transactionHash: string;
|
|
30
|
+
/** Size in bytes of the tx calldata */
|
|
31
|
+
calldataSize: number;
|
|
32
|
+
/** Gas required to pay for the calldata inclusion (depends on size and number of zeros) */
|
|
33
|
+
calldataGas: number;
|
|
34
|
+
};
|
|
35
|
+
export declare enum TxUtilsState {
|
|
36
|
+
IDLE = 0,
|
|
37
|
+
SENT = 1,
|
|
38
|
+
SPEED_UP = 2,
|
|
39
|
+
CANCELLED = 3,
|
|
40
|
+
NOT_MINED = 4,
|
|
41
|
+
MINED = 5
|
|
42
|
+
}
|
|
43
|
+
export type SigningCallback = (transaction: TransactionSerializable, signingAddress: EthAddress) => Promise<ViemTransactionSignature>;
|
|
44
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +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,CAAC,EAAE,MAAM,CAAC;IAAC,WAAW,CAAC,EAAE,IAAI,CAAA;CAAE,CAAC;AAE/F,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,UAAU,EAAE,CAAC;IACpB,GAAG,EAAE,GAAG,CAAC;IACT,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED,MAAM,WAAW,QAAQ;IACvB,YAAY,EAAE,MAAM,CAAC;IACrB,oBAAoB,EAAE,MAAM,CAAC;IAC7B,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED,MAAM,MAAM,gBAAgB,GAAG;IAC7B,6BAA6B;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,+BAA+B;IAC/B,eAAe,EAAE,MAAM,CAAC;IACxB,uCAAuC;IACvC,YAAY,EAAE,MAAM,CAAC;IACrB,4FAA4F;IAC5F,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,oBAAY,YAAY;IACtB,IAAI,IAAA;IACJ,IAAI,IAAA;IACJ,QAAQ,IAAA;IACR,SAAS,IAAA;IACT,SAAS,IAAA;IACT,KAAK,IAAA;CACN;AAED,MAAM,MAAM,eAAe,GAAG,CAC5B,WAAW,EAAE,uBAAuB,EACpC,cAAc,EAAE,UAAU,KACvB,OAAO,CAAC,wBAAwB,CAAC,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export var TxUtilsState = /*#__PURE__*/ function(TxUtilsState) {
|
|
2
|
+
TxUtilsState[TxUtilsState["IDLE"] = 0] = "IDLE";
|
|
3
|
+
TxUtilsState[TxUtilsState["SENT"] = 1] = "SENT";
|
|
4
|
+
TxUtilsState[TxUtilsState["SPEED_UP"] = 2] = "SPEED_UP";
|
|
5
|
+
TxUtilsState[TxUtilsState["CANCELLED"] = 3] = "CANCELLED";
|
|
6
|
+
TxUtilsState[TxUtilsState["NOT_MINED"] = 4] = "NOT_MINED";
|
|
7
|
+
TxUtilsState[TxUtilsState["MINED"] = 5] = "MINED";
|
|
8
|
+
return TxUtilsState;
|
|
9
|
+
}({});
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { ContractFunctionExecutionError } from 'viem';
|
|
2
|
+
export declare function tryGetCustomErrorNameContractFunction(err: ContractFunctionExecutionError): string;
|
|
3
|
+
export declare function getCalldataGasUsage(data: Uint8Array): number;
|
|
4
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/l1_tx_utils/utils.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,MAAM,CAAC;AAE3D,wBAAgB,qCAAqC,CAAC,GAAG,EAAE,8BAA8B,UAExF;AAOD,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,UAAU,UAEnD"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { compactArray } from '@aztec/foundation/collection';
|
|
2
|
+
export function tryGetCustomErrorNameContractFunction(err) {
|
|
3
|
+
return compactArray([
|
|
4
|
+
err.shortMessage,
|
|
5
|
+
...(err.metaMessages ?? []).slice(0, 2).map((s)=>s.trim())
|
|
6
|
+
]).join(' ');
|
|
7
|
+
}
|
|
8
|
+
/*
|
|
9
|
+
* Returns cost of calldata usage in Ethereum.
|
|
10
|
+
* @param data - Calldata.
|
|
11
|
+
* @returns 4 for each zero byte, 16 for each nonzero.
|
|
12
|
+
*/ export function getCalldataGasUsage(data) {
|
|
13
|
+
return data.filter((byte)=>byte === 0).length * 4 + data.filter((byte)=>byte !== 0).length * 16;
|
|
14
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { L1TxUtils } from './l1_tx_utils.js';
|
|
1
|
+
import { L1TxUtils } from './l1_tx_utils/index.js';
|
|
2
2
|
export type PublisherFilter<UtilsType extends L1TxUtils> = (utils: UtilsType) => boolean;
|
|
3
3
|
export declare class PublisherManager<UtilsType extends L1TxUtils = L1TxUtils> {
|
|
4
4
|
private publishers;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"publisher_manager.d.ts","sourceRoot":"","sources":["../src/publisher_manager.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAgB,MAAM,
|
|
1
|
+
{"version":3,"file":"publisher_manager.d.ts","sourceRoot":"","sources":["../src/publisher_manager.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAgB,MAAM,wBAAwB,CAAC;AAKjE,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,CAAoC;IAC/C,OAAO,CAAC,MAAM,CAA4C;gBAGhD,UAAU,EAAE,SAAS,EAAE,EAC/B,MAAM,EAAE;QAAE,2BAA2B,CAAC,EAAE,OAAO,CAAA;KAAE;IAatC,qBAAqB,CAAC,MAAM,GAAE,eAAe,CAAC,SAAS,CAAc,GAAG,OAAO,CAAC,SAAS,CAAC;IAyChG,SAAS;CAGjB"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { pick } from '@aztec/foundation/collection';
|
|
2
2
|
import { createLogger } from '@aztec/foundation/log';
|
|
3
|
-
import { TxUtilsState } from './l1_tx_utils.js';
|
|
3
|
+
import { TxUtilsState } from './l1_tx_utils/index.js';
|
|
4
4
|
const sortOrder = [
|
|
5
5
|
TxUtilsState.IDLE,
|
|
6
6
|
TxUtilsState.MINED
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type Logger } from '@aztec/foundation/log';
|
|
2
2
|
import { DateProvider } from '@aztec/foundation/timer';
|
|
3
|
-
import { type L1TxUtilsConfig } from '../l1_tx_utils.js';
|
|
4
|
-
import { L1TxUtilsWithBlobs } from '../l1_tx_utils_with_blobs.js';
|
|
3
|
+
import { type L1TxUtilsConfig } from '../l1_tx_utils/index.js';
|
|
4
|
+
import { L1TxUtilsWithBlobs } from '../l1_tx_utils/l1_tx_utils_with_blobs.js';
|
|
5
5
|
import type { ExtendedViemWalletClient } from '../types.js';
|
|
6
6
|
import { type Delayer } from './tx_delayer.js';
|
|
7
7
|
export declare class DelayedTxUtils extends L1TxUtilsWithBlobs {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"delayed_tx_utils.d.ts","sourceRoot":"","sources":["../../src/test/delayed_tx_utils.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,MAAM,EAAgB,MAAM,uBAAuB,CAAC;AAClE,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAEvD,OAAO,EAAE,KAAK,eAAe,EAAoB,MAAM,
|
|
1
|
+
{"version":3,"file":"delayed_tx_utils.d.ts","sourceRoot":"","sources":["../../src/test/delayed_tx_utils.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,MAAM,EAAgB,MAAM,uBAAuB,CAAC;AAClE,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAEvD,OAAO,EAAE,KAAK,eAAe,EAAoB,MAAM,yBAAyB,CAAC;AACjF,OAAO,EAAE,kBAAkB,EAAE,MAAM,0CAA0C,CAAC;AAC9E,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAC;AAC5D,OAAO,EAAE,KAAK,OAAO,EAAe,MAAM,iBAAiB,CAAC;AAE5D,qBAAa,cAAe,SAAQ,kBAAkB;IAC7C,OAAO,EAAE,OAAO,GAAG,SAAS,CAAC;WAEtB,aAAa,CACzB,SAAS,EAAE,kBAAkB,EAC7B,oBAAoB,EAAE,MAAM,EAC5B,MAAM,EAAE,wBAAwB;IAW3B,aAAa,CAAC,oBAAoB,EAAE,MAAM;CAOlD;AAED,wBAAgB,oCAAoC,CAClD,MAAM,EAAE,wBAAwB,EAChC,MAAM,GAAE,MAAkC,EAC1C,YAAY,GAAE,YAAiC,EAC/C,MAAM,CAAC,EAAE,OAAO,CAAC,eAAe,CAAC,EACjC,gBAAgB,GAAE,OAAe,kBAWlC"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
2
2
|
import { createLogger } from '@aztec/foundation/log';
|
|
3
3
|
import { DateProvider } from '@aztec/foundation/timer';
|
|
4
|
-
import { createViemSigner } from '../l1_tx_utils.js';
|
|
5
|
-
import { L1TxUtilsWithBlobs } from '../l1_tx_utils_with_blobs.js';
|
|
4
|
+
import { createViemSigner } from '../l1_tx_utils/index.js';
|
|
5
|
+
import { L1TxUtilsWithBlobs } from '../l1_tx_utils/l1_tx_utils_with_blobs.js';
|
|
6
6
|
import { withDelayer } from './tx_delayer.js';
|
|
7
7
|
export class DelayedTxUtils extends L1TxUtilsWithBlobs {
|
|
8
8
|
delayer;
|
|
@@ -3,7 +3,7 @@ import { GovernanceAbi } from '@aztec/l1-artifacts/GovernanceAbi';
|
|
|
3
3
|
import { TestERC20Abi as StakingAssetAbi } from '@aztec/l1-artifacts/TestERC20Abi';
|
|
4
4
|
import { getContract } from 'viem';
|
|
5
5
|
import { extractProposalIdFromLogs } from '../contracts/governance.js';
|
|
6
|
-
import { createL1TxUtilsFromViemWallet } from '../l1_tx_utils.js';
|
|
6
|
+
import { createL1TxUtilsFromViemWallet } from '../l1_tx_utils/index.js';
|
|
7
7
|
import { EthCheatCodes } from './eth_cheat_codes.js';
|
|
8
8
|
export async function executeGovernanceProposal(proposalId, governance, voteAmount, privateKey, l1Client, rpcUrls, logger) {
|
|
9
9
|
const proposal = await governance.read.getProposal([
|
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.20250926",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./dest/index.js",
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"./contracts": "./dest/contracts/index.js",
|
|
9
9
|
"./deploy-l1-contracts": "./dest/deploy_l1_contracts.js",
|
|
10
10
|
"./l1-contract-addresses": "./dest/l1_contract_addresses.js",
|
|
11
|
-
"./l1-tx-utils-with-blobs": "./dest/l1_tx_utils_with_blobs.js",
|
|
11
|
+
"./l1-tx-utils-with-blobs": "./dest/l1_tx_utils/l1_tx_utils_with_blobs.js",
|
|
12
12
|
"./utils": "./dest/utils.js"
|
|
13
13
|
},
|
|
14
14
|
"typedocOptions": {
|
|
@@ -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.20250926",
|
|
35
|
+
"@aztec/constants": "3.0.0-nightly.20250926",
|
|
36
|
+
"@aztec/foundation": "3.0.0-nightly.20250926",
|
|
37
|
+
"@aztec/l1-artifacts": "3.0.0-nightly.20250926",
|
|
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
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
} from '@aztec/foundation/config';
|
|
11
11
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
12
12
|
|
|
13
|
-
import { type L1TxUtilsConfig, l1TxUtilsConfigMappings } from './l1_tx_utils.js';
|
|
13
|
+
import { type L1TxUtilsConfig, l1TxUtilsConfigMappings } from './l1_tx_utils/index.js';
|
|
14
14
|
|
|
15
15
|
export type GenesisStateConfig = {
|
|
16
16
|
/** Whether to populate the genesis state with initial fee juice for the test accounts */
|
|
@@ -232,11 +232,11 @@ const TestnetEntryQueueConfig = {
|
|
|
232
232
|
};
|
|
233
233
|
|
|
234
234
|
const StagingIgnitionEntryQueueConfig = {
|
|
235
|
-
bootstrapValidatorSetSize:
|
|
236
|
-
bootstrapFlushSize:
|
|
235
|
+
bootstrapValidatorSetSize: 24n,
|
|
236
|
+
bootstrapFlushSize: 24n,
|
|
237
237
|
normalFlushSizeMin: 1n,
|
|
238
238
|
normalFlushSizeQuotient: 2048n,
|
|
239
|
-
maxQueueFlushSize:
|
|
239
|
+
maxQueueFlushSize: 24n,
|
|
240
240
|
};
|
|
241
241
|
|
|
242
242
|
export const getEntryQueueConfig = (networkName: NetworkNames) => {
|
|
@@ -4,7 +4,7 @@ import { EmpireBaseAbi } from '@aztec/l1-artifacts/EmpireBaseAbi';
|
|
|
4
4
|
|
|
5
5
|
import { type Hex, type TypedDataDefinition, encodeFunctionData } from 'viem';
|
|
6
6
|
|
|
7
|
-
import type { L1TxRequest } from '../l1_tx_utils.js';
|
|
7
|
+
import type { L1TxRequest } from '../l1_tx_utils/index.js';
|
|
8
8
|
|
|
9
9
|
export interface IEmpireBase {
|
|
10
10
|
get address(): EthAddress;
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
getContract,
|
|
15
15
|
} from 'viem';
|
|
16
16
|
|
|
17
|
-
import type { L1TxRequest, L1TxUtils } from '../l1_tx_utils.js';
|
|
17
|
+
import type { L1TxRequest, L1TxUtils } from '../l1_tx_utils/index.js';
|
|
18
18
|
import type { ViemClient } from '../types.js';
|
|
19
19
|
import { FormattedViemError, tryExtractEvent } from '../utils.js';
|
|
20
20
|
import { type IEmpireBase, encodeSignal, encodeSignalWithSignature, signSignalWithSig } from './empire_base.js';
|
|
@@ -3,7 +3,7 @@ import { FeeAssetHandlerAbi } from '@aztec/l1-artifacts/FeeAssetHandlerAbi';
|
|
|
3
3
|
|
|
4
4
|
import { type Hex, encodeFunctionData, getContract } from 'viem';
|
|
5
5
|
|
|
6
|
-
import type { L1TxUtils } from '../l1_tx_utils.js';
|
|
6
|
+
import type { L1TxUtils } from '../l1_tx_utils/index.js';
|
|
7
7
|
|
|
8
8
|
export class FeeAssetHandlerContract {
|
|
9
9
|
public address: EthAddress;
|