@lodestar/beacon-node 1.50.0-dev.c04a499311 → 1.50.0-dev.c24762bc60

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 (228) hide show
  1. package/lib/api/impl/beacon/index.d.ts.map +1 -1
  2. package/lib/api/impl/beacon/index.js +13 -0
  3. package/lib/api/impl/beacon/index.js.map +1 -1
  4. package/lib/api/impl/beacon/state/index.d.ts.map +1 -1
  5. package/lib/api/impl/beacon/state/index.js +28 -6
  6. package/lib/api/impl/beacon/state/index.js.map +1 -1
  7. package/lib/api/impl/debug/index.d.ts.map +1 -1
  8. package/lib/api/impl/debug/index.js +26 -18
  9. package/lib/api/impl/debug/index.js.map +1 -1
  10. package/lib/api/impl/validator/index.d.ts.map +1 -1
  11. package/lib/api/impl/validator/index.js +32 -0
  12. package/lib/api/impl/validator/index.js.map +1 -1
  13. package/lib/chain/archiveStore/archiveStore.d.ts +5 -0
  14. package/lib/chain/archiveStore/archiveStore.d.ts.map +1 -1
  15. package/lib/chain/archiveStore/archiveStore.js +13 -23
  16. package/lib/chain/archiveStore/archiveStore.js.map +1 -1
  17. package/lib/chain/archiveStore/utils/pruneHistory.d.ts +1 -1
  18. package/lib/chain/archiveStore/utils/pruneHistory.d.ts.map +1 -1
  19. package/lib/chain/archiveStore/utils/pruneHistory.js +2 -1
  20. package/lib/chain/archiveStore/utils/pruneHistory.js.map +1 -1
  21. package/lib/chain/beaconProposerCache.d.ts +6 -0
  22. package/lib/chain/beaconProposerCache.d.ts.map +1 -1
  23. package/lib/chain/beaconProposerCache.js +16 -0
  24. package/lib/chain/beaconProposerCache.js.map +1 -1
  25. package/lib/chain/blocks/importBlock.d.ts.map +1 -1
  26. package/lib/chain/blocks/importBlock.js +14 -8
  27. package/lib/chain/blocks/importBlock.js.map +1 -1
  28. package/lib/chain/blocks/verifyBlock.d.ts.map +1 -1
  29. package/lib/chain/blocks/verifyBlock.js +6 -6
  30. package/lib/chain/blocks/verifyBlock.js.map +1 -1
  31. package/lib/chain/chain.d.ts +5 -1
  32. package/lib/chain/chain.d.ts.map +1 -1
  33. package/lib/chain/chain.js +73 -20
  34. package/lib/chain/chain.js.map +1 -1
  35. package/lib/chain/interface.d.ts +3 -0
  36. package/lib/chain/interface.d.ts.map +1 -1
  37. package/lib/chain/opPools/aggregatedAttestationPool.d.ts +4 -2
  38. package/lib/chain/opPools/aggregatedAttestationPool.d.ts.map +1 -1
  39. package/lib/chain/opPools/aggregatedAttestationPool.js +30 -8
  40. package/lib/chain/opPools/aggregatedAttestationPool.js.map +1 -1
  41. package/lib/chain/opPools/opPool.d.ts.map +1 -1
  42. package/lib/chain/opPools/opPool.js +1 -23
  43. package/lib/chain/opPools/opPool.js.map +1 -1
  44. package/lib/chain/opPools/proposerPreferencesPool.d.ts +8 -4
  45. package/lib/chain/opPools/proposerPreferencesPool.d.ts.map +1 -1
  46. package/lib/chain/opPools/proposerPreferencesPool.js +27 -12
  47. package/lib/chain/opPools/proposerPreferencesPool.js.map +1 -1
  48. package/lib/chain/opPools/utils.d.ts +11 -0
  49. package/lib/chain/opPools/utils.d.ts.map +1 -1
  50. package/lib/chain/opPools/utils.js +22 -0
  51. package/lib/chain/opPools/utils.js.map +1 -1
  52. package/lib/chain/options.d.ts +1 -0
  53. package/lib/chain/options.d.ts.map +1 -1
  54. package/lib/chain/prepareNextSlot.d.ts.map +1 -1
  55. package/lib/chain/prepareNextSlot.js +11 -3
  56. package/lib/chain/prepareNextSlot.js.map +1 -1
  57. package/lib/chain/produceBlock/produceBlockBody.d.ts +8 -0
  58. package/lib/chain/produceBlock/produceBlockBody.d.ts.map +1 -1
  59. package/lib/chain/produceBlock/produceBlockBody.js +40 -28
  60. package/lib/chain/produceBlock/produceBlockBody.js.map +1 -1
  61. package/lib/chain/seenCache/seenGossipBlockInput.d.ts +7 -0
  62. package/lib/chain/seenCache/seenGossipBlockInput.d.ts.map +1 -1
  63. package/lib/chain/seenCache/seenGossipBlockInput.js +21 -0
  64. package/lib/chain/seenCache/seenGossipBlockInput.js.map +1 -1
  65. package/lib/chain/shufflingCache.d.ts +18 -8
  66. package/lib/chain/shufflingCache.d.ts.map +1 -1
  67. package/lib/chain/shufflingCache.js +72 -18
  68. package/lib/chain/shufflingCache.js.map +1 -1
  69. package/lib/db/beacon.d.ts +4 -1
  70. package/lib/db/beacon.d.ts.map +1 -1
  71. package/lib/db/beacon.js +6 -1
  72. package/lib/db/beacon.js.map +1 -1
  73. package/lib/db/buckets.d.ts +3 -1
  74. package/lib/db/buckets.d.ts.map +1 -1
  75. package/lib/db/buckets.js +2 -0
  76. package/lib/db/buckets.js.map +1 -1
  77. package/lib/db/interface.d.ts +4 -1
  78. package/lib/db/interface.d.ts.map +1 -1
  79. package/lib/db/repositories/blockArchiveIndex.d.ts +2 -2
  80. package/lib/db/repositories/blockArchiveIndex.d.ts.map +1 -1
  81. package/lib/db/repositories/earliestAvailableSlot.d.ts +11 -0
  82. package/lib/db/repositories/earliestAvailableSlot.d.ts.map +1 -0
  83. package/lib/db/repositories/earliestAvailableSlot.js +19 -0
  84. package/lib/db/repositories/earliestAvailableSlot.js.map +1 -0
  85. package/lib/db/repositories/index.d.ts +1 -0
  86. package/lib/db/repositories/index.d.ts.map +1 -1
  87. package/lib/db/repositories/index.js +1 -0
  88. package/lib/db/repositories/index.js.map +1 -1
  89. package/lib/db/repositories/proposerPreferences.d.ts +14 -0
  90. package/lib/db/repositories/proposerPreferences.d.ts.map +1 -0
  91. package/lib/db/repositories/proposerPreferences.js +21 -0
  92. package/lib/db/repositories/proposerPreferences.js.map +1 -0
  93. package/lib/execution/engine/blobVersionedHashes.d.ts +9 -0
  94. package/lib/execution/engine/blobVersionedHashes.d.ts.map +1 -0
  95. package/lib/execution/engine/blobVersionedHashes.js +74 -0
  96. package/lib/execution/engine/blobVersionedHashes.js.map +1 -0
  97. package/lib/execution/engine/http.d.ts +45 -13
  98. package/lib/execution/engine/http.d.ts.map +1 -1
  99. package/lib/execution/engine/http.js +236 -198
  100. package/lib/execution/engine/http.js.map +1 -1
  101. package/lib/execution/engine/index.d.ts +3 -2
  102. package/lib/execution/engine/index.d.ts.map +1 -1
  103. package/lib/execution/engine/index.js +33 -8
  104. package/lib/execution/engine/index.js.map +1 -1
  105. package/lib/execution/engine/interface.d.ts +1 -1
  106. package/lib/execution/engine/interface.d.ts.map +1 -1
  107. package/lib/execution/engine/jsonRpcTransport.d.ts +25 -0
  108. package/lib/execution/engine/jsonRpcTransport.d.ts.map +1 -0
  109. package/lib/execution/engine/jsonRpcTransport.js +158 -0
  110. package/lib/execution/engine/jsonRpcTransport.js.map +1 -0
  111. package/lib/execution/engine/restHttpClient.d.ts +71 -0
  112. package/lib/execution/engine/restHttpClient.d.ts.map +1 -0
  113. package/lib/execution/engine/restHttpClient.js +201 -0
  114. package/lib/execution/engine/restHttpClient.js.map +1 -0
  115. package/lib/execution/engine/restTransport.d.ts +46 -0
  116. package/lib/execution/engine/restTransport.d.ts.map +1 -0
  117. package/lib/execution/engine/restTransport.js +399 -0
  118. package/lib/execution/engine/restTransport.js.map +1 -0
  119. package/lib/execution/engine/sszTypes.d.ts +1261 -0
  120. package/lib/execution/engine/sszTypes.d.ts.map +1 -0
  121. package/lib/execution/engine/sszTypes.js +216 -0
  122. package/lib/execution/engine/sszTypes.js.map +1 -0
  123. package/lib/execution/engine/transport.d.ts +39 -0
  124. package/lib/execution/engine/transport.d.ts.map +1 -0
  125. package/lib/execution/engine/transport.js +2 -0
  126. package/lib/execution/engine/transport.js.map +1 -0
  127. package/lib/execution/engine/types.d.ts +2 -0
  128. package/lib/execution/engine/types.d.ts.map +1 -1
  129. package/lib/execution/engine/types.js +24 -57
  130. package/lib/execution/engine/types.js.map +1 -1
  131. package/lib/execution/engine/utils.d.ts.map +1 -1
  132. package/lib/execution/engine/utils.js +9 -2
  133. package/lib/execution/engine/utils.js.map +1 -1
  134. package/lib/metrics/metrics/lodestar.d.ts +10 -0
  135. package/lib/metrics/metrics/lodestar.d.ts.map +1 -1
  136. package/lib/metrics/metrics/lodestar.js +22 -0
  137. package/lib/metrics/metrics/lodestar.js.map +1 -1
  138. package/lib/network/core/events.d.ts +5 -1
  139. package/lib/network/core/events.d.ts.map +1 -1
  140. package/lib/network/core/events.js +8 -0
  141. package/lib/network/core/events.js.map +1 -1
  142. package/lib/network/processor/gossipHandlers.d.ts.map +1 -1
  143. package/lib/network/processor/gossipHandlers.js +60 -64
  144. package/lib/network/processor/gossipHandlers.js.map +1 -1
  145. package/lib/node/nodejs.d.ts +3 -1
  146. package/lib/node/nodejs.d.ts.map +1 -1
  147. package/lib/node/nodejs.js +2 -1
  148. package/lib/node/nodejs.js.map +1 -1
  149. package/lib/node/options.d.ts +3 -2
  150. package/lib/node/options.d.ts.map +1 -1
  151. package/lib/node/options.js +2 -2
  152. package/lib/node/options.js.map +1 -1
  153. package/lib/sync/range/batch.d.ts +5 -5
  154. package/lib/sync/range/batch.d.ts.map +1 -1
  155. package/lib/sync/range/batch.js +11 -17
  156. package/lib/sync/range/batch.js.map +1 -1
  157. package/lib/sync/range/chain.d.ts +4 -4
  158. package/lib/sync/range/chain.d.ts.map +1 -1
  159. package/lib/sync/range/chain.js +9 -5
  160. package/lib/sync/range/chain.js.map +1 -1
  161. package/lib/sync/range/range.d.ts.map +1 -1
  162. package/lib/sync/range/range.js +25 -11
  163. package/lib/sync/range/range.js.map +1 -1
  164. package/lib/sync/unknownBlock.d.ts +5 -2
  165. package/lib/sync/unknownBlock.d.ts.map +1 -1
  166. package/lib/sync/unknownBlock.js +44 -20
  167. package/lib/sync/unknownBlock.js.map +1 -1
  168. package/lib/sync/utils/downloadByRange.d.ts +38 -14
  169. package/lib/sync/utils/downloadByRange.d.ts.map +1 -1
  170. package/lib/sync/utils/downloadByRange.js +84 -39
  171. package/lib/sync/utils/downloadByRange.js.map +1 -1
  172. package/lib/util/asyncIterableToEvents.d.ts +10 -2
  173. package/lib/util/asyncIterableToEvents.d.ts.map +1 -1
  174. package/lib/util/asyncIterableToEvents.js +29 -3
  175. package/lib/util/asyncIterableToEvents.js.map +1 -1
  176. package/lib/util/metadata.d.ts.map +1 -1
  177. package/lib/util/metadata.js +2 -1
  178. package/lib/util/metadata.js.map +1 -1
  179. package/package.json +17 -16
  180. package/src/api/impl/beacon/index.ts +15 -0
  181. package/src/api/impl/beacon/state/index.ts +43 -6
  182. package/src/api/impl/debug/index.ts +28 -19
  183. package/src/api/impl/validator/index.ts +45 -0
  184. package/src/chain/archiveStore/archiveStore.ts +18 -24
  185. package/src/chain/archiveStore/utils/pruneHistory.ts +4 -1
  186. package/src/chain/beaconProposerCache.ts +19 -1
  187. package/src/chain/blocks/importBlock.ts +17 -7
  188. package/src/chain/blocks/verifyBlock.ts +7 -6
  189. package/src/chain/chain.ts +97 -19
  190. package/src/chain/interface.ts +3 -0
  191. package/src/chain/opPools/aggregatedAttestationPool.ts +34 -10
  192. package/src/chain/opPools/opPool.ts +1 -31
  193. package/src/chain/opPools/proposerPreferencesPool.ts +34 -11
  194. package/src/chain/opPools/utils.ts +31 -0
  195. package/src/chain/options.ts +1 -1
  196. package/src/chain/prepareNextSlot.ts +15 -3
  197. package/src/chain/produceBlock/produceBlockBody.ts +68 -34
  198. package/src/chain/seenCache/seenGossipBlockInput.ts +23 -0
  199. package/src/chain/shufflingCache.ts +84 -22
  200. package/src/db/beacon.ts +6 -0
  201. package/src/db/buckets.ts +2 -0
  202. package/src/db/interface.ts +4 -0
  203. package/src/db/repositories/earliestAvailableSlot.ts +19 -0
  204. package/src/db/repositories/index.ts +1 -0
  205. package/src/db/repositories/proposerPreferences.ts +23 -0
  206. package/src/execution/engine/blobVersionedHashes.ts +72 -0
  207. package/src/execution/engine/http.ts +304 -271
  208. package/src/execution/engine/index.ts +41 -7
  209. package/src/execution/engine/interface.ts +1 -1
  210. package/src/execution/engine/jsonRpcTransport.ts +247 -0
  211. package/src/execution/engine/restHttpClient.ts +269 -0
  212. package/src/execution/engine/restTransport.ts +544 -0
  213. package/src/execution/engine/sszTypes.ts +354 -0
  214. package/src/execution/engine/transport.ts +61 -0
  215. package/src/execution/engine/types.ts +34 -74
  216. package/src/execution/engine/utils.ts +12 -2
  217. package/src/metrics/metrics/lodestar.ts +23 -0
  218. package/src/network/core/events.ts +16 -1
  219. package/src/network/processor/gossipHandlers.ts +91 -77
  220. package/src/node/nodejs.ts +4 -0
  221. package/src/node/options.ts +10 -1
  222. package/src/sync/range/batch.ts +14 -19
  223. package/src/sync/range/chain.ts +12 -7
  224. package/src/sync/range/range.ts +26 -12
  225. package/src/sync/unknownBlock.ts +57 -21
  226. package/src/sync/utils/downloadByRange.ts +123 -58
  227. package/src/util/asyncIterableToEvents.ts +44 -5
  228. package/src/util/metadata.ts +2 -1
@@ -0,0 +1,354 @@
1
+ import {
2
+ BitVectorType,
3
+ ByteListType,
4
+ CompositeType,
5
+ CompositeView,
6
+ CompositeViewDU,
7
+ ContainerType,
8
+ ListCompositeType,
9
+ ValueOf,
10
+ } from "@chainsafe/ssz";
11
+ import {CELLS_PER_EXT_BLOB, ForkName, ForkPostBellatrix, MAX_BYTES_PER_TRANSACTION} from "@lodestar/params";
12
+ import {ssz} from "@lodestar/types";
13
+
14
+ /**
15
+ * SSZ containers of the REST engine API, per execution-apis `src/engine/refactor-ssz.md`
16
+ * at 5bcdc34a477b10af278c079525374e6a4046f291.
17
+ *
18
+ * Execution payloads, withdrawals and blobs bundles are shared with the consensus types since
19
+ * they serialize identically. Everything else is transport-only and therefore defined here.
20
+ */
21
+
22
+ const MAX_EXECUTION_REQUESTS_PER_PAYLOAD = 256;
23
+ const MAX_BYTES_PER_EXECUTION_REQUEST = MAX_BYTES_PER_TRANSACTION;
24
+ const MAX_BAL_BYTES = MAX_BYTES_PER_TRANSACTION;
25
+ const MAX_ERROR_BYTES = 1024;
26
+ export const MAX_BODIES_REQUEST = 32;
27
+ export const MAX_BLOBS_REQUEST = 128;
28
+
29
+ /** `Optional[T]` is `List[T, 1]` on the wire, the ssz library's `OptionalType` is a different encoding */
30
+ function Optional<T extends CompositeType<ValueOf<T>, CompositeView<T>, CompositeViewDU<T>>>(
31
+ type: T
32
+ ): ListCompositeType<T> {
33
+ return new ListCompositeType(type, 1);
34
+ }
35
+
36
+ const {Bytes8, Bytes32, Bytes48, ExecutionAddress, Root, Uint8, UintBn64, UintBn256, UintNum64} = ssz;
37
+
38
+ const ExecutionRequestsList = new ListCompositeType(
39
+ new ByteListType(MAX_BYTES_PER_EXECUTION_REQUEST),
40
+ MAX_EXECUTION_REQUESTS_PER_PAYLOAD
41
+ );
42
+
43
+ export const PayloadStatus = new ContainerType(
44
+ {
45
+ status: Uint8,
46
+ latestValidHash: Optional(Bytes32),
47
+ validationError: Optional(new ByteListType(MAX_ERROR_BYTES)),
48
+ },
49
+ {typeName: "PayloadStatus"}
50
+ );
51
+
52
+ export const ForkchoiceState = new ContainerType(
53
+ {
54
+ headBlockHash: Bytes32,
55
+ safeBlockHash: Bytes32,
56
+ finalizedBlockHash: Bytes32,
57
+ },
58
+ {typeName: "ForkchoiceState"}
59
+ );
60
+
61
+ export const ForkchoiceUpdateResponse = new ContainerType(
62
+ {
63
+ payloadStatus: PayloadStatus,
64
+ payloadId: Optional(Bytes8),
65
+ },
66
+ {typeName: "ForkchoiceUpdateResponse"}
67
+ );
68
+
69
+ export const PayloadAttributesBellatrix = new ContainerType(
70
+ {
71
+ timestamp: UintNum64,
72
+ prevRandao: Bytes32,
73
+ suggestedFeeRecipient: ExecutionAddress,
74
+ },
75
+ {typeName: "PayloadAttributes"}
76
+ );
77
+
78
+ export const PayloadAttributesCapella = new ContainerType(
79
+ {
80
+ ...PayloadAttributesBellatrix.fields,
81
+ withdrawals: ssz.capella.Withdrawals,
82
+ },
83
+ {typeName: "PayloadAttributes"}
84
+ );
85
+
86
+ export const PayloadAttributesDeneb = new ContainerType(
87
+ {
88
+ ...PayloadAttributesCapella.fields,
89
+ parentBeaconBlockRoot: Root,
90
+ },
91
+ {typeName: "PayloadAttributes"}
92
+ );
93
+
94
+ export const PayloadAttributesGloas = new ContainerType(
95
+ {
96
+ ...PayloadAttributesDeneb.fields,
97
+ slotNumber: UintNum64,
98
+ targetGasLimit: UintBn64,
99
+ },
100
+ {typeName: "PayloadAttributes"}
101
+ );
102
+
103
+ const CustodyColumns = new BitVectorType(CELLS_PER_EXT_BLOB);
104
+
105
+ function ForkchoiceUpdateType<T extends CompositeType<ValueOf<T>, CompositeView<T>, CompositeViewDU<T>>>(
106
+ payloadAttributes: T
107
+ ) {
108
+ return new ContainerType(
109
+ {
110
+ forkchoiceState: ForkchoiceState,
111
+ payloadAttributes: Optional(payloadAttributes),
112
+ },
113
+ {typeName: "ForkchoiceUpdate"}
114
+ );
115
+ }
116
+
117
+ export const ForkchoiceUpdateBellatrix = ForkchoiceUpdateType(PayloadAttributesBellatrix);
118
+ export const ForkchoiceUpdateCapella = ForkchoiceUpdateType(PayloadAttributesCapella);
119
+ export const ForkchoiceUpdateDeneb = ForkchoiceUpdateType(PayloadAttributesDeneb);
120
+ export const ForkchoiceUpdateGloas = new ContainerType(
121
+ {
122
+ ...ForkchoiceUpdateType(PayloadAttributesGloas).fields,
123
+ custodyColumns: Optional(CustodyColumns),
124
+ },
125
+ {typeName: "ForkchoiceUpdate"}
126
+ );
127
+
128
+ export const ExecutionPayloadEnvelopeBellatrix = new ContainerType(
129
+ {payload: ssz.bellatrix.ExecutionPayload},
130
+ {typeName: "ExecutionPayloadEnvelope"}
131
+ );
132
+ export const ExecutionPayloadEnvelopeCapella = new ContainerType(
133
+ {payload: ssz.capella.ExecutionPayload},
134
+ {typeName: "ExecutionPayloadEnvelope"}
135
+ );
136
+ export const ExecutionPayloadEnvelopeDeneb = new ContainerType(
137
+ {
138
+ payload: ssz.deneb.ExecutionPayload,
139
+ parentBeaconBlockRoot: Root,
140
+ },
141
+ {typeName: "ExecutionPayloadEnvelope"}
142
+ );
143
+ export const ExecutionPayloadEnvelopeElectra = new ContainerType(
144
+ {
145
+ payload: ssz.electra.ExecutionPayload,
146
+ parentBeaconBlockRoot: Root,
147
+ executionRequests: ExecutionRequestsList,
148
+ },
149
+ {typeName: "ExecutionPayloadEnvelope"}
150
+ );
151
+ export const ExecutionPayloadEnvelopeGloas = new ContainerType(
152
+ {
153
+ payload: ssz.gloas.ExecutionPayload,
154
+ parentBeaconBlockRoot: Root,
155
+ executionRequests: ExecutionRequestsList,
156
+ },
157
+ {typeName: "ExecutionPayloadEnvelope"}
158
+ );
159
+
160
+ export const BuiltPayloadBellatrix = new ContainerType(
161
+ {
162
+ payload: ssz.bellatrix.ExecutionPayload,
163
+ blockValue: UintBn256,
164
+ },
165
+ {typeName: "BuiltPayload"}
166
+ );
167
+ export const BuiltPayloadCapella = new ContainerType(
168
+ {
169
+ payload: ssz.capella.ExecutionPayload,
170
+ blockValue: UintBn256,
171
+ },
172
+ {typeName: "BuiltPayload"}
173
+ );
174
+ export const BuiltPayloadDeneb = new ContainerType(
175
+ {
176
+ payload: ssz.deneb.ExecutionPayload,
177
+ blockValue: UintBn256,
178
+ blobsBundle: ssz.deneb.BlobsBundle,
179
+ shouldOverrideBuilder: ssz.Boolean,
180
+ },
181
+ {typeName: "BuiltPayload"}
182
+ );
183
+ export const BuiltPayloadElectra = new ContainerType(
184
+ {
185
+ payload: ssz.electra.ExecutionPayload,
186
+ blockValue: UintBn256,
187
+ blobsBundle: ssz.deneb.BlobsBundle,
188
+ executionRequests: ExecutionRequestsList,
189
+ shouldOverrideBuilder: ssz.Boolean,
190
+ },
191
+ {typeName: "BuiltPayload"}
192
+ );
193
+ export const BuiltPayloadFulu = new ContainerType(
194
+ {
195
+ payload: ssz.fulu.ExecutionPayload,
196
+ blockValue: UintBn256,
197
+ blobsBundle: ssz.fulu.BlobsBundle,
198
+ executionRequests: ExecutionRequestsList,
199
+ shouldOverrideBuilder: ssz.Boolean,
200
+ },
201
+ {typeName: "BuiltPayload"}
202
+ );
203
+ export const BuiltPayloadGloas = new ContainerType(
204
+ {
205
+ payload: ssz.gloas.ExecutionPayload,
206
+ blockValue: UintBn256,
207
+ blobsBundle: ssz.fulu.BlobsBundle,
208
+ executionRequests: ExecutionRequestsList,
209
+ shouldOverrideBuilder: ssz.Boolean,
210
+ },
211
+ {typeName: "BuiltPayload"}
212
+ );
213
+
214
+ export const ExecutionPayloadBodyBellatrix = new ContainerType(
215
+ {transactions: ssz.bellatrix.Transactions},
216
+ {typeName: "ExecutionPayloadBody"}
217
+ );
218
+ export const ExecutionPayloadBodyCapella = new ContainerType(
219
+ {
220
+ transactions: ssz.bellatrix.Transactions,
221
+ withdrawals: ssz.capella.Withdrawals,
222
+ },
223
+ {typeName: "ExecutionPayloadBody"}
224
+ );
225
+ export const ExecutionPayloadBodyGloas = new ContainerType(
226
+ {
227
+ transactions: ssz.bellatrix.Transactions,
228
+ withdrawals: ssz.capella.Withdrawals,
229
+ blockAccessList: new ByteListType(MAX_BAL_BYTES),
230
+ },
231
+ {typeName: "ExecutionPayloadBody"}
232
+ );
233
+
234
+ function BodiesResponseType<T extends CompositeType<ValueOf<T>, CompositeView<T>, CompositeViewDU<T>>>(body: T) {
235
+ const BodyEntry = new ContainerType({available: ssz.Boolean, body}, {typeName: "BodyEntry"});
236
+ return new ContainerType(
237
+ {entries: new ListCompositeType(BodyEntry, MAX_BODIES_REQUEST)},
238
+ {typeName: "BodiesResponse"}
239
+ );
240
+ }
241
+
242
+ export const BodiesResponseBellatrix = BodiesResponseType(ExecutionPayloadBodyBellatrix);
243
+ export const BodiesResponseCapella = BodiesResponseType(ExecutionPayloadBodyCapella);
244
+ export const BodiesResponseGloas = BodiesResponseType(ExecutionPayloadBodyGloas);
245
+
246
+ export const BodiesByHashRequest = new ContainerType(
247
+ {blockHashes: new ListCompositeType(Bytes32, MAX_BODIES_REQUEST)},
248
+ {typeName: "BodiesByHashRequest"}
249
+ );
250
+
251
+ export const BlobsRequest = new ContainerType(
252
+ {versionedHashes: new ListCompositeType(Bytes32, MAX_BLOBS_REQUEST)},
253
+ {typeName: "BlobsRequest"}
254
+ );
255
+
256
+ const BlobAndProofV1 = new ContainerType(
257
+ {
258
+ blob: ssz.deneb.Blob,
259
+ proof: Bytes48,
260
+ },
261
+ {typeName: "BlobAndProofV1"}
262
+ );
263
+
264
+ const BlobAndProofV2 = new ContainerType(
265
+ {
266
+ blob: ssz.deneb.Blob,
267
+ proofs: new ListCompositeType(Bytes48, CELLS_PER_EXT_BLOB),
268
+ },
269
+ {typeName: "BlobAndProofV2"}
270
+ );
271
+
272
+ function BlobsResponseType<T extends CompositeType<ValueOf<T>, CompositeView<T>, CompositeViewDU<T>>>(contents: T) {
273
+ const BlobEntry = new ContainerType({available: ssz.Boolean, contents}, {typeName: "BlobEntry"});
274
+ return new ContainerType({entries: new ListCompositeType(BlobEntry, MAX_BLOBS_REQUEST)}, {typeName: "BlobsResponse"});
275
+ }
276
+
277
+ export const BlobsV1Response = BlobsResponseType(BlobAndProofV1);
278
+ export const BlobsV2Response = BlobsResponseType(BlobAndProofV2);
279
+
280
+ const bellatrix = {
281
+ PayloadAttributes: PayloadAttributesBellatrix,
282
+ ForkchoiceUpdate: ForkchoiceUpdateBellatrix,
283
+ ExecutionPayloadEnvelope: ExecutionPayloadEnvelopeBellatrix,
284
+ BuiltPayload: BuiltPayloadBellatrix,
285
+ BodiesResponse: BodiesResponseBellatrix,
286
+ };
287
+
288
+ const capella = {
289
+ PayloadAttributes: PayloadAttributesCapella,
290
+ ForkchoiceUpdate: ForkchoiceUpdateCapella,
291
+ ExecutionPayloadEnvelope: ExecutionPayloadEnvelopeCapella,
292
+ BuiltPayload: BuiltPayloadCapella,
293
+ BodiesResponse: BodiesResponseCapella,
294
+ };
295
+
296
+ const deneb = {
297
+ PayloadAttributes: PayloadAttributesDeneb,
298
+ ForkchoiceUpdate: ForkchoiceUpdateDeneb,
299
+ ExecutionPayloadEnvelope: ExecutionPayloadEnvelopeDeneb,
300
+ BuiltPayload: BuiltPayloadDeneb,
301
+ BodiesResponse: BodiesResponseCapella,
302
+ };
303
+
304
+ const electra = {
305
+ ...deneb,
306
+ ExecutionPayloadEnvelope: ExecutionPayloadEnvelopeElectra,
307
+ BuiltPayload: BuiltPayloadElectra,
308
+ };
309
+
310
+ const fulu = {
311
+ ...electra,
312
+ BuiltPayload: BuiltPayloadFulu,
313
+ };
314
+
315
+ const gloas = {
316
+ PayloadAttributes: PayloadAttributesGloas,
317
+ ForkchoiceUpdate: ForkchoiceUpdateGloas,
318
+ ExecutionPayloadEnvelope: ExecutionPayloadEnvelopeGloas,
319
+ BuiltPayload: BuiltPayloadGloas,
320
+ BodiesResponse: BodiesResponseGloas,
321
+ };
322
+
323
+ export const engineSszTypes = {
324
+ [ForkName.bellatrix]: bellatrix,
325
+ [ForkName.capella]: capella,
326
+ [ForkName.deneb]: deneb,
327
+ [ForkName.electra]: electra,
328
+ [ForkName.fulu]: fulu,
329
+ [ForkName.gloas]: gloas,
330
+ [ForkName.heze]: gloas,
331
+ };
332
+
333
+ export type PayloadStatusSsz = ValueOf<typeof PayloadStatus>;
334
+
335
+ /** Fork names accepted in the `Eth-Execution-Version` header */
336
+ export type ExecutionForkName = "paris" | "shanghai" | "cancun" | "prague" | "osaka" | "amsterdam";
337
+
338
+ /** Heze has no execution fork name in the spec yet, auto mode serves it over JSON-RPC and ssz mode fails the call */
339
+ export const executionForkName: Record<ForkPostBellatrix, ExecutionForkName | null> = {
340
+ [ForkName.bellatrix]: "paris",
341
+ [ForkName.capella]: "shanghai",
342
+ [ForkName.deneb]: "cancun",
343
+ [ForkName.electra]: "prague",
344
+ [ForkName.fulu]: "osaka",
345
+ [ForkName.gloas]: "amsterdam",
346
+ [ForkName.heze]: null,
347
+ };
348
+
349
+ export enum PayloadStatusCode {
350
+ VALID = 0,
351
+ INVALID = 1,
352
+ SYNCING = 2,
353
+ ACCEPTED = 3,
354
+ }
@@ -0,0 +1,61 @@
1
+ import {ForkName} from "@lodestar/params";
2
+ import {BlobsBundle, ExecutionPayload, ExecutionRequests, Root, RootHex, Wei} from "@lodestar/types";
3
+ import {BlobAndProof} from "@lodestar/types/deneb";
4
+ import {BlobAndProofV2} from "@lodestar/types/fulu";
5
+ import {ClientVersion, ExecutionPayloadStatus, PayloadAttributes, PayloadId, VersionedHashes} from "./interface.js";
6
+ import {JsonRpcHttpClientEventEmitter} from "./jsonRpcHttpClient.js";
7
+ import {ExecutionPayloadBodyV2} from "./types.js";
8
+
9
+ export type PayloadStatusResult = {
10
+ status: ExecutionPayloadStatus;
11
+ latestValidHash: RootHex | null;
12
+ validationError: string | null;
13
+ };
14
+
15
+ export type ForkchoiceUpdatedResult = {
16
+ payloadStatus: PayloadStatusResult;
17
+ payloadId: PayloadId | null;
18
+ };
19
+
20
+ export type GetPayloadResult = {
21
+ executionPayload: ExecutionPayload;
22
+ executionPayloadValue: Wei;
23
+ blobsBundle?: BlobsBundle;
24
+ executionRequests?: ExecutionRequests;
25
+ shouldOverrideBuilder?: boolean;
26
+ };
27
+
28
+ /**
29
+ * Wire-level access to the engine API of the execution client. Implementations only translate
30
+ * between Lodestar types and the encoding of their transport, `ExecutionEngineHttp` owns request
31
+ * ordering, engine state and result interpretation.
32
+ */
33
+ export interface IEngineTransport {
34
+ readonly emitter: JsonRpcHttpClientEventEmitter;
35
+
36
+ newPayload(
37
+ fork: ForkName,
38
+ executionPayload: ExecutionPayload,
39
+ versionedHashes?: VersionedHashes,
40
+ parentBeaconBlockRoot?: Root,
41
+ executionRequests?: ExecutionRequests
42
+ ): Promise<PayloadStatusResult>;
43
+
44
+ forkchoiceUpdated(
45
+ fork: ForkName,
46
+ headBlockHash: RootHex,
47
+ safeBlockHash: RootHex,
48
+ finalizedBlockHash: RootHex,
49
+ payloadAttributes?: PayloadAttributes
50
+ ): Promise<ForkchoiceUpdatedResult>;
51
+
52
+ getPayload(fork: ForkName, payloadId: PayloadId): Promise<GetPayloadResult>;
53
+
54
+ getPayloadBodiesByHashV2(blockHashes: RootHex[]): Promise<(ExecutionPayloadBodyV2 | null)[]>;
55
+
56
+ getBlobsV1(versionedHashes: VersionedHashes): Promise<(BlobAndProof | null)[]>;
57
+
58
+ getBlobsV2(versionedHashes: VersionedHashes, buffers?: Uint8Array[]): Promise<BlobAndProofV2[] | null>;
59
+
60
+ getClientVersion(clientVersion: ClientVersion): Promise<ClientVersion[]>;
61
+ }
@@ -20,7 +20,6 @@ import {
20
20
  bellatrix,
21
21
  capella,
22
22
  deneb,
23
- electra,
24
23
  gloas,
25
24
  ssz,
26
25
  } from "@lodestar/types";
@@ -511,55 +510,6 @@ function prefixRequests(requestsBytes: Uint8Array, requestType: ExecutionRequest
511
510
  return prefixedRequests;
512
511
  }
513
512
 
514
- function serializeDepositRequests(depositRequests: electra.DepositRequests): DepositRequestsRpc {
515
- const requestsBytes = ssz.electra.DepositRequests.serialize(depositRequests);
516
- return bytesToData(prefixRequests(requestsBytes, DEPOSIT_REQUEST_TYPE));
517
- }
518
-
519
- function deserializeDepositRequests(serialized: DepositRequestsRpc): electra.DepositRequests {
520
- return ssz.electra.DepositRequests.deserialize(dataToBytes(serialized, null));
521
- }
522
-
523
- function serializeWithdrawalRequests(withdrawalRequests: electra.WithdrawalRequests): WithdrawalRequestsRpc {
524
- const requestsBytes = ssz.electra.WithdrawalRequests.serialize(withdrawalRequests);
525
- return bytesToData(prefixRequests(requestsBytes, WITHDRAWAL_REQUEST_TYPE));
526
- }
527
-
528
- function deserializeWithdrawalRequests(serialized: WithdrawalRequestsRpc): electra.WithdrawalRequests {
529
- return ssz.electra.WithdrawalRequests.deserialize(dataToBytes(serialized, null));
530
- }
531
-
532
- function serializeConsolidationRequests(
533
- consolidationRequests: electra.ConsolidationRequests
534
- ): ConsolidationRequestsRpc {
535
- const requestsBytes = ssz.electra.ConsolidationRequests.serialize(consolidationRequests);
536
- return bytesToData(prefixRequests(requestsBytes, CONSOLIDATION_REQUEST_TYPE));
537
- }
538
-
539
- function deserializeConsolidationRequests(serialized: ConsolidationRequestsRpc): electra.ConsolidationRequests {
540
- return ssz.electra.ConsolidationRequests.deserialize(dataToBytes(serialized, null));
541
- }
542
-
543
- function serializeBuilderDepositRequests(
544
- builderDepositRequests: gloas.BuilderDepositRequests
545
- ): BuilderDepositRequestsRpc {
546
- const requestsBytes = ssz.gloas.BuilderDepositRequests.serialize(builderDepositRequests);
547
- return bytesToData(prefixRequests(requestsBytes, BUILDER_DEPOSIT_REQUEST_TYPE));
548
- }
549
-
550
- function deserializeBuilderDepositRequests(serialized: BuilderDepositRequestsRpc): gloas.BuilderDepositRequests {
551
- return ssz.gloas.BuilderDepositRequests.deserialize(dataToBytes(serialized, null));
552
- }
553
-
554
- function serializeBuilderExitRequests(builderExitRequests: gloas.BuilderExitRequests): BuilderExitRequestsRpc {
555
- const requestsBytes = ssz.gloas.BuilderExitRequests.serialize(builderExitRequests);
556
- return bytesToData(prefixRequests(requestsBytes, BUILDER_EXIT_REQUEST_TYPE));
557
- }
558
-
559
- function deserializeBuilderExitRequests(serialized: BuilderExitRequestsRpc): gloas.BuilderExitRequests {
560
- return ssz.gloas.BuilderExitRequests.deserialize(dataToBytes(serialized, null));
561
- }
562
-
563
513
  /**
564
514
  * This is identical to get_execution_requests_list in
565
515
  * https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.8/specs/electra/beacon-chain.md#new-get_execution_requests_list
@@ -567,62 +517,65 @@ function deserializeBuilderExitRequests(serialized: BuilderExitRequestsRpc): glo
567
517
  * Gloas extends the list with builder deposits (0x03) and builder exits (0x04) per
568
518
  * https://github.com/ethereum/consensus-specs/blob/v1.7.0-alpha.11/specs/gloas/beacon-chain.md#modified-get_execution_requests_list
569
519
  */
570
- export function serializeExecutionRequests(fork: ForkName, executionRequests: ExecutionRequests): ExecutionRequestsRpc {
520
+ export function serializeExecutionRequestsToBytes(fork: ForkName, executionRequests: ExecutionRequests): Uint8Array[] {
571
521
  const {deposits, withdrawals, consolidations} = executionRequests;
572
- const result: ExecutionRequestsRpc = [];
522
+ const result: Uint8Array[] = [];
573
523
 
574
524
  if (deposits.length !== 0) {
575
- result.push(serializeDepositRequests(deposits));
525
+ result.push(prefixRequests(ssz.electra.DepositRequests.serialize(deposits), DEPOSIT_REQUEST_TYPE));
576
526
  }
577
527
 
578
528
  if (withdrawals.length !== 0) {
579
- result.push(serializeWithdrawalRequests(withdrawals));
529
+ result.push(prefixRequests(ssz.electra.WithdrawalRequests.serialize(withdrawals), WITHDRAWAL_REQUEST_TYPE));
580
530
  }
581
531
 
582
532
  if (consolidations.length !== 0) {
583
- result.push(serializeConsolidationRequests(consolidations));
533
+ result.push(
534
+ prefixRequests(ssz.electra.ConsolidationRequests.serialize(consolidations), CONSOLIDATION_REQUEST_TYPE)
535
+ );
584
536
  }
585
537
 
586
538
  if (ForkSeq[fork] >= ForkSeq.gloas) {
587
539
  const {builderDeposits, builderExits} = executionRequests as gloas.ExecutionRequests;
588
540
 
589
541
  if (builderDeposits.length !== 0) {
590
- result.push(serializeBuilderDepositRequests(builderDeposits));
542
+ result.push(
543
+ prefixRequests(ssz.gloas.BuilderDepositRequests.serialize(builderDeposits), BUILDER_DEPOSIT_REQUEST_TYPE)
544
+ );
591
545
  }
592
546
 
593
547
  if (builderExits.length !== 0) {
594
- result.push(serializeBuilderExitRequests(builderExits));
548
+ result.push(prefixRequests(ssz.gloas.BuilderExitRequests.serialize(builderExits), BUILDER_EXIT_REQUEST_TYPE));
595
549
  }
596
550
  }
597
551
 
598
552
  return result;
599
553
  }
600
554
 
601
- export function deserializeExecutionRequests(fork: ForkName, serialized: ExecutionRequestsRpc): ExecutionRequests {
555
+ export function serializeExecutionRequests(fork: ForkName, executionRequests: ExecutionRequests): ExecutionRequestsRpc {
556
+ return serializeExecutionRequestsToBytes(fork, executionRequests).map(bytesToData);
557
+ }
558
+
559
+ export function deserializeExecutionRequestsFromBytes(fork: ForkName, serialized: Uint8Array[]): ExecutionRequests {
602
560
  const result: ExecutionRequests =
603
561
  ForkSeq[fork] >= ForkSeq.gloas
604
562
  ? {deposits: [], withdrawals: [], consolidations: [], builderDeposits: [], builderExits: []}
605
563
  : {deposits: [], withdrawals: [], consolidations: []};
606
564
 
607
- if (serialized.length === 0) {
608
- return result;
609
- }
610
-
611
565
  let prevRequestType: ExecutionRequestType | undefined;
612
566
 
613
- for (let prefixedRequests of serialized) {
614
- // Slice out 0x so it is easier to extract request type
615
- if (prefixedRequests.startsWith("0x")) {
616
- prefixedRequests = prefixedRequests.slice(2);
567
+ for (const prefixedRequests of serialized) {
568
+ if (prefixedRequests.length === 0) {
569
+ throw Error("Invalid request type, request must be prefixed with its type");
617
570
  }
618
571
 
619
- const currentRequestType = parseInt(prefixedRequests.substring(0, 2), 16);
572
+ const currentRequestType = prefixedRequests[0];
620
573
 
621
574
  if (!isExecutionRequestType(currentRequestType)) {
622
- throw Error(`Invalid request type currentRequestType=${prefixedRequests.substring(0, 2)}`);
575
+ throw Error(`Invalid request type currentRequestType=${currentRequestType}`);
623
576
  }
624
577
 
625
- const requests = prefixedRequests.slice(2);
578
+ const requests = prefixedRequests.subarray(1);
626
579
 
627
580
  if (requests.length === 0) {
628
581
  throw Error(
@@ -638,29 +591,29 @@ export function deserializeExecutionRequests(fork: ForkName, serialized: Executi
638
591
 
639
592
  switch (currentRequestType) {
640
593
  case DEPOSIT_REQUEST_TYPE: {
641
- result.deposits = deserializeDepositRequests(requests);
594
+ result.deposits = ssz.electra.DepositRequests.deserialize(requests);
642
595
  break;
643
596
  }
644
597
  case WITHDRAWAL_REQUEST_TYPE: {
645
- result.withdrawals = deserializeWithdrawalRequests(requests);
598
+ result.withdrawals = ssz.electra.WithdrawalRequests.deserialize(requests);
646
599
  break;
647
600
  }
648
601
  case CONSOLIDATION_REQUEST_TYPE: {
649
- result.consolidations = deserializeConsolidationRequests(requests);
602
+ result.consolidations = ssz.electra.ConsolidationRequests.deserialize(requests);
650
603
  break;
651
604
  }
652
605
  case BUILDER_DEPOSIT_REQUEST_TYPE: {
653
606
  if (ForkSeq[fork] < ForkSeq.gloas) {
654
607
  throw Error(`Builder deposit request is not supported pre-gloas fork=${fork}`);
655
608
  }
656
- (result as gloas.ExecutionRequests).builderDeposits = deserializeBuilderDepositRequests(requests);
609
+ (result as gloas.ExecutionRequests).builderDeposits = ssz.gloas.BuilderDepositRequests.deserialize(requests);
657
610
  break;
658
611
  }
659
612
  case BUILDER_EXIT_REQUEST_TYPE: {
660
613
  if (ForkSeq[fork] < ForkSeq.gloas) {
661
614
  throw Error(`Builder exit request is not supported pre-gloas fork=${fork}`);
662
615
  }
663
- (result as gloas.ExecutionRequests).builderExits = deserializeBuilderExitRequests(requests);
616
+ (result as gloas.ExecutionRequests).builderExits = ssz.gloas.BuilderExitRequests.deserialize(requests);
664
617
  break;
665
618
  }
666
619
  }
@@ -670,6 +623,13 @@ export function deserializeExecutionRequests(fork: ForkName, serialized: Executi
670
623
  return result;
671
624
  }
672
625
 
626
+ export function deserializeExecutionRequests(fork: ForkName, serialized: ExecutionRequestsRpc): ExecutionRequests {
627
+ return deserializeExecutionRequestsFromBytes(
628
+ fork,
629
+ serialized.map((data) => dataToBytes(data, null))
630
+ );
631
+ }
632
+
673
633
  export function deserializeExecutionPayloadBody(data: ExecutionPayloadBodyRpc | null): ExecutionPayloadBody | null {
674
634
  return data
675
635
  ? {
@@ -8,6 +8,7 @@ import {
8
8
  JsonRpcHttpClientEvent,
9
9
  JsonRpcHttpClientEventEmitter,
10
10
  } from "./jsonRpcHttpClient.js";
11
+ import {EngineRestError, EngineRestResponseError} from "./restHttpClient.js";
11
12
 
12
13
  /** QUANTITY as defined in ethereum execution layer JSON RPC https://eth.wiki/json-rpc/API */
13
14
  export type QUANTITY = string;
@@ -191,12 +192,21 @@ function getExecutionEngineStateForPayloadError(
191
192
  return oldState;
192
193
  }
193
194
 
195
+ if (payloadError instanceof EngineRestError && (payloadError.status === 401 || payloadError.status === 403)) {
196
+ return ExecutionEngineState.AUTH_FAILED;
197
+ }
198
+
194
199
  // Originally this case was handled with {status: ExecutePayloadStatus.ELERROR}
195
- if (payloadError instanceof HttpRpcError || payloadError instanceof ErrorJsonRpcResponse) {
200
+ if (
201
+ payloadError instanceof HttpRpcError ||
202
+ payloadError instanceof ErrorJsonRpcResponse ||
203
+ payloadError instanceof EngineRestError ||
204
+ payloadError instanceof EngineRestResponseError
205
+ ) {
196
206
  return ExecutionEngineState.SYNCING;
197
207
  }
198
208
 
199
- if (payloadError && isFetchError(payloadError) && HTTP_FATAL_ERROR_CODES.includes(payloadError.code)) {
209
+ if (isFetchError(payloadError) && HTTP_FATAL_ERROR_CODES.includes(payloadError.code)) {
200
210
  return ExecutionEngineState.OFFLINE;
201
211
  }
202
212
 
@@ -20,6 +20,7 @@ import {InsertOutcome} from "../../chain/opPools/types.js";
20
20
  import {RegenCaller, RegenFnName} from "../../chain/regen/interface.js";
21
21
  import {ReprocessStatus} from "../../chain/reprocess.js";
22
22
  import {RejectReason} from "../../chain/seenCache/seenAttestationData.js";
23
+ import type {ShufflingPromiseCancelReason} from "../../chain/shufflingCache.js";
23
24
  import {CacheItemType} from "../../chain/stateCache/types.js";
24
25
  import {OpSource} from "../../chain/validatorMonitor.js";
25
26
  import type {FlatFileStoreOperation} from "../../db/flatFileStore/metrics.js";
@@ -1176,6 +1177,11 @@ export function createLodestarMetrics(
1176
1177
  help: "The total result of calling notifyForkchoiceUpdate execution engine api",
1177
1178
  labelNames: ["result"],
1178
1179
  }),
1180
+ engineApiRequests: register.counter<{transport: string}>({
1181
+ name: "lodestar_execution_engine_api_requests_total",
1182
+ help: "Total engine API requests by transport",
1183
+ labelNames: ["transport"],
1184
+ }),
1179
1185
  opPool: {
1180
1186
  aggregatedAttestationPool: {
1181
1187
  size: register.gauge({
@@ -1281,6 +1287,10 @@ export function createLodestarMetrics(
1281
1287
  name: "lodestar_oppool_aggregated_attestation_pool_packed_attestations_seen_committees_total",
1282
1288
  help: "Total number of committees for which all members are seen when producing packed attestations",
1283
1289
  }),
1290
+ missingShufflingCommittees: register.gauge({
1291
+ name: "lodestar_oppool_aggregated_attestation_pool_packed_attestations_missing_shuffling_committees_total",
1292
+ help: "Total number of committees skipped due to missing shuffling when producing packed attestations",
1293
+ }),
1284
1294
  },
1285
1295
  },
1286
1296
  attestationPool: {
@@ -1614,6 +1624,19 @@ export function createLodestarMetrics(
1614
1624
  name: "lodestar_shuffling_cache_size",
1615
1625
  help: "Shuffling cache size",
1616
1626
  }),
1627
+ epochs: register.gauge({
1628
+ name: "lodestar_shuffling_cache_epochs",
1629
+ help: "Number of epochs in shuffling cache",
1630
+ }),
1631
+ prunedShufflings: register.counter({
1632
+ name: "lodestar_shuffling_cache_pruned_shufflings_total",
1633
+ help: "Total number of shufflings pruned from shuffling cache",
1634
+ }),
1635
+ cancelledPromises: register.counter<{reason: ShufflingPromiseCancelReason}>({
1636
+ name: "lodestar_shuffling_cache_cancelled_promises_total",
1637
+ help: "Total number of shuffling promises resolved with null",
1638
+ labelNames: ["reason"],
1639
+ }),
1617
1640
  insertPromiseCount: register.gauge({
1618
1641
  name: "lodestar_shuffling_cache_insert_promise_count",
1619
1642
  help: "Total number of times insertPromise is called",