@aztec/ethereum 0.0.0-test.1 → 0.0.1-commit.001888fc

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 (289) 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 +14 -4
  6. package/dest/client.d.ts.map +1 -1
  7. package/dest/client.js +27 -3
  8. package/dest/config.d.ts +70 -23
  9. package/dest/config.d.ts.map +1 -1
  10. package/dest/config.js +155 -34
  11. package/dest/constants.d.ts +1 -1
  12. package/dest/contracts/empire_base.d.ts +27 -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 +69 -0
  16. package/dest/contracts/empire_slashing_proposer.d.ts.map +1 -0
  17. package/dest/contracts/empire_slashing_proposer.js +216 -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 +20 -0
  22. package/dest/contracts/fee_asset_handler.d.ts.map +1 -0
  23. package/dest/contracts/fee_asset_handler.js +59 -0
  24. package/dest/contracts/fee_asset_price_oracle.d.ts +101 -0
  25. package/dest/contracts/fee_asset_price_oracle.d.ts.map +1 -0
  26. package/dest/contracts/fee_asset_price_oracle.js +651 -0
  27. package/dest/contracts/fee_juice.d.ts +6 -7
  28. package/dest/contracts/fee_juice.d.ts.map +1 -1
  29. package/dest/contracts/fee_juice.js +27 -20
  30. package/dest/contracts/governance.d.ts +45 -32
  31. package/dest/contracts/governance.d.ts.map +1 -1
  32. package/dest/contracts/governance.js +98 -85
  33. package/dest/contracts/governance_proposer.d.ts +19 -13
  34. package/dest/contracts/governance_proposer.d.ts.map +1 -1
  35. package/dest/contracts/governance_proposer.js +441 -26
  36. package/dest/contracts/gse.d.ts +32 -0
  37. package/dest/contracts/gse.d.ts.map +1 -0
  38. package/dest/contracts/gse.js +72 -0
  39. package/dest/contracts/inbox.d.ts +47 -0
  40. package/dest/contracts/inbox.d.ts.map +1 -0
  41. package/dest/contracts/inbox.js +80 -0
  42. package/dest/contracts/index.d.ts +12 -3
  43. package/dest/contracts/index.d.ts.map +1 -1
  44. package/dest/contracts/index.js +11 -2
  45. package/dest/contracts/log.d.ts +13 -0
  46. package/dest/contracts/log.d.ts.map +1 -0
  47. package/dest/contracts/log.js +1 -0
  48. package/dest/contracts/multicall.d.ts +21 -0
  49. package/dest/contracts/multicall.d.ts.map +1 -0
  50. package/dest/contracts/multicall.js +157 -0
  51. package/dest/contracts/outbox.d.ts +41 -0
  52. package/dest/contracts/outbox.d.ts.map +1 -0
  53. package/dest/contracts/outbox.js +86 -0
  54. package/dest/contracts/registry.d.ts +12 -5
  55. package/dest/contracts/registry.d.ts.map +1 -1
  56. package/dest/contracts/registry.js +74 -17
  57. package/dest/contracts/rollup.d.ts +311 -53
  58. package/dest/contracts/rollup.d.ts.map +1 -1
  59. package/dest/contracts/rollup.js +1180 -116
  60. package/dest/contracts/slasher_contract.d.ts +44 -0
  61. package/dest/contracts/slasher_contract.d.ts.map +1 -0
  62. package/dest/contracts/slasher_contract.js +75 -0
  63. package/dest/contracts/tally_slashing_proposer.d.ts +140 -0
  64. package/dest/contracts/tally_slashing_proposer.d.ts.map +1 -0
  65. package/dest/contracts/tally_slashing_proposer.js +320 -0
  66. package/dest/contracts/utils.d.ts +3 -0
  67. package/dest/contracts/utils.d.ts.map +1 -0
  68. package/dest/contracts/utils.js +11 -0
  69. package/dest/deploy_aztec_l1_contracts.d.ts +259 -0
  70. package/dest/deploy_aztec_l1_contracts.d.ts.map +1 -0
  71. package/dest/deploy_aztec_l1_contracts.js +413 -0
  72. package/dest/deploy_l1_contract.d.ts +68 -0
  73. package/dest/deploy_l1_contract.d.ts.map +1 -0
  74. package/dest/deploy_l1_contract.js +312 -0
  75. package/dest/eth-signer/eth-signer.d.ts +21 -0
  76. package/dest/eth-signer/eth-signer.d.ts.map +1 -0
  77. package/dest/eth-signer/eth-signer.js +5 -0
  78. package/dest/eth-signer/index.d.ts +2 -0
  79. package/dest/eth-signer/index.d.ts.map +1 -0
  80. package/dest/eth-signer/index.js +1 -0
  81. package/dest/forwarder_proxy.d.ts +32 -0
  82. package/dest/forwarder_proxy.d.ts.map +1 -0
  83. package/dest/forwarder_proxy.js +93 -0
  84. package/dest/generated/l1-contracts-defaults.d.ts +30 -0
  85. package/dest/generated/l1-contracts-defaults.d.ts.map +1 -0
  86. package/dest/generated/l1-contracts-defaults.js +30 -0
  87. package/dest/l1_artifacts.d.ts +81744 -0
  88. package/dest/l1_artifacts.d.ts.map +1 -0
  89. package/dest/l1_artifacts.js +166 -0
  90. package/dest/l1_contract_addresses.d.ts +24 -4
  91. package/dest/l1_contract_addresses.d.ts.map +1 -1
  92. package/dest/l1_contract_addresses.js +25 -21
  93. package/dest/l1_reader.d.ts +6 -2
  94. package/dest/l1_reader.d.ts.map +1 -1
  95. package/dest/l1_reader.js +20 -9
  96. package/dest/l1_tx_utils/config.d.ts +65 -0
  97. package/dest/l1_tx_utils/config.d.ts.map +1 -0
  98. package/dest/l1_tx_utils/config.js +109 -0
  99. package/dest/l1_tx_utils/constants.d.ts +12 -0
  100. package/dest/l1_tx_utils/constants.d.ts.map +1 -0
  101. package/dest/l1_tx_utils/constants.js +39 -0
  102. package/dest/l1_tx_utils/factory.d.ts +32 -0
  103. package/dest/l1_tx_utils/factory.d.ts.map +1 -0
  104. package/dest/l1_tx_utils/factory.js +22 -0
  105. package/dest/l1_tx_utils/fee-strategies/index.d.ts +10 -0
  106. package/dest/l1_tx_utils/fee-strategies/index.d.ts.map +1 -0
  107. package/dest/l1_tx_utils/fee-strategies/index.js +12 -0
  108. package/dest/l1_tx_utils/fee-strategies/p75_competitive.d.ts +8 -0
  109. package/dest/l1_tx_utils/fee-strategies/p75_competitive.d.ts.map +1 -0
  110. package/dest/l1_tx_utils/fee-strategies/p75_competitive.js +129 -0
  111. package/dest/l1_tx_utils/fee-strategies/p75_competitive_blob_txs_only.d.ts +23 -0
  112. package/dest/l1_tx_utils/fee-strategies/p75_competitive_blob_txs_only.d.ts.map +1 -0
  113. package/dest/l1_tx_utils/fee-strategies/p75_competitive_blob_txs_only.js +191 -0
  114. package/dest/l1_tx_utils/fee-strategies/types.d.ts +51 -0
  115. package/dest/l1_tx_utils/fee-strategies/types.d.ts.map +1 -0
  116. package/dest/l1_tx_utils/fee-strategies/types.js +3 -0
  117. package/dest/l1_tx_utils/forwarder_l1_tx_utils.d.ts +41 -0
  118. package/dest/l1_tx_utils/forwarder_l1_tx_utils.d.ts.map +1 -0
  119. package/dest/l1_tx_utils/forwarder_l1_tx_utils.js +42 -0
  120. package/dest/l1_tx_utils/index-blobs.d.ts +3 -0
  121. package/dest/l1_tx_utils/index-blobs.d.ts.map +1 -0
  122. package/dest/l1_tx_utils/index-blobs.js +2 -0
  123. package/dest/l1_tx_utils/index.d.ts +13 -0
  124. package/dest/l1_tx_utils/index.d.ts.map +1 -0
  125. package/dest/l1_tx_utils/index.js +13 -0
  126. package/dest/l1_tx_utils/interfaces.d.ts +76 -0
  127. package/dest/l1_tx_utils/interfaces.d.ts.map +1 -0
  128. package/dest/l1_tx_utils/interfaces.js +4 -0
  129. package/dest/l1_tx_utils/l1_fee_analyzer.d.ts +233 -0
  130. package/dest/l1_tx_utils/l1_fee_analyzer.d.ts.map +1 -0
  131. package/dest/l1_tx_utils/l1_fee_analyzer.js +506 -0
  132. package/dest/l1_tx_utils/l1_tx_utils.d.ts +105 -0
  133. package/dest/l1_tx_utils/l1_tx_utils.d.ts.map +1 -0
  134. package/dest/l1_tx_utils/l1_tx_utils.js +639 -0
  135. package/dest/l1_tx_utils/readonly_l1_tx_utils.d.ts +83 -0
  136. package/dest/l1_tx_utils/readonly_l1_tx_utils.d.ts.map +1 -0
  137. package/dest/l1_tx_utils/readonly_l1_tx_utils.js +327 -0
  138. package/dest/l1_tx_utils/signer.d.ts +4 -0
  139. package/dest/l1_tx_utils/signer.d.ts.map +1 -0
  140. package/dest/l1_tx_utils/signer.js +16 -0
  141. package/dest/l1_tx_utils/tx_delayer.d.ts +56 -0
  142. package/dest/l1_tx_utils/tx_delayer.d.ts.map +1 -0
  143. package/dest/l1_tx_utils/tx_delayer.js +221 -0
  144. package/dest/l1_tx_utils/types.d.ts +67 -0
  145. package/dest/l1_tx_utils/types.d.ts.map +1 -0
  146. package/dest/l1_tx_utils/types.js +26 -0
  147. package/dest/l1_tx_utils/utils.d.ts +4 -0
  148. package/dest/l1_tx_utils/utils.d.ts.map +1 -0
  149. package/dest/l1_tx_utils/utils.js +14 -0
  150. package/dest/l1_types.d.ts +6 -0
  151. package/dest/l1_types.d.ts.map +1 -0
  152. package/dest/l1_types.js +1 -0
  153. package/dest/publisher_manager.d.ts +16 -0
  154. package/dest/publisher_manager.d.ts.map +1 -0
  155. package/dest/publisher_manager.js +88 -0
  156. package/dest/queries.d.ts +5 -3
  157. package/dest/queries.d.ts.map +1 -1
  158. package/dest/queries.js +61 -12
  159. package/dest/test/chain_monitor.d.ts +94 -0
  160. package/dest/test/chain_monitor.d.ts.map +1 -0
  161. package/dest/test/chain_monitor.js +244 -0
  162. package/dest/test/eth_cheat_codes.d.ts +229 -0
  163. package/dest/test/eth_cheat_codes.d.ts.map +1 -0
  164. package/dest/test/eth_cheat_codes.js +560 -0
  165. package/dest/test/eth_cheat_codes_with_state.d.ts +2 -2
  166. package/dest/test/eth_cheat_codes_with_state.d.ts.map +1 -1
  167. package/dest/test/eth_cheat_codes_with_state.js +1 -1
  168. package/dest/test/index.d.ts +4 -3
  169. package/dest/test/index.d.ts.map +1 -1
  170. package/dest/test/index.js +3 -2
  171. package/dest/test/rollup_cheat_codes.d.ts +90 -0
  172. package/dest/test/rollup_cheat_codes.d.ts.map +1 -0
  173. package/dest/test/rollup_cheat_codes.js +292 -0
  174. package/dest/test/start_anvil.d.ts +23 -2
  175. package/dest/test/start_anvil.d.ts.map +1 -1
  176. package/dest/test/start_anvil.js +133 -24
  177. package/dest/test/upgrade_utils.d.ts +6 -5
  178. package/dest/test/upgrade_utils.d.ts.map +1 -1
  179. package/dest/test/upgrade_utils.js +23 -16
  180. package/dest/types.d.ts +62 -8
  181. package/dest/types.d.ts.map +1 -1
  182. package/dest/types.js +3 -1
  183. package/dest/utils.d.ts +17 -3
  184. package/dest/utils.d.ts.map +1 -1
  185. package/dest/utils.js +111 -88
  186. package/dest/zkPassportVerifierAddress.d.ts +15 -0
  187. package/dest/zkPassportVerifierAddress.d.ts.map +1 -0
  188. package/dest/zkPassportVerifierAddress.js +11 -0
  189. package/package.json +51 -25
  190. package/src/account.ts +5 -0
  191. package/src/client.ts +51 -5
  192. package/src/config.ts +222 -43
  193. package/src/contracts/README.md +157 -0
  194. package/src/contracts/empire_base.ts +79 -7
  195. package/src/contracts/empire_slashing_proposer.ts +265 -0
  196. package/src/contracts/errors.ts +13 -0
  197. package/src/contracts/fee_asset_handler.ts +66 -0
  198. package/src/contracts/fee_asset_price_oracle.ts +280 -0
  199. package/src/contracts/fee_juice.ts +29 -15
  200. package/src/contracts/governance.ts +90 -78
  201. package/src/contracts/governance_proposer.ts +81 -25
  202. package/src/contracts/gse.ts +88 -0
  203. package/src/contracts/inbox.ts +115 -0
  204. package/src/contracts/index.ts +11 -2
  205. package/src/contracts/log.ts +13 -0
  206. package/src/contracts/multicall.ts +158 -0
  207. package/src/contracts/outbox.ts +98 -0
  208. package/src/contracts/registry.ts +81 -26
  209. package/src/contracts/rollup.ts +940 -89
  210. package/src/contracts/slasher_contract.ts +89 -0
  211. package/src/contracts/tally_slashing_proposer.ts +322 -0
  212. package/src/contracts/utils.ts +14 -0
  213. package/src/deploy_aztec_l1_contracts.ts +650 -0
  214. package/src/deploy_l1_contract.ts +362 -0
  215. package/src/eth-signer/eth-signer.ts +25 -0
  216. package/src/eth-signer/index.ts +1 -0
  217. package/src/forwarder_proxy.ts +108 -0
  218. package/src/generated/l1-contracts-defaults.ts +32 -0
  219. package/src/l1_artifacts.ts +254 -0
  220. package/src/l1_contract_addresses.ts +49 -34
  221. package/src/l1_reader.ts +30 -10
  222. package/src/l1_tx_utils/README.md +177 -0
  223. package/src/l1_tx_utils/config.ts +181 -0
  224. package/src/l1_tx_utils/constants.ts +29 -0
  225. package/src/l1_tx_utils/factory.ts +64 -0
  226. package/src/l1_tx_utils/fee-strategies/index.ts +22 -0
  227. package/src/l1_tx_utils/fee-strategies/p75_competitive.ts +163 -0
  228. package/src/l1_tx_utils/fee-strategies/p75_competitive_blob_txs_only.ts +245 -0
  229. package/src/l1_tx_utils/fee-strategies/types.ts +56 -0
  230. package/src/l1_tx_utils/forwarder_l1_tx_utils.ts +108 -0
  231. package/src/l1_tx_utils/index-blobs.ts +2 -0
  232. package/src/l1_tx_utils/index.ts +15 -0
  233. package/src/l1_tx_utils/interfaces.ts +86 -0
  234. package/src/l1_tx_utils/l1_fee_analyzer.ts +803 -0
  235. package/src/l1_tx_utils/l1_tx_utils.ts +766 -0
  236. package/src/l1_tx_utils/readonly_l1_tx_utils.ts +423 -0
  237. package/src/l1_tx_utils/signer.ts +28 -0
  238. package/src/l1_tx_utils/tx_delayer.ts +294 -0
  239. package/src/l1_tx_utils/types.ts +85 -0
  240. package/src/l1_tx_utils/utils.ts +16 -0
  241. package/src/l1_types.ts +6 -0
  242. package/src/publisher_manager.ts +108 -0
  243. package/src/queries.ts +82 -16
  244. package/src/test/chain_monitor.ts +302 -0
  245. package/src/test/eth_cheat_codes.ts +588 -0
  246. package/src/test/eth_cheat_codes_with_state.ts +1 -1
  247. package/src/test/index.ts +3 -2
  248. package/src/test/rollup_cheat_codes.ts +330 -0
  249. package/src/test/start_anvil.ts +166 -22
  250. package/src/test/upgrade_utils.ts +30 -21
  251. package/src/types.ts +71 -7
  252. package/src/utils.ts +137 -93
  253. package/src/zkPassportVerifierAddress.ts +15 -0
  254. package/dest/contracts/forwarder.d.ts +0 -24
  255. package/dest/contracts/forwarder.d.ts.map +0 -1
  256. package/dest/contracts/forwarder.js +0 -101
  257. package/dest/contracts/slashing_proposer.d.ts +0 -21
  258. package/dest/contracts/slashing_proposer.d.ts.map +0 -1
  259. package/dest/contracts/slashing_proposer.js +0 -47
  260. package/dest/deploy_l1_contracts.d.ts +0 -21210
  261. package/dest/deploy_l1_contracts.d.ts.map +0 -1
  262. package/dest/deploy_l1_contracts.js +0 -687
  263. package/dest/eth_cheat_codes.d.ts +0 -147
  264. package/dest/eth_cheat_codes.d.ts.map +0 -1
  265. package/dest/eth_cheat_codes.js +0 -303
  266. package/dest/index.d.ts +0 -14
  267. package/dest/index.d.ts.map +0 -1
  268. package/dest/index.js +0 -13
  269. package/dest/l1_tx_utils.d.ts +0 -192
  270. package/dest/l1_tx_utils.d.ts.map +0 -1
  271. package/dest/l1_tx_utils.js +0 -641
  272. package/dest/l1_tx_utils_with_blobs.d.ts +0 -12
  273. package/dest/l1_tx_utils_with_blobs.d.ts.map +0 -1
  274. package/dest/l1_tx_utils_with_blobs.js +0 -64
  275. package/dest/test/delayed_tx_utils.d.ts +0 -8
  276. package/dest/test/delayed_tx_utils.d.ts.map +0 -1
  277. package/dest/test/delayed_tx_utils.js +0 -21
  278. package/dest/test/tx_delayer.d.ts +0 -25
  279. package/dest/test/tx_delayer.d.ts.map +0 -1
  280. package/dest/test/tx_delayer.js +0 -116
  281. package/src/contracts/forwarder.ts +0 -132
  282. package/src/contracts/slashing_proposer.ts +0 -51
  283. package/src/deploy_l1_contracts.ts +0 -948
  284. package/src/eth_cheat_codes.ts +0 -314
  285. package/src/index.ts +0 -13
  286. package/src/l1_tx_utils.ts +0 -847
  287. package/src/l1_tx_utils_with_blobs.ts +0 -86
  288. package/src/test/delayed_tx_utils.ts +0 -24
  289. package/src/test/tx_delayer.ts +0 -163
@@ -0,0 +1,330 @@
1
+ import { OutboxContract, 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 number of seconds until the start of the given slot based on L1 block timestamp. */
60
+ public async getSecondsUntilSlot(slot: SlotNumber): Promise<number> {
61
+ const [currentTimestamp, targetTimestamp] = await Promise.all([
62
+ this.client.getBlock().then(b => BigInt(b.timestamp)),
63
+ this.rollup.read.getTimestampForSlot([BigInt(slot)]),
64
+ ]);
65
+ return Math.max(0, Number(targetTimestamp - currentTimestamp));
66
+ }
67
+
68
+ /** Returns the current epoch */
69
+ public async getEpoch(): Promise<EpochNumber> {
70
+ const slotNumber = await this.getSlot();
71
+ return EpochNumber.fromBigInt(await this.rollup.read.getEpochAtSlot([BigInt(slotNumber)]));
72
+ }
73
+
74
+ /**
75
+ * Returns the pending and proven chain tips
76
+ * @returns The pending and proven chain tips
77
+ */
78
+ public async getTips(): Promise<{
79
+ /** The pending chain tip */ pending: CheckpointNumber;
80
+ /** The proven chain tip */ proven: CheckpointNumber;
81
+ }> {
82
+ const { pending, proven } = await this.rollup.read.getTips();
83
+ return {
84
+ pending: CheckpointNumber.fromBigInt(pending),
85
+ proven: CheckpointNumber.fromBigInt(proven),
86
+ };
87
+ }
88
+
89
+ /**
90
+ * Logs the current state of the rollup contract.
91
+ */
92
+ public async debugRollup() {
93
+ const rollup = new RollupContract(this.client, this.rollup.address);
94
+ const pendingNum = await rollup.getCheckpointNumber();
95
+ const provenNum = await rollup.getProvenCheckpointNumber();
96
+ const validators = await rollup.getAttesters();
97
+ const committee = await rollup.getCurrentEpochCommittee();
98
+ const archive = await rollup.archive();
99
+ const slot = await this.getSlot();
100
+ const epochNum = await rollup.getEpochNumberForSlotNumber(slot);
101
+
102
+ this.logger.info(`Pending checkpoint num: ${pendingNum}`);
103
+ this.logger.info(`Proven checkpoint num: ${provenNum}`);
104
+ this.logger.info(`Validators: ${validators.map(v => v.toString()).join(', ')}`);
105
+ this.logger.info(`Committee: ${committee?.map(v => v.toString()).join(', ')}`);
106
+ this.logger.info(`Archive: ${archive}`);
107
+ this.logger.info(`Epoch num: ${epochNum}`);
108
+ this.logger.info(`Slot: ${slot}`);
109
+ }
110
+
111
+ /** Fetches the epoch and slot duration config from the rollup contract */
112
+ public async getConfig(): Promise<{
113
+ /** Epoch duration */ epochDuration: bigint;
114
+ /** Slot duration */ slotDuration: number;
115
+ }> {
116
+ const [epochDuration, slotDuration] = await Promise.all([
117
+ this.rollup.read.getEpochDuration(),
118
+ this.rollup.read.getSlotDuration(),
119
+ ]);
120
+ return { epochDuration, slotDuration: Number(slotDuration) };
121
+ }
122
+
123
+ /**
124
+ * Advances time to the beginning of the given epoch
125
+ * @param epoch - The epoch to advance to
126
+ * @param opts - Options
127
+ */
128
+ public async advanceToEpoch(
129
+ epoch: EpochNumber,
130
+ opts: {
131
+ /** Offset in seconds */
132
+ offset?: number;
133
+ } = {},
134
+ ) {
135
+ const { epochDuration: slotsInEpoch } = await this.getConfig();
136
+ const slotNumber = SlotNumber(Number(epoch) * Number(slotsInEpoch));
137
+ const timestamp = (await this.rollup.read.getTimestampForSlot([BigInt(slotNumber)])) + BigInt(opts.offset ?? 0);
138
+ try {
139
+ await this.ethCheatCodes.warp(Number(timestamp), { ...opts, silent: true, resetBlockInterval: true });
140
+ this.logger.warn(`Warped to epoch ${epoch}`, { offset: opts.offset, timestamp });
141
+ } catch (err) {
142
+ this.logger.warn(`Warp to epoch ${epoch} failed: ${err}`);
143
+ }
144
+ return timestamp;
145
+ }
146
+
147
+ /** Warps time in L1 until the next epoch */
148
+ public async advanceToNextEpoch() {
149
+ const slot = await this.getSlot();
150
+ const { epochDuration, slotDuration } = await this.getConfig();
151
+ const slotsUntilNextEpoch = epochDuration - (BigInt(slot) % epochDuration) + 1n;
152
+ const timeToNextEpoch = slotsUntilNextEpoch * BigInt(slotDuration);
153
+ const l1Timestamp = BigInt((await this.client.getBlock()).timestamp);
154
+ await this.ethCheatCodes.warp(Number(l1Timestamp + timeToNextEpoch), {
155
+ silent: true,
156
+ resetBlockInterval: true,
157
+ });
158
+ this.logger.warn(`Advanced to next epoch`);
159
+ }
160
+
161
+ /** Warps time in L1 until the beginning of the next slot. */
162
+ public async advanceToNextSlot() {
163
+ const currentSlot = await this.getSlot();
164
+ const nextSlot = SlotNumber(currentSlot + 1);
165
+ const timestamp = await this.rollup.read.getTimestampForSlot([BigInt(nextSlot)]);
166
+ await this.ethCheatCodes.warp(Number(timestamp), { silent: true, resetBlockInterval: true });
167
+ this.logger.warn(`Advanced to slot ${nextSlot}`);
168
+ return [timestamp, nextSlot];
169
+ }
170
+
171
+ /**
172
+ * Warps time in L1 equivalent to however many slots.
173
+ * @param howMany - The number of slots to advance.
174
+ */
175
+ public async advanceSlots(howMany: number) {
176
+ const l1Timestamp = (await this.client.getBlock()).timestamp;
177
+ const slotDuration = Number(await this.rollup.read.getSlotDuration());
178
+ const timeToWarp = BigInt(howMany) * BigInt(slotDuration);
179
+ await this.ethCheatCodes.warp(l1Timestamp + timeToWarp, { silent: true, resetBlockInterval: true });
180
+ const [slot, epoch] = await Promise.all([this.getSlot(), this.getEpoch()]);
181
+ this.logger.warn(`Advanced ${howMany} slots up to slot ${slot} in epoch ${epoch}`);
182
+ }
183
+
184
+ /**
185
+ * Marks the specified checkpoint (or latest if none) as proven
186
+ * @param maybeCheckpointNumber - The checkpoint number to mark as proven (defaults to latest pending)
187
+ */
188
+ public markAsProven(maybeCheckpointNumber?: CheckpointNumber) {
189
+ return this.ethCheatCodes.execWithPausedAnvil(async () => {
190
+ const tipsBefore = await this.getTips();
191
+ const { pending, proven } = tipsBefore;
192
+
193
+ let checkpointNumber = maybeCheckpointNumber;
194
+ if (checkpointNumber === undefined || checkpointNumber > pending) {
195
+ checkpointNumber = pending;
196
+ }
197
+ if (checkpointNumber <= proven) {
198
+ this.logger.debug(`Checkpoint ${checkpointNumber} is already proven`);
199
+ return;
200
+ }
201
+
202
+ // @note @LHerskind this is heavily dependent on the storage layout and size of values
203
+ // The rollupStore is a struct and if the size of elements or the struct changes, this can break
204
+ const provenCheckpointNumberSlot = hexToBigInt(RollupContract.stfStorageSlot);
205
+
206
+ // Need to pack it as a single 32 byte word
207
+ const newValue = (BigInt(tipsBefore.pending) << 128n) | BigInt(checkpointNumber);
208
+ await this.ethCheatCodes.store(EthAddress.fromString(this.rollup.address), provenCheckpointNumberSlot, newValue);
209
+
210
+ const tipsAfter = await this.getTips();
211
+ if (tipsAfter.pending < tipsAfter.proven) {
212
+ throw new Error('Overwrote pending tip to a checkpoint in the past');
213
+ }
214
+
215
+ this.logger.info(
216
+ `Proven tip moved: ${tipsBefore.proven} -> ${tipsAfter.proven}. Pending tip: ${tipsAfter.pending}.`,
217
+ );
218
+ });
219
+ }
220
+
221
+ /**
222
+ * Overrides the inProgress field of the Inbox contract state
223
+ * @param howMuch - How many checkpoints to move it forward
224
+ */
225
+ public advanceInboxInProgress(howMuch: number | bigint): Promise<bigint> {
226
+ return this.ethCheatCodes.execWithPausedAnvil(async () => {
227
+ // Storage slot 2 contains the InboxState struct
228
+ const inboxStateSlot = 2n;
229
+
230
+ // Get inbox and its current state values
231
+ const inboxAddress = await this.rollup.read.getInbox();
232
+ const currentStateValue = await this.ethCheatCodes.load(EthAddress.fromString(inboxAddress), inboxStateSlot);
233
+
234
+ // Extract current values from the packed storage slot
235
+ // Storage layout: rollingHash (128 bits) | totalMessagesInserted (64 bits) | inProgress (64 bits)
236
+ const currentRollingHash = currentStateValue & ((1n << 128n) - 1n);
237
+ const currentTotalMessages = (currentStateValue >> 128n) & ((1n << 64n) - 1n);
238
+ const currentInProgress = currentStateValue >> 192n;
239
+ const newInProgress = currentInProgress + BigInt(howMuch);
240
+
241
+ // Pack new values: rollingHash (low 128 bits) | totalMessages (middle 64 bits) | inProgress (high 64 bits)
242
+ const newValue = (BigInt(newInProgress) << 192n) | (currentTotalMessages << 128n) | currentRollingHash;
243
+
244
+ await this.ethCheatCodes.store(EthAddress.fromString(inboxAddress), inboxStateSlot, newValue, {
245
+ silent: true,
246
+ });
247
+
248
+ this.logger.warn(`Inbox inProgress advanced from ${currentInProgress} to ${newInProgress}`, {
249
+ inbox: inboxAddress,
250
+ oldValue: '0x' + currentStateValue.toString(16),
251
+ newValue: '0x' + newValue.toString(16),
252
+ rollingHash: currentRollingHash,
253
+ totalMessages: currentTotalMessages,
254
+ oldInProgress: currentInProgress,
255
+ newInProgress,
256
+ });
257
+
258
+ return newInProgress;
259
+ });
260
+ }
261
+
262
+ public insertOutbox(epoch: EpochNumber, outHash: bigint) {
263
+ return this.ethCheatCodes.execWithPausedAnvil(async () => {
264
+ const outboxAddress = await this.rollup.read.getOutbox();
265
+ const epochRootSlot = OutboxContract.getEpochRootStorageSlot(epoch);
266
+ await this.ethCheatCodes.store(EthAddress.fromString(outboxAddress), epochRootSlot, outHash);
267
+ this.logger.warn(`Advanced outbox to epoch ${epoch} with out hash ${outHash}`);
268
+ });
269
+ }
270
+
271
+ /**
272
+ * Executes an action impersonated as the owner of the Rollup contract.
273
+ * @param action - The action to execute
274
+ */
275
+ public async asOwner(
276
+ action: (owner: Hex, rollup: GetContractReturnType<typeof RollupAbi, ViemPublicClient>) => Promise<void>,
277
+ ) {
278
+ const owner = await this.rollup.read.owner();
279
+ await this.ethCheatCodes.startImpersonating(owner);
280
+ await action(owner, this.rollup);
281
+ await this.ethCheatCodes.stopImpersonating(owner);
282
+ }
283
+
284
+ /**
285
+ * Sets up the epoch.
286
+ */
287
+ public async setupEpoch() {
288
+ // Doesn't need to be done as owner, but the functionality is here...
289
+ await this.asOwner(async (account, rollup) => {
290
+ const hash = await rollup.write.setupEpoch({ account });
291
+ await this.client.waitForTransactionReceipt({ hash });
292
+ this.logger.warn(`Setup epoch`);
293
+ });
294
+ }
295
+
296
+ /** Directly calls the L1 gas fee oracle. */
297
+ public async updateL1GasFeeOracle() {
298
+ await this.asOwner(async (account, rollup) => {
299
+ const hash = await rollup.write.updateL1GasFeeOracle({ account, chain: this.client.chain });
300
+ await this.client.waitForTransactionReceipt({ hash });
301
+ this.logger.warn(`Updated L1 gas fee oracle`);
302
+ });
303
+ }
304
+
305
+ /**
306
+ * Bumps proving cost per mana.
307
+ * @param bumper - Callback to calculate the new proving cost per mana based on current value.
308
+ */
309
+ public async bumpProvingCostPerMana(bumper: (before: bigint) => bigint) {
310
+ const currentCost = await this.rollup.read.getProvingCostPerManaInEth();
311
+ const newCost = bumper(currentCost);
312
+ await this.setProvingCostPerMana(newCost);
313
+ }
314
+
315
+ /**
316
+ * Directly updates proving cost per mana.
317
+ * @param ethValue - The new proving cost per mana in ETH
318
+ */
319
+ public async setProvingCostPerMana(ethValue: bigint) {
320
+ await this.asOwner(async (account, rollup) => {
321
+ const hash = await rollup.write.setProvingCostPerMana([ethValue], {
322
+ account,
323
+ chain: this.client.chain,
324
+ gasLimit: 1000000n,
325
+ });
326
+ await this.client.waitForTransactionReceipt({ hash });
327
+ this.logger.warn(`Updated proving cost per mana to ${ethValue}`);
328
+ });
329
+ }
330
+ }
@@ -1,52 +1,196 @@
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
 
4
- import { type Anvil, createAnvil } from '@viem/anvil';
5
+ import { type ChildProcess, spawn } from 'child_process';
5
6
  import { dirname, resolve } from 'path';
6
7
 
8
+ /** Minimal interface matching the @viem/anvil Anvil shape used by callers. */
9
+ export interface Anvil {
10
+ readonly port: number;
11
+ readonly host: string;
12
+ readonly status: 'listening' | 'idle';
13
+ stop(): Promise<void>;
14
+ }
15
+
7
16
  /**
8
17
  * Ensures there's a running Anvil instance and returns the RPC URL.
9
18
  */
10
19
  export async function startAnvil(
11
20
  opts: {
21
+ port?: number;
12
22
  l1BlockTime?: number;
23
+ log?: boolean;
24
+ captureMethodCalls?: boolean;
25
+ accounts?: number;
26
+ chainId?: number;
27
+ /** The hardfork to use (e.g. 'cancun', 'latest'). */
28
+ hardfork?: string;
29
+ /**
30
+ * Number of slots per epoch used by anvil to compute the 'finalized' and 'safe' block tags.
31
+ * Anvil reports `finalized = latest - slotsInAnEpoch * 2`.
32
+ * Defaults to 1 so the finalized block advances immediately, making tests that check
33
+ * L1-finality-based logic work without needing hundreds of mined blocks.
34
+ */
35
+ slotsInAnEpoch?: number;
13
36
  } = {},
14
- ): Promise<{ anvil: Anvil; rpcUrl: string; stop: () => Promise<void> }> {
37
+ ): Promise<{ anvil: Anvil; methodCalls?: string[]; rpcUrl: string; stop: () => Promise<void> }> {
15
38
  const anvilBinary = resolve(dirname(fileURLToPath(import.meta.url)), '../../', 'scripts/anvil_kill_wrapper.sh');
39
+ const logger = opts.log ? createLogger('ethereum:anvil') : undefined;
40
+ const methodCalls = opts.captureMethodCalls ? ([] as string[]) : undefined;
16
41
 
17
- let port: number | undefined;
42
+ let detectedPort: number | undefined;
18
43
 
19
- // Start anvil.
20
- // We go via a wrapper script to ensure if the parent dies, anvil dies.
21
44
  const anvil = await retry(
22
45
  async () => {
23
- const anvil = createAnvil({
24
- anvilBinary,
25
- port: 0,
26
- blockTime: opts.l1BlockTime,
27
- stopTimeout: 1000,
46
+ const port = opts.port ?? (process.env.ANVIL_PORT ? parseInt(process.env.ANVIL_PORT) : 8545);
47
+ const args: string[] = [
48
+ '--host',
49
+ '127.0.0.1',
50
+ '--port',
51
+ String(port),
52
+ '--accounts',
53
+ String(opts.accounts ?? 20),
54
+ '--gas-limit',
55
+ String(45_000_000),
56
+ '--chain-id',
57
+ String(opts.chainId ?? 31337),
58
+ ];
59
+ if (opts.l1BlockTime !== undefined) {
60
+ args.push('--block-time', String(opts.l1BlockTime));
61
+ }
62
+ if (opts.hardfork !== undefined) {
63
+ args.push('--hardfork', opts.hardfork);
64
+ }
65
+ args.push('--slots-in-an-epoch', String(opts.slotsInAnEpoch ?? 1));
66
+
67
+ const child = spawn(anvilBinary, args, {
68
+ stdio: ['ignore', 'pipe', 'pipe'],
69
+ env: { ...process.env, RAYON_NUM_THREADS: '1' },
28
70
  });
29
71
 
30
- // Listen to the anvil output to get the port.
31
- const removeHandler = anvil.on('message', (message: string) => {
32
- if (port === undefined && message.includes('Listening on')) {
33
- port = parseInt(message.match(/Listening on ([^:]+):(\d+)/)![2]);
34
- }
72
+ // Wait for "Listening on" or an early exit.
73
+ await new Promise<void>((resolve, reject) => {
74
+ let stderr = '';
75
+
76
+ const onStdout = (data: Buffer) => {
77
+ const text = data.toString();
78
+ logger?.debug(text.trim());
79
+ methodCalls?.push(...(text.match(/eth_[^\s]+/g) || []));
80
+
81
+ if (detectedPort === undefined && text.includes('Listening on')) {
82
+ const match = text.match(/Listening on ([^:]+):(\d+)/);
83
+ if (match) {
84
+ detectedPort = parseInt(match[2]);
85
+ }
86
+ }
87
+ if (detectedPort !== undefined) {
88
+ child.stdout?.removeListener('data', onStdout);
89
+ child.stderr?.removeListener('data', onStderr);
90
+ child.removeListener('close', onClose);
91
+ resolve();
92
+ }
93
+ };
94
+
95
+ const onStderr = (data: Buffer) => {
96
+ stderr += data.toString();
97
+ logger?.debug(data.toString().trim());
98
+ };
99
+
100
+ const onClose = (code: number | null) => {
101
+ child.stdout?.removeListener('data', onStdout);
102
+ child.stderr?.removeListener('data', onStderr);
103
+ reject(new Error(`Anvil exited with code ${code} before listening. stderr: ${stderr}`));
104
+ };
105
+
106
+ child.stdout?.on('data', onStdout);
107
+ child.stderr?.on('data', onStderr);
108
+ child.once('close', onClose);
35
109
  });
36
- await anvil.start();
37
- removeHandler();
38
110
 
39
- return anvil;
111
+ // Continue piping for logging / method-call capture after startup.
112
+ if (logger || opts.captureMethodCalls) {
113
+ child.stdout?.on('data', (data: Buffer) => {
114
+ const text = data.toString();
115
+ logger?.debug(text.trim());
116
+ methodCalls?.push(...(text.match(/eth_[^\s]+/g) || []));
117
+ });
118
+ child.stderr?.on('data', (data: Buffer) => {
119
+ logger?.debug(data.toString().trim());
120
+ });
121
+ } else {
122
+ // Consume streams so the child process doesn't block on full pipe buffers.
123
+ child.stdout?.resume();
124
+ child.stderr?.resume();
125
+ }
126
+
127
+ return child;
40
128
  },
41
129
  'Start anvil',
42
130
  makeBackoff([5, 5, 5]),
43
131
  );
44
132
 
45
- if (!port) {
133
+ if (!detectedPort) {
46
134
  throw new Error('Failed to start anvil');
47
135
  }
48
136
 
49
- // 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}` };
137
+ const port = detectedPort;
138
+ let status: 'listening' | 'idle' = 'listening';
139
+
140
+ anvil.once('close', () => {
141
+ status = 'idle';
142
+ });
143
+
144
+ const stop = async () => {
145
+ if (status === 'idle') {
146
+ return;
147
+ }
148
+ await killChild(anvil);
149
+ };
150
+
151
+ const anvilObj: Anvil = {
152
+ port,
153
+ host: '127.0.0.1',
154
+ get status() {
155
+ return status;
156
+ },
157
+ stop,
158
+ };
159
+
160
+ return { anvil: anvilObj, methodCalls, stop, rpcUrl: `http://127.0.0.1:${port}` };
161
+ }
162
+
163
+ /** Send SIGTERM, wait up to 5 s, then SIGKILL. All timers are always cleared. */
164
+ function killChild(child: ChildProcess): Promise<void> {
165
+ return new Promise<void>(resolve => {
166
+ if (child.exitCode !== null || child.killed) {
167
+ child.stdout?.destroy();
168
+ child.stderr?.destroy();
169
+ resolve();
170
+ return;
171
+ }
172
+
173
+ let killTimer: NodeJS.Timeout | undefined;
174
+
175
+ const onClose = () => {
176
+ if (killTimer !== undefined) {
177
+ clearTimeout(killTimer);
178
+ }
179
+ // Destroy stdio streams so their PipeWrap handles don't keep the event loop alive.
180
+ child.stdout?.destroy();
181
+ child.stderr?.destroy();
182
+ resolve();
183
+ };
184
+
185
+ child.once('close', onClose);
186
+ child.kill('SIGTERM');
187
+
188
+ killTimer = setTimeout(() => {
189
+ killTimer = undefined;
190
+ child.kill('SIGKILL');
191
+ }, 5000);
192
+
193
+ // Ensure the timer does not prevent Node from exiting.
194
+ killTimer.unref();
195
+ });
52
196
  }
@@ -1,36 +1,37 @@
1
1
  import type { Logger } from '@aztec/foundation/log';
2
- import { TestERC20Abi as FeeJuiceAbi } from '@aztec/l1-artifacts';
2
+ import { DateProvider } from '@aztec/foundation/timer';
3
3
  import { GovernanceAbi } from '@aztec/l1-artifacts/GovernanceAbi';
4
+ import { TestERC20Abi as StakingAssetAbi } from '@aztec/l1-artifacts/TestERC20Abi';
4
5
 
5
6
  import { type GetContractReturnType, type PrivateKeyAccount, getContract } from 'viem';
6
7
 
7
- import { EthCheatCodes } from '../eth_cheat_codes.js';
8
+ import { extractProposalIdFromLogs } from '../contracts/governance.js';
8
9
  import type { L1ContractAddresses } from '../l1_contract_addresses.js';
9
- import type { L1Clients } from '../types.js';
10
+ import { createL1TxUtils } from '../l1_tx_utils/index.js';
11
+ import type { ExtendedViemWalletClient, ViemPublicClient } from '../types.js';
12
+ import { EthCheatCodes } from './eth_cheat_codes.js';
10
13
 
11
14
  export async function executeGovernanceProposal(
12
15
  proposalId: bigint,
13
- governance: GetContractReturnType<typeof GovernanceAbi, L1Clients['publicClient']>,
16
+ governance: GetContractReturnType<typeof GovernanceAbi, ViemPublicClient>,
14
17
  voteAmount: bigint,
15
18
  privateKey: PrivateKeyAccount,
16
- publicClient: L1Clients['publicClient'],
17
- walletClient: L1Clients['walletClient'],
19
+ l1Client: ExtendedViemWalletClient,
18
20
  rpcUrls: string[],
19
21
  logger: Logger,
20
22
  ) {
21
23
  const proposal = await governance.read.getProposal([proposalId]);
22
24
 
25
+ const l1TxUtils = createL1TxUtils(l1Client);
26
+
23
27
  const waitL1Block = async () => {
24
- await publicClient.waitForTransactionReceipt({
25
- hash: await walletClient.sendTransaction({
26
- to: privateKey.address,
27
- value: 1n,
28
- account: privateKey,
29
- }),
28
+ await l1TxUtils.sendAndMonitorTransaction({
29
+ to: l1Client.account.address,
30
+ value: 1n,
30
31
  });
31
32
  };
32
33
 
33
- const cheatCodes = new EthCheatCodes(rpcUrls, logger);
34
+ const cheatCodes = new EthCheatCodes(rpcUrls, new DateProvider(), logger);
34
35
 
35
36
  const timeToActive = proposal.creation + proposal.config.votingDelay;
36
37
  logger.info(`Warping to ${timeToActive + 1n}`);
@@ -40,7 +41,7 @@ export async function executeGovernanceProposal(
40
41
 
41
42
  logger.info(`Voting`);
42
43
  const voteTx = await governance.write.vote([proposalId, voteAmount, true], { account: privateKey });
43
- await publicClient.waitForTransactionReceipt({ hash: voteTx });
44
+ await l1Client.waitForTransactionReceipt({ hash: voteTx });
44
45
  logger.info(`Voted`);
45
46
 
46
47
  const timeToExecutable = timeToActive + proposal.config.votingDuration + proposal.config.executionDelay + 1n;
@@ -50,7 +51,7 @@ export async function executeGovernanceProposal(
50
51
  await waitL1Block();
51
52
 
52
53
  const executeTx = await governance.write.execute([proposalId], { account: privateKey });
53
- await publicClient.waitForTransactionReceipt({ hash: executeTx });
54
+ await l1Client.waitForTransactionReceipt({ hash: executeTx });
54
55
  logger.info(`Executed proposal`);
55
56
  }
56
57
 
@@ -58,12 +59,16 @@ export async function createGovernanceProposal(
58
59
  payloadAddress: `0x${string}`,
59
60
  addresses: L1ContractAddresses,
60
61
  privateKey: PrivateKeyAccount,
61
- publicClient: L1Clients['publicClient'],
62
+ publicClient: ViemPublicClient,
62
63
  logger: Logger,
63
- ): Promise<{ governance: GetContractReturnType<typeof GovernanceAbi, L1Clients['publicClient']>; voteAmount: bigint }> {
64
+ ): Promise<{
65
+ governance: GetContractReturnType<typeof GovernanceAbi, ViemPublicClient>;
66
+ voteAmount: bigint;
67
+ proposalId: bigint;
68
+ }> {
64
69
  const token = getContract({
65
- address: addresses.feeJuiceAddress.toString(),
66
- abi: FeeJuiceAbi,
70
+ address: addresses.stakingAssetAddress.toString(),
71
+ abi: StakingAssetAbi,
67
72
  client: publicClient,
68
73
  });
69
74
 
@@ -92,9 +97,13 @@ export async function createGovernanceProposal(
92
97
  await publicClient.waitForTransactionReceipt({ hash: depositTx });
93
98
  logger.info(`Deposited tokens`);
94
99
 
95
- await governance.write.proposeWithLock([payloadAddress, privateKey.address], {
100
+ const proposeTx = await governance.write.proposeWithLock([payloadAddress, privateKey.address], {
96
101
  account: privateKey,
97
102
  });
103
+ const receipt = await publicClient.waitForTransactionReceipt({ hash: proposeTx });
104
+ logger.info(`Proposed upgrade`);
105
+
106
+ const proposalId = extractProposalIdFromLogs(receipt.logs);
98
107
 
99
- return { governance, voteAmount };
108
+ return { governance, voteAmount, proposalId };
100
109
  }