@aztec/ethereum 3.0.0-nightly.20250925 → 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 +1 -1
- 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 +1 -1
- package/dest/deploy_l1_contracts.d.ts.map +1 -1
- package/dest/deploy_l1_contracts.js +1 -1
- 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 +1 -1
- 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 +1 -1
- 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
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
getContract,
|
|
12
12
|
} from 'viem';
|
|
13
13
|
|
|
14
|
-
import type { GasPrice, L1TxRequest, L1TxUtils } from '../l1_tx_utils.js';
|
|
14
|
+
import type { GasPrice, L1TxRequest, L1TxUtils } from '../l1_tx_utils/index.js';
|
|
15
15
|
import type { ViemClient } from '../types.js';
|
|
16
16
|
import { type IEmpireBase, encodeSignal, encodeSignalWithSignature, signSignalWithSig } from './empire_base.js';
|
|
17
17
|
import { extractProposalIdFromLogs } from './governance.js';
|
|
@@ -4,7 +4,7 @@ import type { Logger } from '@aztec/foundation/log';
|
|
|
4
4
|
|
|
5
5
|
import { type EncodeFunctionDataParameters, type Hex, encodeFunctionData, multicall3Abi } from 'viem';
|
|
6
6
|
|
|
7
|
-
import type { L1BlobInputs, L1GasConfig, L1TxRequest, L1TxUtils } from '../l1_tx_utils.js';
|
|
7
|
+
import type { L1BlobInputs, L1GasConfig, L1TxRequest, L1TxUtils } from '../l1_tx_utils/index.js';
|
|
8
8
|
import type { ExtendedViemWalletClient } from '../types.js';
|
|
9
9
|
import { FormattedViemError, formatViemError } from '../utils.js';
|
|
10
10
|
import { RollupContract } from './rollup.js';
|
package/src/contracts/rollup.ts
CHANGED
|
@@ -21,7 +21,7 @@ import { getPublicClient } from '../client.js';
|
|
|
21
21
|
import type { DeployL1ContractsReturnType } from '../deploy_l1_contracts.js';
|
|
22
22
|
import type { L1ContractAddresses } from '../l1_contract_addresses.js';
|
|
23
23
|
import type { L1ReaderConfig } from '../l1_reader.js';
|
|
24
|
-
import type { L1TxRequest, L1TxUtils } from '../l1_tx_utils.js';
|
|
24
|
+
import type { L1TxRequest, L1TxUtils } from '../l1_tx_utils/index.js';
|
|
25
25
|
import type { ViemClient } from '../types.js';
|
|
26
26
|
import { formatViemError } from '../utils.js';
|
|
27
27
|
import { EmpireSlashingProposerContract } from './empire_slashing_proposer.js';
|
|
@@ -69,7 +69,7 @@ import {
|
|
|
69
69
|
type L1TxUtilsConfig,
|
|
70
70
|
createL1TxUtilsFromViemWallet,
|
|
71
71
|
getL1TxUtilsConfigEnvVars,
|
|
72
|
-
} from './l1_tx_utils.js';
|
|
72
|
+
} from './l1_tx_utils/index.js';
|
|
73
73
|
import type { ExtendedViemWalletClient } from './types.js';
|
|
74
74
|
import { formatViemError } from './utils.js';
|
|
75
75
|
import { ZK_PASSPORT_DOMAIN, ZK_PASSPORT_SCOPE, ZK_PASSPORT_VERIFIER_ADDRESS } from './zkPassportVerifierAddress.js';
|
package/src/index.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export * from './constants.js';
|
|
2
2
|
export * from './deploy_l1_contracts.js';
|
|
3
3
|
export * from './chain.js';
|
|
4
|
-
export * from './l1_tx_utils.js';
|
|
4
|
+
export * from './l1_tx_utils/index.js';
|
|
5
5
|
export * from './l1_contract_addresses.js';
|
|
6
6
|
export * from './l1_reader.js';
|
|
7
7
|
export * from './utils.js';
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import {
|
|
2
|
+
type ConfigMappingsType,
|
|
3
|
+
bigintConfigHelper,
|
|
4
|
+
booleanConfigHelper,
|
|
5
|
+
getConfigFromMappings,
|
|
6
|
+
getDefaultConfig,
|
|
7
|
+
numberConfigHelper,
|
|
8
|
+
} from '@aztec/foundation/config';
|
|
9
|
+
|
|
10
|
+
export interface L1TxUtilsConfig {
|
|
11
|
+
/**
|
|
12
|
+
* How much to increase calculated gas limit.
|
|
13
|
+
*/
|
|
14
|
+
gasLimitBufferPercentage?: number;
|
|
15
|
+
/**
|
|
16
|
+
* Maximum gas price in gwei
|
|
17
|
+
*/
|
|
18
|
+
maxGwei?: bigint;
|
|
19
|
+
/**
|
|
20
|
+
* Maximum blob fee per gas in gwei
|
|
21
|
+
*/
|
|
22
|
+
maxBlobGwei?: bigint;
|
|
23
|
+
/**
|
|
24
|
+
* Priority fee bump percentage
|
|
25
|
+
*/
|
|
26
|
+
priorityFeeBumpPercentage?: number;
|
|
27
|
+
/**
|
|
28
|
+
* How much to increase priority fee by each attempt (percentage)
|
|
29
|
+
*/
|
|
30
|
+
priorityFeeRetryBumpPercentage?: number;
|
|
31
|
+
/**
|
|
32
|
+
* Fixed priority fee per gas in Gwei. Overrides any priority fee bump percentage config
|
|
33
|
+
*/
|
|
34
|
+
fixedPriorityFeePerGas?: number;
|
|
35
|
+
/**
|
|
36
|
+
* Maximum number of speed-up attempts
|
|
37
|
+
*/
|
|
38
|
+
maxAttempts?: number;
|
|
39
|
+
/**
|
|
40
|
+
* How often to check tx status
|
|
41
|
+
*/
|
|
42
|
+
checkIntervalMs?: number;
|
|
43
|
+
/**
|
|
44
|
+
* How long before considering tx stalled
|
|
45
|
+
*/
|
|
46
|
+
stallTimeMs?: number;
|
|
47
|
+
/**
|
|
48
|
+
* How long to wait for a tx to be mined before giving up
|
|
49
|
+
*/
|
|
50
|
+
txTimeoutMs?: number;
|
|
51
|
+
/**
|
|
52
|
+
* How many attempts will be done to get a tx after it was sent?
|
|
53
|
+
* First attempt is done at 1s, second at 2s, third at 3s, etc.
|
|
54
|
+
*/
|
|
55
|
+
txPropagationMaxQueryAttempts?: number;
|
|
56
|
+
/**
|
|
57
|
+
* Whether to attempt to cancel a tx if it's not mined after txTimeoutMs
|
|
58
|
+
*/
|
|
59
|
+
cancelTxOnTimeout?: boolean;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export const l1TxUtilsConfigMappings: ConfigMappingsType<L1TxUtilsConfig> = {
|
|
63
|
+
gasLimitBufferPercentage: {
|
|
64
|
+
description: 'How much to increase calculated gas limit by (percentage)',
|
|
65
|
+
env: 'L1_GAS_LIMIT_BUFFER_PERCENTAGE',
|
|
66
|
+
...numberConfigHelper(20),
|
|
67
|
+
},
|
|
68
|
+
maxGwei: {
|
|
69
|
+
description: 'Maximum gas price in gwei',
|
|
70
|
+
env: 'L1_GAS_PRICE_MAX',
|
|
71
|
+
...bigintConfigHelper(500n),
|
|
72
|
+
},
|
|
73
|
+
maxBlobGwei: {
|
|
74
|
+
description: 'Maximum blob fee per gas in gwei',
|
|
75
|
+
env: 'L1_BLOB_FEE_PER_GAS_MAX',
|
|
76
|
+
...bigintConfigHelper(1_500n),
|
|
77
|
+
},
|
|
78
|
+
priorityFeeBumpPercentage: {
|
|
79
|
+
description: 'How much to increase priority fee by each attempt (percentage)',
|
|
80
|
+
env: 'L1_PRIORITY_FEE_BUMP_PERCENTAGE',
|
|
81
|
+
...numberConfigHelper(20),
|
|
82
|
+
},
|
|
83
|
+
priorityFeeRetryBumpPercentage: {
|
|
84
|
+
description: 'How much to increase priority fee by each retry attempt (percentage)',
|
|
85
|
+
env: 'L1_PRIORITY_FEE_RETRY_BUMP_PERCENTAGE',
|
|
86
|
+
...numberConfigHelper(50),
|
|
87
|
+
},
|
|
88
|
+
fixedPriorityFeePerGas: {
|
|
89
|
+
description: 'Fixed priority fee per gas in Gwei. Overrides any priority fee bump percentage',
|
|
90
|
+
env: 'L1_FIXED_PRIORITY_FEE_PER_GAS',
|
|
91
|
+
...numberConfigHelper(0),
|
|
92
|
+
},
|
|
93
|
+
maxAttempts: {
|
|
94
|
+
description: 'Maximum number of speed-up attempts',
|
|
95
|
+
env: 'L1_TX_MONITOR_MAX_ATTEMPTS',
|
|
96
|
+
...numberConfigHelper(3),
|
|
97
|
+
},
|
|
98
|
+
checkIntervalMs: {
|
|
99
|
+
description: 'How often to check tx status',
|
|
100
|
+
env: 'L1_TX_MONITOR_CHECK_INTERVAL_MS',
|
|
101
|
+
...numberConfigHelper(1_000),
|
|
102
|
+
},
|
|
103
|
+
stallTimeMs: {
|
|
104
|
+
description: 'How long before considering tx stalled',
|
|
105
|
+
env: 'L1_TX_MONITOR_STALL_TIME_MS',
|
|
106
|
+
...numberConfigHelper(24_000), // 24s, 2 ethereum slots
|
|
107
|
+
},
|
|
108
|
+
txTimeoutMs: {
|
|
109
|
+
description: 'How long to wait for a tx to be mined before giving up. Set to 0 to disable.',
|
|
110
|
+
env: 'L1_TX_MONITOR_TX_TIMEOUT_MS',
|
|
111
|
+
...numberConfigHelper(120_000), // 2 mins
|
|
112
|
+
},
|
|
113
|
+
txPropagationMaxQueryAttempts: {
|
|
114
|
+
description: 'How many attempts will be done to get a tx after it was sent',
|
|
115
|
+
env: 'L1_TX_PROPAGATION_MAX_QUERY_ATTEMPTS',
|
|
116
|
+
...numberConfigHelper(3),
|
|
117
|
+
},
|
|
118
|
+
cancelTxOnTimeout: {
|
|
119
|
+
description: "Whether to attempt to cancel a tx if it's not mined after txTimeoutMs",
|
|
120
|
+
env: 'L1_TX_MONITOR_CANCEL_TX_ON_TIMEOUT',
|
|
121
|
+
...booleanConfigHelper(true),
|
|
122
|
+
},
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
export const defaultL1TxUtilsConfig = getDefaultConfig<L1TxUtilsConfig>(l1TxUtilsConfigMappings);
|
|
126
|
+
|
|
127
|
+
export function getL1TxUtilsConfigEnvVars(): L1TxUtilsConfig {
|
|
128
|
+
return getConfigFromMappings(l1TxUtilsConfigMappings);
|
|
129
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// 1_000_000_000 Gwei = 1 ETH
|
|
2
|
+
// 1_000_000_000 Wei = 1 Gwei
|
|
3
|
+
// 1_000_000_000_000_000_000 Wei = 1 ETH
|
|
4
|
+
export const WEI_CONST = 1_000_000_000n;
|
|
5
|
+
|
|
6
|
+
// @note using this large gas limit to avoid the issue of `gas limit too low` when estimating gas in reth
|
|
7
|
+
export const LARGE_GAS_LIMIT = 12_000_000n;
|
|
8
|
+
|
|
9
|
+
// setting a minimum bump percentage to 10% due to geth's implementation
|
|
10
|
+
// https://github.com/ethereum/go-ethereum/blob/e3d61e6db028c412f74bc4d4c7e117a9e29d0de0/core/txpool/legacypool/list.go#L298
|
|
11
|
+
export const MIN_REPLACEMENT_BUMP_PERCENTAGE = 10;
|
|
12
|
+
|
|
13
|
+
// setting a minimum bump percentage to 100% due to geth's implementation
|
|
14
|
+
// https://github.com/ethereum/go-ethereum/blob/e3d61e6db028c412f74bc4d4c7e117a9e29d0de0/core/txpool/blobpool/config.go#L34
|
|
15
|
+
export const MIN_BLOB_REPLACEMENT_BUMP_PERCENTAGE = 100;
|
|
16
|
+
|
|
17
|
+
// Avg ethereum block time is ~12s
|
|
18
|
+
export const BLOCK_TIME_MS = 12_000;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
2
|
+
import { type Logger, createLogger } from '@aztec/foundation/log';
|
|
3
|
+
import { DateProvider } from '@aztec/foundation/timer';
|
|
4
|
+
|
|
5
|
+
import type { TransactionSerializable } from 'viem';
|
|
6
|
+
|
|
7
|
+
import type { EthSigner } from '../eth-signer/eth-signer.js';
|
|
8
|
+
import type { ExtendedViemWalletClient, ViemClient } from '../types.js';
|
|
9
|
+
import type { L1TxUtilsConfig } from './config.js';
|
|
10
|
+
import { L1TxUtils } from './l1_tx_utils.js';
|
|
11
|
+
import { createViemSigner } from './signer.js';
|
|
12
|
+
import type { SigningCallback } from './types.js';
|
|
13
|
+
|
|
14
|
+
export function createL1TxUtilsFromViemWallet(
|
|
15
|
+
client: ExtendedViemWalletClient,
|
|
16
|
+
logger: Logger = createLogger('L1TxUtils'),
|
|
17
|
+
dateProvider: DateProvider = new DateProvider(),
|
|
18
|
+
config?: Partial<L1TxUtilsConfig>,
|
|
19
|
+
debugMaxGasLimit: boolean = false,
|
|
20
|
+
) {
|
|
21
|
+
return new L1TxUtils(
|
|
22
|
+
client,
|
|
23
|
+
EthAddress.fromString(client.account.address),
|
|
24
|
+
createViemSigner(client),
|
|
25
|
+
logger,
|
|
26
|
+
dateProvider,
|
|
27
|
+
config,
|
|
28
|
+
debugMaxGasLimit,
|
|
29
|
+
);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export function createL1TxUtilsFromEthSigner(
|
|
33
|
+
client: ViemClient,
|
|
34
|
+
signer: EthSigner,
|
|
35
|
+
logger: Logger = createLogger('L1TxUtils'),
|
|
36
|
+
dateProvider: DateProvider = new DateProvider(),
|
|
37
|
+
config?: Partial<L1TxUtilsConfig>,
|
|
38
|
+
debugMaxGasLimit: boolean = false,
|
|
39
|
+
) {
|
|
40
|
+
const callback: SigningCallback = async (transaction: TransactionSerializable, _signingAddress) => {
|
|
41
|
+
return (await signer.signTransaction(transaction)).toViemTransactionSignature();
|
|
42
|
+
};
|
|
43
|
+
return new L1TxUtils(client, signer.address, callback, logger, dateProvider, config, debugMaxGasLimit);
|
|
44
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export * from './config.js';
|
|
2
|
+
export * from './constants.js';
|
|
3
|
+
export * from './factory.js';
|
|
4
|
+
export * from './l1_tx_utils.js';
|
|
5
|
+
export * from './readonly_l1_tx_utils.js';
|
|
6
|
+
export * from './signer.js';
|
|
7
|
+
export * from './types.js';
|
|
8
|
+
export * from './utils.js';
|
|
9
|
+
|
|
10
|
+
// Note: We intentionally do not export l1_tx_utils_with_blobs.js
|
|
11
|
+
// to avoid accidentally importing blob-lib dependency.
|