@aztec/ethereum 0.0.0-test.1 → 0.0.1-commit.03f7ef2

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 (272) hide show
  1. package/dest/account.d.ts +2 -0
  2. package/dest/account.d.ts.map +1 -0
  3. package/dest/account.js +4 -0
  4. package/dest/chain.d.ts +1 -1
  5. package/dest/client.d.ts +6 -4
  6. package/dest/client.d.ts.map +1 -1
  7. package/dest/client.js +21 -3
  8. package/dest/config.d.ts +71 -16
  9. package/dest/config.d.ts.map +1 -1
  10. package/dest/config.js +138 -22
  11. package/dest/constants.d.ts +1 -1
  12. package/dest/contracts/empire_base.d.ts +25 -8
  13. package/dest/contracts/empire_base.d.ts.map +1 -1
  14. package/dest/contracts/empire_base.js +75 -2
  15. package/dest/contracts/empire_slashing_proposer.d.ts +67 -0
  16. package/dest/contracts/empire_slashing_proposer.d.ts.map +1 -0
  17. package/dest/contracts/empire_slashing_proposer.js +209 -0
  18. package/dest/contracts/errors.d.ts +7 -0
  19. package/dest/contracts/errors.d.ts.map +1 -0
  20. package/dest/contracts/errors.js +12 -0
  21. package/dest/contracts/fee_asset_handler.d.ts +19 -0
  22. package/dest/contracts/fee_asset_handler.d.ts.map +1 -0
  23. package/dest/contracts/fee_asset_handler.js +57 -0
  24. package/dest/contracts/fee_juice.d.ts +6 -7
  25. package/dest/contracts/fee_juice.d.ts.map +1 -1
  26. package/dest/contracts/fee_juice.js +27 -20
  27. package/dest/contracts/governance.d.ts +43 -32
  28. package/dest/contracts/governance.d.ts.map +1 -1
  29. package/dest/contracts/governance.js +87 -84
  30. package/dest/contracts/governance_proposer.d.ts +17 -13
  31. package/dest/contracts/governance_proposer.d.ts.map +1 -1
  32. package/dest/contracts/governance_proposer.js +46 -17
  33. package/dest/contracts/gse.d.ts +32 -0
  34. package/dest/contracts/gse.d.ts.map +1 -0
  35. package/dest/contracts/gse.js +72 -0
  36. package/dest/contracts/inbox.d.ts +26 -0
  37. package/dest/contracts/inbox.d.ts.map +1 -0
  38. package/dest/contracts/inbox.js +45 -0
  39. package/dest/contracts/index.d.ts +9 -3
  40. package/dest/contracts/index.d.ts.map +1 -1
  41. package/dest/contracts/index.js +8 -2
  42. package/dest/contracts/multicall.d.ts +21 -0
  43. package/dest/contracts/multicall.d.ts.map +1 -0
  44. package/dest/contracts/multicall.js +156 -0
  45. package/dest/contracts/registry.d.ts +10 -5
  46. package/dest/contracts/registry.d.ts.map +1 -1
  47. package/dest/contracts/registry.js +44 -16
  48. package/dest/contracts/rollup.d.ts +221 -41
  49. package/dest/contracts/rollup.d.ts.map +1 -1
  50. package/dest/contracts/rollup.js +549 -81
  51. package/dest/contracts/slasher_contract.d.ts +44 -0
  52. package/dest/contracts/slasher_contract.d.ts.map +1 -0
  53. package/dest/contracts/slasher_contract.js +75 -0
  54. package/dest/contracts/tally_slashing_proposer.d.ts +140 -0
  55. package/dest/contracts/tally_slashing_proposer.d.ts.map +1 -0
  56. package/dest/contracts/tally_slashing_proposer.js +313 -0
  57. package/dest/contracts/utils.d.ts +3 -0
  58. package/dest/contracts/utils.d.ts.map +1 -0
  59. package/dest/contracts/utils.js +11 -0
  60. package/dest/deploy_aztec_l1_contracts.d.ts +245 -0
  61. package/dest/deploy_aztec_l1_contracts.d.ts.map +1 -0
  62. package/dest/deploy_aztec_l1_contracts.js +335 -0
  63. package/dest/deploy_l1_contract.d.ts +68 -0
  64. package/dest/deploy_l1_contract.d.ts.map +1 -0
  65. package/dest/deploy_l1_contract.js +312 -0
  66. package/dest/eth-signer/eth-signer.d.ts +21 -0
  67. package/dest/eth-signer/eth-signer.d.ts.map +1 -0
  68. package/dest/eth-signer/eth-signer.js +5 -0
  69. package/dest/eth-signer/index.d.ts +2 -0
  70. package/dest/eth-signer/index.d.ts.map +1 -0
  71. package/dest/eth-signer/index.js +1 -0
  72. package/dest/forwarder_proxy.d.ts +32 -0
  73. package/dest/forwarder_proxy.d.ts.map +1 -0
  74. package/dest/forwarder_proxy.js +93 -0
  75. package/dest/l1_artifacts.d.ts +77364 -0
  76. package/dest/l1_artifacts.d.ts.map +1 -0
  77. package/dest/l1_artifacts.js +166 -0
  78. package/dest/l1_contract_addresses.d.ts +24 -4
  79. package/dest/l1_contract_addresses.d.ts.map +1 -1
  80. package/dest/l1_contract_addresses.js +25 -21
  81. package/dest/l1_reader.d.ts +4 -2
  82. package/dest/l1_reader.d.ts.map +1 -1
  83. package/dest/l1_reader.js +14 -8
  84. package/dest/l1_tx_utils/config.d.ts +59 -0
  85. package/dest/l1_tx_utils/config.d.ts.map +1 -0
  86. package/dest/l1_tx_utils/config.js +96 -0
  87. package/dest/l1_tx_utils/constants.d.ts +12 -0
  88. package/dest/l1_tx_utils/constants.d.ts.map +1 -0
  89. package/dest/l1_tx_utils/constants.js +39 -0
  90. package/dest/l1_tx_utils/factory.d.ts +24 -0
  91. package/dest/l1_tx_utils/factory.d.ts.map +1 -0
  92. package/dest/l1_tx_utils/factory.js +12 -0
  93. package/dest/l1_tx_utils/fee-strategies/index.d.ts +9 -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 +11 -0
  96. package/dest/l1_tx_utils/fee-strategies/p75_competitive.d.ts +18 -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 +111 -0
  99. package/dest/l1_tx_utils/fee-strategies/p75_competitive_blob_txs_only.d.ts +32 -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 +173 -0
  102. package/dest/l1_tx_utils/fee-strategies/types.d.ts +64 -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 +24 -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 +48 -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 +12 -0
  112. package/dest/l1_tx_utils/index.d.ts.map +1 -0
  113. package/dest/l1_tx_utils/index.js +12 -0
  114. package/dest/l1_tx_utils/interfaces.d.ts +76 -0
  115. package/dest/l1_tx_utils/interfaces.d.ts.map +1 -0
  116. package/dest/l1_tx_utils/interfaces.js +4 -0
  117. package/dest/l1_tx_utils/l1_fee_analyzer.d.ts +233 -0
  118. package/dest/l1_tx_utils/l1_fee_analyzer.d.ts.map +1 -0
  119. package/dest/l1_tx_utils/l1_fee_analyzer.js +506 -0
  120. package/dest/l1_tx_utils/l1_tx_utils.d.ts +94 -0
  121. package/dest/l1_tx_utils/l1_tx_utils.d.ts.map +1 -0
  122. package/dest/l1_tx_utils/l1_tx_utils.js +623 -0
  123. package/dest/l1_tx_utils/l1_tx_utils_with_blobs.d.ts +26 -0
  124. package/dest/l1_tx_utils/l1_tx_utils_with_blobs.d.ts.map +1 -0
  125. package/dest/l1_tx_utils/l1_tx_utils_with_blobs.js +26 -0
  126. package/dest/l1_tx_utils/readonly_l1_tx_utils.d.ts +87 -0
  127. package/dest/l1_tx_utils/readonly_l1_tx_utils.d.ts.map +1 -0
  128. package/dest/l1_tx_utils/readonly_l1_tx_utils.js +360 -0
  129. package/dest/l1_tx_utils/signer.d.ts +4 -0
  130. package/dest/l1_tx_utils/signer.d.ts.map +1 -0
  131. package/dest/l1_tx_utils/signer.js +16 -0
  132. package/dest/l1_tx_utils/types.d.ts +67 -0
  133. package/dest/l1_tx_utils/types.d.ts.map +1 -0
  134. package/dest/l1_tx_utils/types.js +26 -0
  135. package/dest/l1_tx_utils/utils.d.ts +4 -0
  136. package/dest/l1_tx_utils/utils.d.ts.map +1 -0
  137. package/dest/l1_tx_utils/utils.js +14 -0
  138. package/dest/l1_types.d.ts +6 -0
  139. package/dest/l1_types.d.ts.map +1 -0
  140. package/dest/l1_types.js +1 -0
  141. package/dest/publisher_manager.d.ts +15 -0
  142. package/dest/publisher_manager.d.ts.map +1 -0
  143. package/dest/publisher_manager.js +88 -0
  144. package/dest/queries.d.ts +4 -2
  145. package/dest/queries.d.ts.map +1 -1
  146. package/dest/queries.js +53 -12
  147. package/dest/test/chain_monitor.d.ts +75 -0
  148. package/dest/test/chain_monitor.d.ts.map +1 -0
  149. package/dest/test/chain_monitor.js +214 -0
  150. package/dest/test/delayed_tx_utils.d.ts +8 -3
  151. package/dest/test/delayed_tx_utils.d.ts.map +1 -1
  152. package/dest/test/delayed_tx_utils.js +13 -6
  153. package/dest/test/eth_cheat_codes.d.ts +217 -0
  154. package/dest/test/eth_cheat_codes.d.ts.map +1 -0
  155. package/dest/test/eth_cheat_codes.js +560 -0
  156. package/dest/test/eth_cheat_codes_with_state.d.ts +2 -2
  157. package/dest/test/eth_cheat_codes_with_state.d.ts.map +1 -1
  158. package/dest/test/eth_cheat_codes_with_state.js +1 -1
  159. package/dest/test/index.d.ts +4 -1
  160. package/dest/test/index.d.ts.map +1 -1
  161. package/dest/test/index.js +3 -0
  162. package/dest/test/rollup_cheat_codes.d.ts +87 -0
  163. package/dest/test/rollup_cheat_codes.d.ts.map +1 -0
  164. package/dest/test/rollup_cheat_codes.js +275 -0
  165. package/dest/test/start_anvil.d.ts +9 -1
  166. package/dest/test/start_anvil.d.ts.map +1 -1
  167. package/dest/test/start_anvil.js +16 -7
  168. package/dest/test/tx_delayer.d.ts +18 -7
  169. package/dest/test/tx_delayer.d.ts.map +1 -1
  170. package/dest/test/tx_delayer.js +97 -20
  171. package/dest/test/upgrade_utils.d.ts +6 -5
  172. package/dest/test/upgrade_utils.d.ts.map +1 -1
  173. package/dest/test/upgrade_utils.js +23 -16
  174. package/dest/types.d.ts +62 -8
  175. package/dest/types.d.ts.map +1 -1
  176. package/dest/types.js +3 -1
  177. package/dest/utils.d.ts +16 -3
  178. package/dest/utils.d.ts.map +1 -1
  179. package/dest/utils.js +61 -88
  180. package/dest/zkPassportVerifierAddress.d.ts +15 -0
  181. package/dest/zkPassportVerifierAddress.d.ts.map +1 -0
  182. package/dest/zkPassportVerifierAddress.js +11 -0
  183. package/package.json +50 -23
  184. package/src/account.ts +5 -0
  185. package/src/client.ts +43 -5
  186. package/src/config.ts +188 -31
  187. package/src/contracts/empire_base.ts +77 -7
  188. package/src/contracts/empire_slashing_proposer.ts +270 -0
  189. package/src/contracts/errors.ts +13 -0
  190. package/src/contracts/fee_asset_handler.ts +63 -0
  191. package/src/contracts/fee_juice.ts +29 -15
  192. package/src/contracts/governance.ts +80 -77
  193. package/src/contracts/governance_proposer.ts +71 -24
  194. package/src/contracts/gse.ts +88 -0
  195. package/src/contracts/inbox.ts +63 -0
  196. package/src/contracts/index.ts +8 -2
  197. package/src/contracts/multicall.ts +155 -0
  198. package/src/contracts/registry.ts +51 -26
  199. package/src/contracts/rollup.ts +624 -78
  200. package/src/contracts/slasher_contract.ts +89 -0
  201. package/src/contracts/tally_slashing_proposer.ts +318 -0
  202. package/src/contracts/utils.ts +14 -0
  203. package/src/deploy_aztec_l1_contracts.ts +556 -0
  204. package/src/deploy_l1_contract.ts +362 -0
  205. package/src/eth-signer/eth-signer.ts +25 -0
  206. package/src/eth-signer/index.ts +1 -0
  207. package/src/forwarder_proxy.ts +108 -0
  208. package/src/l1_artifacts.ts +254 -0
  209. package/src/l1_contract_addresses.ts +49 -34
  210. package/src/l1_reader.ts +17 -9
  211. package/src/l1_tx_utils/README.md +177 -0
  212. package/src/l1_tx_utils/config.ts +161 -0
  213. package/src/l1_tx_utils/constants.ts +29 -0
  214. package/src/l1_tx_utils/factory.ts +64 -0
  215. package/src/l1_tx_utils/fee-strategies/index.ts +22 -0
  216. package/src/l1_tx_utils/fee-strategies/p75_competitive.ts +159 -0
  217. package/src/l1_tx_utils/fee-strategies/p75_competitive_blob_txs_only.ts +241 -0
  218. package/src/l1_tx_utils/fee-strategies/types.ts +88 -0
  219. package/src/l1_tx_utils/forwarder_l1_tx_utils.ts +119 -0
  220. package/src/l1_tx_utils/index-blobs.ts +2 -0
  221. package/src/l1_tx_utils/index.ts +14 -0
  222. package/src/l1_tx_utils/interfaces.ts +86 -0
  223. package/src/l1_tx_utils/l1_fee_analyzer.ts +804 -0
  224. package/src/l1_tx_utils/l1_tx_utils.ts +738 -0
  225. package/src/l1_tx_utils/l1_tx_utils_with_blobs.ts +77 -0
  226. package/src/l1_tx_utils/readonly_l1_tx_utils.ts +458 -0
  227. package/src/l1_tx_utils/signer.ts +28 -0
  228. package/src/l1_tx_utils/types.ts +85 -0
  229. package/src/l1_tx_utils/utils.ts +16 -0
  230. package/src/l1_types.ts +6 -0
  231. package/src/publisher_manager.ts +106 -0
  232. package/src/queries.ts +73 -15
  233. package/src/test/chain_monitor.ts +245 -0
  234. package/src/test/delayed_tx_utils.ts +34 -6
  235. package/src/test/eth_cheat_codes.ts +588 -0
  236. package/src/test/eth_cheat_codes_with_state.ts +1 -1
  237. package/src/test/index.ts +3 -0
  238. package/src/test/rollup_cheat_codes.ts +312 -0
  239. package/src/test/start_anvil.ts +24 -5
  240. package/src/test/tx_delayer.ts +130 -27
  241. package/src/test/upgrade_utils.ts +30 -21
  242. package/src/types.ts +71 -7
  243. package/src/utils.ts +79 -91
  244. package/src/zkPassportVerifierAddress.ts +15 -0
  245. package/dest/contracts/forwarder.d.ts +0 -24
  246. package/dest/contracts/forwarder.d.ts.map +0 -1
  247. package/dest/contracts/forwarder.js +0 -101
  248. package/dest/contracts/slashing_proposer.d.ts +0 -21
  249. package/dest/contracts/slashing_proposer.d.ts.map +0 -1
  250. package/dest/contracts/slashing_proposer.js +0 -47
  251. package/dest/deploy_l1_contracts.d.ts +0 -21210
  252. package/dest/deploy_l1_contracts.d.ts.map +0 -1
  253. package/dest/deploy_l1_contracts.js +0 -687
  254. package/dest/eth_cheat_codes.d.ts +0 -147
  255. package/dest/eth_cheat_codes.d.ts.map +0 -1
  256. package/dest/eth_cheat_codes.js +0 -303
  257. package/dest/index.d.ts +0 -14
  258. package/dest/index.d.ts.map +0 -1
  259. package/dest/index.js +0 -13
  260. package/dest/l1_tx_utils.d.ts +0 -192
  261. package/dest/l1_tx_utils.d.ts.map +0 -1
  262. package/dest/l1_tx_utils.js +0 -641
  263. package/dest/l1_tx_utils_with_blobs.d.ts +0 -12
  264. package/dest/l1_tx_utils_with_blobs.d.ts.map +0 -1
  265. package/dest/l1_tx_utils_with_blobs.js +0 -64
  266. package/src/contracts/forwarder.ts +0 -132
  267. package/src/contracts/slashing_proposer.ts +0 -51
  268. package/src/deploy_l1_contracts.ts +0 -948
  269. package/src/eth_cheat_codes.ts +0 -314
  270. package/src/index.ts +0 -13
  271. package/src/l1_tx_utils.ts +0 -847
  272. package/src/l1_tx_utils_with_blobs.ts +0 -86
@@ -0,0 +1,59 @@
1
+ import { type ConfigMappingsType } from '@aztec/foundation/config';
2
+ export interface L1TxUtilsConfig {
3
+ /**
4
+ * How much to increase calculated gas limit.
5
+ */
6
+ gasLimitBufferPercentage?: number;
7
+ /**
8
+ * Maximum gas price in gwei
9
+ */
10
+ maxGwei?: number;
11
+ /**
12
+ * Maximum blob fee per gas in gwei
13
+ */
14
+ maxBlobGwei?: number;
15
+ /**
16
+ * Priority fee bump percentage
17
+ */
18
+ priorityFeeBumpPercentage?: number;
19
+ /**
20
+ * How much to increase priority fee by each attempt (percentage)
21
+ */
22
+ priorityFeeRetryBumpPercentage?: number;
23
+ /**
24
+ * Minimum priority fee per gas in Gwei. Acts as a floor for the computed priority fee.
25
+ */
26
+ minimumPriorityFeePerGas?: number;
27
+ /**
28
+ * Maximum number of speed-up attempts
29
+ */
30
+ maxSpeedUpAttempts?: number;
31
+ /**
32
+ * How often to check tx status
33
+ */
34
+ checkIntervalMs?: number;
35
+ /**
36
+ * How long before considering tx stalled
37
+ */
38
+ stallTimeMs?: number;
39
+ /**
40
+ * How long to wait for a tx to be mined before giving up
41
+ */
42
+ txTimeoutMs?: number;
43
+ /**
44
+ * Whether to attempt to cancel a tx if it's not mined after txTimeoutMs
45
+ */
46
+ cancelTxOnTimeout?: boolean;
47
+ /**
48
+ * How long to wait for a cancellation tx to be mined after its last attempt before giving up
49
+ */
50
+ txCancellationFinalTimeoutMs?: number;
51
+ /**
52
+ * How long a tx nonce can be unseen in the mempool before considering it dropped
53
+ */
54
+ txUnseenConsideredDroppedMs?: number;
55
+ }
56
+ export declare const l1TxUtilsConfigMappings: ConfigMappingsType<L1TxUtilsConfig>;
57
+ export declare const defaultL1TxUtilsConfig: Required<L1TxUtilsConfig>;
58
+ export declare function getL1TxUtilsConfigEnvVars(): L1TxUtilsConfig;
59
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29uZmlnLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvbDFfdHhfdXRpbHMvY29uZmlnLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFDTCxLQUFLLGtCQUFrQixFQU14QixNQUFNLDBCQUEwQixDQUFDO0FBRWxDLE1BQU0sV0FBVyxlQUFlO0lBQzlCOztPQUVHO0lBQ0gsd0JBQXdCLENBQUMsRUFBRSxNQUFNLENBQUM7SUFDbEM7O09BRUc7SUFDSCxPQUFPLENBQUMsRUFBRSxNQUFNLENBQUM7SUFDakI7O09BRUc7SUFDSCxXQUFXLENBQUMsRUFBRSxNQUFNLENBQUM7SUFDckI7O09BRUc7SUFDSCx5QkFBeUIsQ0FBQyxFQUFFLE1BQU0sQ0FBQztJQUNuQzs7T0FFRztJQUNILDhCQUE4QixDQUFDLEVBQUUsTUFBTSxDQUFDO0lBQ3hDOztPQUVHO0lBQ0gsd0JBQXdCLENBQUMsRUFBRS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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;CACtC;AAED,eAAO,MAAM,uBAAuB,EAAE,kBAAkB,CAAC,eAAe,CAgFvE,CAAC;AAGF,eAAO,MAAM,sBAAsB,2BAEL,CAAC;AAE/B,wBAAgB,yBAAyB,IAAI,eAAe,CAE3D"}
@@ -0,0 +1,96 @@
1
+ import { booleanConfigHelper, floatConfigHelper, getConfigFromMappings, getDefaultConfig, numberConfigHelper } from '@aztec/foundation/config';
2
+ export const l1TxUtilsConfigMappings = {
3
+ gasLimitBufferPercentage: {
4
+ description: 'How much to increase calculated gas limit by (percentage)',
5
+ env: 'L1_GAS_LIMIT_BUFFER_PERCENTAGE',
6
+ ...numberConfigHelper(20)
7
+ },
8
+ maxGwei: {
9
+ description: 'Maximum gas price in gwei to be used for transactions.',
10
+ env: 'L1_GAS_PRICE_MAX',
11
+ fallback: [
12
+ 'L1_FEE_PER_GAS_GWEI_MAX'
13
+ ],
14
+ ...floatConfigHelper(2000)
15
+ },
16
+ maxBlobGwei: {
17
+ description: 'Maximum blob fee per gas in gwei',
18
+ env: 'L1_BLOB_FEE_PER_GAS_MAX',
19
+ fallback: [
20
+ 'L1_BLOB_FEE_PER_GAS_GWEI_MAX'
21
+ ],
22
+ ...floatConfigHelper(3000)
23
+ },
24
+ priorityFeeBumpPercentage: {
25
+ description: 'How much to increase priority fee by each attempt (percentage)',
26
+ env: 'L1_PRIORITY_FEE_BUMP_PERCENTAGE',
27
+ ...numberConfigHelper(20)
28
+ },
29
+ priorityFeeRetryBumpPercentage: {
30
+ description: 'How much to increase priority fee by each retry attempt (percentage)',
31
+ env: 'L1_PRIORITY_FEE_RETRY_BUMP_PERCENTAGE',
32
+ ...numberConfigHelper(50)
33
+ },
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)
52
+ },
53
+ maxSpeedUpAttempts: {
54
+ description: 'Maximum number of speed-up attempts',
55
+ env: 'L1_TX_MONITOR_MAX_ATTEMPTS',
56
+ ...numberConfigHelper(3)
57
+ },
58
+ checkIntervalMs: {
59
+ description: 'How often to check tx status',
60
+ env: 'L1_TX_MONITOR_CHECK_INTERVAL_MS',
61
+ ...numberConfigHelper(1_000)
62
+ },
63
+ stallTimeMs: {
64
+ description: 'How long before considering tx stalled',
65
+ env: 'L1_TX_MONITOR_STALL_TIME_MS',
66
+ ...numberConfigHelper(12_000)
67
+ },
68
+ txTimeoutMs: {
69
+ description: 'How long to wait for a tx to be mined before giving up. Set to 0 to disable.',
70
+ env: 'L1_TX_MONITOR_TX_TIMEOUT_MS',
71
+ ...numberConfigHelper(120_000)
72
+ },
73
+ cancelTxOnTimeout: {
74
+ description: "Whether to attempt to cancel a tx if it's not mined after txTimeoutMs",
75
+ env: 'L1_TX_MONITOR_CANCEL_TX_ON_TIMEOUT',
76
+ ...booleanConfigHelper(true)
77
+ },
78
+ txCancellationFinalTimeoutMs: {
79
+ description: 'How long to wait for a cancellation tx after its last attempt before giving up',
80
+ env: 'L1_TX_MONITOR_TX_CANCELLATION_TIMEOUT_MS',
81
+ ...numberConfigHelper(24 * 12 * 1000)
82
+ },
83
+ txUnseenConsideredDroppedMs: {
84
+ description: 'How long a tx nonce can be unseen in the mempool before considering it dropped',
85
+ env: 'L1_TX_MONITOR_TX_UNSEEN_CONSIDERED_DROPPED_MS',
86
+ ...numberConfigHelper(6 * 12 * 1000)
87
+ }
88
+ };
89
+ // We abuse the fact that all mappings above have a non null default value and force-type this to Required
90
+ export const defaultL1TxUtilsConfig = getDefaultConfig(l1TxUtilsConfigMappings);
91
+ export function getL1TxUtilsConfigEnvVars() {
92
+ return getConfigFromMappings(l1TxUtilsConfigMappings);
93
+ }
94
+ function deprecatedFixedFeeMessage(envVar) {
95
+ 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.';
96
+ }
@@ -0,0 +1,12 @@
1
+ export declare const WEI_CONST = 1000000000n;
2
+ export declare const LARGE_GAS_LIMIT = 12000000n;
3
+ export declare const MIN_REPLACEMENT_BUMP_PERCENTAGE = 10;
4
+ export declare const MIN_BLOB_REPLACEMENT_BUMP_PERCENTAGE = 100;
5
+ export declare const BLOCK_TIME_MS = 12000;
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=
@@ -0,0 +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;AAGpC,eAAO,MAAM,YAAY,UAAU,CAAC;AAGpC,eAAO,MAAM,sBAAsB;;;;GAKlC,CAAC"}
@@ -0,0 +1,39 @@
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
+ // @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;
7
+ // setting a minimum bump percentage to 10% due to geth's implementation
8
+ // https://github.com/ethereum/go-ethereum/blob/e3d61e6db028c412f74bc4d4c7e117a9e29d0de0/core/txpool/legacypool/list.go#L298
9
+ export const MIN_REPLACEMENT_BUMP_PERCENTAGE = 10;
10
+ // setting a minimum bump percentage to 100% due to geth's implementation
11
+ // https://github.com/ethereum/go-ethereum/blob/e3d61e6db028c412f74bc4d4c7e117a9e29d0de0/core/txpool/blobpool/config.go#L34
12
+ export const MIN_BLOB_REPLACEMENT_BUMP_PERCENTAGE = 100;
13
+ // Avg ethereum block time is ~12s
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
+ ];
@@ -0,0 +1,24 @@
1
+ import type { Logger } from '@aztec/foundation/log';
2
+ import { DateProvider } from '@aztec/foundation/timer';
3
+ import type { EthSigner } from '../eth-signer/eth-signer.js';
4
+ import type { ExtendedViemWalletClient, ViemClient } from '../types.js';
5
+ import type { L1TxUtilsConfig } from './config.js';
6
+ import type { IL1TxMetrics, IL1TxStore } from './interfaces.js';
7
+ import { L1TxUtils } from './l1_tx_utils.js';
8
+ export declare function createL1TxUtilsFromViemWallet(client: ExtendedViemWalletClient, deps?: {
9
+ logger?: Logger;
10
+ dateProvider?: DateProvider;
11
+ store?: IL1TxStore;
12
+ metrics?: IL1TxMetrics;
13
+ }, config?: Partial<L1TxUtilsConfig> & {
14
+ debugMaxGasLimit?: boolean;
15
+ }): 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
+ //#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AAE,OAAO,CAAC,eAAe,CAAC,GAAG;IAAE,gBAAgB,CAAC,EAAE,OAAO,CAAA;CAAE,GACjE,SAAS,CAYX;AAED,wBAAgB,4BAA4B,CAC1C,MAAM,EAAE,UAAU,EAClB,MAAM,EAAE,SAAS,EACjB,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;CACxB,EACD,MAAM,CAAC,EAAE,OAAO,CAAC,eAAe,CAAC,GAAG;IAAE,gBAAgB,CAAC,EAAE,OAAO,CAAA;CAAE,GACjE,SAAS,CAgBX"}
@@ -0,0 +1,12 @@
1
+ import { EthAddress } from '@aztec/foundation/eth-address';
2
+ import { L1TxUtils } from './l1_tx_utils.js';
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();
10
+ };
11
+ return new L1TxUtils(client, signer.address, callback, deps?.logger, deps?.dateProvider, config, config?.debugMaxGasLimit ?? false, deps?.store, deps?.metrics);
12
+ }
@@ -0,0 +1,9 @@
1
+ import type { PriorityFeeStrategy } from './types.js';
2
+ export { HISTORICAL_BLOCK_COUNT, executeStrategy, type PriorityFeeStrategy, type PriorityFeeStrategyContext, type PriorityFeeStrategyResult, } from './types.js';
3
+ export { P75AllTxsPriorityFeeStrategy } from './p75_competitive.js';
4
+ /**
5
+ * Default list of priority fee strategies to analyze.
6
+ * Add more strategies here for comparison.
7
+ */
8
+ export declare const DEFAULT_PRIORITY_FEE_STRATEGIES: PriorityFeeStrategy[];
9
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9sMV90eF91dGlscy9mZWUtc3RyYXRlZ2llcy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFFQSxPQUFPLEtBQUssRUFBRSxtQkFBbUIsRUFBRSxNQUFNLFlBQVksQ0FBQztBQUV0RCxPQUFPLEVBQ0wsc0JBQXNCLEVBQ3RCLGVBQWUsRUFDZixLQUFLLG1CQUFtQixFQUN4QixLQUFLLDBCQUEwQixFQUMvQixLQUFLLHlCQUF5QixHQUMvQixNQUFNLFlBQVksQ0FBQztBQUVwQixPQUFPLEVBQUUsNEJBQTRCLEVBQUUsTUFBTSxzQkFBc0IsQ0FBQztBQUVwRTs7O0dBR0c7QUFDSCxlQUFPLE1BQU0sK0JBQStCLEVBQUUsbUJBQW1CLEVBR2hFLENBQUMifQ==
@@ -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,eAAe,EACf,KAAK,mBAAmB,EACxB,KAAK,0BAA0B,EAC/B,KAAK,yBAAyB,GAC/B,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,4BAA4B,EAAE,MAAM,sBAAsB,CAAC;AAEpE;;;GAGG;AACH,eAAO,MAAM,+BAA+B,EAAE,mBAAmB,EAGhE,CAAC"}
@@ -0,0 +1,11 @@
1
+ import { P75AllTxsPriorityFeeStrategy } from './p75_competitive.js';
2
+ import { P75BlobTxsOnlyPriorityFeeStrategy } from './p75_competitive_blob_txs_only.js';
3
+ export { HISTORICAL_BLOCK_COUNT, executeStrategy } from './types.js';
4
+ export { P75AllTxsPriorityFeeStrategy } from './p75_competitive.js';
5
+ /**
6
+ * Default list of priority fee strategies to analyze.
7
+ * Add more strategies here for comparison.
8
+ */ export const DEFAULT_PRIORITY_FEE_STRATEGIES = [
9
+ P75AllTxsPriorityFeeStrategy,
10
+ P75BlobTxsOnlyPriorityFeeStrategy
11
+ ];
@@ -0,0 +1,18 @@
1
+ import type { ViemClient } from '../../types.js';
2
+ import { type PriorityFeeStrategy } from './types.js';
3
+ /**
4
+ * Type for the promises required by the competitive strategy
5
+ */
6
+ type P75AllTxsStrategyPromises = {
7
+ networkEstimate: Promise<bigint>;
8
+ pendingBlock: Promise<Awaited<ReturnType<ViemClient['getBlock']>> | null>;
9
+ feeHistory: Promise<Awaited<ReturnType<ViemClient['getFeeHistory']>> | null>;
10
+ };
11
+ /**
12
+ * Our current competitive priority fee strategy.
13
+ * Analyzes p75 of pending transactions and 5-block fee history to determine a competitive priority fee.
14
+ * Falls back to network estimate if data is unavailable.
15
+ */
16
+ export declare const P75AllTxsPriorityFeeStrategy: PriorityFeeStrategy<P75AllTxsStrategyPromises>;
17
+ export {};
18
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicDc1X2NvbXBldGl0aXZlLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvbDFfdHhfdXRpbHMvZmVlLXN0cmF0ZWdpZXMvcDc1X2NvbXBldGl0aXZlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUlBLE9BQU8sS0FBSyxFQUFFLFVBQVUsRUFBRSxNQUFNLGdCQUFnQixDQUFDO0FBR2pELE9BQU8sRUFFTCxLQUFLLG1CQUFtQixFQUd6QixNQUFNLFlBQVksQ0FBQztBQUVwQjs7R0FFRztBQUNILEtBQUsseUJBQXlCLEdBQUc7SUFDL0IsZUFBZSxFQUFFLE9BQU8sQ0FBQyxNQUFNLENBQUMsQ0FBQztJQUNqQyxZQUFZLEVBQUUsT0FBTyxDQUFDLE9BQU8sQ0FBQyxVQUFVLENBQUMsVUFBVSxDQUFDLFVBQVUsQ0FBQyxDQUFDLENBQUMsR0FBRyxJQUFJLENBQUMsQ0FBQztJQUMxRSxVQUFVLEVBQUUsT0FBTyxDQUFDLE9BQU8sQ0FBQyxVQUFVLENBQUMsVUFBVSxDQUFDLGVBQWUsQ0FBQyxDQUFDLENBQUMsR0FBRyxJQUFJLENBQUMsQ0FBQztDQUM5RSxDQUFDO0FBRUY7Ozs7R0FJRztBQUNILGVBQU8sTUFBTSw0QkFBNEIsRUFBRSxtQkFBbUIsQ0FBQyx5QkFBeUIsQ0FrSXZGLENBQUMifQ==
@@ -0,0 +1 @@
1
+ {"version":3,"file":"p75_competitive.d.ts","sourceRoot":"","sources":["../../../src/l1_tx_utils/fee-strategies/p75_competitive.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAGjD,OAAO,EAEL,KAAK,mBAAmB,EAGzB,MAAM,YAAY,CAAC;AAEpB;;GAEG;AACH,KAAK,yBAAyB,GAAG;IAC/B,eAAe,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;IACjC,YAAY,EAAE,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC;IAC1E,UAAU,EAAE,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC,UAAU,CAAC,eAAe,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC;CAC9E,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,4BAA4B,EAAE,mBAAmB,CAAC,yBAAyB,CAkIvF,CAAC"}
@@ -0,0 +1,111 @@
1
+ import { median } from '@aztec/foundation/collection';
2
+ import { formatGwei } from 'viem';
3
+ import { calculatePercentile } from '../../utils.js';
4
+ import { WEI_CONST } from '../constants.js';
5
+ import { HISTORICAL_BLOCK_COUNT } from './types.js';
6
+ /**
7
+ * Our current competitive priority fee strategy.
8
+ * Analyzes p75 of pending transactions and 5-block fee history to determine a competitive priority fee.
9
+ * Falls back to network estimate if data is unavailable.
10
+ */ export const P75AllTxsPriorityFeeStrategy = {
11
+ name: 'Competitive (P75 + History) - CURRENT',
12
+ id: 'p75_pending_txs_and_history_all_txs',
13
+ getRequiredPromises (client) {
14
+ return {
15
+ networkEstimate: client.estimateMaxPriorityFeePerGas().catch(()=>0n),
16
+ pendingBlock: client.getBlock({
17
+ blockTag: 'pending',
18
+ includeTransactions: true
19
+ }).catch(()=>null),
20
+ feeHistory: client.getFeeHistory({
21
+ blockCount: HISTORICAL_BLOCK_COUNT,
22
+ rewardPercentiles: [
23
+ 75
24
+ ],
25
+ blockTag: 'latest'
26
+ }).catch(()=>null)
27
+ };
28
+ },
29
+ calculate (results, context) {
30
+ const { logger } = context;
31
+ // Extract network estimate from settled result
32
+ const networkEstimate = results.networkEstimate.status === 'fulfilled' && typeof results.networkEstimate.value === 'bigint' ? results.networkEstimate.value : 0n;
33
+ let competitiveFee = networkEstimate;
34
+ const debugInfo = {
35
+ networkEstimateGwei: formatGwei(networkEstimate)
36
+ };
37
+ // Extract pending block from settled result
38
+ const pendingBlock = results.pendingBlock.status === 'fulfilled' ? results.pendingBlock.value : null;
39
+ // Analyze pending block transactions
40
+ if (pendingBlock?.transactions && pendingBlock.transactions.length > 0) {
41
+ const pendingFees = pendingBlock.transactions.map((tx)=>{
42
+ if (typeof tx === 'string') {
43
+ return 0n;
44
+ }
45
+ const fee = tx.maxPriorityFeePerGas || 0n;
46
+ return fee;
47
+ }).filter((fee)=>fee > 0n);
48
+ if (pendingFees.length > 0) {
49
+ // Use 75th percentile of pending fees to be competitive
50
+ const pendingCompetitiveFee = calculatePercentile(pendingFees, 75);
51
+ if (pendingCompetitiveFee > competitiveFee) {
52
+ competitiveFee = pendingCompetitiveFee;
53
+ }
54
+ debugInfo.pendingTxCount = pendingFees.length;
55
+ debugInfo.pendingP75Gwei = formatGwei(pendingCompetitiveFee);
56
+ logger?.debug('Analyzed pending transactions for competitive pricing', {
57
+ pendingTxCount: pendingFees.length,
58
+ pendingP75: formatGwei(pendingCompetitiveFee)
59
+ });
60
+ }
61
+ }
62
+ // Extract fee history from settled result
63
+ const feeHistory = results.feeHistory.status === 'fulfilled' ? results.feeHistory.value : null;
64
+ // Analyze fee history
65
+ if (feeHistory?.reward && feeHistory.reward.length > 0) {
66
+ // Extract 75th percentile fees from each block
67
+ const percentile75Fees = feeHistory.reward.map((rewards)=>rewards[0] || 0n).filter((fee)=>fee > 0n);
68
+ if (percentile75Fees.length > 0) {
69
+ // Calculate median of the 75th percentile fees across blocks
70
+ const medianHistoricalFee = median(percentile75Fees) ?? 0n;
71
+ // Debug: Log suspicious fees from history
72
+ if (medianHistoricalFee > 100n * WEI_CONST) {
73
+ logger?.warn('Suspicious high fee in history', {
74
+ historicalMedian: formatGwei(medianHistoricalFee),
75
+ allP75Fees: percentile75Fees.map((f)=>formatGwei(f))
76
+ });
77
+ }
78
+ if (medianHistoricalFee > competitiveFee) {
79
+ competitiveFee = medianHistoricalFee;
80
+ }
81
+ debugInfo.historicalMedianGwei = formatGwei(medianHistoricalFee);
82
+ logger?.debug('Analyzed fee history for competitive pricing', {
83
+ historicalMedian: formatGwei(medianHistoricalFee)
84
+ });
85
+ }
86
+ }
87
+ // Sanity check: cap competitive fee at 100x network estimate to avoid using unrealistic fees
88
+ const maxReasonableFee = networkEstimate * 100n;
89
+ if (competitiveFee > maxReasonableFee && networkEstimate > 0n) {
90
+ logger?.warn('Competitive fee exceeds sanity cap, using capped value', {
91
+ competitiveFee: formatGwei(competitiveFee),
92
+ networkEstimate: formatGwei(networkEstimate),
93
+ cappedTo: formatGwei(maxReasonableFee)
94
+ });
95
+ competitiveFee = maxReasonableFee;
96
+ debugInfo.cappedToGwei = formatGwei(maxReasonableFee);
97
+ }
98
+ // Log final decision
99
+ if (competitiveFee > networkEstimate) {
100
+ logger?.debug('Using competitive fee from market analysis', {
101
+ networkEstimate: formatGwei(networkEstimate),
102
+ competitive: formatGwei(competitiveFee)
103
+ });
104
+ }
105
+ debugInfo.finalFeeGwei = formatGwei(competitiveFee);
106
+ return {
107
+ priorityFee: competitiveFee,
108
+ debugInfo
109
+ };
110
+ }
111
+ };
@@ -0,0 +1,32 @@
1
+ import { type GetFeeHistoryReturnType } from 'viem';
2
+ import type { ViemClient } from '../../types.js';
3
+ import { type PriorityFeeStrategy } from './types.js';
4
+ /**
5
+ * Type for the promises required by the competitive strategy
6
+ */
7
+ type P75AllTxsStrategyPromises = {
8
+ networkEstimate: Promise<bigint>;
9
+ pendingBlock: Promise<Awaited<ReturnType<ViemClient['getBlock']>> | null>;
10
+ feeHistory: Promise<Awaited<ReturnType<ViemClient['getFeeHistory']>> | null>;
11
+ };
12
+ /**
13
+ * Fetches historical blocks and calculates reward percentiles for blob transactions only.
14
+ * Returns data in the same format as getFeeHistory for easy drop-in replacement.
15
+ *
16
+ * @param client - Viem client to use for RPC calls
17
+ * @param blockCount - Number of historical blocks to fetch
18
+ * @param rewardPercentiles - Array of percentiles to calculate (e.g., [75] for 75th percentile)
19
+ * @returns Object with reward field containing percentile fees for each block, similar to getFeeHistory
20
+ * @throws Error if fetching blocks fails
21
+ */
22
+ export declare function getBlobPriorityFeeHistory(client: ViemClient, blockCount: number, rewardPercentiles: number[]): Promise<GetFeeHistoryReturnType>;
23
+ /**
24
+ * Similar to our current competitive priority fee strategy, but only considers blob transactions
25
+ * when calculating competitive priority fee for blob transactions.
26
+ * This strategy also has NO cap on the competitive fee if it's much higher than the network estimate.
27
+ * Analyzes p75 of pending transactions and 5-block fee history to determine a competitive priority fee.
28
+ * Falls back to network estimate if data is unavailable.
29
+ */
30
+ export declare const P75BlobTxsOnlyPriorityFeeStrategy: PriorityFeeStrategy<P75AllTxsStrategyPromises>;
31
+ export {};
32
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJza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UsbUJBQW1CLENBQUMseUJBQXlCLENBNEg1RixDQUFDIn0=
@@ -0,0 +1 @@
1
+ {"version":3,"file":"p75_competitive_blob_txs_only.d.ts","sourceRoot":"","sources":["../../../src/l1_tx_utils/fee-strategies/p75_competitive_blob_txs_only.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,uBAAuB,EAAc,MAAM,MAAM,CAAC;AAEhE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAGjD,OAAO,EAEL,KAAK,mBAAmB,EAGzB,MAAM,YAAY,CAAC;AAEpB;;GAEG;AACH,KAAK,yBAAyB,GAAG;IAC/B,eAAe,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;IACjC,YAAY,EAAE,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC;IAC1E,UAAU,EAAE,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC,UAAU,CAAC,eAAe,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC;CAC9E,CAAC;AAEF;;;;;;;;;GASG;AACH,wBAAsB,yBAAyB,CAC7C,MAAM,EAAE,UAAU,EAClB,UAAU,EAAE,MAAM,EAClB,iBAAiB,EAAE,MAAM,EAAE,GAC1B,OAAO,CAAC,uBAAuB,CAAC,CAsElC;AAED;;;;;;GAMG;AACH,eAAO,MAAM,iCAAiC,EAAE,mBAAmB,CAAC,yBAAyB,CA4H5F,CAAC"}
@@ -0,0 +1,173 @@
1
+ import { median } from '@aztec/foundation/collection';
2
+ import { formatGwei } from 'viem';
3
+ import { calculatePercentile, isBlobTransaction } from '../../utils.js';
4
+ import { WEI_CONST } from '../constants.js';
5
+ import { HISTORICAL_BLOCK_COUNT } from './types.js';
6
+ /**
7
+ * Fetches historical blocks and calculates reward percentiles for blob transactions only.
8
+ * Returns data in the same format as getFeeHistory for easy drop-in replacement.
9
+ *
10
+ * @param client - Viem client to use for RPC calls
11
+ * @param blockCount - Number of historical blocks to fetch
12
+ * @param rewardPercentiles - Array of percentiles to calculate (e.g., [75] for 75th percentile)
13
+ * @returns Object with reward field containing percentile fees for each block, similar to getFeeHistory
14
+ * @throws Error if fetching blocks fails
15
+ */ export async function getBlobPriorityFeeHistory(client, blockCount, rewardPercentiles) {
16
+ const latestBlockNumber = await client.getBlockNumber();
17
+ // Fetch multiple blocks in parallel
18
+ const blockPromises = Array.from({
19
+ length: blockCount
20
+ }, (_, i)=>client.getBlock({
21
+ blockNumber: latestBlockNumber - BigInt(i),
22
+ includeTransactions: true
23
+ }));
24
+ const blocks = await Promise.all(blockPromises);
25
+ // Process each block to extract blob transaction fees and other data
26
+ const baseFeePerGas = [];
27
+ const gasUsedRatio = [];
28
+ const reward = [];
29
+ for (const block of blocks){
30
+ // Collect base fee per gas
31
+ baseFeePerGas.push(block.baseFeePerGas || 0n);
32
+ // Calculate gas used ratio
33
+ const gasUsed = block.gasUsed || 0n;
34
+ const gasLimit = block.gasLimit || 1n; // Avoid division by zero
35
+ gasUsedRatio.push(Number(gasUsed) / Number(gasLimit));
36
+ if (!block.transactions || block.transactions.length === 0) {
37
+ // No transactions in this block - return zeros for each percentile
38
+ reward.push(rewardPercentiles.map(()=>0n));
39
+ continue;
40
+ }
41
+ // Extract priority fees from blob transactions only
42
+ const blobFees = block.transactions.map((tx)=>{
43
+ // Transaction can be just a hash string
44
+ if (typeof tx === 'string') {
45
+ return 0n;
46
+ }
47
+ if (!isBlobTransaction(tx)) {
48
+ return 0n;
49
+ }
50
+ return tx.maxPriorityFeePerGas || 0n;
51
+ }).filter((fee)=>fee > 0n);
52
+ if (blobFees.length === 0) {
53
+ // No blob transactions in this block - return zeros for each percentile
54
+ reward.push(rewardPercentiles.map(()=>0n));
55
+ continue;
56
+ }
57
+ // Calculate requested percentiles
58
+ const percentiles = rewardPercentiles.map((percentile)=>calculatePercentile(blobFees, percentile));
59
+ reward.push(percentiles);
60
+ }
61
+ // Calculate oldest block number (the last block in our array)
62
+ const oldestBlock = latestBlockNumber - BigInt(blockCount - 1);
63
+ // Reverse arrays to match getFeeHistory behavior (oldest first)
64
+ return {
65
+ baseFeePerGas: baseFeePerGas.reverse(),
66
+ gasUsedRatio: gasUsedRatio.reverse(),
67
+ oldestBlock,
68
+ reward: reward.reverse()
69
+ };
70
+ }
71
+ /**
72
+ * Similar to our current competitive priority fee strategy, but only considers blob transactions
73
+ * when calculating competitive priority fee for blob transactions.
74
+ * This strategy also has NO cap on the competitive fee if it's much higher than the network estimate.
75
+ * Analyzes p75 of pending transactions and 5-block fee history to determine a competitive priority fee.
76
+ * Falls back to network estimate if data is unavailable.
77
+ */ export const P75BlobTxsOnlyPriorityFeeStrategy = {
78
+ name: 'Competitive (P75 + History) - Blob Txs Only',
79
+ id: 'p75_pending_txs_and_history_blob_txs_only',
80
+ getRequiredPromises (client, opts) {
81
+ return {
82
+ networkEstimate: client.estimateMaxPriorityFeePerGas().catch(()=>0n),
83
+ pendingBlock: client.getBlock({
84
+ blockTag: 'pending',
85
+ includeTransactions: true
86
+ }).catch(()=>null),
87
+ feeHistory: opts.isBlobTx ? getBlobPriorityFeeHistory(client, HISTORICAL_BLOCK_COUNT, [
88
+ 75
89
+ ]) : client.getFeeHistory({
90
+ blockCount: HISTORICAL_BLOCK_COUNT,
91
+ rewardPercentiles: [
92
+ 75
93
+ ],
94
+ blockTag: 'latest'
95
+ }).catch(()=>null)
96
+ };
97
+ },
98
+ calculate (results, context) {
99
+ const { logger } = context;
100
+ // Extract network estimate from settled result
101
+ const networkEstimate = results.networkEstimate.status === 'fulfilled' && typeof results.networkEstimate.value === 'bigint' ? results.networkEstimate.value : 0n;
102
+ let competitiveFee = networkEstimate;
103
+ const debugInfo = {
104
+ networkEstimateGwei: formatGwei(networkEstimate)
105
+ };
106
+ // Extract pending block from settled result
107
+ const pendingBlock = results.pendingBlock.status === 'fulfilled' ? results.pendingBlock.value : null;
108
+ // Analyze pending block transactions
109
+ if (pendingBlock?.transactions && pendingBlock.transactions.length > 0) {
110
+ const pendingFees = pendingBlock.transactions.map((tx)=>{
111
+ if (typeof tx === 'string') {
112
+ return 0n;
113
+ }
114
+ if (context.isBlobTx) {
115
+ if (!isBlobTransaction(tx)) {
116
+ return 0n;
117
+ }
118
+ }
119
+ const fee = tx.maxPriorityFeePerGas || 0n;
120
+ return fee;
121
+ }).filter((fee)=>fee > 0n);
122
+ if (pendingFees.length > 0) {
123
+ const pendingCompetitiveFee = calculatePercentile(pendingFees, 75);
124
+ if (pendingCompetitiveFee > competitiveFee) {
125
+ competitiveFee = pendingCompetitiveFee;
126
+ }
127
+ debugInfo.pendingTxCount = pendingFees.length;
128
+ debugInfo.pendingP75Gwei = formatGwei(pendingCompetitiveFee);
129
+ logger?.debug('Analyzed pending transactions for competitive pricing', {
130
+ pendingTxCount: pendingFees.length,
131
+ pendingP75: formatGwei(pendingCompetitiveFee)
132
+ });
133
+ }
134
+ }
135
+ // Extract fee history from settled result
136
+ const feeHistory = results.feeHistory.status === 'fulfilled' ? results.feeHistory.value : null;
137
+ // Analyze fee history
138
+ if (feeHistory?.reward && feeHistory.reward.length > 0) {
139
+ // Extract 75th percentile fees from each block
140
+ const percentile75Fees = feeHistory.reward.map((rewards)=>rewards[0] || 0n).filter((fee)=>fee > 0n);
141
+ if (percentile75Fees.length > 0) {
142
+ // Calculate median of the 75th percentile fees across blocks
143
+ const medianHistoricalFee = median(percentile75Fees) ?? 0n;
144
+ // Debug: Log suspicious fees from history
145
+ if (medianHistoricalFee > 100n * WEI_CONST) {
146
+ logger?.warn('Suspicious high fee in history', {
147
+ historicalMedian: formatGwei(medianHistoricalFee),
148
+ allP75Fees: percentile75Fees.map((f)=>formatGwei(f))
149
+ });
150
+ }
151
+ if (medianHistoricalFee > competitiveFee) {
152
+ competitiveFee = medianHistoricalFee;
153
+ }
154
+ debugInfo.historicalMedianGwei = formatGwei(medianHistoricalFee);
155
+ logger?.debug('Analyzed fee history for competitive pricing', {
156
+ historicalMedian: formatGwei(medianHistoricalFee)
157
+ });
158
+ }
159
+ }
160
+ // Log final decision
161
+ if (competitiveFee > networkEstimate) {
162
+ logger?.debug('Using competitive fee from market analysis', {
163
+ networkEstimate: formatGwei(networkEstimate),
164
+ competitive: formatGwei(competitiveFee)
165
+ });
166
+ }
167
+ debugInfo.finalFeeGwei = formatGwei(competitiveFee);
168
+ return {
169
+ priorityFee: competitiveFee,
170
+ debugInfo
171
+ };
172
+ }
173
+ };