@aztec/ethereum 0.0.0-test.0 → 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,312 @@
1
+ import { RollupContract } from '@aztec/ethereum/contracts';
2
+ import type { L1ContractAddresses } from '@aztec/ethereum/l1-contract-addresses';
3
+ import type { ViemPublicClient } from '@aztec/ethereum/types';
4
+ import { CheckpointNumber, EpochNumber, SlotNumber } from '@aztec/foundation/branded-types';
5
+ import { EthAddress } from '@aztec/foundation/eth-address';
6
+ import { createLogger } from '@aztec/foundation/log';
7
+ import type { DateProvider } from '@aztec/foundation/timer';
8
+ import { RollupAbi } from '@aztec/l1-artifacts/RollupAbi';
9
+
10
+ import {
11
+ type GetContractReturnType,
12
+ type Hex,
13
+ createPublicClient,
14
+ fallback,
15
+ getContract,
16
+ hexToBigInt,
17
+ http,
18
+ } from 'viem';
19
+
20
+ import { EthCheatCodes } from './eth_cheat_codes.js';
21
+
22
+ /** Cheat codes for the L1 rollup contract. */
23
+ export class RollupCheatCodes {
24
+ private client: ViemPublicClient;
25
+ private rollup: GetContractReturnType<typeof RollupAbi, ViemPublicClient>;
26
+
27
+ private logger = createLogger('aztecjs:cheat_codes');
28
+
29
+ constructor(
30
+ private ethCheatCodes: EthCheatCodes,
31
+ addresses: Pick<L1ContractAddresses, 'rollupAddress'>,
32
+ ) {
33
+ this.client = createPublicClient({
34
+ chain: ethCheatCodes.chain,
35
+ transport: fallback(ethCheatCodes.rpcUrls.map(url => http(url, { batch: false }))),
36
+ });
37
+ this.rollup = getContract({
38
+ abi: RollupAbi,
39
+ address: addresses.rollupAddress.toString(),
40
+ client: this.client,
41
+ });
42
+ }
43
+
44
+ static create(
45
+ rpcUrls: string[],
46
+ addresses: Pick<L1ContractAddresses, 'rollupAddress'>,
47
+ dateProvider: DateProvider,
48
+ ): RollupCheatCodes {
49
+ const ethCheatCodes = new EthCheatCodes(rpcUrls, dateProvider);
50
+ return new RollupCheatCodes(ethCheatCodes, addresses);
51
+ }
52
+
53
+ /** Returns the current slot */
54
+ public async getSlot(): Promise<SlotNumber> {
55
+ const ts = BigInt((await this.client.getBlock()).timestamp);
56
+ return SlotNumber.fromBigInt(await this.rollup.read.getSlotAt([ts]));
57
+ }
58
+
59
+ /** Returns the current epoch */
60
+ public async getEpoch(): Promise<EpochNumber> {
61
+ const slotNumber = await this.getSlot();
62
+ return EpochNumber.fromBigInt(await this.rollup.read.getEpochAtSlot([BigInt(slotNumber)]));
63
+ }
64
+
65
+ /**
66
+ * Returns the pending and proven chain tips
67
+ * @returns The pending and proven chain tips
68
+ */
69
+ public async getTips(): Promise<{
70
+ /** The pending chain tip */ pending: CheckpointNumber;
71
+ /** The proven chain tip */ proven: CheckpointNumber;
72
+ }> {
73
+ const { pending, proven } = await this.rollup.read.getTips();
74
+ return {
75
+ pending: CheckpointNumber.fromBigInt(pending),
76
+ proven: CheckpointNumber.fromBigInt(proven),
77
+ };
78
+ }
79
+
80
+ /**
81
+ * Logs the current state of the rollup contract.
82
+ */
83
+ public async debugRollup() {
84
+ const rollup = new RollupContract(this.client, this.rollup.address);
85
+ const pendingNum = await rollup.getCheckpointNumber();
86
+ const provenNum = await rollup.getProvenCheckpointNumber();
87
+ const validators = await rollup.getAttesters();
88
+ const committee = await rollup.getCurrentEpochCommittee();
89
+ const archive = await rollup.archive();
90
+ const slot = await this.getSlot();
91
+ const epochNum = await rollup.getEpochNumberForSlotNumber(slot);
92
+
93
+ this.logger.info(`Pending checkpoint num: ${pendingNum}`);
94
+ this.logger.info(`Proven checkpoint num: ${provenNum}`);
95
+ this.logger.info(`Validators: ${validators.map(v => v.toString()).join(', ')}`);
96
+ this.logger.info(`Committee: ${committee?.map(v => v.toString()).join(', ')}`);
97
+ this.logger.info(`Archive: ${archive}`);
98
+ this.logger.info(`Epoch num: ${epochNum}`);
99
+ this.logger.info(`Slot: ${slot}`);
100
+ }
101
+
102
+ /** Fetches the epoch and slot duration config from the rollup contract */
103
+ public async getConfig(): Promise<{
104
+ /** Epoch duration */ epochDuration: bigint;
105
+ /** Slot duration */ slotDuration: number;
106
+ }> {
107
+ const [epochDuration, slotDuration] = await Promise.all([
108
+ this.rollup.read.getEpochDuration(),
109
+ this.rollup.read.getSlotDuration(),
110
+ ]);
111
+ return { epochDuration, slotDuration: Number(slotDuration) };
112
+ }
113
+
114
+ /**
115
+ * Advances time to the beginning of the given epoch
116
+ * @param epoch - The epoch to advance to
117
+ * @param opts - Options
118
+ */
119
+ public async advanceToEpoch(
120
+ epoch: EpochNumber,
121
+ opts: {
122
+ /** Offset in seconds */
123
+ offset?: number;
124
+ } = {},
125
+ ) {
126
+ const { epochDuration: slotsInEpoch } = await this.getConfig();
127
+ const slotNumber = SlotNumber(epoch * Number(slotsInEpoch));
128
+ const timestamp = (await this.rollup.read.getTimestampForSlot([BigInt(slotNumber)])) + BigInt(opts.offset ?? 0);
129
+ try {
130
+ await this.ethCheatCodes.warp(Number(timestamp), { ...opts, silent: true, resetBlockInterval: true });
131
+ this.logger.warn(`Warped to epoch ${epoch}`, { offset: opts.offset, timestamp });
132
+ } catch (err) {
133
+ this.logger.warn(`Warp to epoch ${epoch} failed: ${err}`);
134
+ }
135
+ return timestamp;
136
+ }
137
+
138
+ /** Warps time in L1 until the next epoch */
139
+ public async advanceToNextEpoch() {
140
+ const slot = await this.getSlot();
141
+ const { epochDuration, slotDuration } = await this.getConfig();
142
+ const slotsUntilNextEpoch = epochDuration - (BigInt(slot) % epochDuration) + 1n;
143
+ const timeToNextEpoch = slotsUntilNextEpoch * BigInt(slotDuration);
144
+ const l1Timestamp = BigInt((await this.client.getBlock()).timestamp);
145
+ await this.ethCheatCodes.warp(Number(l1Timestamp + timeToNextEpoch), {
146
+ silent: true,
147
+ resetBlockInterval: true,
148
+ });
149
+ this.logger.warn(`Advanced to next epoch`);
150
+ }
151
+
152
+ /** Warps time in L1 until the beginning of the next slot. */
153
+ public async advanceToNextSlot() {
154
+ const currentSlot = await this.getSlot();
155
+ const nextSlot = SlotNumber(currentSlot + 1);
156
+ const timestamp = await this.rollup.read.getTimestampForSlot([BigInt(nextSlot)]);
157
+ await this.ethCheatCodes.warp(Number(timestamp), { silent: true, resetBlockInterval: true });
158
+ this.logger.warn(`Advanced to slot ${nextSlot}`);
159
+ return [timestamp, nextSlot];
160
+ }
161
+
162
+ /**
163
+ * Warps time in L1 equivalent to however many slots.
164
+ * @param howMany - The number of slots to advance.
165
+ */
166
+ public async advanceSlots(howMany: number) {
167
+ const l1Timestamp = (await this.client.getBlock()).timestamp;
168
+ const slotDuration = Number(await this.rollup.read.getSlotDuration());
169
+ const timeToWarp = BigInt(howMany) * BigInt(slotDuration);
170
+ await this.ethCheatCodes.warp(l1Timestamp + timeToWarp, { silent: true, resetBlockInterval: true });
171
+ const [slot, epoch] = await Promise.all([this.getSlot(), this.getEpoch()]);
172
+ this.logger.warn(`Advanced ${howMany} slots up to slot ${slot} in epoch ${epoch}`);
173
+ }
174
+
175
+ /**
176
+ * Marks the specified checkpoint (or latest if none) as proven
177
+ * @param maybeCheckpointNumber - The checkpoint number to mark as proven (defaults to latest pending)
178
+ */
179
+ public markAsProven(maybeCheckpointNumber?: number | bigint) {
180
+ return this.ethCheatCodes.execWithPausedAnvil(async () => {
181
+ const tipsBefore = await this.getTips();
182
+ const { pending, proven } = tipsBefore;
183
+
184
+ let checkpointNumber = maybeCheckpointNumber;
185
+ if (checkpointNumber === undefined || checkpointNumber > pending) {
186
+ checkpointNumber = pending;
187
+ }
188
+ if (checkpointNumber <= proven) {
189
+ this.logger.debug(`Checkpoint ${checkpointNumber} is already proven`);
190
+ return;
191
+ }
192
+
193
+ // @note @LHerskind this is heavily dependent on the storage layout and size of values
194
+ // The rollupStore is a struct and if the size of elements or the struct changes, this can break
195
+ const provenCheckpointNumberSlot = hexToBigInt(RollupContract.stfStorageSlot);
196
+
197
+ // Need to pack it as a single 32 byte word
198
+ const newValue = (BigInt(tipsBefore.pending) << 128n) | BigInt(checkpointNumber);
199
+ await this.ethCheatCodes.store(EthAddress.fromString(this.rollup.address), provenCheckpointNumberSlot, newValue);
200
+
201
+ const tipsAfter = await this.getTips();
202
+ if (tipsAfter.pending < tipsAfter.proven) {
203
+ throw new Error('Overwrote pending tip to a checkpoint in the past');
204
+ }
205
+
206
+ this.logger.info(
207
+ `Proven tip moved: ${tipsBefore.proven} -> ${tipsAfter.proven}. Pending tip: ${tipsAfter.pending}.`,
208
+ );
209
+ });
210
+ }
211
+
212
+ /**
213
+ * Overrides the inProgress field of the Inbox contract state
214
+ * @param howMuch - How many checkpoints to move it forward
215
+ */
216
+ public advanceInboxInProgress(howMuch: number | bigint): Promise<bigint> {
217
+ return this.ethCheatCodes.execWithPausedAnvil(async () => {
218
+ // Storage slot 2 contains the InboxState struct
219
+ const inboxStateSlot = 2n;
220
+
221
+ // Get inbox and its current state values
222
+ const inboxAddress = await this.rollup.read.getInbox();
223
+ const currentStateValue = await this.ethCheatCodes.load(EthAddress.fromString(inboxAddress), inboxStateSlot);
224
+
225
+ // Extract current values from the packed storage slot
226
+ // Storage layout: rollingHash (128 bits) | totalMessagesInserted (64 bits) | inProgress (64 bits)
227
+ const currentRollingHash = currentStateValue & ((1n << 128n) - 1n);
228
+ const currentTotalMessages = (currentStateValue >> 128n) & ((1n << 64n) - 1n);
229
+ const currentInProgress = currentStateValue >> 192n;
230
+ const newInProgress = currentInProgress + BigInt(howMuch);
231
+
232
+ // Pack new values: rollingHash (low 128 bits) | totalMessages (middle 64 bits) | inProgress (high 64 bits)
233
+ const newValue = (BigInt(newInProgress) << 192n) | (currentTotalMessages << 128n) | currentRollingHash;
234
+
235
+ await this.ethCheatCodes.store(EthAddress.fromString(inboxAddress), inboxStateSlot, newValue, {
236
+ silent: true,
237
+ });
238
+
239
+ this.logger.warn(`Inbox inProgress advanced from ${currentInProgress} to ${newInProgress}`, {
240
+ inbox: inboxAddress,
241
+ oldValue: '0x' + currentStateValue.toString(16),
242
+ newValue: '0x' + newValue.toString(16),
243
+ rollingHash: currentRollingHash,
244
+ totalMessages: currentTotalMessages,
245
+ oldInProgress: currentInProgress,
246
+ newInProgress,
247
+ });
248
+
249
+ return newInProgress;
250
+ });
251
+ }
252
+
253
+ /**
254
+ * Executes an action impersonated as the owner of the Rollup contract.
255
+ * @param action - The action to execute
256
+ */
257
+ public async asOwner(
258
+ action: (owner: Hex, rollup: GetContractReturnType<typeof RollupAbi, ViemPublicClient>) => Promise<void>,
259
+ ) {
260
+ const owner = await this.rollup.read.owner();
261
+ await this.ethCheatCodes.startImpersonating(owner);
262
+ await action(owner, this.rollup);
263
+ await this.ethCheatCodes.stopImpersonating(owner);
264
+ }
265
+
266
+ /**
267
+ * Sets up the epoch.
268
+ */
269
+ public async setupEpoch() {
270
+ // Doesn't need to be done as owner, but the functionality is here...
271
+ await this.asOwner(async (account, rollup) => {
272
+ const hash = await rollup.write.setupEpoch({ account });
273
+ await this.client.waitForTransactionReceipt({ hash });
274
+ this.logger.warn(`Setup epoch`);
275
+ });
276
+ }
277
+
278
+ /** Directly calls the L1 gas fee oracle. */
279
+ public async updateL1GasFeeOracle() {
280
+ await this.asOwner(async (account, rollup) => {
281
+ const hash = await rollup.write.updateL1GasFeeOracle({ account, chain: this.client.chain });
282
+ await this.client.waitForTransactionReceipt({ hash });
283
+ this.logger.warn(`Updated L1 gas fee oracle`);
284
+ });
285
+ }
286
+
287
+ /**
288
+ * Bumps proving cost per mana.
289
+ * @param bumper - Callback to calculate the new proving cost per mana based on current value.
290
+ */
291
+ public async bumpProvingCostPerMana(bumper: (before: bigint) => bigint) {
292
+ const currentCost = await this.rollup.read.getProvingCostPerManaInEth();
293
+ const newCost = bumper(currentCost);
294
+ await this.setProvingCostPerMana(newCost);
295
+ }
296
+
297
+ /**
298
+ * Directly updates proving cost per mana.
299
+ * @param ethValue - The new proving cost per mana in ETH
300
+ */
301
+ public async setProvingCostPerMana(ethValue: bigint) {
302
+ await this.asOwner(async (account, rollup) => {
303
+ const hash = await rollup.write.setProvingCostPerMana([ethValue], {
304
+ account,
305
+ chain: this.client.chain,
306
+ gasLimit: 1000000n,
307
+ });
308
+ await this.client.waitForTransactionReceipt({ hash });
309
+ this.logger.warn(`Updated proving cost per mana to ${ethValue}`);
310
+ });
311
+ }
312
+ }
@@ -1,3 +1,4 @@
1
+ import { createLogger } from '@aztec/foundation/log';
1
2
  import { makeBackoff, retry } from '@aztec/foundation/retry';
2
3
  import { fileURLToPath } from '@aztec/foundation/url';
3
4
 
@@ -9,10 +10,19 @@ import { dirname, resolve } from 'path';
9
10
  */
10
11
  export async function startAnvil(
11
12
  opts: {
13
+ port?: number;
12
14
  l1BlockTime?: number;
15
+ log?: boolean;
16
+ captureMethodCalls?: boolean;
17
+ accounts?: number;
18
+ chainId?: number;
19
+ /** The hardfork to use - note: @viem/anvil types are out of date but 'cancun' and 'latest' work */
20
+ hardfork?: string;
13
21
  } = {},
14
- ): Promise<{ anvil: Anvil; rpcUrl: string; stop: () => Promise<void> }> {
22
+ ): Promise<{ anvil: Anvil; methodCalls?: string[]; rpcUrl: string; stop: () => Promise<void> }> {
15
23
  const anvilBinary = resolve(dirname(fileURLToPath(import.meta.url)), '../../', 'scripts/anvil_kill_wrapper.sh');
24
+ const logger = opts.log ? createLogger('ethereum:anvil') : undefined;
25
+ const methodCalls = opts.captureMethodCalls ? ([] as string[]) : undefined;
16
26
 
17
27
  let port: number | undefined;
18
28
 
@@ -22,19 +32,28 @@ export async function startAnvil(
22
32
  async () => {
23
33
  const anvil = createAnvil({
24
34
  anvilBinary,
25
- port: 0,
35
+ host: '127.0.0.1',
36
+ port: opts.port ?? 8545,
26
37
  blockTime: opts.l1BlockTime,
27
38
  stopTimeout: 1000,
39
+ accounts: opts.accounts ?? 20,
40
+ gasLimit: 45_000_000n,
41
+ chainId: opts.chainId ?? 31337,
28
42
  });
29
43
 
30
44
  // Listen to the anvil output to get the port.
31
45
  const removeHandler = anvil.on('message', (message: string) => {
46
+ logger?.debug(message.trim());
47
+
48
+ methodCalls?.push(...(message.match(/eth_[^\s]+/g) || []));
32
49
  if (port === undefined && message.includes('Listening on')) {
33
50
  port = parseInt(message.match(/Listening on ([^:]+):(\d+)/)![2]);
34
51
  }
35
52
  });
36
53
  await anvil.start();
37
- removeHandler();
54
+ if (!logger && !opts.captureMethodCalls) {
55
+ removeHandler();
56
+ }
38
57
 
39
58
  return anvil;
40
59
  },
@@ -47,6 +66,6 @@ export async function startAnvil(
47
66
  }
48
67
 
49
68
  // Monkeypatch the anvil instance to include the actually assigned port
50
- Object.defineProperty(anvil, 'port', { value: port, writable: false });
51
- return { anvil, stop: () => anvil.stop(), rpcUrl: `http://127.0.0.1:${port}` };
69
+ // Object.defineProperty(anvil, 'port', { value: port, writable: false });
70
+ return { anvil, methodCalls, stop: () => anvil.stop(), rpcUrl: `http://127.0.0.1:${port}` };
52
71
  }
@@ -1,21 +1,31 @@
1
1
  import { omit } from '@aztec/foundation/collection';
2
2
  import { type Logger, createLogger } from '@aztec/foundation/log';
3
3
  import { retryUntil } from '@aztec/foundation/retry';
4
+ import type { DateProvider } from '@aztec/foundation/timer';
4
5
 
5
6
  import { inspect } from 'util';
6
7
  import {
7
8
  type Client,
8
9
  type Hex,
9
10
  type PublicClient,
11
+ type TransactionSerializableEIP4844,
10
12
  keccak256,
11
13
  parseTransaction,
12
14
  publicActions,
15
+ serializeTransaction,
13
16
  walletActions,
14
17
  } from 'viem';
15
18
 
16
- import type { ViemWalletClient } from '../types.js';
19
+ import { type ViemClient, isExtendedClient } from '../types.js';
17
20
 
18
- export function waitUntilBlock<T extends Client>(client: T, blockNumber: number | bigint, logger?: Logger) {
21
+ const MAX_WAIT_TIME_SECONDS = 180;
22
+
23
+ export function waitUntilBlock<T extends Client>(
24
+ client: T,
25
+ blockNumber: number | bigint,
26
+ logger?: Logger,
27
+ timeout?: number,
28
+ ) {
19
29
  const publicClient =
20
30
  'getBlockNumber' in client && typeof client.getBlockNumber === 'function'
21
31
  ? (client as unknown as PublicClient)
@@ -28,12 +38,17 @@ export function waitUntilBlock<T extends Client>(client: T, blockNumber: number
28
38
  return currentBlockNumber >= BigInt(blockNumber);
29
39
  },
30
40
  `Wait until L1 block ${blockNumber}`,
31
- 120,
41
+ timeout ?? MAX_WAIT_TIME_SECONDS,
32
42
  0.1,
33
43
  );
34
44
  }
35
45
 
36
- export function waitUntilL1Timestamp<T extends Client>(client: T, timestamp: number | bigint, logger?: Logger) {
46
+ export function waitUntilL1Timestamp<T extends Client>(
47
+ client: T,
48
+ timestamp: number | bigint,
49
+ logger?: Logger,
50
+ timeout?: number,
51
+ ) {
37
52
  const publicClient =
38
53
  'getBlockNumber' in client && typeof client.getBlockNumber === 'function'
39
54
  ? (client as unknown as PublicClient)
@@ -53,31 +68,51 @@ export function waitUntilL1Timestamp<T extends Client>(client: T, timestamp: num
53
68
  return currentTs >= BigInt(timestamp);
54
69
  },
55
70
  `Wait until L1 timestamp ${timestamp}`,
56
- 120,
71
+ timeout ?? MAX_WAIT_TIME_SECONDS,
57
72
  0.1,
58
73
  );
59
74
  }
60
75
 
61
76
  export interface Delayer {
62
- /** Returns the list of all txs (not just the delayed ones) sent through the attached client. */
63
- getTxs(): Hex[];
77
+ /** Returns the hashes of all effectively sent txs. */
78
+ getSentTxHashes(): Hex[];
79
+ /** Returns the raw hex for all cancelled txs. */
80
+ getCancelledTxs(): Hex[];
64
81
  /** Delays the next tx to be sent so it lands on the given L1 block number. */
65
82
  pauseNextTxUntilBlock(l1BlockNumber: number | bigint | undefined): void;
66
83
  /** Delays the next tx to be sent so it lands on the given timestamp. */
67
84
  pauseNextTxUntilTimestamp(l1Timestamp: number | bigint | undefined): void;
85
+ /** Delays the next tx to be sent indefinitely. */
86
+ cancelNextTx(): void;
87
+ /**
88
+ * Sets max inclusion time into slot. If more than this many seconds have passed
89
+ * since the last L1 block was mined, then any tx will not be mined in the current
90
+ * L1 slot but will be deferred for the next one.
91
+ */
92
+ setMaxInclusionTimeIntoSlot(seconds: number | bigint | undefined): void;
68
93
  }
69
94
 
70
95
  class DelayerImpl implements Delayer {
71
- constructor(opts: { ethereumSlotDuration: bigint | number }) {
96
+ private logger = createLogger('ethereum:tx_delayer');
97
+ constructor(
98
+ public dateProvider: DateProvider,
99
+ opts: { ethereumSlotDuration: bigint | number },
100
+ ) {
72
101
  this.ethereumSlotDuration = BigInt(opts.ethereumSlotDuration);
73
102
  }
74
103
 
104
+ public maxInclusionTimeIntoSlot: number | undefined = undefined;
75
105
  public ethereumSlotDuration: bigint;
76
- public nextWait: { l1Timestamp: bigint } | { l1BlockNumber: bigint } | undefined = undefined;
77
- public txs: Hex[] = [];
106
+ public nextWait: { l1Timestamp: bigint } | { l1BlockNumber: bigint } | { indefinitely: true } | undefined = undefined;
107
+ public sentTxHashes: Hex[] = [];
108
+ public cancelledTxs: Hex[] = [];
78
109
 
79
- getTxs() {
80
- return this.txs;
110
+ getSentTxHashes() {
111
+ return this.sentTxHashes;
112
+ }
113
+
114
+ getCancelledTxs(): Hex[] {
115
+ return this.cancelledTxs;
81
116
  }
82
117
 
83
118
  pauseNextTxUntilBlock(l1BlockNumber: number | bigint) {
@@ -87,6 +122,14 @@ class DelayerImpl implements Delayer {
87
122
  pauseNextTxUntilTimestamp(l1Timestamp: number | bigint) {
88
123
  this.nextWait = { l1Timestamp: BigInt(l1Timestamp) };
89
124
  }
125
+
126
+ cancelNextTx() {
127
+ this.nextWait = { indefinitely: true };
128
+ }
129
+
130
+ setMaxInclusionTimeIntoSlot(seconds: number | undefined) {
131
+ this.maxInclusionTimeIntoSlot = seconds;
132
+ }
90
133
  }
91
134
 
92
135
  /**
@@ -94,12 +137,17 @@ class DelayerImpl implements Delayer {
94
137
  * The delayer can be used to hold off the next tx to be sent until a given block number.
95
138
  * TODO(#10824): This doesn't play along well with blob txs for some reason.
96
139
  */
97
- export function withDelayer<T extends ViemWalletClient>(
140
+ export function withDelayer<T extends ViemClient>(
98
141
  client: T,
142
+ dateProvider: DateProvider,
99
143
  opts: { ethereumSlotDuration: bigint | number },
100
144
  ): { client: T; delayer: Delayer } {
145
+ if (!isExtendedClient(client)) {
146
+ throw new Error('withDelayer has to be instantiated with a wallet viem client.');
147
+ }
101
148
  const logger = createLogger('ethereum:tx_delayer');
102
- const delayer = new DelayerImpl(opts);
149
+ const delayer = new DelayerImpl(dateProvider, opts);
150
+
103
151
  const extended = client
104
152
  // Tweak sendRawTransaction so it uses the delay defined in the delayer.
105
153
  // Note that this will only work with local accounts (ie accounts for which we have the private key).
@@ -107,28 +155,68 @@ export function withDelayer<T extends ViemWalletClient>(
107
155
  // but we do not use them in our codebase at all.
108
156
  .extend(client => ({
109
157
  async sendRawTransaction(...args) {
158
+ let wait: Promise<unknown> | undefined;
159
+ let txHash: Hex | undefined;
160
+
161
+ const { serializedTransaction } = args[0];
162
+ const publicClient = client as unknown as PublicClient;
163
+
110
164
  if (delayer.nextWait !== undefined) {
165
+ // Check if we have been instructed to delay the next tx.
111
166
  const waitUntil = delayer.nextWait;
112
167
  delayer.nextWait = undefined;
113
168
 
114
- const publicClient = client as unknown as PublicClient;
115
- const wait =
169
+ // Compute the tx hash manually so we emulate sendRawTransaction response
170
+ txHash = computeTxHash(serializedTransaction);
171
+
172
+ // Cancel tx outright if instructed
173
+ if ('indefinitely' in waitUntil && waitUntil.indefinitely) {
174
+ logger.info(`Cancelling tx ${txHash}`);
175
+ delayer.cancelledTxs.push(serializedTransaction);
176
+ return Promise.resolve(txHash);
177
+ }
178
+
179
+ // Or wait until the desired block number or timestamp
180
+ wait =
116
181
  'l1BlockNumber' in waitUntil
117
182
  ? waitUntilBlock(publicClient, waitUntil.l1BlockNumber - 1n, logger)
118
- : waitUntilL1Timestamp(publicClient, waitUntil.l1Timestamp - delayer.ethereumSlotDuration, logger);
183
+ : 'l1Timestamp' in waitUntil
184
+ ? waitUntilL1Timestamp(publicClient, waitUntil.l1Timestamp - delayer.ethereumSlotDuration, logger)
185
+ : undefined;
119
186
 
120
- // Compute the tx hash manually so we emulate sendRawTransaction response
121
- const { serializedTransaction } = args[0];
122
- const txHash = keccak256(serializedTransaction);
123
187
  logger.info(`Delaying tx ${txHash} until ${inspect(waitUntil)}`, {
124
188
  argsLen: args.length,
125
189
  ...omit(parseTransaction(serializedTransaction), 'data', 'sidecars'),
126
190
  });
191
+ } else if (delayer.maxInclusionTimeIntoSlot !== undefined) {
192
+ // Check if we need to delay txs sent too close to the end of the slot.
193
+ const currentBlock = await publicClient.getBlock({ includeTransactions: false });
194
+ const { timestamp: lastBlockTimestamp, number } = currentBlock;
195
+ const now = delayer.dateProvider.now();
196
+
197
+ txHash = computeTxHash(serializedTransaction);
198
+ const logData = {
199
+ ...omit(parseTransaction(serializedTransaction), 'data', 'sidecars'),
200
+ lastBlockTimestamp,
201
+ now,
202
+ maxInclusionTimeIntoSlot: delayer.maxInclusionTimeIntoSlot,
203
+ };
204
+
205
+ if (now / 1000 - Number(lastBlockTimestamp) > delayer.maxInclusionTimeIntoSlot) {
206
+ // If the last block was mined more than `maxInclusionTimeIntoSlot` seconds ago, then we cannot include
207
+ // any txs in the current slot, so we delay the tx until the next slot.
208
+ logger.info(`Delaying inclusion of tx ${txHash} until the next slot since it was sent too late`, logData);
209
+ wait = waitUntilBlock(publicClient, number + 1n, logger);
210
+ } else {
211
+ logger.debug(`Immediately sending tx ${txHash} as it was received early enough in the slot`, logData);
212
+ }
213
+ }
127
214
 
215
+ if (wait !== undefined) {
128
216
  // Do not await here so we can return the tx hash immediately as if it had been sent on the spot.
129
217
  // Instead, delay it so it lands on the desired block number or timestamp, assuming anvil will
130
218
  // mine it immediately.
131
- void wait
219
+ void wait!
132
220
  .then(async () => {
133
221
  const clientTxHash = await client.sendRawTransaction(...args);
134
222
  if (clientTxHash !== txHash) {
@@ -137,16 +225,15 @@ export function withDelayer<T extends ViemWalletClient>(
137
225
  computedTxHash: txHash,
138
226
  });
139
227
  }
140
- logger.info(`Sent previously delayed tx ${clientTxHash} to land on ${inspect(waitUntil)}`);
141
- delayer.txs.push(clientTxHash);
228
+ logger.info(`Sent previously delayed tx ${clientTxHash}`);
229
+ delayer.sentTxHashes.push(clientTxHash);
142
230
  })
143
231
  .catch(err => logger.error(`Error sending tx after delay`, err));
144
-
145
- return Promise.resolve(txHash);
232
+ return Promise.resolve(txHash!);
146
233
  } else {
147
234
  const txHash = await client.sendRawTransaction(...args);
148
- logger.verbose(`Sent tx immediately ${txHash}`);
149
- delayer.txs.push(txHash);
235
+ logger.debug(`Sent tx immediately ${txHash}`);
236
+ delayer.sentTxHashes.push(txHash);
150
237
  return txHash;
151
238
  }
152
239
  },
@@ -161,3 +248,19 @@ export function withDelayer<T extends ViemWalletClient>(
161
248
 
162
249
  return { client: extended, delayer };
163
250
  }
251
+
252
+ /**
253
+ * Compute the tx hash given the serialized tx. Note that if this is a blob tx, we need to
254
+ * exclude the blobs, commitments, and proofs from the hash.
255
+ */
256
+ function computeTxHash(serializedTransaction: Hex) {
257
+ if (serializedTransaction.startsWith('0x03')) {
258
+ const parsed = parseTransaction(serializedTransaction);
259
+ if (parsed.blobs || parsed.sidecars) {
260
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
261
+ const { blobs, sidecars, ...rest } = parsed;
262
+ return keccak256(serializeTransaction({ type: 'eip4844', ...rest } as TransactionSerializableEIP4844));
263
+ }
264
+ }
265
+ return keccak256(serializedTransaction);
266
+ }