@aztec/ethereum 0.0.1-commit.b655e406 → 0.0.1-commit.b8a057fa

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (240) hide show
  1. package/dest/account.d.ts +1 -1
  2. package/dest/chain.d.ts +1 -1
  3. package/dest/client.d.ts +25 -3
  4. package/dest/client.d.ts.map +1 -1
  5. package/dest/client.js +60 -4
  6. package/dest/config.d.ts +48 -73
  7. package/dest/config.d.ts.map +1 -1
  8. package/dest/config.js +120 -386
  9. package/dest/constants.d.ts +1 -1
  10. package/dest/contracts/chain_state_override.d.ts +78 -0
  11. package/dest/contracts/chain_state_override.d.ts.map +1 -0
  12. package/dest/contracts/chain_state_override.js +137 -0
  13. package/dest/contracts/empire_base.d.ts +7 -5
  14. package/dest/contracts/empire_base.d.ts.map +1 -1
  15. package/dest/contracts/empire_base.js +1 -1
  16. package/dest/contracts/errors.d.ts +1 -1
  17. package/dest/contracts/errors.d.ts.map +1 -1
  18. package/dest/contracts/fee_asset_handler.d.ts +6 -5
  19. package/dest/contracts/fee_asset_handler.d.ts.map +1 -1
  20. package/dest/contracts/fee_asset_handler.js +11 -9
  21. package/dest/contracts/fee_asset_price_oracle.d.ts +105 -0
  22. package/dest/contracts/fee_asset_price_oracle.d.ts.map +1 -0
  23. package/dest/contracts/fee_asset_price_oracle.js +656 -0
  24. package/dest/contracts/fee_juice.d.ts +1 -1
  25. package/dest/contracts/fee_juice.d.ts.map +1 -1
  26. package/dest/contracts/governance.d.ts +113 -36
  27. package/dest/contracts/governance.d.ts.map +1 -1
  28. package/dest/contracts/governance.js +207 -16
  29. package/dest/contracts/governance_proposer.d.ts +38 -4
  30. package/dest/contracts/governance_proposer.d.ts.map +1 -1
  31. package/dest/contracts/governance_proposer.js +455 -12
  32. package/dest/contracts/gse.d.ts +4 -2
  33. package/dest/contracts/gse.d.ts.map +1 -1
  34. package/dest/contracts/gse.js +2 -2
  35. package/dest/contracts/inbox.d.ts +24 -3
  36. package/dest/contracts/inbox.d.ts.map +1 -1
  37. package/dest/contracts/inbox.js +42 -2
  38. package/dest/contracts/index.d.ts +6 -3
  39. package/dest/contracts/index.d.ts.map +1 -1
  40. package/dest/contracts/index.js +5 -2
  41. package/dest/contracts/log.d.ts +13 -0
  42. package/dest/contracts/log.d.ts.map +1 -0
  43. package/dest/contracts/log.js +1 -0
  44. package/dest/contracts/multicall.d.ts +130 -13
  45. package/dest/contracts/multicall.d.ts.map +1 -1
  46. package/dest/contracts/multicall.js +203 -93
  47. package/dest/contracts/outbox.d.ts +64 -0
  48. package/dest/contracts/outbox.d.ts.map +1 -0
  49. package/dest/contracts/outbox.js +113 -0
  50. package/dest/contracts/registry.d.ts +3 -1
  51. package/dest/contracts/registry.d.ts.map +1 -1
  52. package/dest/contracts/registry.js +30 -1
  53. package/dest/contracts/rollup.d.ts +5591 -131
  54. package/dest/contracts/rollup.d.ts.map +1 -1
  55. package/dest/contracts/rollup.js +1125 -232
  56. package/dest/contracts/slasher_contract.d.ts +1 -1
  57. package/dest/contracts/slasher_contract.d.ts.map +1 -1
  58. package/dest/contracts/{tally_slashing_proposer.d.ts → slashing_proposer.d.ts} +11 -10
  59. package/dest/contracts/slashing_proposer.d.ts.map +1 -0
  60. package/dest/contracts/{tally_slashing_proposer.js → slashing_proposer.js} +21 -16
  61. package/dest/contracts/utils.d.ts +1 -1
  62. package/dest/deploy_aztec_l1_contracts.d.ts +267 -0
  63. package/dest/deploy_aztec_l1_contracts.d.ts.map +1 -0
  64. package/dest/deploy_aztec_l1_contracts.js +417 -0
  65. package/dest/deploy_l1_contract.d.ts +68 -0
  66. package/dest/deploy_l1_contract.d.ts.map +1 -0
  67. package/dest/deploy_l1_contract.js +312 -0
  68. package/dest/eth-signer/eth-signer.d.ts +1 -1
  69. package/dest/eth-signer/index.d.ts +1 -1
  70. package/dest/forwarder_proxy.d.ts +32 -0
  71. package/dest/forwarder_proxy.d.ts.map +1 -0
  72. package/dest/forwarder_proxy.js +93 -0
  73. package/dest/l1_artifacts.d.ts +21007 -16779
  74. package/dest/l1_artifacts.d.ts.map +1 -1
  75. package/dest/l1_artifacts.js +9 -24
  76. package/dest/l1_contract_addresses.d.ts +61 -65
  77. package/dest/l1_contract_addresses.d.ts.map +1 -1
  78. package/dest/l1_contract_addresses.js +99 -80
  79. package/dest/l1_reader.d.ts +7 -5
  80. package/dest/l1_reader.d.ts.map +1 -1
  81. package/dest/l1_reader.js +15 -7
  82. package/dest/l1_tx_utils/config.d.ts +11 -5
  83. package/dest/l1_tx_utils/config.d.ts.map +1 -1
  84. package/dest/l1_tx_utils/config.js +46 -10
  85. package/dest/l1_tx_utils/constants.d.ts +8 -2
  86. package/dest/l1_tx_utils/constants.d.ts.map +1 -1
  87. package/dest/l1_tx_utils/constants.js +27 -2
  88. package/dest/l1_tx_utils/factory.d.ts +18 -10
  89. package/dest/l1_tx_utils/factory.d.ts.map +1 -1
  90. package/dest/l1_tx_utils/factory.js +17 -7
  91. package/dest/l1_tx_utils/fee-strategies/index.d.ts +10 -0
  92. package/dest/l1_tx_utils/fee-strategies/index.d.ts.map +1 -0
  93. package/dest/l1_tx_utils/fee-strategies/index.js +12 -0
  94. package/dest/l1_tx_utils/fee-strategies/p75_competitive.d.ts +8 -0
  95. package/dest/l1_tx_utils/fee-strategies/p75_competitive.d.ts.map +1 -0
  96. package/dest/l1_tx_utils/fee-strategies/p75_competitive.js +129 -0
  97. package/dest/l1_tx_utils/fee-strategies/p75_competitive_blob_txs_only.d.ts +23 -0
  98. package/dest/l1_tx_utils/fee-strategies/p75_competitive_blob_txs_only.d.ts.map +1 -0
  99. package/dest/l1_tx_utils/fee-strategies/p75_competitive_blob_txs_only.js +191 -0
  100. package/dest/l1_tx_utils/fee-strategies/types.d.ts +51 -0
  101. package/dest/l1_tx_utils/fee-strategies/types.d.ts.map +1 -0
  102. package/dest/l1_tx_utils/fee-strategies/types.js +3 -0
  103. package/dest/l1_tx_utils/forwarder_l1_tx_utils.d.ts +41 -0
  104. package/dest/l1_tx_utils/forwarder_l1_tx_utils.d.ts.map +1 -0
  105. package/dest/l1_tx_utils/forwarder_l1_tx_utils.js +42 -0
  106. package/dest/l1_tx_utils/index-blobs.d.ts +3 -0
  107. package/dest/l1_tx_utils/index-blobs.d.ts.map +1 -0
  108. package/dest/l1_tx_utils/index-blobs.js +2 -0
  109. package/dest/l1_tx_utils/index.d.ts +4 -1
  110. package/dest/l1_tx_utils/index.d.ts.map +1 -1
  111. package/dest/l1_tx_utils/index.js +3 -0
  112. package/dest/l1_tx_utils/interfaces.d.ts +2 -2
  113. package/dest/l1_tx_utils/interfaces.d.ts.map +1 -1
  114. package/dest/l1_tx_utils/l1_fee_analyzer.d.ts +252 -0
  115. package/dest/l1_tx_utils/l1_fee_analyzer.d.ts.map +1 -0
  116. package/dest/l1_tx_utils/l1_fee_analyzer.js +568 -0
  117. package/dest/l1_tx_utils/l1_tx_utils.d.ts +26 -8
  118. package/dest/l1_tx_utils/l1_tx_utils.d.ts.map +1 -1
  119. package/dest/l1_tx_utils/l1_tx_utils.js +202 -92
  120. package/dest/l1_tx_utils/readonly_l1_tx_utils.d.ts +19 -30
  121. package/dest/l1_tx_utils/readonly_l1_tx_utils.d.ts.map +1 -1
  122. package/dest/l1_tx_utils/readonly_l1_tx_utils.js +65 -168
  123. package/dest/l1_tx_utils/signer.d.ts +1 -1
  124. package/dest/l1_tx_utils/tx_delayer.d.ts +58 -0
  125. package/dest/l1_tx_utils/tx_delayer.d.ts.map +1 -0
  126. package/dest/{test → l1_tx_utils}/tx_delayer.js +70 -39
  127. package/dest/l1_tx_utils/types.d.ts +27 -1
  128. package/dest/l1_tx_utils/types.d.ts.map +1 -1
  129. package/dest/l1_tx_utils/types.js +10 -0
  130. package/dest/l1_tx_utils/utils.d.ts +1 -1
  131. package/dest/l1_types.d.ts +1 -1
  132. package/dest/publisher_manager.d.ts +34 -7
  133. package/dest/publisher_manager.d.ts.map +1 -1
  134. package/dest/publisher_manager.js +119 -8
  135. package/dest/queries.d.ts +14 -3
  136. package/dest/queries.d.ts.map +1 -1
  137. package/dest/queries.js +84 -9
  138. package/dest/test/blob_kzg_warmup.d.ts +19 -0
  139. package/dest/test/blob_kzg_warmup.d.ts.map +1 -0
  140. package/dest/test/blob_kzg_warmup.js +64 -0
  141. package/dest/test/chain_monitor.d.ts +80 -26
  142. package/dest/test/chain_monitor.d.ts.map +1 -1
  143. package/dest/test/chain_monitor.js +137 -39
  144. package/dest/test/eth_cheat_codes.d.ts +47 -8
  145. package/dest/test/eth_cheat_codes.d.ts.map +1 -1
  146. package/dest/test/eth_cheat_codes.js +100 -44
  147. package/dest/test/eth_cheat_codes_with_state.d.ts +1 -1
  148. package/dest/test/eth_cheat_codes_with_state.d.ts.map +1 -1
  149. package/dest/test/index.d.ts +2 -3
  150. package/dest/test/index.d.ts.map +1 -1
  151. package/dest/test/index.js +1 -2
  152. package/dest/test/rollup_cheat_codes.d.ts +75 -14
  153. package/dest/test/rollup_cheat_codes.d.ts.map +1 -1
  154. package/dest/test/rollup_cheat_codes.js +145 -42
  155. package/dest/test/start_anvil.d.ts +25 -2
  156. package/dest/test/start_anvil.d.ts.map +1 -1
  157. package/dest/test/start_anvil.js +143 -28
  158. package/dest/test/upgrade_utils.d.ts +1 -1
  159. package/dest/test/upgrade_utils.js +2 -2
  160. package/dest/types.d.ts +57 -2
  161. package/dest/types.d.ts.map +1 -1
  162. package/dest/utils.d.ts +24 -4
  163. package/dest/utils.d.ts.map +1 -1
  164. package/dest/utils.js +112 -16
  165. package/dest/zkPassportVerifierAddress.d.ts +1 -1
  166. package/package.json +34 -17
  167. package/src/client.ts +66 -2
  168. package/src/config.ts +162 -470
  169. package/src/contracts/README.md +157 -0
  170. package/src/contracts/chain_state_override.ts +200 -0
  171. package/src/contracts/empire_base.ts +6 -5
  172. package/src/contracts/fee_asset_handler.ts +10 -7
  173. package/src/contracts/fee_asset_price_oracle.ts +285 -0
  174. package/src/contracts/governance.ts +279 -13
  175. package/src/contracts/governance_proposer.ts +74 -7
  176. package/src/contracts/gse.ts +7 -2
  177. package/src/contracts/inbox.ts +64 -4
  178. package/src/contracts/index.ts +5 -2
  179. package/src/contracts/log.ts +13 -0
  180. package/src/contracts/multicall.ts +247 -103
  181. package/src/contracts/outbox.ts +132 -0
  182. package/src/contracts/registry.ts +31 -1
  183. package/src/contracts/rollup.ts +830 -194
  184. package/src/contracts/{tally_slashing_proposer.ts → slashing_proposer.ts} +26 -21
  185. package/src/deploy_aztec_l1_contracts.ts +652 -0
  186. package/src/deploy_l1_contract.ts +362 -0
  187. package/src/forwarder_proxy.ts +108 -0
  188. package/src/l1_artifacts.ts +12 -35
  189. package/src/l1_contract_addresses.ts +120 -92
  190. package/src/l1_reader.ts +25 -10
  191. package/src/l1_tx_utils/config.ts +55 -14
  192. package/src/l1_tx_utils/constants.ts +13 -2
  193. package/src/l1_tx_utils/factory.ts +31 -31
  194. package/src/l1_tx_utils/fee-strategies/index.ts +22 -0
  195. package/src/l1_tx_utils/fee-strategies/p75_competitive.ts +163 -0
  196. package/src/l1_tx_utils/fee-strategies/p75_competitive_blob_txs_only.ts +245 -0
  197. package/src/l1_tx_utils/fee-strategies/types.ts +56 -0
  198. package/src/l1_tx_utils/forwarder_l1_tx_utils.ts +108 -0
  199. package/src/l1_tx_utils/index-blobs.ts +2 -0
  200. package/src/l1_tx_utils/index.ts +3 -0
  201. package/src/l1_tx_utils/interfaces.ts +1 -1
  202. package/src/l1_tx_utils/l1_fee_analyzer.ts +875 -0
  203. package/src/l1_tx_utils/l1_tx_utils.ts +194 -72
  204. package/src/l1_tx_utils/readonly_l1_tx_utils.ts +79 -214
  205. package/src/{test → l1_tx_utils}/tx_delayer.ts +97 -58
  206. package/src/l1_tx_utils/types.ts +32 -0
  207. package/src/publisher_manager.ts +145 -12
  208. package/src/queries.ts +93 -10
  209. package/src/test/blob_kzg_warmup.ts +65 -0
  210. package/src/test/chain_monitor.ts +198 -51
  211. package/src/test/eth_cheat_codes.ts +91 -48
  212. package/src/test/index.ts +1 -2
  213. package/src/test/rollup_cheat_codes.ts +174 -45
  214. package/src/test/start_anvil.ts +179 -27
  215. package/src/test/upgrade_utils.ts +2 -2
  216. package/src/types.ts +62 -0
  217. package/src/utils.ts +128 -19
  218. package/dest/contracts/empire_slashing_proposer.d.ts +0 -65
  219. package/dest/contracts/empire_slashing_proposer.d.ts.map +0 -1
  220. package/dest/contracts/empire_slashing_proposer.js +0 -194
  221. package/dest/contracts/tally_slashing_proposer.d.ts.map +0 -1
  222. package/dest/deploy_l1_contracts.d.ts +0 -226
  223. package/dest/deploy_l1_contracts.d.ts.map +0 -1
  224. package/dest/deploy_l1_contracts.js +0 -1473
  225. package/dest/index.d.ts +0 -18
  226. package/dest/index.d.ts.map +0 -1
  227. package/dest/index.js +0 -17
  228. package/dest/l1_tx_utils/l1_tx_utils_with_blobs.d.ts +0 -26
  229. package/dest/l1_tx_utils/l1_tx_utils_with_blobs.d.ts.map +0 -1
  230. package/dest/l1_tx_utils/l1_tx_utils_with_blobs.js +0 -26
  231. package/dest/test/delayed_tx_utils.d.ts +0 -13
  232. package/dest/test/delayed_tx_utils.d.ts.map +0 -1
  233. package/dest/test/delayed_tx_utils.js +0 -28
  234. package/dest/test/tx_delayer.d.ts +0 -36
  235. package/dest/test/tx_delayer.d.ts.map +0 -1
  236. package/src/contracts/empire_slashing_proposer.ts +0 -259
  237. package/src/deploy_l1_contracts.ts +0 -1849
  238. package/src/index.ts +0 -17
  239. package/src/l1_tx_utils/l1_tx_utils_with_blobs.ts +0 -77
  240. package/src/test/delayed_tx_utils.ts +0 -52
@@ -2,10 +2,10 @@ import { EthAddress } from '@aztec/foundation/eth-address';
2
2
  import { schemas } from '@aztec/foundation/schemas';
3
3
  import { z } from 'zod';
4
4
  /**
5
- * The names of the current L1 contract addresses.
5
+ * Required L1 contract address keys.
6
6
  * NOTE: When changing this list, make sure to update CLI & CI scripts accordingly.
7
7
  * For reference: https://github.com/AztecProtocol/aztec-packages/pull/5553
8
- */ export const L1ContractsNames = [
8
+ */ const REQUIRED_L1_CONTRACT_ADDRESS_KEYS = [
9
9
  'rollupAddress',
10
10
  'registryAddress',
11
11
  'inboxAddress',
@@ -18,84 +18,103 @@ import { z } from 'zod';
18
18
  'governanceAddress',
19
19
  'stakingAssetAddress'
20
20
  ];
21
+ /** Optional L1 contract address keys — present only in some deployments. */ export const OPTIONAL_L1_CONTRACT_ADDRESS_KEYS = [
22
+ 'feeAssetHandlerAddress',
23
+ 'stakingAssetHandlerAddress',
24
+ 'zkPassportVerifierAddress',
25
+ 'gseAddress',
26
+ 'dateGatedRelayerAddress'
27
+ ];
28
+ /**
29
+ * Names of required L1 contract addresses.
30
+ * NOTE: When changing the set of contracts, update CLI & CI scripts accordingly.
31
+ * For reference: https://github.com/AztecProtocol/aztec-packages/pull/5553
32
+ */ export const L1ContractsNames = REQUIRED_L1_CONTRACT_ADDRESS_KEYS;
33
+ const parseEnv = (val)=>EthAddress.fromString(val);
34
+ const addrEnv = (description, env)=>({
35
+ description,
36
+ parseEnv,
37
+ ...env && {
38
+ env
39
+ }
40
+ });
41
+ /**
42
+ * Config mapping for all L1 contract addresses.
43
+ * This is the single source of truth for which contract addresses exist and how to parse them.
44
+ */ export const l1ContractAddressesMapping = {
45
+ rollupAddress: addrEnv('The deployed L1 rollup contract address.'),
46
+ registryAddress: addrEnv('The deployed L1 registry contract address.', 'REGISTRY_CONTRACT_ADDRESS'),
47
+ inboxAddress: addrEnv('The deployed L1 inbox contract address.'),
48
+ outboxAddress: addrEnv('The deployed L1 outbox contract address.'),
49
+ feeJuiceAddress: addrEnv('The deployed L1 Fee Juice contract address.'),
50
+ feeJuicePortalAddress: addrEnv('The deployed L1 Fee Juice portal contract address.'),
51
+ coinIssuerAddress: addrEnv('The deployed L1 coinIssuer contract address'),
52
+ rewardDistributorAddress: addrEnv('The deployed L1 rewardDistributor contract address'),
53
+ governanceProposerAddress: addrEnv('The deployed L1 governanceProposer contract address'),
54
+ governanceAddress: addrEnv('The deployed L1 governance contract address'),
55
+ stakingAssetAddress: addrEnv('The deployed L1 staking asset contract address.'),
56
+ feeAssetHandlerAddress: addrEnv('The deployed L1 feeAssetHandler contract address', 'FEE_ASSET_HANDLER_CONTRACT_ADDRESS'),
57
+ stakingAssetHandlerAddress: addrEnv('The deployed L1 stakingAssetHandler contract address'),
58
+ zkPassportVerifierAddress: addrEnv('The deployed L1 ZK passport verifier contract address'),
59
+ gseAddress: addrEnv('The deployed L1 GSE contract address'),
60
+ dateGatedRelayerAddress: addrEnv('The deployed L1 date-gated relayer contract address')
61
+ };
21
62
  export const L1ContractAddressesSchema = z.object({
22
- rollupAddress: schemas.EthAddress,
23
- registryAddress: schemas.EthAddress,
24
- inboxAddress: schemas.EthAddress,
25
- outboxAddress: schemas.EthAddress,
26
- feeJuiceAddress: schemas.EthAddress,
27
- stakingAssetAddress: schemas.EthAddress,
28
- feeJuicePortalAddress: schemas.EthAddress,
29
- coinIssuerAddress: schemas.EthAddress,
30
- rewardDistributorAddress: schemas.EthAddress,
31
- governanceProposerAddress: schemas.EthAddress,
32
- governanceAddress: schemas.EthAddress,
33
- slashFactoryAddress: schemas.EthAddress.optional(),
34
- feeAssetHandlerAddress: schemas.EthAddress.optional(),
35
- stakingAssetHandlerAddress: schemas.EthAddress.optional(),
36
- zkPassportVerifierAddress: schemas.EthAddress.optional(),
37
- gseAddress: schemas.EthAddress.optional(),
38
- dateGatedRelayerAddress: schemas.EthAddress.optional()
63
+ ...Object.fromEntries(REQUIRED_L1_CONTRACT_ADDRESS_KEYS.map((k)=>[
64
+ k,
65
+ schemas.EthAddress
66
+ ])),
67
+ ...Object.fromEntries(OPTIONAL_L1_CONTRACT_ADDRESS_KEYS.map((k)=>[
68
+ k,
69
+ schemas.EthAddress.optional()
70
+ ]))
39
71
  });
40
- const parseEnv = (val)=>EthAddress.fromString(val);
41
- export const l1ContractAddressesMapping = {
42
- registryAddress: {
43
- env: 'REGISTRY_CONTRACT_ADDRESS',
44
- description: 'The deployed L1 registry contract address.',
45
- parseEnv
46
- },
47
- slashFactoryAddress: {
48
- env: 'SLASH_FACTORY_CONTRACT_ADDRESS',
49
- description: 'The deployed L1 slashFactory contract address',
50
- parseEnv
51
- },
52
- feeAssetHandlerAddress: {
53
- env: 'FEE_ASSET_HANDLER_CONTRACT_ADDRESS',
54
- description: 'The deployed L1 feeAssetHandler contract address',
55
- parseEnv
56
- },
57
- rollupAddress: {
58
- description: 'The deployed L1 rollup contract address.',
59
- parseEnv
60
- },
61
- inboxAddress: {
62
- description: 'The deployed L1 inbox contract address.',
63
- parseEnv
64
- },
65
- outboxAddress: {
66
- description: 'The deployed L1 outbox contract address.',
67
- parseEnv
68
- },
69
- feeJuiceAddress: {
70
- description: 'The deployed L1 Fee Juice contract address.',
71
- parseEnv
72
- },
73
- stakingAssetAddress: {
74
- description: 'The deployed L1 staking asset contract address.',
75
- parseEnv
76
- },
77
- feeJuicePortalAddress: {
78
- description: 'The deployed L1 Fee Juice portal contract address.',
79
- parseEnv
80
- },
81
- coinIssuerAddress: {
82
- description: 'The deployed L1 coinIssuer contract address',
83
- parseEnv
84
- },
85
- rewardDistributorAddress: {
86
- description: 'The deployed L1 rewardDistributor contract address',
87
- parseEnv
88
- },
89
- governanceProposerAddress: {
90
- description: 'The deployed L1 governanceProposer contract address',
91
- parseEnv
92
- },
93
- governanceAddress: {
94
- description: 'The deployed L1 governance contract address',
95
- parseEnv
96
- },
97
- stakingAssetHandlerAddress: {
98
- description: 'The deployed L1 stakingAssetHandler contract address',
99
- parseEnv
72
+ /**
73
+ * Selects entries from {@link l1ContractAddressesMapping} so composed configs can reuse the same
74
+ * env vars, descriptions, and parsers without duplicating definitions.
75
+ *
76
+ * @example
77
+ * ```ts
78
+ * const mappings = {
79
+ * ...pickL1ContractAddressMappings('rollupAddress'),
80
+ * nodeId: { ... },
81
+ * };
82
+ * ```
83
+ */ export function pickL1ContractAddressMappings(...keys) {
84
+ return Object.fromEntries(keys.map((key)=>[
85
+ key,
86
+ l1ContractAddressesMapping[key]
87
+ ]));
88
+ }
89
+ /**
90
+ * Like {@link pickL1ContractAddressMappings}, but returns a fragment of {@link L1ContractAddressesSchema}'s shape for
91
+ * spreading into `z.object({ ...pickL1ContractAddressesSchemaShape('rollupAddress'), localField: z... })`.
92
+ */ export function pickL1ContractAddressesSchema(...keys) {
93
+ return Object.fromEntries(keys.map((key)=>[
94
+ key,
95
+ L1ContractAddressesSchema.shape[key]
96
+ ]));
97
+ }
98
+ /** Builds an {@link L1ContractAddresses} object from config that stores those fields at the top level. */ export function pickL1ContractAddresses(config) {
99
+ const result = {};
100
+ for (const key of REQUIRED_L1_CONTRACT_ADDRESS_KEYS){
101
+ result[key] = config[key];
100
102
  }
101
- };
103
+ for (const key of OPTIONAL_L1_CONTRACT_ADDRESS_KEYS){
104
+ const v = config[key];
105
+ if (v !== undefined) {
106
+ result[key] = v;
107
+ }
108
+ }
109
+ return result;
110
+ }
111
+ export function randomL1ContractAddresses(includeOptional = false) {
112
+ const keys = includeOptional ? [
113
+ ...L1ContractsNames,
114
+ ...OPTIONAL_L1_CONTRACT_ADDRESS_KEYS
115
+ ] : L1ContractsNames;
116
+ return Object.fromEntries(keys.map((name)=>[
117
+ name,
118
+ EthAddress.random()
119
+ ]));
120
+ }
@@ -1,16 +1,18 @@
1
1
  import { type ConfigMappingsType } from '@aztec/foundation/config';
2
2
  import { type L1ContractAddresses } from './l1_contract_addresses.js';
3
3
  /** Configuration of the L1GlobalReader. */
4
- export interface L1ReaderConfig {
4
+ export type L1ReaderConfig = {
5
5
  /** List of URLs of Ethereum RPC nodes that services will connect to (comma separated). */
6
6
  l1RpcUrls: string[];
7
+ /** The RPC Url of the ethereum debug host for trace and debug methods. */
8
+ l1DebugRpcUrls: string[];
7
9
  /** The chain ID of the ethereum host. */
8
10
  l1ChainId: number;
9
- /** The deployed l1 contract addresses */
10
- l1Contracts: L1ContractAddresses;
11
11
  /** The polling interval viem uses in ms */
12
12
  viemPollingIntervalMS: number;
13
- }
13
+ /** Timeout for HTTP requests to the L1 RPC node in ms. */
14
+ l1HttpTimeoutMS?: number;
15
+ } & L1ContractAddresses;
14
16
  export declare const l1ReaderConfigMappings: ConfigMappingsType<L1ReaderConfig>;
15
17
  export declare function getL1ReaderConfigFromEnv(): L1ReaderConfig;
16
- //# sourceMappingURL=l1_reader.d.ts.map
18
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibDFfcmVhZGVyLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvbDFfcmVhZGVyLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFDTCxLQUFLLGtCQUFrQixFQUl4QixNQUFNLDBCQUEwQixDQUFDO0FBRWxDLE9BQU8sRUFBRSxLQUFLLG1CQUFtQixFQUE4QixNQUFNLDRCQUE0QixDQUFDO0FBRWxHLDJDQUEyQztBQUMzQyxNQUFNLE1BQU0sY0FBYyxHQUFHO0lBQzNCLDBGQUEwRjtJQUMxRixTQUFTLEVBQUUsTUFBTSxFQUFFLENBQUM7SUFDcEIsMEVBQTBFO0lBQzFFLGNBQWMsRUFBRSxNQUFNLEVBQUUsQ0FBQztJQUN6Qix5Q0FBeUM7SUFDekMsU0FBUyxFQUFFLE1BQU0sQ0FBQztJQUNsQiwyQ0FBMkM7SUFDM0MscUJBQXFCLEVBQUUsTUFBTSxDQUFDO0lBQzlCLDBEQUEwRDtJQUMxRCxlQUFlLENBQUMsRUFBRSxNQUFNLENBQUM7Q0FDMUIsR0FBRyxtQkFBbUIsQ0FBQztBQUV4QixlQUFPLE1BQU0sc0JBQXNCLEVBQUUsa0JBQWtCLENBQUMsY0FBYyxDQTZCckUsQ0FBQztBQUVGLHdCQUFnQix3QkFBd0IsSUFBSSxjQUFjLENBRXpEIn0=
@@ -1 +1 @@
1
- {"version":3,"file":"l1_reader.d.ts","sourceRoot":"","sources":["../src/l1_reader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,kBAAkB,EAA6C,MAAM,0BAA0B,CAAC;AAE9G,OAAO,EAAE,KAAK,mBAAmB,EAA8B,MAAM,4BAA4B,CAAC;AAElG,2CAA2C;AAC3C,MAAM,WAAW,cAAc;IAC7B,0FAA0F;IAC1F,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,yCAAyC;IACzC,SAAS,EAAE,MAAM,CAAC;IAClB,yCAAyC;IACzC,WAAW,EAAE,mBAAmB,CAAC;IACjC,2CAA2C;IAC3C,qBAAqB,EAAE,MAAM,CAAC;CAC/B;AAED,eAAO,MAAM,sBAAsB,EAAE,kBAAkB,CAAC,cAAc,CAqBrE,CAAC;AAEF,wBAAgB,wBAAwB,IAAI,cAAc,CAEzD"}
1
+ {"version":3,"file":"l1_reader.d.ts","sourceRoot":"","sources":["../src/l1_reader.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,kBAAkB,EAIxB,MAAM,0BAA0B,CAAC;AAElC,OAAO,EAAE,KAAK,mBAAmB,EAA8B,MAAM,4BAA4B,CAAC;AAElG,2CAA2C;AAC3C,MAAM,MAAM,cAAc,GAAG;IAC3B,0FAA0F;IAC1F,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,0EAA0E;IAC1E,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,yCAAyC;IACzC,SAAS,EAAE,MAAM,CAAC;IAClB,2CAA2C;IAC3C,qBAAqB,EAAE,MAAM,CAAC;IAC9B,0DAA0D;IAC1D,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B,GAAG,mBAAmB,CAAC;AAExB,eAAO,MAAM,sBAAsB,EAAE,kBAAkB,CAAC,cAAc,CA6BrE,CAAC;AAEF,wBAAgB,wBAAwB,IAAI,cAAc,CAEzD"}
package/dest/l1_reader.js CHANGED
@@ -1,13 +1,9 @@
1
- import { getConfigFromMappings, numberConfigHelper } from '@aztec/foundation/config';
1
+ import { getConfigFromMappings, numberConfigHelper, optionalNumberConfigHelper } from '@aztec/foundation/config';
2
2
  import { l1ContractAddressesMapping } from './l1_contract_addresses.js';
3
3
  export const l1ReaderConfigMappings = {
4
- l1Contracts: {
5
- description: 'The deployed L1 contract addresses',
6
- nested: l1ContractAddressesMapping
7
- },
8
4
  l1ChainId: {
9
5
  env: 'L1_CHAIN_ID',
10
- parseEnv: (val)=>+val,
6
+ ...optionalNumberConfigHelper(),
11
7
  description: 'The chain ID of the ethereum host.'
12
8
  },
13
9
  l1RpcUrls: {
@@ -16,11 +12,23 @@ export const l1ReaderConfigMappings = {
16
12
  parseEnv: (val)=>val.split(',').map((url)=>url.trim()),
17
13
  defaultValue: []
18
14
  },
15
+ l1DebugRpcUrls: {
16
+ env: 'ETHEREUM_DEBUG_HOSTS',
17
+ description: 'The RPC Url of the ethereum debug host for trace and debug methods.',
18
+ parseEnv: (val)=>val.split(',').map((url)=>url.trim()),
19
+ defaultValue: []
20
+ },
19
21
  viemPollingIntervalMS: {
20
22
  env: 'L1_READER_VIEM_POLLING_INTERVAL_MS',
21
23
  description: 'The polling interval viem uses in ms',
22
24
  ...numberConfigHelper(1_000)
23
- }
25
+ },
26
+ l1HttpTimeoutMS: {
27
+ env: 'ETHEREUM_HTTP_TIMEOUT_MS',
28
+ description: 'Timeout for HTTP requests to the L1 RPC node in ms.',
29
+ ...optionalNumberConfigHelper()
30
+ },
31
+ ...l1ContractAddressesMapping
24
32
  };
25
33
  export function getL1ReaderConfigFromEnv() {
26
34
  return getConfigFromMappings(l1ReaderConfigMappings);
@@ -7,11 +7,11 @@ export interface L1TxUtilsConfig {
7
7
  /**
8
8
  * Maximum gas price in gwei
9
9
  */
10
- maxGwei?: bigint;
10
+ maxGwei?: number;
11
11
  /**
12
12
  * Maximum blob fee per gas in gwei
13
13
  */
14
- maxBlobGwei?: bigint;
14
+ maxBlobGwei?: number;
15
15
  /**
16
16
  * Priority fee bump percentage
17
17
  */
@@ -21,9 +21,9 @@ export interface L1TxUtilsConfig {
21
21
  */
22
22
  priorityFeeRetryBumpPercentage?: number;
23
23
  /**
24
- * Fixed priority fee per gas in Gwei. Overrides any priority fee bump percentage config
24
+ * Minimum priority fee per gas in Gwei. Acts as a floor for the computed priority fee.
25
25
  */
26
- fixedPriorityFeePerGas?: number;
26
+ minimumPriorityFeePerGas?: number;
27
27
  /**
28
28
  * Maximum number of speed-up attempts
29
29
  */
@@ -52,8 +52,14 @@ export interface L1TxUtilsConfig {
52
52
  * How long a tx nonce can be unseen in the mempool before considering it dropped
53
53
  */
54
54
  txUnseenConsideredDroppedMs?: number;
55
+ /** Enable tx delayer. When true, wraps the viem client to intercept and delay txs. Test-only. */
56
+ enableDelayer?: boolean;
57
+ /** Max seconds into an L1 slot for tx inclusion. Txs sent later are deferred to next slot. Only used when enableDelayer is true. */
58
+ txDelayerMaxInclusionTimeIntoSlot?: number;
59
+ /** How many seconds an L1 slot lasts. */
60
+ ethereumSlotDuration?: number;
55
61
  }
56
62
  export declare const l1TxUtilsConfigMappings: ConfigMappingsType<L1TxUtilsConfig>;
57
63
  export declare const defaultL1TxUtilsConfig: Required<L1TxUtilsConfig>;
58
64
  export declare function getL1TxUtilsConfigEnvVars(): L1TxUtilsConfig;
59
- //# sourceMappingURL=config.d.ts.map
65
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29uZmlnLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvbDFfdHhfdXRpbHMvY29uZmlnLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFDTCxLQUFLLGtCQUFrQixFQU94QixNQUFNLDBCQUEwQixDQUFDO0FBRWxDLE1BQU0sV0FBVyxlQUFlO0lBQzlCOztPQUVHO0lBQ0gsd0JBQXdCLENBQUMsRUFBRSxNQUFNLENBQUM7SUFDbEM7O09BRUc7SUFDSCxPQUFPLENBQUMsRUFBRSxNQUFNLENBQUM7SUFDakI7O09BRUc7SUFDSCxXQUFXLENBQU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ACH,yBAAyB,CAAC,EAAE,MAAM,CAAC;IACnC;;OAEG;IACH,8BAA8B,CAAC,EAAE,MAAM,CAAC;IACxC;;OAEG;IACH,wBAAwB,CAAC,EAAE,MAAM,CAAC;IAClC;;OAEG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B;;OAEG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;OAEG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B;;OAEG;IACH,4BAA4B,CAAC,EAAE,MAAM,CAAC;IACtC;;OAEG;IACH,2BAA2B,CAAC,EAAE,MAAM,CAAC;IACrC,iGAAiG;IACjG,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,oIAAoI;IACpI,iCAAiC,CAAC,EAAE,MAAM,CAAC;IAC3C,yCAAyC;IACzC,oBAAoB,CAAC,EAAE,MAAM,CAAC;CAC/B;AAED,eAAO,MAAM,uBAAuB,EAAE,kBAAkB,CAAC,eAAe,CA6FvE,CAAC;AAGF,eAAO,MAAM,sBAAsB,2BAEL,CAAC;AAE/B,wBAAgB,yBAAyB,IAAI,eAAe,CAE3D"}
@@ -1,34 +1,54 @@
1
- import { bigintConfigHelper, booleanConfigHelper, getConfigFromMappings, getDefaultConfig, numberConfigHelper } from '@aztec/foundation/config';
1
+ import { booleanConfigHelper, floatConfigHelper, getConfigFromMappings, getDefaultConfig, numberConfigHelper, optionalNumberConfigHelper } from '@aztec/foundation/config';
2
2
  export const l1TxUtilsConfigMappings = {
3
3
  gasLimitBufferPercentage: {
4
4
  description: 'How much to increase calculated gas limit by (percentage)',
5
5
  env: 'L1_GAS_LIMIT_BUFFER_PERCENTAGE',
6
- ...numberConfigHelper(20)
6
+ ...floatConfigHelper(20)
7
7
  },
8
8
  maxGwei: {
9
9
  description: 'Maximum gas price in gwei to be used for transactions.',
10
10
  env: 'L1_GAS_PRICE_MAX',
11
- ...bigintConfigHelper(2000n)
11
+ fallback: [
12
+ 'L1_FEE_PER_GAS_GWEI_MAX'
13
+ ],
14
+ ...floatConfigHelper(2000)
12
15
  },
13
16
  maxBlobGwei: {
14
17
  description: 'Maximum blob fee per gas in gwei',
15
18
  env: 'L1_BLOB_FEE_PER_GAS_MAX',
16
- ...bigintConfigHelper(3000n)
19
+ fallback: [
20
+ 'L1_BLOB_FEE_PER_GAS_GWEI_MAX'
21
+ ],
22
+ ...floatConfigHelper(3000)
17
23
  },
18
24
  priorityFeeBumpPercentage: {
19
25
  description: 'How much to increase priority fee by each attempt (percentage)',
20
26
  env: 'L1_PRIORITY_FEE_BUMP_PERCENTAGE',
21
- ...numberConfigHelper(20)
27
+ ...floatConfigHelper(20)
22
28
  },
23
29
  priorityFeeRetryBumpPercentage: {
24
30
  description: 'How much to increase priority fee by each retry attempt (percentage)',
25
31
  env: 'L1_PRIORITY_FEE_RETRY_BUMP_PERCENTAGE',
26
- ...numberConfigHelper(50)
32
+ ...floatConfigHelper(50)
27
33
  },
28
- fixedPriorityFeePerGas: {
29
- description: 'Fixed priority fee per gas in Gwei. Overrides any priority fee bump percentage',
30
- env: 'L1_FIXED_PRIORITY_FEE_PER_GAS',
31
- ...numberConfigHelper(0)
34
+ minimumPriorityFeePerGas: {
35
+ description: 'Minimum priority fee per gas in Gwei. Acts as a floor for the computed priority fee. If network conditions require a higher fee, the higher fee will be used.',
36
+ env: 'L1_MINIMUM_PRIORITY_FEE_PER_GAS_GWEI',
37
+ fallback: [
38
+ 'L1_FIXED_PRIORITY_FEE_PER_GAS',
39
+ 'L1_FIXED_PRIORITY_FEE_PER_GAS_GWEI'
40
+ ],
41
+ deprecatedFallback: [
42
+ {
43
+ env: 'L1_FIXED_PRIORITY_FEE_PER_GAS',
44
+ message: deprecatedFixedFeeMessage('L1_FIXED_PRIORITY_FEE_PER_GAS')
45
+ },
46
+ {
47
+ env: 'L1_FIXED_PRIORITY_FEE_PER_GAS_GWEI',
48
+ message: deprecatedFixedFeeMessage('L1_FIXED_PRIORITY_FEE_PER_GAS_GWEI')
49
+ }
50
+ ],
51
+ ...floatConfigHelper(0)
32
52
  },
33
53
  maxSpeedUpAttempts: {
34
54
  description: 'Maximum number of speed-up attempts',
@@ -64,6 +84,19 @@ export const l1TxUtilsConfigMappings = {
64
84
  description: 'How long a tx nonce can be unseen in the mempool before considering it dropped',
65
85
  env: 'L1_TX_MONITOR_TX_UNSEEN_CONSIDERED_DROPPED_MS',
66
86
  ...numberConfigHelper(6 * 12 * 1000)
87
+ },
88
+ enableDelayer: {
89
+ description: 'Enable tx delayer for testing.',
90
+ ...booleanConfigHelper(false)
91
+ },
92
+ txDelayerMaxInclusionTimeIntoSlot: {
93
+ description: 'Max seconds into L1 slot for tx inclusion when delayer is enabled.',
94
+ ...optionalNumberConfigHelper()
95
+ },
96
+ ethereumSlotDuration: {
97
+ env: 'ETHEREUM_SLOT_DURATION',
98
+ description: 'How many seconds an L1 slot lasts.',
99
+ ...numberConfigHelper(12)
67
100
  }
68
101
  };
69
102
  // We abuse the fact that all mappings above have a non null default value and force-type this to Required
@@ -71,3 +104,6 @@ export const defaultL1TxUtilsConfig = getDefaultConfig(l1TxUtilsConfigMappings);
71
104
  export function getL1TxUtilsConfigEnvVars() {
72
105
  return getConfigFromMappings(l1TxUtilsConfigMappings);
73
106
  }
107
+ function deprecatedFixedFeeMessage(envVar) {
108
+ return `Environment variable ${envVar} is deprecated. It is now used as a MINIMUM priority fee rather than a fixed value. ` + 'Please use L1_MINIMUM_PRIORITY_FEE_PER_GAS_GWEI instead. If network conditions require a higher fee, the higher fee will be used.';
109
+ }
@@ -1,6 +1,12 @@
1
1
  export declare const WEI_CONST = 1000000000n;
2
- export declare const LARGE_GAS_LIMIT = 12000000n;
2
+ export declare const MAX_L1_TX_LIMIT = 16777216n;
3
3
  export declare const MIN_REPLACEMENT_BUMP_PERCENTAGE = 10;
4
4
  export declare const MIN_BLOB_REPLACEMENT_BUMP_PERCENTAGE = 100;
5
5
  export declare const BLOCK_TIME_MS = 12000;
6
- //# sourceMappingURL=constants.d.ts.map
6
+ export declare const GAS_PER_BLOB = 131072n;
7
+ export declare const BLOB_CAPACITY_SCHEDULE: {
8
+ timestamp: number;
9
+ target: number;
10
+ max: number;
11
+ }[];
12
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29uc3RhbnRzLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvbDFfdHhfdXRpbHMvY29uc3RhbnRzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUdBLGVBQU8sTUFBTSxTQUFTLGNBQWlCLENBQUM7QUFHeEMsZUFBTyxNQUFNLGVBQWUsWUFBYyxDQUFDO0FBSTNDLGVBQU8sTUFBTSwrQkFBK0IsS0FBSyxDQUFDO0FBSWxELGVBQU8sTUFBTSxvQ0FBb0MsTUFBTSxDQUFDO0FBR3hELGVBQU8sTUFBTSxhQUFhLFFBQVMsQ0FBQztBQUdwQyxlQUFPLE1BQU0sWUFBWSxVQUFVLENBQUM7QUFHcEMsZUFBTyxNQUFNLHNCQUFzQjs7OztHQUtsQyxDQUFDIn0=
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/l1_tx_utils/constants.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,SAAS,cAAiB,CAAC;AAGxC,eAAO,MAAM,eAAe,YAAc,CAAC;AAI3C,eAAO,MAAM,+BAA+B,KAAK,CAAC;AAIlD,eAAO,MAAM,oCAAoC,MAAM,CAAC;AAGxD,eAAO,MAAM,aAAa,QAAS,CAAC"}
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/l1_tx_utils/constants.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,SAAS,cAAiB,CAAC;AAGxC,eAAO,MAAM,eAAe,YAAc,CAAC;AAI3C,eAAO,MAAM,+BAA+B,KAAK,CAAC;AAIlD,eAAO,MAAM,oCAAoC,MAAM,CAAC;AAGxD,eAAO,MAAM,aAAa,QAAS,CAAC;AAGpC,eAAO,MAAM,YAAY,UAAU,CAAC;AAGpC,eAAO,MAAM,sBAAsB;;;;GAKlC,CAAC"}
@@ -2,8 +2,8 @@
2
2
  // 1_000_000_000 Wei = 1 Gwei
3
3
  // 1_000_000_000_000_000_000 Wei = 1 ETH
4
4
  export const WEI_CONST = 1_000_000_000n;
5
- // @note using this large gas limit to avoid the issue of `gas limit too low` when estimating gas in reth
6
- export const LARGE_GAS_LIMIT = 12_000_000n;
5
+ // EIP-7825: protocol-level cap on tx gas limit (2^24). Clients reject above this.
6
+ export const MAX_L1_TX_LIMIT = 16_777_216n;
7
7
  // setting a minimum bump percentage to 10% due to geth's implementation
8
8
  // https://github.com/ethereum/go-ethereum/blob/e3d61e6db028c412f74bc4d4c7e117a9e29d0de0/core/txpool/legacypool/list.go#L298
9
9
  export const MIN_REPLACEMENT_BUMP_PERCENTAGE = 10;
@@ -12,3 +12,28 @@ export const MIN_REPLACEMENT_BUMP_PERCENTAGE = 10;
12
12
  export const MIN_BLOB_REPLACEMENT_BUMP_PERCENTAGE = 100;
13
13
  // Avg ethereum block time is ~12s
14
14
  export const BLOCK_TIME_MS = 12_000;
15
+ // Gas per blob (EIP-4844)
16
+ export const GAS_PER_BLOB = 131072n;
17
+ // Blob capacity schedule based on Ethereum upgrades
18
+ export const BLOB_CAPACITY_SCHEDULE = [
19
+ {
20
+ timestamp: 1734357600,
21
+ target: 14,
22
+ max: 21
23
+ },
24
+ {
25
+ timestamp: 1733752800,
26
+ target: 10,
27
+ max: 15
28
+ },
29
+ {
30
+ timestamp: 1733234400,
31
+ target: 6,
32
+ max: 9
33
+ },
34
+ {
35
+ timestamp: 0,
36
+ target: 6,
37
+ max: 9
38
+ }
39
+ ];
@@ -1,3 +1,5 @@
1
+ import type { BlobKzgInstance } from '@aztec/blob-lib/types';
2
+ import { EthAddress } from '@aztec/foundation/eth-address';
1
3
  import type { Logger } from '@aztec/foundation/log';
2
4
  import { DateProvider } from '@aztec/foundation/timer';
3
5
  import type { EthSigner } from '../eth-signer/eth-signer.js';
@@ -5,20 +7,26 @@ import type { ExtendedViemWalletClient, ViemClient } from '../types.js';
5
7
  import type { L1TxUtilsConfig } from './config.js';
6
8
  import type { IL1TxMetrics, IL1TxStore } from './interfaces.js';
7
9
  import { L1TxUtils } from './l1_tx_utils.js';
8
- export declare function createL1TxUtilsFromViemWallet(client: ExtendedViemWalletClient, deps?: {
10
+ import { Delayer } from './tx_delayer.js';
11
+ import type { SigningCallback } from './types.js';
12
+ /** Source of signing capability: either a wallet client or a separate client + signer. */
13
+ export type L1SignerSource = ExtendedViemWalletClient | {
14
+ client: ViemClient;
15
+ signer: EthSigner;
16
+ };
17
+ export declare function resolveSignerSource(source: L1SignerSource): {
18
+ client: ViemClient;
19
+ address: EthAddress;
20
+ signingCallback: SigningCallback;
21
+ };
22
+ export declare function createL1TxUtils(source: L1SignerSource, deps?: {
9
23
  logger?: Logger;
10
24
  dateProvider?: DateProvider;
11
25
  store?: IL1TxStore;
12
26
  metrics?: IL1TxMetrics;
27
+ kzg?: BlobKzgInstance;
28
+ delayer?: Delayer;
13
29
  }, config?: Partial<L1TxUtilsConfig> & {
14
30
  debugMaxGasLimit?: boolean;
15
31
  }): L1TxUtils;
16
- export declare function createL1TxUtilsFromEthSigner(client: ViemClient, signer: EthSigner, deps?: {
17
- logger?: Logger;
18
- dateProvider?: DateProvider;
19
- store?: IL1TxStore;
20
- metrics?: IL1TxMetrics;
21
- }, config?: Partial<L1TxUtilsConfig> & {
22
- debugMaxGasLimit?: boolean;
23
- }): L1TxUtils;
24
- //# sourceMappingURL=factory.d.ts.map
32
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZmFjdG9yeS5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOls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AM,iBAAiB,CAAC;AAC1C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAElD,0FAA0F;AAC1F,MAAM,MAAM,cAAc,GAAG,wBAAwB,GAAG;IAAE,MAAM,EAAE,UAAU,CAAC;IAAC,MAAM,EAAE,SAAS,CAAA;CAAE,CAAC;AAElG,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,cAAc,GAAG;IAC3D,MAAM,EAAE,UAAU,CAAC;IACnB,OAAO,EAAE,UAAU,CAAC;IACpB,eAAe,EAAE,eAAe,CAAC;CAClC,CAcA;AAED,wBAAgB,eAAe,CAC7B,MAAM,EAAE,cAAc,EACtB,IAAI,CAAC,EAAE;IACL,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB,OAAO,CAAC,EAAE,YAAY,CAAC;IACvB,GAAG,CAAC,EAAE,eAAe,CAAC;IACtB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,EACD,MAAM,CAAC,EAAE,OAAO,CAAC,eAAe,CAAC,GAAG;IAAE,gBAAgB,CAAC,EAAE,OAAO,CAAA;CAAE,GACjE,SAAS,CAeX"}
@@ -1,12 +1,22 @@
1
1
  import { EthAddress } from '@aztec/foundation/eth-address';
2
2
  import { L1TxUtils } from './l1_tx_utils.js';
3
3
  import { createViemSigner } from './signer.js';
4
- export function createL1TxUtilsFromViemWallet(client, deps, config) {
5
- return new L1TxUtils(client, EthAddress.fromString(client.account.address), createViemSigner(client), deps?.logger, deps?.dateProvider, config, config?.debugMaxGasLimit ?? false, deps?.store, deps?.metrics);
6
- }
7
- export function createL1TxUtilsFromEthSigner(client, signer, deps, config) {
8
- const callback = async (transaction, _signingAddress)=>{
9
- return (await signer.signTransaction(transaction)).toViemTransactionSignature();
4
+ export function resolveSignerSource(source) {
5
+ if ('account' in source && source.account) {
6
+ return {
7
+ client: source,
8
+ address: EthAddress.fromString(source.account.address),
9
+ signingCallback: createViemSigner(source)
10
+ };
11
+ }
12
+ const { client, signer } = source;
13
+ return {
14
+ client,
15
+ address: signer.address,
16
+ signingCallback: async (tx, _addr)=>(await signer.signTransaction(tx)).toViemTransactionSignature()
10
17
  };
11
- return new L1TxUtils(client, signer.address, callback, deps?.logger, deps?.dateProvider, config, config?.debugMaxGasLimit ?? false, deps?.store, deps?.metrics);
18
+ }
19
+ export function createL1TxUtils(source, deps, config) {
20
+ const { client, address, signingCallback } = resolveSignerSource(source);
21
+ return new L1TxUtils(client, address, signingCallback, deps?.logger, deps?.dateProvider, config, config?.debugMaxGasLimit ?? false, deps?.store, deps?.metrics, deps?.kzg, deps?.delayer);
12
22
  }
@@ -0,0 +1,10 @@
1
+ import type { PriorityFeeStrategy } from './types.js';
2
+ export { HISTORICAL_BLOCK_COUNT, type PriorityFeeStrategy, type PriorityFeeStrategyContext, type PriorityFeeStrategyResult, } from './types.js';
3
+ export { P75AllTxsPriorityFeeStrategy } from './p75_competitive.js';
4
+ export { P75BlobTxsOnlyPriorityFeeStrategy } from './p75_competitive_blob_txs_only.js';
5
+ /**
6
+ * Default list of priority fee strategies to analyze.
7
+ * Add more strategies here for comparison.
8
+ */
9
+ export declare const DEFAULT_PRIORITY_FEE_STRATEGIES: PriorityFeeStrategy[];
10
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9sMV90eF91dGlscy9mZWUtc3RyYXRlZ2llcy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFFQSxPQUFPLEtBQUssRUFBRSxtQkFBbUIsRUFBRSxNQUFNLFlBQVksQ0FBQztBQUV0RCxPQUFPLEVBQ0wsc0JBQXNCLEVBQ3RCLEtBQUssbUJBQW1CLEVBQ3hCLEtBQUssMEJBQTBCLEVBQy9CLEtBQUsseUJBQXlCLEdBQy9CLE1BQU0sWUFBWSxDQUFDO0FBRXBCLE9BQU8sRUFBRSw0QkFBNEIsRUFBRSxNQUFNLHNCQUFzQixDQUFDO0FBQ3BFLE9BQU8sRUFBRSxpQ0FBaUMsRUFBRSxNQUFNLG9DQUFvQyxDQUFDO0FBRXZGOzs7R0FHRztBQUNILGVBQU8sTUFBTSwrQkFBK0IsRUFBRSxtQkFBbUIsRUFHaEUsQ0FBQyJ9
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/l1_tx_utils/fee-strategies/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAEtD,OAAO,EACL,sBAAsB,EACtB,KAAK,mBAAmB,EACxB,KAAK,0BAA0B,EAC/B,KAAK,yBAAyB,GAC/B,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,4BAA4B,EAAE,MAAM,sBAAsB,CAAC;AACpE,OAAO,EAAE,iCAAiC,EAAE,MAAM,oCAAoC,CAAC;AAEvF;;;GAGG;AACH,eAAO,MAAM,+BAA+B,EAAE,mBAAmB,EAGhE,CAAC"}
@@ -0,0 +1,12 @@
1
+ import { P75AllTxsPriorityFeeStrategy } from './p75_competitive.js';
2
+ import { P75BlobTxsOnlyPriorityFeeStrategy } from './p75_competitive_blob_txs_only.js';
3
+ export { HISTORICAL_BLOCK_COUNT } from './types.js';
4
+ export { P75AllTxsPriorityFeeStrategy } from './p75_competitive.js';
5
+ export { P75BlobTxsOnlyPriorityFeeStrategy } from './p75_competitive_blob_txs_only.js';
6
+ /**
7
+ * Default list of priority fee strategies to analyze.
8
+ * Add more strategies here for comparison.
9
+ */ export const DEFAULT_PRIORITY_FEE_STRATEGIES = [
10
+ P75AllTxsPriorityFeeStrategy,
11
+ P75BlobTxsOnlyPriorityFeeStrategy
12
+ ];
@@ -0,0 +1,8 @@
1
+ import { type PriorityFeeStrategy } from './types.js';
2
+ /**
3
+ * Our current competitive priority fee strategy.
4
+ * Analyzes p75 of pending transactions and 5-block fee history to determine a competitive priority fee.
5
+ * Falls back to network estimate if data is unavailable.
6
+ */
7
+ export declare const P75AllTxsPriorityFeeStrategy: PriorityFeeStrategy;
8
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicDc1X2NvbXBldGl0aXZlLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvbDFfdHhfdXRpbHMvZmVlLXN0cmF0ZWdpZXMvcDc1X2NvbXBldGl0aXZlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQU9BLE9BQU8sRUFFTCxLQUFLLG1CQUFtQixFQUd6QixNQUFNLFlBQVksQ0FBQztBQUVwQjs7OztHQUlHO0FBQ0gsZUFBTyxNQUFNLDRCQUE0QixFQUFFLG1CQStJMUMsQ0FBQyJ9
@@ -0,0 +1 @@
1
+ {"version":3,"file":"p75_competitive.d.ts","sourceRoot":"","sources":["../../../src/l1_tx_utils/fee-strategies/p75_competitive.ts"],"names":[],"mappings":"AAOA,OAAO,EAEL,KAAK,mBAAmB,EAGzB,MAAM,YAAY,CAAC;AAEpB;;;;GAIG;AACH,eAAO,MAAM,4BAA4B,EAAE,mBA+I1C,CAAC"}