@aztec/ethereum 0.0.1-commit.24de95ac → 0.0.1-commit.2606882

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 (236) 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 +29 -73
  7. package/dest/config.d.ts.map +1 -1
  8. package/dest/config.js +70 -387
  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 +1 -1
  33. package/dest/contracts/gse.d.ts.map +1 -1
  34. package/dest/contracts/inbox.d.ts +24 -3
  35. package/dest/contracts/inbox.d.ts.map +1 -1
  36. package/dest/contracts/inbox.js +42 -2
  37. package/dest/contracts/index.d.ts +6 -3
  38. package/dest/contracts/index.d.ts.map +1 -1
  39. package/dest/contracts/index.js +5 -2
  40. package/dest/contracts/log.d.ts +13 -0
  41. package/dest/contracts/log.d.ts.map +1 -0
  42. package/dest/contracts/log.js +1 -0
  43. package/dest/contracts/multicall.d.ts +127 -12
  44. package/dest/contracts/multicall.d.ts.map +1 -1
  45. package/dest/contracts/multicall.js +201 -93
  46. package/dest/contracts/outbox.d.ts +64 -0
  47. package/dest/contracts/outbox.d.ts.map +1 -0
  48. package/dest/contracts/outbox.js +113 -0
  49. package/dest/contracts/registry.d.ts +3 -1
  50. package/dest/contracts/registry.d.ts.map +1 -1
  51. package/dest/contracts/registry.js +30 -1
  52. package/dest/contracts/rollup.d.ts +5432 -131
  53. package/dest/contracts/rollup.d.ts.map +1 -1
  54. package/dest/contracts/rollup.js +1114 -231
  55. package/dest/contracts/slasher_contract.d.ts +1 -1
  56. package/dest/contracts/slasher_contract.d.ts.map +1 -1
  57. package/dest/contracts/{tally_slashing_proposer.d.ts → slashing_proposer.d.ts} +11 -10
  58. package/dest/contracts/slashing_proposer.d.ts.map +1 -0
  59. package/dest/contracts/{tally_slashing_proposer.js → slashing_proposer.js} +21 -16
  60. package/dest/contracts/utils.d.ts +1 -1
  61. package/dest/deploy_aztec_l1_contracts.d.ts +256 -0
  62. package/dest/deploy_aztec_l1_contracts.d.ts.map +1 -0
  63. package/dest/deploy_aztec_l1_contracts.js +411 -0
  64. package/dest/deploy_l1_contract.d.ts +68 -0
  65. package/dest/deploy_l1_contract.d.ts.map +1 -0
  66. package/dest/deploy_l1_contract.js +312 -0
  67. package/dest/eth-signer/eth-signer.d.ts +1 -1
  68. package/dest/eth-signer/index.d.ts +1 -1
  69. package/dest/forwarder_proxy.d.ts +32 -0
  70. package/dest/forwarder_proxy.d.ts.map +1 -0
  71. package/dest/forwarder_proxy.js +93 -0
  72. package/dest/generated/l1-contracts-defaults.d.ts +30 -0
  73. package/dest/generated/l1-contracts-defaults.d.ts.map +1 -0
  74. package/dest/generated/l1-contracts-defaults.js +30 -0
  75. package/dest/l1_artifacts.d.ts +19816 -16730
  76. package/dest/l1_artifacts.d.ts.map +1 -1
  77. package/dest/l1_artifacts.js +9 -24
  78. package/dest/l1_contract_addresses.d.ts +61 -65
  79. package/dest/l1_contract_addresses.d.ts.map +1 -1
  80. package/dest/l1_contract_addresses.js +99 -80
  81. package/dest/l1_reader.d.ts +7 -5
  82. package/dest/l1_reader.d.ts.map +1 -1
  83. package/dest/l1_reader.js +15 -7
  84. package/dest/l1_tx_utils/config.d.ts +11 -5
  85. package/dest/l1_tx_utils/config.d.ts.map +1 -1
  86. package/dest/l1_tx_utils/config.js +43 -7
  87. package/dest/l1_tx_utils/constants.d.ts +8 -2
  88. package/dest/l1_tx_utils/constants.d.ts.map +1 -1
  89. package/dest/l1_tx_utils/constants.js +27 -2
  90. package/dest/l1_tx_utils/factory.d.ts +18 -10
  91. package/dest/l1_tx_utils/factory.d.ts.map +1 -1
  92. package/dest/l1_tx_utils/factory.js +17 -7
  93. package/dest/l1_tx_utils/fee-strategies/index.d.ts +10 -0
  94. package/dest/l1_tx_utils/fee-strategies/index.d.ts.map +1 -0
  95. package/dest/l1_tx_utils/fee-strategies/index.js +12 -0
  96. package/dest/l1_tx_utils/fee-strategies/p75_competitive.d.ts +8 -0
  97. package/dest/l1_tx_utils/fee-strategies/p75_competitive.d.ts.map +1 -0
  98. package/dest/l1_tx_utils/fee-strategies/p75_competitive.js +129 -0
  99. package/dest/l1_tx_utils/fee-strategies/p75_competitive_blob_txs_only.d.ts +23 -0
  100. package/dest/l1_tx_utils/fee-strategies/p75_competitive_blob_txs_only.d.ts.map +1 -0
  101. package/dest/l1_tx_utils/fee-strategies/p75_competitive_blob_txs_only.js +191 -0
  102. package/dest/l1_tx_utils/fee-strategies/types.d.ts +51 -0
  103. package/dest/l1_tx_utils/fee-strategies/types.d.ts.map +1 -0
  104. package/dest/l1_tx_utils/fee-strategies/types.js +3 -0
  105. package/dest/l1_tx_utils/forwarder_l1_tx_utils.d.ts +41 -0
  106. package/dest/l1_tx_utils/forwarder_l1_tx_utils.d.ts.map +1 -0
  107. package/dest/l1_tx_utils/forwarder_l1_tx_utils.js +42 -0
  108. package/dest/l1_tx_utils/index-blobs.d.ts +3 -0
  109. package/dest/l1_tx_utils/index-blobs.d.ts.map +1 -0
  110. package/dest/l1_tx_utils/index-blobs.js +2 -0
  111. package/dest/l1_tx_utils/index.d.ts +4 -1
  112. package/dest/l1_tx_utils/index.d.ts.map +1 -1
  113. package/dest/l1_tx_utils/index.js +3 -0
  114. package/dest/l1_tx_utils/interfaces.d.ts +2 -2
  115. package/dest/l1_tx_utils/interfaces.d.ts.map +1 -1
  116. package/dest/l1_tx_utils/l1_fee_analyzer.d.ts +233 -0
  117. package/dest/l1_tx_utils/l1_fee_analyzer.d.ts.map +1 -0
  118. package/dest/l1_tx_utils/l1_fee_analyzer.js +506 -0
  119. package/dest/l1_tx_utils/l1_tx_utils.d.ts +26 -8
  120. package/dest/l1_tx_utils/l1_tx_utils.d.ts.map +1 -1
  121. package/dest/l1_tx_utils/l1_tx_utils.js +118 -70
  122. package/dest/l1_tx_utils/readonly_l1_tx_utils.d.ts +19 -30
  123. package/dest/l1_tx_utils/readonly_l1_tx_utils.d.ts.map +1 -1
  124. package/dest/l1_tx_utils/readonly_l1_tx_utils.js +65 -168
  125. package/dest/l1_tx_utils/signer.d.ts +1 -1
  126. package/dest/l1_tx_utils/tx_delayer.d.ts +58 -0
  127. package/dest/l1_tx_utils/tx_delayer.d.ts.map +1 -0
  128. package/dest/{test → l1_tx_utils}/tx_delayer.js +70 -39
  129. package/dest/l1_tx_utils/types.d.ts +1 -1
  130. package/dest/l1_tx_utils/types.d.ts.map +1 -1
  131. package/dest/l1_tx_utils/utils.d.ts +1 -1
  132. package/dest/l1_types.d.ts +1 -1
  133. package/dest/publisher_manager.d.ts +21 -6
  134. package/dest/publisher_manager.d.ts.map +1 -1
  135. package/dest/publisher_manager.js +81 -7
  136. package/dest/queries.d.ts +14 -3
  137. package/dest/queries.d.ts.map +1 -1
  138. package/dest/queries.js +78 -9
  139. package/dest/test/chain_monitor.d.ts +48 -25
  140. package/dest/test/chain_monitor.d.ts.map +1 -1
  141. package/dest/test/chain_monitor.js +71 -38
  142. package/dest/test/eth_cheat_codes.d.ts +22 -6
  143. package/dest/test/eth_cheat_codes.d.ts.map +1 -1
  144. package/dest/test/eth_cheat_codes.js +28 -7
  145. package/dest/test/eth_cheat_codes_with_state.d.ts +1 -1
  146. package/dest/test/eth_cheat_codes_with_state.d.ts.map +1 -1
  147. package/dest/test/index.d.ts +1 -3
  148. package/dest/test/index.d.ts.map +1 -1
  149. package/dest/test/index.js +0 -2
  150. package/dest/test/rollup_cheat_codes.d.ts +46 -14
  151. package/dest/test/rollup_cheat_codes.d.ts.map +1 -1
  152. package/dest/test/rollup_cheat_codes.js +118 -42
  153. package/dest/test/start_anvil.d.ts +25 -2
  154. package/dest/test/start_anvil.d.ts.map +1 -1
  155. package/dest/test/start_anvil.js +143 -28
  156. package/dest/test/upgrade_utils.d.ts +1 -1
  157. package/dest/test/upgrade_utils.js +2 -2
  158. package/dest/types.d.ts +57 -2
  159. package/dest/types.d.ts.map +1 -1
  160. package/dest/utils.d.ts +24 -4
  161. package/dest/utils.d.ts.map +1 -1
  162. package/dest/utils.js +112 -16
  163. package/dest/zkPassportVerifierAddress.d.ts +1 -1
  164. package/package.json +35 -17
  165. package/src/client.ts +66 -2
  166. package/src/config.ts +91 -469
  167. package/src/contracts/README.md +157 -0
  168. package/src/contracts/chain_state_override.ts +200 -0
  169. package/src/contracts/empire_base.ts +6 -5
  170. package/src/contracts/fee_asset_handler.ts +10 -7
  171. package/src/contracts/fee_asset_price_oracle.ts +285 -0
  172. package/src/contracts/governance.ts +279 -13
  173. package/src/contracts/governance_proposer.ts +74 -7
  174. package/src/contracts/inbox.ts +64 -4
  175. package/src/contracts/index.ts +5 -2
  176. package/src/contracts/log.ts +13 -0
  177. package/src/contracts/multicall.ts +243 -102
  178. package/src/contracts/outbox.ts +132 -0
  179. package/src/contracts/registry.ts +31 -1
  180. package/src/contracts/rollup.ts +819 -192
  181. package/src/contracts/{tally_slashing_proposer.ts → slashing_proposer.ts} +26 -21
  182. package/src/deploy_aztec_l1_contracts.ts +646 -0
  183. package/src/deploy_l1_contract.ts +362 -0
  184. package/src/forwarder_proxy.ts +108 -0
  185. package/src/generated/l1-contracts-defaults.ts +32 -0
  186. package/src/l1_artifacts.ts +12 -35
  187. package/src/l1_contract_addresses.ts +120 -92
  188. package/src/l1_reader.ts +25 -10
  189. package/src/l1_tx_utils/config.ts +52 -11
  190. package/src/l1_tx_utils/constants.ts +13 -2
  191. package/src/l1_tx_utils/factory.ts +31 -31
  192. package/src/l1_tx_utils/fee-strategies/index.ts +22 -0
  193. package/src/l1_tx_utils/fee-strategies/p75_competitive.ts +163 -0
  194. package/src/l1_tx_utils/fee-strategies/p75_competitive_blob_txs_only.ts +245 -0
  195. package/src/l1_tx_utils/fee-strategies/types.ts +56 -0
  196. package/src/l1_tx_utils/forwarder_l1_tx_utils.ts +108 -0
  197. package/src/l1_tx_utils/index-blobs.ts +2 -0
  198. package/src/l1_tx_utils/index.ts +3 -0
  199. package/src/l1_tx_utils/interfaces.ts +1 -1
  200. package/src/l1_tx_utils/l1_fee_analyzer.ts +803 -0
  201. package/src/l1_tx_utils/l1_tx_utils.ts +123 -52
  202. package/src/l1_tx_utils/readonly_l1_tx_utils.ts +79 -214
  203. package/src/{test → l1_tx_utils}/tx_delayer.ts +97 -58
  204. package/src/publisher_manager.ts +107 -10
  205. package/src/queries.ts +87 -10
  206. package/src/test/chain_monitor.ts +115 -51
  207. package/src/test/eth_cheat_codes.ts +25 -7
  208. package/src/test/index.ts +0 -2
  209. package/src/test/rollup_cheat_codes.ts +123 -45
  210. package/src/test/start_anvil.ts +179 -27
  211. package/src/test/upgrade_utils.ts +2 -2
  212. package/src/types.ts +62 -0
  213. package/src/utils.ts +128 -19
  214. package/dest/contracts/empire_slashing_proposer.d.ts +0 -65
  215. package/dest/contracts/empire_slashing_proposer.d.ts.map +0 -1
  216. package/dest/contracts/empire_slashing_proposer.js +0 -194
  217. package/dest/contracts/tally_slashing_proposer.d.ts.map +0 -1
  218. package/dest/deploy_l1_contracts.d.ts +0 -226
  219. package/dest/deploy_l1_contracts.d.ts.map +0 -1
  220. package/dest/deploy_l1_contracts.js +0 -1473
  221. package/dest/index.d.ts +0 -18
  222. package/dest/index.d.ts.map +0 -1
  223. package/dest/index.js +0 -17
  224. package/dest/l1_tx_utils/l1_tx_utils_with_blobs.d.ts +0 -26
  225. package/dest/l1_tx_utils/l1_tx_utils_with_blobs.d.ts.map +0 -1
  226. package/dest/l1_tx_utils/l1_tx_utils_with_blobs.js +0 -26
  227. package/dest/test/delayed_tx_utils.d.ts +0 -13
  228. package/dest/test/delayed_tx_utils.d.ts.map +0 -1
  229. package/dest/test/delayed_tx_utils.js +0 -28
  230. package/dest/test/tx_delayer.d.ts +0 -36
  231. package/dest/test/tx_delayer.d.ts.map +0 -1
  232. package/src/contracts/empire_slashing_proposer.ts +0 -259
  233. package/src/deploy_l1_contracts.ts +0 -1849
  234. package/src/index.ts +0 -17
  235. package/src/l1_tx_utils/l1_tx_utils_with_blobs.ts +0 -77
  236. package/src/test/delayed_tx_utils.ts +0 -52
@@ -1,15 +1,15 @@
1
- import type { ConfigMappingsType } from '@aztec/foundation/config';
1
+ import type { ConfigMapping, ConfigMappingsType } from '@aztec/foundation/config';
2
2
  import { EthAddress } from '@aztec/foundation/eth-address';
3
- import { type ZodFor, schemas } from '@aztec/foundation/schemas';
3
+ import { schemas } from '@aztec/foundation/schemas';
4
4
 
5
5
  import { z } from 'zod';
6
6
 
7
7
  /**
8
- * The names of the current L1 contract addresses.
8
+ * Required L1 contract address keys.
9
9
  * NOTE: When changing this list, make sure to update CLI & CI scripts accordingly.
10
10
  * For reference: https://github.com/AztecProtocol/aztec-packages/pull/5553
11
11
  */
12
- export const L1ContractsNames = [
12
+ const REQUIRED_L1_CONTRACT_ADDRESS_KEYS = [
13
13
  'rollupAddress',
14
14
  'registryAddress',
15
15
  'inboxAddress',
@@ -23,100 +23,128 @@ export const L1ContractsNames = [
23
23
  'stakingAssetAddress',
24
24
  ] as const;
25
25
 
26
+ /** Optional L1 contract address keys — present only in some deployments. */
27
+ export const OPTIONAL_L1_CONTRACT_ADDRESS_KEYS = [
28
+ 'feeAssetHandlerAddress',
29
+ 'stakingAssetHandlerAddress',
30
+ 'zkPassportVerifierAddress',
31
+ 'gseAddress',
32
+ 'dateGatedRelayerAddress',
33
+ ] as const;
34
+
35
+ type RequiredContractKey = (typeof REQUIRED_L1_CONTRACT_ADDRESS_KEYS)[number];
36
+ type OptionalContractKey = (typeof OPTIONAL_L1_CONTRACT_ADDRESS_KEYS)[number];
37
+
26
38
  /** Provides the directory of current L1 contract addresses */
27
39
  export type L1ContractAddresses = {
28
- [K in (typeof L1ContractsNames)[number]]: EthAddress;
40
+ [K in RequiredContractKey]: EthAddress;
29
41
  } & {
30
- slashFactoryAddress?: EthAddress | undefined;
31
- feeAssetHandlerAddress?: EthAddress | undefined;
32
- stakingAssetHandlerAddress?: EthAddress | undefined;
33
- zkPassportVerifierAddress?: EthAddress | undefined;
34
- gseAddress?: EthAddress | undefined;
35
- dateGatedRelayerAddress?: EthAddress | undefined;
42
+ [K in OptionalContractKey]?: EthAddress;
36
43
  };
37
44
 
38
- export const L1ContractAddressesSchema = z.object({
39
- rollupAddress: schemas.EthAddress,
40
- registryAddress: schemas.EthAddress,
41
- inboxAddress: schemas.EthAddress,
42
- outboxAddress: schemas.EthAddress,
43
- feeJuiceAddress: schemas.EthAddress,
44
- stakingAssetAddress: schemas.EthAddress,
45
- feeJuicePortalAddress: schemas.EthAddress,
46
- coinIssuerAddress: schemas.EthAddress,
47
- rewardDistributorAddress: schemas.EthAddress,
48
- governanceProposerAddress: schemas.EthAddress,
49
- governanceAddress: schemas.EthAddress,
50
- slashFactoryAddress: schemas.EthAddress.optional(),
51
- feeAssetHandlerAddress: schemas.EthAddress.optional(),
52
- stakingAssetHandlerAddress: schemas.EthAddress.optional(),
53
- zkPassportVerifierAddress: schemas.EthAddress.optional(),
54
- gseAddress: schemas.EthAddress.optional(),
55
- dateGatedRelayerAddress: schemas.EthAddress.optional(),
56
- }) satisfies ZodFor<L1ContractAddresses>;
45
+ /**
46
+ * Names of required L1 contract addresses.
47
+ * NOTE: When changing the set of contracts, update CLI & CI scripts accordingly.
48
+ * For reference: https://github.com/AztecProtocol/aztec-packages/pull/5553
49
+ */
50
+ export const L1ContractsNames = REQUIRED_L1_CONTRACT_ADDRESS_KEYS;
57
51
 
58
52
  const parseEnv = (val: string) => EthAddress.fromString(val);
53
+ const addrEnv = (description: string, env?: ConfigMapping<EthAddress>['env']): ConfigMapping<EthAddress> => ({
54
+ description,
55
+ parseEnv,
56
+ ...(env && { env }),
57
+ });
59
58
 
60
- export const l1ContractAddressesMapping: ConfigMappingsType<
61
- Omit<L1ContractAddresses, 'gseAddress' | 'zkPassportVerifierAddress' | 'dateGatedRelayerAddress'>
62
- > = {
63
- registryAddress: {
64
- env: 'REGISTRY_CONTRACT_ADDRESS',
65
- description: 'The deployed L1 registry contract address.',
66
- parseEnv,
67
- },
68
- slashFactoryAddress: {
69
- env: 'SLASH_FACTORY_CONTRACT_ADDRESS',
70
- description: 'The deployed L1 slashFactory contract address',
71
- parseEnv,
72
- },
73
- feeAssetHandlerAddress: {
74
- env: 'FEE_ASSET_HANDLER_CONTRACT_ADDRESS',
75
- description: 'The deployed L1 feeAssetHandler contract address',
76
- parseEnv,
77
- },
78
- rollupAddress: {
79
- description: 'The deployed L1 rollup contract address.',
80
- parseEnv,
81
- },
82
- inboxAddress: {
83
- description: 'The deployed L1 inbox contract address.',
84
- parseEnv,
85
- },
86
- outboxAddress: {
87
- description: 'The deployed L1 outbox contract address.',
88
- parseEnv,
89
- },
90
- feeJuiceAddress: {
91
- description: 'The deployed L1 Fee Juice contract address.',
92
- parseEnv,
93
- },
94
- stakingAssetAddress: {
95
- description: 'The deployed L1 staking asset contract address.',
96
- parseEnv,
97
- },
98
- feeJuicePortalAddress: {
99
- description: 'The deployed L1 Fee Juice portal contract address.',
100
- parseEnv,
101
- },
102
- coinIssuerAddress: {
103
- description: 'The deployed L1 coinIssuer contract address',
104
- parseEnv,
105
- },
106
- rewardDistributorAddress: {
107
- description: 'The deployed L1 rewardDistributor contract address',
108
- parseEnv,
109
- },
110
- governanceProposerAddress: {
111
- description: 'The deployed L1 governanceProposer contract address',
112
- parseEnv,
113
- },
114
- governanceAddress: {
115
- description: 'The deployed L1 governance contract address',
116
- parseEnv,
117
- },
118
- stakingAssetHandlerAddress: {
119
- description: 'The deployed L1 stakingAssetHandler contract address',
120
- parseEnv,
121
- },
59
+ /**
60
+ * Config mapping for all L1 contract addresses.
61
+ * This is the single source of truth for which contract addresses exist and how to parse them.
62
+ */
63
+ export const l1ContractAddressesMapping: ConfigMappingsType<L1ContractAddresses> = {
64
+ rollupAddress: addrEnv('The deployed L1 rollup contract address.'),
65
+ registryAddress: addrEnv('The deployed L1 registry contract address.', 'REGISTRY_CONTRACT_ADDRESS'),
66
+ inboxAddress: addrEnv('The deployed L1 inbox contract address.'),
67
+ outboxAddress: addrEnv('The deployed L1 outbox contract address.'),
68
+ feeJuiceAddress: addrEnv('The deployed L1 Fee Juice contract address.'),
69
+ feeJuicePortalAddress: addrEnv('The deployed L1 Fee Juice portal contract address.'),
70
+ coinIssuerAddress: addrEnv('The deployed L1 coinIssuer contract address'),
71
+ rewardDistributorAddress: addrEnv('The deployed L1 rewardDistributor contract address'),
72
+ governanceProposerAddress: addrEnv('The deployed L1 governanceProposer contract address'),
73
+ governanceAddress: addrEnv('The deployed L1 governance contract address'),
74
+ stakingAssetAddress: addrEnv('The deployed L1 staking asset contract address.'),
75
+ feeAssetHandlerAddress: addrEnv(
76
+ 'The deployed L1 feeAssetHandler contract address',
77
+ 'FEE_ASSET_HANDLER_CONTRACT_ADDRESS',
78
+ ),
79
+ stakingAssetHandlerAddress: addrEnv('The deployed L1 stakingAssetHandler contract address'),
80
+ zkPassportVerifierAddress: addrEnv('The deployed L1 ZK passport verifier contract address'),
81
+ gseAddress: addrEnv('The deployed L1 GSE contract address'),
82
+ dateGatedRelayerAddress: addrEnv('The deployed L1 date-gated relayer contract address'),
122
83
  };
84
+
85
+ /** Keys present in {@link l1ContractAddressesMapping}. */
86
+ export type L1ContractAddressMappingKey = keyof typeof l1ContractAddressesMapping;
87
+
88
+ type RequiredAddressShape = { [K in RequiredContractKey]: typeof schemas.EthAddress };
89
+ type OptionalAddressShape = { [K in OptionalContractKey]: ReturnType<typeof schemas.EthAddress.optional> };
90
+
91
+ export const L1ContractAddressesSchema = z.object({
92
+ ...(Object.fromEntries(REQUIRED_L1_CONTRACT_ADDRESS_KEYS.map(k => [k, schemas.EthAddress])) as RequiredAddressShape),
93
+ ...(Object.fromEntries(
94
+ OPTIONAL_L1_CONTRACT_ADDRESS_KEYS.map(k => [k, schemas.EthAddress.optional()]),
95
+ ) as OptionalAddressShape),
96
+ });
97
+
98
+ /**
99
+ * Selects entries from {@link l1ContractAddressesMapping} so composed configs can reuse the same
100
+ * env vars, descriptions, and parsers without duplicating definitions.
101
+ *
102
+ * @example
103
+ * ```ts
104
+ * const mappings = {
105
+ * ...pickL1ContractAddressMappings('rollupAddress'),
106
+ * nodeId: { ... },
107
+ * };
108
+ * ```
109
+ */
110
+ export function pickL1ContractAddressMappings<const K extends readonly L1ContractAddressMappingKey[]>(
111
+ ...keys: K
112
+ ): Pick<typeof l1ContractAddressesMapping, K[number]> {
113
+ return Object.fromEntries(keys.map(key => [key, l1ContractAddressesMapping[key]] as const)) as Pick<
114
+ typeof l1ContractAddressesMapping,
115
+ K[number]
116
+ >;
117
+ }
118
+
119
+ /**
120
+ * Like {@link pickL1ContractAddressMappings}, but returns a fragment of {@link L1ContractAddressesSchema}'s shape for
121
+ * spreading into `z.object({ ...pickL1ContractAddressesSchemaShape('rollupAddress'), localField: z... })`.
122
+ */
123
+ export function pickL1ContractAddressesSchema<const K extends readonly L1ContractAddressMappingKey[]>(
124
+ ...keys: K
125
+ ): Pick<typeof L1ContractAddressesSchema.shape, K[number]> {
126
+ return Object.fromEntries(keys.map(key => [key, L1ContractAddressesSchema.shape[key]])) as Pick<
127
+ typeof L1ContractAddressesSchema.shape,
128
+ K[number]
129
+ >;
130
+ }
131
+
132
+ /** Builds an {@link L1ContractAddresses} object from config that stores those fields at the top level. */
133
+ export function pickL1ContractAddresses<T extends L1ContractAddresses>(config: T): L1ContractAddresses {
134
+ const result: Partial<L1ContractAddresses> = {};
135
+ for (const key of REQUIRED_L1_CONTRACT_ADDRESS_KEYS) {
136
+ result[key] = config[key];
137
+ }
138
+ for (const key of OPTIONAL_L1_CONTRACT_ADDRESS_KEYS) {
139
+ const v = config[key];
140
+ if (v !== undefined) {
141
+ result[key] = v;
142
+ }
143
+ }
144
+ return result as L1ContractAddresses;
145
+ }
146
+
147
+ export function randomL1ContractAddresses(includeOptional: boolean = false): L1ContractAddresses {
148
+ const keys = includeOptional ? [...L1ContractsNames, ...OPTIONAL_L1_CONTRACT_ADDRESS_KEYS] : L1ContractsNames;
149
+ return Object.fromEntries(keys.map(name => [name, EthAddress.random()])) as L1ContractAddresses;
150
+ }
package/src/l1_reader.ts CHANGED
@@ -1,27 +1,30 @@
1
- import { type ConfigMappingsType, getConfigFromMappings, numberConfigHelper } from '@aztec/foundation/config';
1
+ import {
2
+ type ConfigMappingsType,
3
+ getConfigFromMappings,
4
+ numberConfigHelper,
5
+ optionalNumberConfigHelper,
6
+ } from '@aztec/foundation/config';
2
7
 
3
8
  import { type L1ContractAddresses, l1ContractAddressesMapping } from './l1_contract_addresses.js';
4
9
 
5
10
  /** Configuration of the L1GlobalReader. */
6
- export interface L1ReaderConfig {
11
+ export type L1ReaderConfig = {
7
12
  /** List of URLs of Ethereum RPC nodes that services will connect to (comma separated). */
8
13
  l1RpcUrls: string[];
14
+ /** The RPC Url of the ethereum debug host for trace and debug methods. */
15
+ l1DebugRpcUrls: string[];
9
16
  /** The chain ID of the ethereum host. */
10
17
  l1ChainId: number;
11
- /** The deployed l1 contract addresses */
12
- l1Contracts: L1ContractAddresses;
13
18
  /** The polling interval viem uses in ms */
14
19
  viemPollingIntervalMS: number;
15
- }
20
+ /** Timeout for HTTP requests to the L1 RPC node in ms. */
21
+ l1HttpTimeoutMS?: number;
22
+ } & L1ContractAddresses;
16
23
 
17
24
  export const l1ReaderConfigMappings: ConfigMappingsType<L1ReaderConfig> = {
18
- l1Contracts: {
19
- description: 'The deployed L1 contract addresses',
20
- nested: l1ContractAddressesMapping,
21
- },
22
25
  l1ChainId: {
23
26
  env: 'L1_CHAIN_ID',
24
- parseEnv: (val: string) => +val,
27
+ ...optionalNumberConfigHelper(),
25
28
  description: 'The chain ID of the ethereum host.',
26
29
  },
27
30
  l1RpcUrls: {
@@ -30,11 +33,23 @@ export const l1ReaderConfigMappings: ConfigMappingsType<L1ReaderConfig> = {
30
33
  parseEnv: (val: string) => val.split(',').map(url => url.trim()),
31
34
  defaultValue: [],
32
35
  },
36
+ l1DebugRpcUrls: {
37
+ env: 'ETHEREUM_DEBUG_HOSTS',
38
+ description: 'The RPC Url of the ethereum debug host for trace and debug methods.',
39
+ parseEnv: (val: string) => val.split(',').map(url => url.trim()),
40
+ defaultValue: [],
41
+ },
33
42
  viemPollingIntervalMS: {
34
43
  env: 'L1_READER_VIEM_POLLING_INTERVAL_MS',
35
44
  description: 'The polling interval viem uses in ms',
36
45
  ...numberConfigHelper(1_000),
37
46
  },
47
+ l1HttpTimeoutMS: {
48
+ env: 'ETHEREUM_HTTP_TIMEOUT_MS',
49
+ description: 'Timeout for HTTP requests to the L1 RPC node in ms.',
50
+ ...optionalNumberConfigHelper(),
51
+ },
52
+ ...l1ContractAddressesMapping,
38
53
  };
39
54
 
40
55
  export function getL1ReaderConfigFromEnv(): L1ReaderConfig {
@@ -1,10 +1,11 @@
1
1
  import {
2
2
  type ConfigMappingsType,
3
- bigintConfigHelper,
4
3
  booleanConfigHelper,
4
+ floatConfigHelper,
5
5
  getConfigFromMappings,
6
6
  getDefaultConfig,
7
7
  numberConfigHelper,
8
+ optionalNumberConfigHelper,
8
9
  } from '@aztec/foundation/config';
9
10
 
10
11
  export interface L1TxUtilsConfig {
@@ -15,11 +16,11 @@ export interface L1TxUtilsConfig {
15
16
  /**
16
17
  * Maximum gas price in gwei
17
18
  */
18
- maxGwei?: bigint;
19
+ maxGwei?: number;
19
20
  /**
20
21
  * Maximum blob fee per gas in gwei
21
22
  */
22
- maxBlobGwei?: bigint;
23
+ maxBlobGwei?: number;
23
24
  /**
24
25
  * Priority fee bump percentage
25
26
  */
@@ -29,9 +30,9 @@ export interface L1TxUtilsConfig {
29
30
  */
30
31
  priorityFeeRetryBumpPercentage?: number;
31
32
  /**
32
- * Fixed priority fee per gas in Gwei. Overrides any priority fee bump percentage config
33
+ * Minimum priority fee per gas in Gwei. Acts as a floor for the computed priority fee.
33
34
  */
34
- fixedPriorityFeePerGas?: number;
35
+ minimumPriorityFeePerGas?: number;
35
36
  /**
36
37
  * Maximum number of speed-up attempts
37
38
  */
@@ -60,6 +61,12 @@ export interface L1TxUtilsConfig {
60
61
  * How long a tx nonce can be unseen in the mempool before considering it dropped
61
62
  */
62
63
  txUnseenConsideredDroppedMs?: number;
64
+ /** Enable tx delayer. When true, wraps the viem client to intercept and delay txs. Test-only. */
65
+ enableDelayer?: boolean;
66
+ /** Max seconds into an L1 slot for tx inclusion. Txs sent later are deferred to next slot. Only used when enableDelayer is true. */
67
+ txDelayerMaxInclusionTimeIntoSlot?: number;
68
+ /** How many seconds an L1 slot lasts. */
69
+ ethereumSlotDuration?: number;
63
70
  }
64
71
 
65
72
  export const l1TxUtilsConfigMappings: ConfigMappingsType<L1TxUtilsConfig> = {
@@ -71,12 +78,14 @@ export const l1TxUtilsConfigMappings: ConfigMappingsType<L1TxUtilsConfig> = {
71
78
  maxGwei: {
72
79
  description: 'Maximum gas price in gwei to be used for transactions.',
73
80
  env: 'L1_GAS_PRICE_MAX',
74
- ...bigintConfigHelper(2000n),
81
+ fallback: ['L1_FEE_PER_GAS_GWEI_MAX'],
82
+ ...floatConfigHelper(2000),
75
83
  },
76
84
  maxBlobGwei: {
77
85
  description: 'Maximum blob fee per gas in gwei',
78
86
  env: 'L1_BLOB_FEE_PER_GAS_MAX',
79
- ...bigintConfigHelper(3000n),
87
+ fallback: ['L1_BLOB_FEE_PER_GAS_GWEI_MAX'],
88
+ ...floatConfigHelper(3000),
80
89
  },
81
90
  priorityFeeBumpPercentage: {
82
91
  description: 'How much to increase priority fee by each attempt (percentage)',
@@ -88,10 +97,22 @@ export const l1TxUtilsConfigMappings: ConfigMappingsType<L1TxUtilsConfig> = {
88
97
  env: 'L1_PRIORITY_FEE_RETRY_BUMP_PERCENTAGE',
89
98
  ...numberConfigHelper(50),
90
99
  },
91
- fixedPriorityFeePerGas: {
92
- description: 'Fixed priority fee per gas in Gwei. Overrides any priority fee bump percentage',
93
- env: 'L1_FIXED_PRIORITY_FEE_PER_GAS',
94
- ...numberConfigHelper(0),
100
+ minimumPriorityFeePerGas: {
101
+ description:
102
+ '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.',
103
+ env: 'L1_MINIMUM_PRIORITY_FEE_PER_GAS_GWEI',
104
+ fallback: ['L1_FIXED_PRIORITY_FEE_PER_GAS', 'L1_FIXED_PRIORITY_FEE_PER_GAS_GWEI'],
105
+ deprecatedFallback: [
106
+ {
107
+ env: 'L1_FIXED_PRIORITY_FEE_PER_GAS',
108
+ message: deprecatedFixedFeeMessage('L1_FIXED_PRIORITY_FEE_PER_GAS'),
109
+ },
110
+ {
111
+ env: 'L1_FIXED_PRIORITY_FEE_PER_GAS_GWEI',
112
+ message: deprecatedFixedFeeMessage('L1_FIXED_PRIORITY_FEE_PER_GAS_GWEI'),
113
+ },
114
+ ],
115
+ ...floatConfigHelper(0),
95
116
  },
96
117
  maxSpeedUpAttempts: {
97
118
  description: 'Maximum number of speed-up attempts',
@@ -128,6 +149,19 @@ export const l1TxUtilsConfigMappings: ConfigMappingsType<L1TxUtilsConfig> = {
128
149
  env: 'L1_TX_MONITOR_TX_UNSEEN_CONSIDERED_DROPPED_MS',
129
150
  ...numberConfigHelper(6 * 12 * 1000), // 6 L1 blocks
130
151
  },
152
+ enableDelayer: {
153
+ description: 'Enable tx delayer for testing.',
154
+ ...booleanConfigHelper(false),
155
+ },
156
+ txDelayerMaxInclusionTimeIntoSlot: {
157
+ description: 'Max seconds into L1 slot for tx inclusion when delayer is enabled.',
158
+ ...optionalNumberConfigHelper(),
159
+ },
160
+ ethereumSlotDuration: {
161
+ env: 'ETHEREUM_SLOT_DURATION',
162
+ description: 'How many seconds an L1 slot lasts.',
163
+ ...numberConfigHelper(12),
164
+ },
131
165
  };
132
166
 
133
167
  // We abuse the fact that all mappings above have a non null default value and force-type this to Required
@@ -138,3 +172,10 @@ export const defaultL1TxUtilsConfig = getDefaultConfig<L1TxUtilsConfig>(
138
172
  export function getL1TxUtilsConfigEnvVars(): L1TxUtilsConfig {
139
173
  return getConfigFromMappings(l1TxUtilsConfigMappings);
140
174
  }
175
+
176
+ function deprecatedFixedFeeMessage(envVar: string): string {
177
+ return (
178
+ `Environment variable ${envVar} is deprecated. It is now used as a MINIMUM priority fee rather than a fixed value. ` +
179
+ 'Please use L1_MINIMUM_PRIORITY_FEE_PER_GAS_GWEI instead. If network conditions require a higher fee, the higher fee will be used.'
180
+ );
181
+ }
@@ -3,8 +3,8 @@
3
3
  // 1_000_000_000_000_000_000 Wei = 1 ETH
4
4
  export const WEI_CONST = 1_000_000_000n;
5
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;
6
+ // EIP-7825: protocol-level cap on tx gas limit (2^24). Clients reject above this.
7
+ export const MAX_L1_TX_LIMIT = 16_777_216n;
8
8
 
9
9
  // setting a minimum bump percentage to 10% due to geth's implementation
10
10
  // https://github.com/ethereum/go-ethereum/blob/e3d61e6db028c412f74bc4d4c7e117a9e29d0de0/core/txpool/legacypool/list.go#L298
@@ -16,3 +16,14 @@ export const MIN_BLOB_REPLACEMENT_BUMP_PERCENTAGE = 100;
16
16
 
17
17
  // Avg ethereum block time is ~12s
18
18
  export const BLOCK_TIME_MS = 12_000;
19
+
20
+ // Gas per blob (EIP-4844)
21
+ export const GAS_PER_BLOB = 131072n;
22
+
23
+ // Blob capacity schedule based on Ethereum upgrades
24
+ export const BLOB_CAPACITY_SCHEDULE = [
25
+ { timestamp: 1734357600, target: 14, max: 21 }, // BPO2: Dec 17, 2025
26
+ { timestamp: 1733752800, target: 10, max: 15 }, // BPO1: Dec 9, 2025
27
+ { timestamp: 1733234400, target: 6, max: 9 }, // Fusaka: Dec 3, 2025
28
+ { timestamp: 0, target: 6, max: 9 }, // Pectra/earlier
29
+ ];
@@ -1,64 +1,64 @@
1
+ import type { BlobKzgInstance } from '@aztec/blob-lib/types';
1
2
  import { EthAddress } from '@aztec/foundation/eth-address';
2
3
  import type { Logger } from '@aztec/foundation/log';
3
4
  import { DateProvider } from '@aztec/foundation/timer';
4
5
 
5
- import type { TransactionSerializable } from 'viem';
6
-
7
6
  import type { EthSigner } from '../eth-signer/eth-signer.js';
8
7
  import type { ExtendedViemWalletClient, ViemClient } from '../types.js';
9
8
  import type { L1TxUtilsConfig } from './config.js';
10
9
  import type { IL1TxMetrics, IL1TxStore } from './interfaces.js';
11
10
  import { L1TxUtils } from './l1_tx_utils.js';
12
11
  import { createViemSigner } from './signer.js';
12
+ import { Delayer } from './tx_delayer.js';
13
13
  import type { SigningCallback } from './types.js';
14
14
 
15
- export function createL1TxUtilsFromViemWallet(
16
- client: ExtendedViemWalletClient,
17
- deps?: {
18
- logger?: Logger;
19
- dateProvider?: DateProvider;
20
- store?: IL1TxStore;
21
- metrics?: IL1TxMetrics;
22
- },
23
- config?: Partial<L1TxUtilsConfig> & { debugMaxGasLimit?: boolean },
24
- ): L1TxUtils {
25
- return new L1TxUtils(
15
+ /** Source of signing capability: either a wallet client or a separate client + signer. */
16
+ export type L1SignerSource = ExtendedViemWalletClient | { client: ViemClient; signer: EthSigner };
17
+
18
+ export function resolveSignerSource(source: L1SignerSource): {
19
+ client: ViemClient;
20
+ address: EthAddress;
21
+ signingCallback: SigningCallback;
22
+ } {
23
+ if ('account' in source && source.account) {
24
+ return {
25
+ client: source as ExtendedViemWalletClient,
26
+ address: EthAddress.fromString((source as ExtendedViemWalletClient).account.address),
27
+ signingCallback: createViemSigner(source as ExtendedViemWalletClient),
28
+ };
29
+ }
30
+ const { client, signer } = source as { client: ViemClient; signer: EthSigner };
31
+ return {
26
32
  client,
27
- EthAddress.fromString(client.account.address),
28
- createViemSigner(client),
29
- deps?.logger,
30
- deps?.dateProvider,
31
- config,
32
- config?.debugMaxGasLimit ?? false,
33
- deps?.store,
34
- deps?.metrics,
35
- );
33
+ address: signer.address,
34
+ signingCallback: async (tx, _addr) => (await signer.signTransaction(tx)).toViemTransactionSignature(),
35
+ };
36
36
  }
37
37
 
38
- export function createL1TxUtilsFromEthSigner(
39
- client: ViemClient,
40
- signer: EthSigner,
38
+ export function createL1TxUtils(
39
+ source: L1SignerSource,
41
40
  deps?: {
42
41
  logger?: Logger;
43
42
  dateProvider?: DateProvider;
44
43
  store?: IL1TxStore;
45
44
  metrics?: IL1TxMetrics;
45
+ kzg?: BlobKzgInstance;
46
+ delayer?: Delayer;
46
47
  },
47
48
  config?: Partial<L1TxUtilsConfig> & { debugMaxGasLimit?: boolean },
48
49
  ): L1TxUtils {
49
- const callback: SigningCallback = async (transaction: TransactionSerializable, _signingAddress) => {
50
- return (await signer.signTransaction(transaction)).toViemTransactionSignature();
51
- };
52
-
50
+ const { client, address, signingCallback } = resolveSignerSource(source);
53
51
  return new L1TxUtils(
54
52
  client,
55
- signer.address,
56
- callback,
53
+ address,
54
+ signingCallback,
57
55
  deps?.logger,
58
56
  deps?.dateProvider,
59
57
  config,
60
58
  config?.debugMaxGasLimit ?? false,
61
59
  deps?.store,
62
60
  deps?.metrics,
61
+ deps?.kzg,
62
+ deps?.delayer,
63
63
  );
64
64
  }
@@ -0,0 +1,22 @@
1
+ import { P75AllTxsPriorityFeeStrategy } from './p75_competitive.js';
2
+ import { P75BlobTxsOnlyPriorityFeeStrategy } from './p75_competitive_blob_txs_only.js';
3
+ import type { PriorityFeeStrategy } from './types.js';
4
+
5
+ export {
6
+ HISTORICAL_BLOCK_COUNT,
7
+ type PriorityFeeStrategy,
8
+ type PriorityFeeStrategyContext,
9
+ type PriorityFeeStrategyResult,
10
+ } from './types.js';
11
+
12
+ export { P75AllTxsPriorityFeeStrategy } from './p75_competitive.js';
13
+ export { P75BlobTxsOnlyPriorityFeeStrategy } from './p75_competitive_blob_txs_only.js';
14
+
15
+ /**
16
+ * Default list of priority fee strategies to analyze.
17
+ * Add more strategies here for comparison.
18
+ */
19
+ export const DEFAULT_PRIORITY_FEE_STRATEGIES: PriorityFeeStrategy[] = [
20
+ P75AllTxsPriorityFeeStrategy,
21
+ P75BlobTxsOnlyPriorityFeeStrategy,
22
+ ];