@aztec/ethereum 0.0.0-test.0 → 0.0.1-commit.21caa21

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 (232) 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 +16 -2
  8. package/dest/config.d.ts +111 -17
  9. package/dest/config.d.ts.map +1 -1
  10. package/dest/config.js +462 -22
  11. package/dest/constants.d.ts +1 -1
  12. package/dest/contracts/empire_base.d.ts +24 -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 +66 -0
  16. package/dest/contracts/empire_slashing_proposer.d.ts.map +1 -0
  17. package/dest/contracts/empire_slashing_proposer.js +200 -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 +16 -13
  31. package/dest/contracts/governance_proposer.d.ts.map +1 -1
  32. package/dest/contracts/governance_proposer.js +37 -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 +204 -40
  49. package/dest/contracts/rollup.d.ts.map +1 -1
  50. package/dest/contracts/rollup.js +529 -79
  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 +139 -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_l1_contracts.d.ts +577 -21114
  61. package/dest/deploy_l1_contracts.d.ts.map +1 -1
  62. package/dest/deploy_l1_contracts.js +1225 -421
  63. package/dest/eth-signer/eth-signer.d.ts +21 -0
  64. package/dest/eth-signer/eth-signer.d.ts.map +1 -0
  65. package/dest/eth-signer/eth-signer.js +5 -0
  66. package/dest/eth-signer/index.d.ts +2 -0
  67. package/dest/eth-signer/index.d.ts.map +1 -0
  68. package/dest/eth-signer/index.js +1 -0
  69. package/dest/index.d.ts +7 -3
  70. package/dest/index.d.ts.map +1 -1
  71. package/dest/index.js +6 -2
  72. package/dest/l1_artifacts.d.ts +77344 -0
  73. package/dest/l1_artifacts.d.ts.map +1 -0
  74. package/dest/l1_artifacts.js +166 -0
  75. package/dest/l1_contract_addresses.d.ts +24 -4
  76. package/dest/l1_contract_addresses.d.ts.map +1 -1
  77. package/dest/l1_contract_addresses.js +22 -18
  78. package/dest/l1_reader.d.ts +2 -2
  79. package/dest/l1_reader.d.ts.map +1 -1
  80. package/dest/l1_reader.js +8 -8
  81. package/dest/l1_tx_utils/config.d.ts +59 -0
  82. package/dest/l1_tx_utils/config.d.ts.map +1 -0
  83. package/dest/l1_tx_utils/config.js +82 -0
  84. package/dest/l1_tx_utils/constants.d.ts +6 -0
  85. package/dest/l1_tx_utils/constants.d.ts.map +1 -0
  86. package/dest/l1_tx_utils/constants.js +14 -0
  87. package/dest/l1_tx_utils/factory.d.ts +24 -0
  88. package/dest/l1_tx_utils/factory.d.ts.map +1 -0
  89. package/dest/l1_tx_utils/factory.js +12 -0
  90. package/dest/l1_tx_utils/index.d.ts +10 -0
  91. package/dest/l1_tx_utils/index.d.ts.map +1 -0
  92. package/dest/l1_tx_utils/index.js +10 -0
  93. package/dest/l1_tx_utils/interfaces.d.ts +76 -0
  94. package/dest/l1_tx_utils/interfaces.d.ts.map +1 -0
  95. package/dest/l1_tx_utils/interfaces.js +4 -0
  96. package/dest/l1_tx_utils/l1_tx_utils.d.ts +94 -0
  97. package/dest/l1_tx_utils/l1_tx_utils.d.ts.map +1 -0
  98. package/dest/l1_tx_utils/l1_tx_utils.js +610 -0
  99. package/dest/l1_tx_utils/l1_tx_utils_with_blobs.d.ts +26 -0
  100. package/dest/l1_tx_utils/l1_tx_utils_with_blobs.d.ts.map +1 -0
  101. package/dest/l1_tx_utils/l1_tx_utils_with_blobs.js +26 -0
  102. package/dest/l1_tx_utils/readonly_l1_tx_utils.d.ts +94 -0
  103. package/dest/l1_tx_utils/readonly_l1_tx_utils.d.ts.map +1 -0
  104. package/dest/l1_tx_utils/readonly_l1_tx_utils.js +430 -0
  105. package/dest/l1_tx_utils/signer.d.ts +4 -0
  106. package/dest/l1_tx_utils/signer.d.ts.map +1 -0
  107. package/dest/l1_tx_utils/signer.js +16 -0
  108. package/dest/l1_tx_utils/types.d.ts +67 -0
  109. package/dest/l1_tx_utils/types.d.ts.map +1 -0
  110. package/dest/l1_tx_utils/types.js +26 -0
  111. package/dest/l1_tx_utils/utils.d.ts +4 -0
  112. package/dest/l1_tx_utils/utils.d.ts.map +1 -0
  113. package/dest/l1_tx_utils/utils.js +14 -0
  114. package/dest/l1_types.d.ts +6 -0
  115. package/dest/l1_types.d.ts.map +1 -0
  116. package/dest/l1_types.js +1 -0
  117. package/dest/publisher_manager.d.ts +15 -0
  118. package/dest/publisher_manager.d.ts.map +1 -0
  119. package/dest/publisher_manager.js +88 -0
  120. package/dest/queries.d.ts +4 -2
  121. package/dest/queries.d.ts.map +1 -1
  122. package/dest/queries.js +53 -12
  123. package/dest/test/chain_monitor.d.ts +73 -0
  124. package/dest/test/chain_monitor.d.ts.map +1 -0
  125. package/dest/test/chain_monitor.js +215 -0
  126. package/dest/test/delayed_tx_utils.d.ts +8 -3
  127. package/dest/test/delayed_tx_utils.d.ts.map +1 -1
  128. package/dest/test/delayed_tx_utils.js +13 -6
  129. package/dest/test/eth_cheat_codes.d.ts +217 -0
  130. package/dest/test/eth_cheat_codes.d.ts.map +1 -0
  131. package/dest/test/eth_cheat_codes.js +558 -0
  132. package/dest/test/eth_cheat_codes_with_state.d.ts +2 -2
  133. package/dest/test/eth_cheat_codes_with_state.d.ts.map +1 -1
  134. package/dest/test/eth_cheat_codes_with_state.js +1 -1
  135. package/dest/test/index.d.ts +4 -1
  136. package/dest/test/index.d.ts.map +1 -1
  137. package/dest/test/index.js +3 -0
  138. package/dest/test/rollup_cheat_codes.d.ts +87 -0
  139. package/dest/test/rollup_cheat_codes.d.ts.map +1 -0
  140. package/dest/test/rollup_cheat_codes.js +266 -0
  141. package/dest/test/start_anvil.d.ts +7 -1
  142. package/dest/test/start_anvil.d.ts.map +1 -1
  143. package/dest/test/start_anvil.js +16 -7
  144. package/dest/test/tx_delayer.d.ts +18 -7
  145. package/dest/test/tx_delayer.d.ts.map +1 -1
  146. package/dest/test/tx_delayer.js +95 -19
  147. package/dest/test/upgrade_utils.d.ts +6 -5
  148. package/dest/test/upgrade_utils.d.ts.map +1 -1
  149. package/dest/test/upgrade_utils.js +23 -16
  150. package/dest/types.d.ts +7 -8
  151. package/dest/types.d.ts.map +1 -1
  152. package/dest/types.js +3 -1
  153. package/dest/utils.d.ts +2 -1
  154. package/dest/utils.d.ts.map +1 -1
  155. package/dest/utils.js +43 -88
  156. package/dest/zkPassportVerifierAddress.d.ts +15 -0
  157. package/dest/zkPassportVerifierAddress.d.ts.map +1 -0
  158. package/dest/zkPassportVerifierAddress.js +11 -0
  159. package/package.json +28 -19
  160. package/src/account.ts +5 -0
  161. package/src/client.ts +42 -4
  162. package/src/config.ts +592 -31
  163. package/src/contracts/empire_base.ts +77 -7
  164. package/src/contracts/empire_slashing_proposer.ts +265 -0
  165. package/src/contracts/errors.ts +13 -0
  166. package/src/contracts/fee_asset_handler.ts +63 -0
  167. package/src/contracts/fee_juice.ts +29 -15
  168. package/src/contracts/governance.ts +80 -77
  169. package/src/contracts/governance_proposer.ts +66 -24
  170. package/src/contracts/gse.ts +88 -0
  171. package/src/contracts/inbox.ts +63 -0
  172. package/src/contracts/index.ts +8 -2
  173. package/src/contracts/multicall.ts +155 -0
  174. package/src/contracts/registry.ts +51 -26
  175. package/src/contracts/rollup.ts +596 -74
  176. package/src/contracts/slasher_contract.ts +89 -0
  177. package/src/contracts/tally_slashing_proposer.ts +316 -0
  178. package/src/contracts/utils.ts +14 -0
  179. package/src/deploy_l1_contracts.ts +1459 -538
  180. package/src/eth-signer/eth-signer.ts +25 -0
  181. package/src/eth-signer/index.ts +1 -0
  182. package/src/index.ts +6 -2
  183. package/src/l1_artifacts.ts +254 -0
  184. package/src/l1_contract_addresses.ts +32 -19
  185. package/src/l1_reader.ts +9 -9
  186. package/src/l1_tx_utils/README.md +177 -0
  187. package/src/l1_tx_utils/config.ts +143 -0
  188. package/src/l1_tx_utils/constants.ts +18 -0
  189. package/src/l1_tx_utils/factory.ts +64 -0
  190. package/src/l1_tx_utils/index.ts +12 -0
  191. package/src/l1_tx_utils/interfaces.ts +86 -0
  192. package/src/l1_tx_utils/l1_tx_utils.ts +718 -0
  193. package/src/l1_tx_utils/l1_tx_utils_with_blobs.ts +77 -0
  194. package/src/l1_tx_utils/readonly_l1_tx_utils.ts +558 -0
  195. package/src/l1_tx_utils/signer.ts +28 -0
  196. package/src/l1_tx_utils/types.ts +85 -0
  197. package/src/l1_tx_utils/utils.ts +16 -0
  198. package/src/l1_types.ts +6 -0
  199. package/src/publisher_manager.ts +106 -0
  200. package/src/queries.ts +73 -15
  201. package/src/test/chain_monitor.ts +243 -0
  202. package/src/test/delayed_tx_utils.ts +34 -6
  203. package/src/test/eth_cheat_codes.ts +588 -0
  204. package/src/test/eth_cheat_codes_with_state.ts +1 -1
  205. package/src/test/index.ts +3 -0
  206. package/src/test/rollup_cheat_codes.ts +307 -0
  207. package/src/test/start_anvil.ts +22 -5
  208. package/src/test/tx_delayer.ts +127 -26
  209. package/src/test/upgrade_utils.ts +30 -21
  210. package/src/types.ts +10 -8
  211. package/src/utils.ts +49 -90
  212. package/src/zkPassportVerifierAddress.ts +15 -0
  213. package/dest/contracts/forwarder.d.ts +0 -24
  214. package/dest/contracts/forwarder.d.ts.map +0 -1
  215. package/dest/contracts/forwarder.js +0 -101
  216. package/dest/contracts/slashing_proposer.d.ts +0 -21
  217. package/dest/contracts/slashing_proposer.d.ts.map +0 -1
  218. package/dest/contracts/slashing_proposer.js +0 -47
  219. package/dest/eth_cheat_codes.d.ts +0 -147
  220. package/dest/eth_cheat_codes.d.ts.map +0 -1
  221. package/dest/eth_cheat_codes.js +0 -303
  222. package/dest/l1_tx_utils.d.ts +0 -192
  223. package/dest/l1_tx_utils.d.ts.map +0 -1
  224. package/dest/l1_tx_utils.js +0 -641
  225. package/dest/l1_tx_utils_with_blobs.d.ts +0 -12
  226. package/dest/l1_tx_utils_with_blobs.d.ts.map +0 -1
  227. package/dest/l1_tx_utils_with_blobs.js +0 -64
  228. package/src/contracts/forwarder.ts +0 -132
  229. package/src/contracts/slashing_proposer.ts +0 -51
  230. package/src/eth_cheat_codes.ts +0 -314
  231. package/src/l1_tx_utils.ts +0 -847
  232. package/src/l1_tx_utils_with_blobs.ts +0 -86
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Common interface for all signer implementations
3
+ */
4
+ import type { Buffer32 } from '@aztec/foundation/buffer';
5
+ import type { EthAddress } from '@aztec/foundation/eth-address';
6
+ import type { Signature } from '@aztec/foundation/eth-signature';
7
+
8
+ import type { TransactionSerializable, TypedDataDefinition } from 'viem';
9
+
10
+ /**
11
+ * Abstraction for signing operations used by the node keystore.
12
+ */
13
+ export interface EthSigner {
14
+ /** The Ethereum address for this signer */
15
+ readonly address: EthAddress;
16
+
17
+ /** Sign a message using eth_sign (with Ethereum message prefix) */
18
+ signMessage(message: Buffer32): Promise<Signature>;
19
+
20
+ /** Sign typed data using EIP-712 */
21
+ signTypedData(typedData: TypedDataDefinition): Promise<Signature>;
22
+
23
+ /** Sign a transaction */
24
+ signTransaction(transaction: TransactionSerializable): Promise<Signature>;
25
+ }
@@ -0,0 +1 @@
1
+ export * from './eth-signer.js';
package/src/index.ts CHANGED
@@ -1,8 +1,7 @@
1
1
  export * from './constants.js';
2
2
  export * from './deploy_l1_contracts.js';
3
3
  export * from './chain.js';
4
- export * from './eth_cheat_codes.js';
5
- export * from './l1_tx_utils.js';
4
+ export * from './l1_tx_utils/index.js';
6
5
  export * from './l1_contract_addresses.js';
7
6
  export * from './l1_reader.js';
8
7
  export * from './utils.js';
@@ -11,3 +10,8 @@ export * from './types.js';
11
10
  export * from './contracts/index.js';
12
11
  export * from './queries.js';
13
12
  export * from './client.js';
13
+ export * from './account.js';
14
+ export * from './l1_types.js';
15
+ export * from './l1_artifacts.js';
16
+ export * from './publisher_manager.js';
17
+ export * from './eth-signer/index.js';
@@ -0,0 +1,254 @@
1
+ import {
2
+ CoinIssuerAbi,
3
+ CoinIssuerBytecode,
4
+ DateGatedRelayerAbi,
5
+ DateGatedRelayerBytecode,
6
+ EmpireSlasherDeploymentExtLibAbi,
7
+ EmpireSlasherDeploymentExtLibBytecode,
8
+ EmpireSlashingProposerAbi,
9
+ EmpireSlashingProposerBytecode,
10
+ FeeAssetHandlerAbi,
11
+ FeeAssetHandlerBytecode,
12
+ FeeJuicePortalAbi,
13
+ FeeJuicePortalBytecode,
14
+ GSEAbi,
15
+ GSEBytecode,
16
+ GovernanceAbi,
17
+ GovernanceBytecode,
18
+ GovernanceProposerAbi,
19
+ GovernanceProposerBytecode,
20
+ HonkVerifierAbi,
21
+ HonkVerifierBytecode,
22
+ InboxAbi,
23
+ InboxBytecode,
24
+ MockVerifierAbi,
25
+ MockVerifierBytecode,
26
+ MockZKPassportVerifierAbi,
27
+ MockZKPassportVerifierBytecode,
28
+ MultiAdderAbi,
29
+ MultiAdderBytecode,
30
+ OutboxAbi,
31
+ OutboxBytecode,
32
+ RegisterNewRollupVersionPayloadAbi,
33
+ RegisterNewRollupVersionPayloadBytecode,
34
+ RegistryAbi,
35
+ RegistryBytecode,
36
+ RewardDistributorAbi,
37
+ RewardDistributorBytecode,
38
+ RewardExtLibAbi,
39
+ RewardExtLibBytecode,
40
+ RollupAbi,
41
+ RollupBytecode,
42
+ RollupLinkReferences,
43
+ RollupOperationsExtLibAbi,
44
+ RollupOperationsExtLibBytecode,
45
+ SlashFactoryAbi,
46
+ SlashFactoryBytecode,
47
+ SlasherAbi,
48
+ SlasherBytecode,
49
+ StakingAssetHandlerAbi,
50
+ StakingAssetHandlerBytecode,
51
+ TallySlasherDeploymentExtLibAbi,
52
+ TallySlasherDeploymentExtLibBytecode,
53
+ TallySlashingProposerAbi,
54
+ TallySlashingProposerBytecode,
55
+ TestERC20Abi,
56
+ TestERC20Bytecode,
57
+ ValidatorOperationsExtLibAbi,
58
+ ValidatorOperationsExtLibBytecode,
59
+ ValidatorSelectionLibAbi,
60
+ ValidatorSelectionLibBytecode,
61
+ } from '@aztec/l1-artifacts';
62
+
63
+ import type { Hex } from 'viem';
64
+
65
+ export const RegistryArtifact = {
66
+ name: 'Registry',
67
+ contractAbi: RegistryAbi,
68
+ contractBytecode: RegistryBytecode as Hex,
69
+ };
70
+
71
+ export const InboxArtifact = {
72
+ name: 'Inbox',
73
+ contractAbi: InboxAbi,
74
+ contractBytecode: InboxBytecode as Hex,
75
+ };
76
+
77
+ export const OutboxArtifact = {
78
+ name: 'Outbox',
79
+ contractAbi: OutboxAbi,
80
+ contractBytecode: OutboxBytecode as Hex,
81
+ };
82
+
83
+ export const RollupArtifact = {
84
+ name: 'Rollup',
85
+ contractAbi: RollupAbi,
86
+ contractBytecode: RollupBytecode as Hex,
87
+ libraries: {
88
+ linkReferences: RollupLinkReferences,
89
+ libraryCode: {
90
+ ValidatorSelectionLib: {
91
+ name: 'ValidatorSelectionLib',
92
+ contractAbi: ValidatorSelectionLibAbi,
93
+ contractBytecode: ValidatorSelectionLibBytecode as Hex,
94
+ },
95
+ RollupOperationsExtLib: {
96
+ name: 'RollupOperationsExtLib',
97
+ contractAbi: RollupOperationsExtLibAbi,
98
+ contractBytecode: RollupOperationsExtLibBytecode as Hex,
99
+ },
100
+ ValidatorOperationsExtLib: {
101
+ name: 'ValidatorOperationsExtLib',
102
+ contractAbi: ValidatorOperationsExtLibAbi,
103
+ contractBytecode: ValidatorOperationsExtLibBytecode as Hex,
104
+ },
105
+ RewardExtLib: {
106
+ name: 'RewardExtLib',
107
+ contractAbi: RewardExtLibAbi,
108
+ contractBytecode: RewardExtLibBytecode as Hex,
109
+ },
110
+ TallySlasherDeploymentExtLib: {
111
+ name: 'TallySlasherDeploymentExtLib',
112
+ contractAbi: TallySlasherDeploymentExtLibAbi,
113
+ contractBytecode: TallySlasherDeploymentExtLibBytecode as Hex,
114
+ },
115
+ EmpireSlasherDeploymentExtLib: {
116
+ name: 'EmpireSlasherDeploymentExtLib',
117
+ contractAbi: EmpireSlasherDeploymentExtLibAbi,
118
+ contractBytecode: EmpireSlasherDeploymentExtLibBytecode as Hex,
119
+ },
120
+ },
121
+ },
122
+ };
123
+
124
+ export const StakingAssetArtifact = {
125
+ name: 'StakingAsset',
126
+ contractAbi: TestERC20Abi,
127
+ contractBytecode: TestERC20Bytecode as Hex,
128
+ };
129
+
130
+ export const FeeAssetArtifact = {
131
+ name: 'FeeAsset',
132
+ contractAbi: TestERC20Abi,
133
+ contractBytecode: TestERC20Bytecode as Hex,
134
+ };
135
+
136
+ export const FeeJuicePortalArtifact = {
137
+ name: 'FeeJuicePortal',
138
+ contractAbi: FeeJuicePortalAbi,
139
+ contractBytecode: FeeJuicePortalBytecode as Hex,
140
+ };
141
+
142
+ export const RewardDistributorArtifact = {
143
+ name: 'RewardDistributor',
144
+ contractAbi: RewardDistributorAbi,
145
+ contractBytecode: RewardDistributorBytecode as Hex,
146
+ };
147
+
148
+ export const CoinIssuerArtifact = {
149
+ name: 'CoinIssuer',
150
+ contractAbi: CoinIssuerAbi,
151
+ contractBytecode: CoinIssuerBytecode as Hex,
152
+ };
153
+
154
+ export const DateGatedRelayerArtifact = {
155
+ name: 'DateGatedRelayer',
156
+ contractAbi: DateGatedRelayerAbi,
157
+ contractBytecode: DateGatedRelayerBytecode as Hex,
158
+ };
159
+
160
+ export const GovernanceProposerArtifact = {
161
+ name: 'GovernanceProposer',
162
+ contractAbi: GovernanceProposerAbi,
163
+ contractBytecode: GovernanceProposerBytecode as Hex,
164
+ };
165
+
166
+ export const GovernanceArtifact = {
167
+ name: 'Governance',
168
+ contractAbi: GovernanceAbi,
169
+ contractBytecode: GovernanceBytecode as Hex,
170
+ };
171
+
172
+ export const SlasherArtifact = {
173
+ name: 'Slasher',
174
+ contractAbi: SlasherAbi,
175
+ contractBytecode: SlasherBytecode as Hex,
176
+ };
177
+
178
+ export const EmpireSlashingProposerArtifact = {
179
+ name: 'EmpireSlashingProposer',
180
+ contractAbi: EmpireSlashingProposerAbi,
181
+ contractBytecode: EmpireSlashingProposerBytecode as Hex,
182
+ };
183
+
184
+ export const TallySlashingProposerArtifact = {
185
+ name: 'TallySlashingProposer',
186
+ contractAbi: TallySlashingProposerAbi,
187
+ contractBytecode: TallySlashingProposerBytecode as Hex,
188
+ };
189
+
190
+ export const SlashFactoryArtifact = {
191
+ name: 'SlashFactory',
192
+ contractAbi: SlashFactoryAbi,
193
+ contractBytecode: SlashFactoryBytecode as Hex,
194
+ };
195
+
196
+ export const RegisterNewRollupVersionPayloadArtifact = {
197
+ name: 'RegisterNewRollupVersionPayload',
198
+ contractAbi: RegisterNewRollupVersionPayloadAbi,
199
+ contractBytecode: RegisterNewRollupVersionPayloadBytecode as Hex,
200
+ };
201
+
202
+ export const FeeAssetHandlerArtifact = {
203
+ name: 'FeeAssetHandler',
204
+ contractAbi: FeeAssetHandlerAbi,
205
+ contractBytecode: FeeAssetHandlerBytecode as Hex,
206
+ };
207
+
208
+ export const StakingAssetHandlerArtifact = {
209
+ name: 'StakingAssetHandler',
210
+ contractAbi: StakingAssetHandlerAbi,
211
+ contractBytecode: StakingAssetHandlerBytecode as Hex,
212
+ };
213
+
214
+ export const MultiAdderArtifact = {
215
+ name: 'MultiAdder',
216
+ contractAbi: MultiAdderAbi,
217
+ contractBytecode: MultiAdderBytecode as Hex,
218
+ };
219
+
220
+ export const GSEArtifact = {
221
+ name: 'GSE',
222
+ contractAbi: GSEAbi,
223
+ contractBytecode: GSEBytecode as Hex,
224
+ };
225
+
226
+ // Verifier artifacts
227
+ export const HonkVerifierArtifact = {
228
+ name: 'HonkVerifier',
229
+ contractAbi: HonkVerifierAbi,
230
+ contractBytecode: HonkVerifierBytecode as Hex,
231
+ };
232
+
233
+ export const MockVerifierArtifact = {
234
+ name: 'MockVerifier',
235
+ contractAbi: MockVerifierAbi,
236
+ contractBytecode: MockVerifierBytecode as Hex,
237
+ };
238
+
239
+ export const MockZkPassportVerifierArtifact = {
240
+ name: 'MockZkPassportVerifier',
241
+ contractAbi: MockZKPassportVerifierAbi,
242
+ contractBytecode: MockZKPassportVerifierBytecode as Hex,
243
+ };
244
+
245
+ // Re-export the verifier artifacts for backwards compatibility
246
+ export const l1ArtifactsVerifiers = {
247
+ honkVerifier: HonkVerifierArtifact,
248
+ };
249
+
250
+ // Re-export the mock verifiers for backwards compatibility
251
+ export const mockVerifiers = {
252
+ mockVerifier: MockVerifierArtifact,
253
+ mockZkPassportVerifier: MockZkPassportVerifierArtifact,
254
+ };
@@ -26,7 +26,14 @@ export const L1ContractsNames = [
26
26
  /** Provides the directory of current L1 contract addresses */
27
27
  export type L1ContractAddresses = {
28
28
  [K in (typeof L1ContractsNames)[number]]: EthAddress;
29
- } & { slashFactoryAddress?: EthAddress | undefined };
29
+ } & {
30
+ slashFactoryAddress?: EthAddress | undefined;
31
+ feeAssetHandlerAddress?: EthAddress | undefined;
32
+ stakingAssetHandlerAddress?: EthAddress | undefined;
33
+ zkPassportVerifierAddress?: EthAddress | undefined;
34
+ gseAddress?: EthAddress | undefined;
35
+ dateGatedRelayerAddress?: EthAddress | undefined;
36
+ };
30
37
 
31
38
  export const L1ContractAddressesSchema = z.object({
32
39
  rollupAddress: schemas.EthAddress,
@@ -41,69 +48,75 @@ export const L1ContractAddressesSchema = z.object({
41
48
  governanceProposerAddress: schemas.EthAddress,
42
49
  governanceAddress: schemas.EthAddress,
43
50
  slashFactoryAddress: schemas.EthAddress.optional(),
51
+ feeAssetHandlerAddress: schemas.EthAddress.optional(),
52
+ stakingAssetHandlerAddress: schemas.EthAddress.optional(),
53
+ zkPassportVerifierAddress: schemas.EthAddress.optional(),
54
+ gseAddress: schemas.EthAddress.optional(),
55
+ dateGatedRelayerAddress: schemas.EthAddress.optional(),
44
56
  }) satisfies ZodFor<L1ContractAddresses>;
45
57
 
46
58
  const parseEnv = (val: string) => EthAddress.fromString(val);
47
59
 
48
- export const l1ContractAddressesMapping: ConfigMappingsType<L1ContractAddresses> = {
49
- rollupAddress: {
50
- env: 'ROLLUP_CONTRACT_ADDRESS',
51
- description: 'The deployed L1 rollup contract address.',
52
- parseEnv,
53
- },
60
+ export const l1ContractAddressesMapping: ConfigMappingsType<
61
+ Omit<L1ContractAddresses, 'gseAddress' | 'zkPassportVerifierAddress' | 'dateGatedRelayerAddress'>
62
+ > = {
54
63
  registryAddress: {
55
64
  env: 'REGISTRY_CONTRACT_ADDRESS',
56
65
  description: 'The deployed L1 registry contract address.',
57
66
  parseEnv,
58
67
  },
68
+ slashFactoryAddress: {
69
+ env: 'SLASH_FACTORY_CONTRACT_ADDRESS',
70
+ description: 'The deployed L1 slashFactory contract address',
71
+ parseEnv,
72
+ },
73
+ feeAssetHandlerAddress: {
74
+ env: 'FEE_ASSET_HANDLER_CONTRACT_ADDRESS',
75
+ description: 'The deployed L1 feeAssetHandler contract address',
76
+ parseEnv,
77
+ },
78
+ rollupAddress: {
79
+ description: 'The deployed L1 rollup contract address.',
80
+ parseEnv,
81
+ },
59
82
  inboxAddress: {
60
- env: 'INBOX_CONTRACT_ADDRESS',
61
83
  description: 'The deployed L1 inbox contract address.',
62
84
  parseEnv,
63
85
  },
64
86
  outboxAddress: {
65
- env: 'OUTBOX_CONTRACT_ADDRESS',
66
87
  description: 'The deployed L1 outbox contract address.',
67
88
  parseEnv,
68
89
  },
69
90
  feeJuiceAddress: {
70
- env: 'FEE_JUICE_CONTRACT_ADDRESS',
71
91
  description: 'The deployed L1 Fee Juice contract address.',
72
92
  parseEnv,
73
93
  },
74
94
  stakingAssetAddress: {
75
- env: 'STAKING_ASSET_CONTRACT_ADDRESS',
76
95
  description: 'The deployed L1 staking asset contract address.',
77
96
  parseEnv,
78
97
  },
79
98
  feeJuicePortalAddress: {
80
- env: 'FEE_JUICE_PORTAL_CONTRACT_ADDRESS',
81
99
  description: 'The deployed L1 Fee Juice portal contract address.',
82
100
  parseEnv,
83
101
  },
84
102
  coinIssuerAddress: {
85
- env: 'COIN_ISSUER_CONTRACT_ADDRESS',
86
103
  description: 'The deployed L1 coinIssuer contract address',
87
104
  parseEnv,
88
105
  },
89
106
  rewardDistributorAddress: {
90
- env: 'REWARD_DISTRIBUTOR_CONTRACT_ADDRESS',
91
107
  description: 'The deployed L1 rewardDistributor contract address',
92
108
  parseEnv,
93
109
  },
94
110
  governanceProposerAddress: {
95
- env: 'GOVERNANCE_PROPOSER_CONTRACT_ADDRESS',
96
111
  description: 'The deployed L1 governanceProposer contract address',
97
112
  parseEnv,
98
113
  },
99
114
  governanceAddress: {
100
- env: 'GOVERNANCE_CONTRACT_ADDRESS',
101
115
  description: 'The deployed L1 governance contract address',
102
116
  parseEnv,
103
117
  },
104
- slashFactoryAddress: {
105
- env: 'SLASH_FACTORY_CONTRACT_ADDRESS',
106
- description: 'The deployed L1 slashFactory contract address',
118
+ stakingAssetHandlerAddress: {
119
+ description: 'The deployed L1 stakingAssetHandler contract address',
107
120
  parseEnv,
108
121
  },
109
122
  };
package/src/l1_reader.ts CHANGED
@@ -4,7 +4,7 @@ import { type L1ContractAddresses, l1ContractAddressesMapping } from './l1_contr
4
4
 
5
5
  /** Configuration of the L1GlobalReader. */
6
6
  export interface L1ReaderConfig {
7
- /** The RPC Url of the ethereum host. */
7
+ /** List of URLs of Ethereum RPC nodes that services will connect to (comma separated). */
8
8
  l1RpcUrls: string[];
9
9
  /** The chain ID of the ethereum host. */
10
10
  l1ChainId: number;
@@ -15,20 +15,20 @@ export interface L1ReaderConfig {
15
15
  }
16
16
 
17
17
  export const l1ReaderConfigMappings: ConfigMappingsType<L1ReaderConfig> = {
18
- l1RpcUrls: {
19
- env: 'ETHEREUM_HOSTS',
20
- description: 'The RPC Url of the ethereum host.',
21
- parseEnv: (val: string) => val.split(',').map(url => url.trim()),
18
+ l1Contracts: {
19
+ description: 'The deployed L1 contract addresses',
20
+ nested: l1ContractAddressesMapping,
22
21
  },
23
22
  l1ChainId: {
24
23
  env: 'L1_CHAIN_ID',
25
24
  parseEnv: (val: string) => +val,
26
- defaultValue: 31337,
27
25
  description: 'The chain ID of the ethereum host.',
28
26
  },
29
- l1Contracts: {
30
- description: 'The deployed L1 contract addresses',
31
- nested: l1ContractAddressesMapping,
27
+ l1RpcUrls: {
28
+ env: 'ETHEREUM_HOSTS',
29
+ description: 'List of URLs of Ethereum RPC nodes that services will connect to (comma separated).',
30
+ parseEnv: (val: string) => val.split(',').map(url => url.trim()),
31
+ defaultValue: [],
32
32
  },
33
33
  viemPollingIntervalMS: {
34
34
  env: 'L1_READER_VIEM_POLLING_INTERVAL_MS',
@@ -0,0 +1,177 @@
1
+ # L1 Transaction Utils
2
+
3
+ This module handles sending L1 txs, including simulating txs, choosing gas prices, estimating gas limits, monitoring sent txs, speeding them up, and cancelling them. Each instance of `L1TxUtils` is stateful, corresponds to a given **publisher** EOA, and tracks its in-flight txs.
4
+
5
+ ## Usage context
6
+
7
+ Aside from bootstrapping (such as deploying L1 contracts), the Aztec node sends txs to L1 for the following purposes:
8
+
9
+ ### Sequencing
10
+
11
+ As a sequencer (ie block proposer), the node sends blob txs proposing new L2 blocks. These txs may be part of a multicall where the proposer also votes for a proposal, slashes other validators, or invalidates a block. If block building fails, the sequencer may send a multicall without a block (and hence without blobs). These actions have a specific set of L1 blocks in which they may land (ie an L2 slot, which lasts 2-6 L1 slots), after which they "expire" and revert if mined. On each L2 slot, at most one L1 tx is in-flight.
12
+
13
+ A given block proposer is chosen at random. While chances are low, it could be the case that the same proposer is chosen for two L2 slots in a row.
14
+
15
+ There is an edge case in which block building fails at the beginning of the slot (for instance, if there are not enough L2 txs to build the block), which means only a vote or a slash is sent to L1, but then the block does get built, and is submitted in a separate L1 tx.
16
+
17
+ ### Proving
18
+
19
+ As a prover, the node sends a tx with a validity proof for an epoch. These txs also have an expiration window, after which they revert if they'd land. No blobs are used. The cost is 1M-4M gas, and these txs are sent at most once per epoch, which is about 96-384 L1 slots.
20
+
21
+ Provers typically try proving all epochs. Today the proof submission window is set to one epoch, meaning that each epoch must be proven during the next, so there is no overlap. If this window were to be extended, then we could have multiple L1 proving txs in flight, which must land in order.
22
+
23
+ ## Properties
24
+
25
+ From the usage context above, we know that:
26
+
27
+ - Each publisher EOA has typically only one in-flight tx at a time.
28
+ - Every tx has an expiration time after which they'd revert if mined.
29
+
30
+ ## State transitions
31
+
32
+ We keep all our **publishers** split by scope, where the scope may be _proving_ or _sequencing_. If sequencing, publishers are also scoped by validator address, so a node that runs multiple validators may use different publisher accounts for each validator, to avoid publicly linking them. Note that a publisher may belong to more than one scope.
33
+
34
+ Each publisher account is in one of the following states, which is reflected from the state of the tx with the highest nonce it has sent:
35
+
36
+ - `idle`: Ready to send a tx
37
+ - `sent`: A tx has been sent and we are awaiting for it to be mined
38
+ - `speed-up`: The tx has been replaced with the same tx but higher gas price
39
+ - `cancelled`: The tx has expired so it has been replaced with a noop tx
40
+ - `not-mined`: The tx has expired or was dropped and we are no longer monitoring it
41
+ - `mined`: The tx or one of its replacements (ie a tx with the same nonce) has been mined
42
+
43
+ With the following state transitions:
44
+
45
+ | From | To | Condition | Effect |
46
+ |-|-|-|-|
47
+ | `idle` | `sent` | `send_tx` | A new tx is sent and nonce is consumed |
48
+ | `sent` | `speed-up`| `time_since_last_sent > stall_time && retry_attempts < max_retries` | The requested tx is replaced with an equivalent but higher gas price |
49
+ | `sent`, `speed-up` | `not-mined` | `current_time > tx_timeout && !cancel_on_timeout` | The tx times out, nonce manager is reset |
50
+ | `sent`, `speed-up` | `cancelled` | `current_time > tx_timeout && cancel_on_timeout` | The tx times out and we replace it with a noop |
51
+ | `sent`, `speed-up`, `cancelled` | `mined` | `get_nonce(latest) > tx_nonce` | The tx or a replacement is mined |
52
+ | `cancelled` | `not-mined` | `current_time > cancel_tx_timeout` | Cancellation times out, nonce manager is reset |
53
+ | `cancelled` | `not-mined` | `nonce no longer in mempool && time_passed > unseen_considered_dropped` | Cancel tx dropped from mempool, nonce manager is reset |
54
+
55
+ Note that we do not transition back to `idle`.
56
+
57
+ ## Nonce Management
58
+
59
+ The `L1TxUtils` class uses a `NonceManager` from viem to track and manage nonces for the publisher account:
60
+
61
+ - **Nonce consumption**: When sending a new transaction, the nonce is consumed from the nonce manager, which increments the internal counter.
62
+ - **Nonce reset**: The nonce manager is reset in the following scenarios:
63
+ - When a regular tx times out without being cancelled (`NOT_MINED` state)
64
+ - When a cancellation tx is dropped from the mempool
65
+ - When a cancellation tx itself times out
66
+ - When we decide not to send a cancellation due to interruption or the original tx being dropped
67
+
68
+ The reset allows the next transaction to reuse the nonce if the current tx is no longer in the mempool by the time this next transaction is sent.
69
+
70
+ ## Time checks
71
+
72
+ All time checks for speed ups and time outs are based on L1 time, not local time. When se send a tx, we assign the `sent_at` time to the time of the most recent L1 block. Using L1 time means that speed ups and time outs can be expressed in terms of L1 slots. It also means that we will wait for a new L1 block to be mined and check if our tx is present in that block before computing time outs or speed ups.
73
+
74
+ An edge case here is that, if an L1 slot is missed (ie there is no L1 block for that slot), we won't update time outs during that 12s period. Given how infrequent these are, we are fine with this tradeoff.
75
+
76
+ ## Pseudocode
77
+
78
+ ```python
79
+ def send_and_monitor_tx(tx_request):
80
+ # Always consume a fresh nonce from the nonce manager
81
+ nonce = nonce_manager.consume()
82
+
83
+ # Build and send the transaction
84
+ tx = make_tx(tx_request, nonce)
85
+ state = create_state(tx, status='sent')
86
+ txs.push(state)
87
+ l1.send_tx(tx)
88
+
89
+ # State transitions differ based on whether this is a cancel tx
90
+ is_cancel_tx = state.cancelTxHashes.length > 0
91
+
92
+ # Monitor loop
93
+ loop:
94
+ # Check if interrupted
95
+ if interrupted:
96
+ break
97
+
98
+ # Check if the tx was mined
99
+ current_nonce = l1.get_nonce(latest)
100
+ if current_nonce > nonce:
101
+ # Try to find the receipt from all tx attempts
102
+ for tx in state.txHashes + state.cancelTxHashes:
103
+ if receipt = l1.get_tx_receipt(tx):
104
+ state.status = 'mined'
105
+ return receipt
106
+ # Unknown tx was mined with our nonce
107
+ state.status = 'mined'
108
+ raise unknown_mined_tx_error
109
+
110
+ # Check if cancel tx dropped from mempool (only for cancellations)
111
+ pending_nonce = l1.get_nonce(pending)
112
+ if is_cancel_tx and pending_nonce < nonce and time_passed > unseen_considered_dropped:
113
+ state.status = 'idle'
114
+ nonce_manager.reset()
115
+ raise dropped_transaction_error
116
+
117
+ # Check if tx has timed out
118
+ if is_timed_out(state, l1_timestamp):
119
+ if is_cancel_tx or !cancel_on_timeout:
120
+ # Either already a cancel tx or configured not to cancel
121
+ state.status = 'not-mined'
122
+ nonce_manager.reset()
123
+ raise timeout_error
124
+ else:
125
+ # Send cancellation in background
126
+ run_in_background attempt_tx_cancellation(state)
127
+ raise timeout_error
128
+
129
+ # Speed up if stalled and have retries left
130
+ if time_since_last_sent > stall_time and attempts < max_attempts:
131
+ replacement_tx = make_tx(tx_request, nonce, bump_gas_price(state.gasPrice))
132
+ state.status = is_cancel_tx ? 'cancelled' : 'speed-up'
133
+ state.tx_hashes.push(send_tx(replacement_tx))
134
+ state.last_sent_at = now
135
+ continue
136
+
137
+ sleep(check_interval)
138
+
139
+ def attempt_tx_cancellation(state):
140
+ # Check if original tx still in mempool
141
+ if l1.get_nonce(pending) < state.nonce:
142
+ state.status = 'not-mined'
143
+ nonce_manager.reset()
144
+ return
145
+
146
+ # Send noop tx with same nonce but higher gas
147
+ cancel_tx = make_noop_tx(state.nonce, bump_gas_price(state.gasPrice))
148
+ state.cancelTxHashes.push(send_tx(cancel_tx))
149
+ state.status = 'cancelled'
150
+
151
+ # Monitor the cancellation in background
152
+ run_in_background monitor_transaction(state)
153
+ ```
154
+
155
+ ## Publisher selection
156
+
157
+ When sending a tx for a given scope, we choose from all publishers for the scope in the following order:
158
+
159
+ - `idle`: The publisher is ready to be used and has not sent any txs recently.
160
+ - `mined`: The publisher has mined a tx and is ready for a new one.
161
+ - `speed-up`, `sent`: There is a tx in-flight, new one will be enqueued after (not eligible unless `publisherAllowInvalidStates` is set).
162
+ - `cancelled`: There is a tx in-flight caused by a time-out mining the previous one, new tx will be enqueued after (not eligible unless `publisherAllowInvalidStates` is set).
163
+ - `not-mined`: The previous tx timed out or was dropped, new tx will reuse the same nonce if previous one is no longer in the mempool, or pick the next otherwise (not eligible unless `publisherAllowInvalidStates` is enabled).
164
+
165
+ If there is more than one publisher in the same state to choose from, we prefer choosing based on:
166
+ 1. Highest balance first
167
+ 2. Least recently used (based on `lastMinedAtBlockNumber`)
168
+
169
+ Available publishers should be filtered by balance, ensuring that the given EOA has enough funds to send the tx, and possibly replace it with a larger gas price. If we detect a publisher account has not enough gas, we should warn (bonus points if we warn before running out).
170
+
171
+ Note that selection is not handled by the `L1TxUtils` class but by the `PublisherManager`.
172
+
173
+ ## API
174
+
175
+ - `sendTransaction`: Sends an L1 tx and returns the tx hash. Returns when the tx has been sent. Consumes a nonce from the nonce manager.
176
+ - `monitorTransaction`: Monitors a sent tx and speeds up or cancels it. Returns when mined or timed out. May reset the nonce manager on timeout.
177
+ - `sendAndMonitorTransaction`: Combines sending and monitoring in a single call.