@lodestar/beacon-node 1.50.0 → 1.51.0-dev.15ecdb3b27

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 (311) hide show
  1. package/lib/api/impl/beacon/blocks/index.d.ts.map +1 -1
  2. package/lib/api/impl/beacon/blocks/index.js +7 -2
  3. package/lib/api/impl/beacon/blocks/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 +8 -2
  6. package/lib/api/impl/beacon/state/index.js.map +1 -1
  7. package/lib/api/impl/beacon/state/utils.d.ts +2 -1
  8. package/lib/api/impl/beacon/state/utils.d.ts.map +1 -1
  9. package/lib/api/impl/beacon/state/utils.js +17 -9
  10. package/lib/api/impl/beacon/state/utils.js.map +1 -1
  11. package/lib/api/impl/debug/index.d.ts.map +1 -1
  12. package/lib/api/impl/debug/index.js +3 -0
  13. package/lib/api/impl/debug/index.js.map +1 -1
  14. package/lib/api/impl/validator/index.d.ts.map +1 -1
  15. package/lib/api/impl/validator/index.js +133 -27
  16. package/lib/api/impl/validator/index.js.map +1 -1
  17. package/lib/chain/ColumnReconstructionTracker.d.ts +11 -13
  18. package/lib/chain/ColumnReconstructionTracker.d.ts.map +1 -1
  19. package/lib/chain/ColumnReconstructionTracker.js +49 -44
  20. package/lib/chain/ColumnReconstructionTracker.js.map +1 -1
  21. package/lib/chain/archiveStore/utils/archiveBlocks.d.ts.map +1 -1
  22. package/lib/chain/archiveStore/utils/archiveBlocks.js +4 -5
  23. package/lib/chain/archiveStore/utils/archiveBlocks.js.map +1 -1
  24. package/lib/chain/blocks/blockInput/blockInput.d.ts +1 -1
  25. package/lib/chain/blocks/blockInput/blockInput.d.ts.map +1 -1
  26. package/lib/chain/blocks/blockInput/blockInput.js.map +1 -1
  27. package/lib/chain/blocks/blockInput/utils.js +2 -2
  28. package/lib/chain/blocks/blockInput/utils.js.map +1 -1
  29. package/lib/chain/blocks/importBlock.js +10 -6
  30. package/lib/chain/blocks/importBlock.js.map +1 -1
  31. package/lib/chain/blocks/importExecutionPayload.d.ts.map +1 -1
  32. package/lib/chain/blocks/importExecutionPayload.js +49 -2
  33. package/lib/chain/blocks/importExecutionPayload.js.map +1 -1
  34. package/lib/chain/blocks/types.d.ts +4 -0
  35. package/lib/chain/blocks/types.d.ts.map +1 -1
  36. package/lib/chain/blocks/types.js +5 -0
  37. package/lib/chain/blocks/types.js.map +1 -1
  38. package/lib/chain/chain.d.ts +2 -1
  39. package/lib/chain/chain.d.ts.map +1 -1
  40. package/lib/chain/chain.js +8 -3
  41. package/lib/chain/chain.js.map +1 -1
  42. package/lib/chain/errors/executionPayloadBid.d.ts +11 -1
  43. package/lib/chain/errors/executionPayloadBid.d.ts.map +1 -1
  44. package/lib/chain/errors/executionPayloadBid.js +2 -0
  45. package/lib/chain/errors/executionPayloadBid.js.map +1 -1
  46. package/lib/chain/errors/inclusionList.d.ts +60 -0
  47. package/lib/chain/errors/inclusionList.d.ts.map +1 -0
  48. package/lib/chain/errors/inclusionList.js +19 -0
  49. package/lib/chain/errors/inclusionList.js.map +1 -0
  50. package/lib/chain/errors/index.d.ts +1 -0
  51. package/lib/chain/errors/index.d.ts.map +1 -1
  52. package/lib/chain/errors/index.js +1 -0
  53. package/lib/chain/errors/index.js.map +1 -1
  54. package/lib/chain/interface.d.ts +3 -2
  55. package/lib/chain/interface.d.ts.map +1 -1
  56. package/lib/chain/interface.js.map +1 -1
  57. package/lib/chain/opPools/inclusionListStore.d.ts +63 -0
  58. package/lib/chain/opPools/inclusionListStore.d.ts.map +1 -0
  59. package/lib/chain/opPools/inclusionListStore.js +171 -0
  60. package/lib/chain/opPools/inclusionListStore.js.map +1 -0
  61. package/lib/chain/opPools/index.d.ts +1 -0
  62. package/lib/chain/opPools/index.d.ts.map +1 -1
  63. package/lib/chain/opPools/index.js +1 -0
  64. package/lib/chain/opPools/index.js.map +1 -1
  65. package/lib/chain/prepareNextSlot.d.ts.map +1 -1
  66. package/lib/chain/prepareNextSlot.js +4 -3
  67. package/lib/chain/prepareNextSlot.js.map +1 -1
  68. package/lib/chain/produceBlock/computeNewStateRoot.d.ts.map +1 -1
  69. package/lib/chain/produceBlock/computeNewStateRoot.js.map +1 -1
  70. package/lib/chain/produceBlock/produceBlockBody.d.ts +3 -1
  71. package/lib/chain/produceBlock/produceBlockBody.d.ts.map +1 -1
  72. package/lib/chain/produceBlock/produceBlockBody.js +37 -14
  73. package/lib/chain/produceBlock/produceBlockBody.js.map +1 -1
  74. package/lib/chain/regen/interface.d.ts +1 -0
  75. package/lib/chain/regen/interface.d.ts.map +1 -1
  76. package/lib/chain/regen/interface.js +1 -0
  77. package/lib/chain/regen/interface.js.map +1 -1
  78. package/lib/chain/reprocess.d.ts +2 -1
  79. package/lib/chain/reprocess.d.ts.map +1 -1
  80. package/lib/chain/reprocess.js +2 -1
  81. package/lib/chain/reprocess.js.map +1 -1
  82. package/lib/chain/seenCache/seenGossipBlockInput.d.ts.map +1 -1
  83. package/lib/chain/seenCache/seenGossipBlockInput.js +1 -1
  84. package/lib/chain/seenCache/seenGossipBlockInput.js.map +1 -1
  85. package/lib/chain/stateCache/persistentCheckpointsCache.d.ts.map +1 -1
  86. package/lib/chain/stateCache/persistentCheckpointsCache.js +1 -1
  87. package/lib/chain/stateCache/persistentCheckpointsCache.js.map +1 -1
  88. package/lib/chain/validation/executionPayloadBid.d.ts.map +1 -1
  89. package/lib/chain/validation/executionPayloadBid.js +33 -1
  90. package/lib/chain/validation/executionPayloadBid.js.map +1 -1
  91. package/lib/chain/validation/inclusionList.d.ts +14 -0
  92. package/lib/chain/validation/inclusionList.d.ts.map +1 -0
  93. package/lib/chain/validation/inclusionList.js +141 -0
  94. package/lib/chain/validation/inclusionList.js.map +1 -0
  95. package/lib/chain/validation/index.d.ts +1 -0
  96. package/lib/chain/validation/index.d.ts.map +1 -1
  97. package/lib/chain/validation/index.js +1 -0
  98. package/lib/chain/validation/index.js.map +1 -1
  99. package/lib/chain/validatorMonitor.d.ts.map +1 -1
  100. package/lib/chain/validatorMonitor.js +6 -4
  101. package/lib/chain/validatorMonitor.js.map +1 -1
  102. package/lib/constants/constants.d.ts +1 -0
  103. package/lib/constants/constants.d.ts.map +1 -1
  104. package/lib/constants/constants.js +1 -0
  105. package/lib/constants/constants.js.map +1 -1
  106. package/lib/db/repositories/blockArchive.js +2 -2
  107. package/lib/db/repositories/blockArchive.js.map +1 -1
  108. package/lib/db/repositories/blockArchiveIndex.d.ts +1 -1
  109. package/lib/db/repositories/blockArchiveIndex.d.ts.map +1 -1
  110. package/lib/db/repositories/blockArchiveIndex.js +1 -2
  111. package/lib/db/repositories/blockArchiveIndex.js.map +1 -1
  112. package/lib/execution/builder/validateBid.d.ts.map +1 -1
  113. package/lib/execution/builder/validateBid.js +14 -1
  114. package/lib/execution/builder/validateBid.js.map +1 -1
  115. package/lib/execution/engine/disabled.d.ts +1 -0
  116. package/lib/execution/engine/disabled.d.ts.map +1 -1
  117. package/lib/execution/engine/disabled.js +3 -0
  118. package/lib/execution/engine/disabled.js.map +1 -1
  119. package/lib/execution/engine/http.d.ts +8 -2
  120. package/lib/execution/engine/http.d.ts.map +1 -1
  121. package/lib/execution/engine/http.js +28 -4
  122. package/lib/execution/engine/http.js.map +1 -1
  123. package/lib/execution/engine/index.d.ts.map +1 -1
  124. package/lib/execution/engine/index.js +1 -1
  125. package/lib/execution/engine/index.js.map +1 -1
  126. package/lib/execution/engine/interface.d.ts +11 -2
  127. package/lib/execution/engine/interface.d.ts.map +1 -1
  128. package/lib/execution/engine/interface.js.map +1 -1
  129. package/lib/execution/engine/jsonRpcHttpClient.d.ts.map +1 -1
  130. package/lib/execution/engine/jsonRpcHttpClient.js +14 -4
  131. package/lib/execution/engine/jsonRpcHttpClient.js.map +1 -1
  132. package/lib/execution/engine/jsonRpcTransport.d.ts +3 -2
  133. package/lib/execution/engine/jsonRpcTransport.d.ts.map +1 -1
  134. package/lib/execution/engine/jsonRpcTransport.js +33 -9
  135. package/lib/execution/engine/jsonRpcTransport.js.map +1 -1
  136. package/lib/execution/engine/mock.d.ts +1 -0
  137. package/lib/execution/engine/mock.d.ts.map +1 -1
  138. package/lib/execution/engine/mock.js +25 -3
  139. package/lib/execution/engine/mock.js.map +1 -1
  140. package/lib/execution/engine/payloadIdCache.d.ts +4 -1
  141. package/lib/execution/engine/payloadIdCache.d.ts.map +1 -1
  142. package/lib/execution/engine/payloadIdCache.js +13 -2
  143. package/lib/execution/engine/payloadIdCache.js.map +1 -1
  144. package/lib/execution/engine/restTransport.d.ts +5 -2
  145. package/lib/execution/engine/restTransport.d.ts.map +1 -1
  146. package/lib/execution/engine/restTransport.js +36 -21
  147. package/lib/execution/engine/restTransport.js.map +1 -1
  148. package/lib/execution/engine/transport.d.ts +5 -2
  149. package/lib/execution/engine/transport.d.ts.map +1 -1
  150. package/lib/execution/engine/transportMetrics.d.ts +5 -1
  151. package/lib/execution/engine/transportMetrics.d.ts.map +1 -1
  152. package/lib/execution/engine/types.d.ts +24 -0
  153. package/lib/execution/engine/types.d.ts.map +1 -1
  154. package/lib/execution/engine/types.js +24 -11
  155. package/lib/execution/engine/types.js.map +1 -1
  156. package/lib/metrics/metrics/beacon.d.ts +16 -0
  157. package/lib/metrics/metrics/beacon.d.ts.map +1 -1
  158. package/lib/metrics/metrics/beacon.js +35 -0
  159. package/lib/metrics/metrics/beacon.js.map +1 -1
  160. package/lib/metrics/metrics/lodestar.d.ts +20 -0
  161. package/lib/metrics/metrics/lodestar.d.ts.map +1 -1
  162. package/lib/metrics/metrics/lodestar.js +51 -1
  163. package/lib/metrics/metrics/lodestar.js.map +1 -1
  164. package/lib/network/gossip/gossipsub.d.ts.map +1 -1
  165. package/lib/network/gossip/gossipsub.js +3 -1
  166. package/lib/network/gossip/gossipsub.js.map +1 -1
  167. package/lib/network/gossip/interface.d.ts +8 -2
  168. package/lib/network/gossip/interface.d.ts.map +1 -1
  169. package/lib/network/gossip/interface.js +1 -0
  170. package/lib/network/gossip/interface.js.map +1 -1
  171. package/lib/network/gossip/topic.d.ts +8 -14
  172. package/lib/network/gossip/topic.d.ts.map +1 -1
  173. package/lib/network/gossip/topic.js +13 -1
  174. package/lib/network/gossip/topic.js.map +1 -1
  175. package/lib/network/interface.d.ts +2 -1
  176. package/lib/network/interface.d.ts.map +1 -1
  177. package/lib/network/network.d.ts +2 -1
  178. package/lib/network/network.d.ts.map +1 -1
  179. package/lib/network/network.js +5 -0
  180. package/lib/network/network.js.map +1 -1
  181. package/lib/network/peers/utils/enrSubnetsDeserialize.d.ts.map +1 -1
  182. package/lib/network/peers/utils/enrSubnetsDeserialize.js +5 -2
  183. package/lib/network/peers/utils/enrSubnetsDeserialize.js.map +1 -1
  184. package/lib/network/processor/gossipHandlers.d.ts.map +1 -1
  185. package/lib/network/processor/gossipHandlers.js +40 -1
  186. package/lib/network/processor/gossipHandlers.js.map +1 -1
  187. package/lib/network/processor/gossipQueues/index.d.ts.map +1 -1
  188. package/lib/network/processor/gossipQueues/index.js +6 -0
  189. package/lib/network/processor/gossipQueues/index.js.map +1 -1
  190. package/lib/network/processor/gossipValidatorFn.d.ts.map +1 -1
  191. package/lib/network/processor/gossipValidatorFn.js +5 -1
  192. package/lib/network/processor/gossipValidatorFn.js.map +1 -1
  193. package/lib/network/processor/index.d.ts +5 -0
  194. package/lib/network/processor/index.d.ts.map +1 -1
  195. package/lib/network/processor/index.js +40 -29
  196. package/lib/network/processor/index.js.map +1 -1
  197. package/lib/network/reqresp/ReqRespBeaconNode.d.ts.map +1 -1
  198. package/lib/network/reqresp/ReqRespBeaconNode.js +6 -0
  199. package/lib/network/reqresp/ReqRespBeaconNode.js.map +1 -1
  200. package/lib/network/reqresp/handlers/dataColumnSidecarsByRange.d.ts.map +1 -1
  201. package/lib/network/reqresp/handlers/dataColumnSidecarsByRange.js +4 -4
  202. package/lib/network/reqresp/handlers/dataColumnSidecarsByRange.js.map +1 -1
  203. package/lib/network/reqresp/handlers/dataColumnSidecarsByRoot.js +3 -3
  204. package/lib/network/reqresp/handlers/dataColumnSidecarsByRoot.js.map +1 -1
  205. package/lib/network/reqresp/handlers/inclusionListsByIndices.d.ts +10 -0
  206. package/lib/network/reqresp/handlers/inclusionListsByIndices.d.ts.map +1 -0
  207. package/lib/network/reqresp/handlers/inclusionListsByIndices.js +30 -0
  208. package/lib/network/reqresp/handlers/inclusionListsByIndices.js.map +1 -0
  209. package/lib/network/reqresp/handlers/index.d.ts.map +1 -1
  210. package/lib/network/reqresp/handlers/index.js +5 -0
  211. package/lib/network/reqresp/handlers/index.js.map +1 -1
  212. package/lib/network/reqresp/protocols.d.ts +1 -0
  213. package/lib/network/reqresp/protocols.d.ts.map +1 -1
  214. package/lib/network/reqresp/protocols.js +5 -0
  215. package/lib/network/reqresp/protocols.js.map +1 -1
  216. package/lib/network/reqresp/rateLimit.d.ts.map +1 -1
  217. package/lib/network/reqresp/rateLimit.js +6 -2
  218. package/lib/network/reqresp/rateLimit.js.map +1 -1
  219. package/lib/network/reqresp/types.d.ts +5 -2
  220. package/lib/network/reqresp/types.d.ts.map +1 -1
  221. package/lib/network/reqresp/types.js +3 -0
  222. package/lib/network/reqresp/types.js.map +1 -1
  223. package/lib/network/subnets/attnetsService.d.ts.map +1 -1
  224. package/lib/network/subnets/attnetsService.js +3 -1
  225. package/lib/network/subnets/attnetsService.js.map +1 -1
  226. package/lib/node/notifier.d.ts.map +1 -1
  227. package/lib/node/notifier.js +12 -13
  228. package/lib/node/notifier.js.map +1 -1
  229. package/lib/sync/unknownBlock.d.ts.map +1 -1
  230. package/lib/sync/unknownBlock.js +3 -2
  231. package/lib/sync/unknownBlock.js.map +1 -1
  232. package/lib/util/clock.d.ts.map +1 -1
  233. package/lib/util/clock.js +3 -4
  234. package/lib/util/clock.js.map +1 -1
  235. package/lib/util/sszBytes.d.ts +2 -2
  236. package/lib/util/sszBytes.d.ts.map +1 -1
  237. package/lib/util/sszBytes.js +22 -14
  238. package/lib/util/sszBytes.js.map +1 -1
  239. package/package.json +15 -15
  240. package/src/api/impl/beacon/blocks/index.ts +10 -3
  241. package/src/api/impl/beacon/state/index.ts +10 -1
  242. package/src/api/impl/beacon/state/utils.ts +19 -9
  243. package/src/api/impl/debug/index.ts +4 -0
  244. package/src/api/impl/validator/index.ts +173 -29
  245. package/src/chain/ColumnReconstructionTracker.ts +63 -46
  246. package/src/chain/archiveStore/utils/archiveBlocks.ts +6 -7
  247. package/src/chain/blocks/blockInput/blockInput.ts +1 -1
  248. package/src/chain/blocks/blockInput/utils.ts +2 -2
  249. package/src/chain/blocks/importBlock.ts +11 -11
  250. package/src/chain/blocks/importExecutionPayload.ts +67 -2
  251. package/src/chain/blocks/types.ts +5 -0
  252. package/src/chain/chain.ts +8 -2
  253. package/src/chain/errors/executionPayloadBid.ts +12 -0
  254. package/src/chain/errors/inclusionList.ts +38 -0
  255. package/src/chain/errors/index.ts +1 -0
  256. package/src/chain/interface.ts +4 -1
  257. package/src/chain/opPools/inclusionListStore.ts +208 -0
  258. package/src/chain/opPools/index.ts +1 -0
  259. package/src/chain/prepareNextSlot.ts +7 -3
  260. package/src/chain/produceBlock/computeNewStateRoot.ts +9 -2
  261. package/src/chain/produceBlock/produceBlockBody.ts +70 -23
  262. package/src/chain/regen/interface.ts +1 -0
  263. package/src/chain/reprocess.ts +2 -1
  264. package/src/chain/seenCache/seenGossipBlockInput.ts +2 -1
  265. package/src/chain/stateCache/persistentCheckpointsCache.ts +4 -1
  266. package/src/chain/validation/executionPayloadBid.ts +52 -2
  267. package/src/chain/validation/inclusionList.ts +183 -0
  268. package/src/chain/validation/index.ts +1 -0
  269. package/src/chain/validatorMonitor.ts +7 -4
  270. package/src/constants/constants.ts +1 -0
  271. package/src/db/repositories/blockArchive.ts +2 -2
  272. package/src/db/repositories/blockArchiveIndex.ts +2 -3
  273. package/src/execution/builder/validateBid.ts +23 -2
  274. package/src/execution/engine/disabled.ts +4 -0
  275. package/src/execution/engine/http.ts +41 -5
  276. package/src/execution/engine/index.ts +2 -1
  277. package/src/execution/engine/interface.ts +27 -3
  278. package/src/execution/engine/jsonRpcHttpClient.ts +12 -5
  279. package/src/execution/engine/jsonRpcTransport.ts +46 -9
  280. package/src/execution/engine/mock.ts +26 -3
  281. package/src/execution/engine/payloadIdCache.ts +23 -4
  282. package/src/execution/engine/restTransport.ts +68 -23
  283. package/src/execution/engine/transport.ts +7 -2
  284. package/src/execution/engine/transportMetrics.ts +2 -1
  285. package/src/execution/engine/types.ts +48 -11
  286. package/src/metrics/metrics/beacon.ts +37 -0
  287. package/src/metrics/metrics/lodestar.ts +53 -1
  288. package/src/network/gossip/gossipsub.ts +3 -1
  289. package/src/network/gossip/interface.ts +5 -0
  290. package/src/network/gossip/topic.ts +14 -0
  291. package/src/network/interface.ts +2 -0
  292. package/src/network/network.ts +11 -0
  293. package/src/network/peers/utils/enrSubnetsDeserialize.ts +5 -2
  294. package/src/network/processor/gossipHandlers.ts +52 -1
  295. package/src/network/processor/gossipQueues/index.ts +6 -0
  296. package/src/network/processor/gossipValidatorFn.ts +5 -0
  297. package/src/network/processor/index.ts +36 -27
  298. package/src/network/processor/types.ts +1 -1
  299. package/src/network/reqresp/ReqRespBeaconNode.ts +7 -0
  300. package/src/network/reqresp/handlers/dataColumnSidecarsByRange.ts +4 -10
  301. package/src/network/reqresp/handlers/dataColumnSidecarsByRoot.ts +3 -3
  302. package/src/network/reqresp/handlers/inclusionListsByIndices.ts +44 -0
  303. package/src/network/reqresp/handlers/index.ts +5 -0
  304. package/src/network/reqresp/protocols.ts +6 -0
  305. package/src/network/reqresp/rateLimit.ts +6 -2
  306. package/src/network/reqresp/types.ts +6 -0
  307. package/src/network/subnets/attnetsService.ts +8 -3
  308. package/src/node/notifier.ts +14 -13
  309. package/src/sync/unknownBlock.ts +3 -2
  310. package/src/util/clock.ts +3 -4
  311. package/src/util/sszBytes.ts +25 -12
@@ -19,6 +19,7 @@ import {onDataColumnSidecarsByRange} from "./dataColumnSidecarsByRange.js";
19
19
  import {onDataColumnSidecarsByRoot} from "./dataColumnSidecarsByRoot.js";
20
20
  import {onExecutionPayloadEnvelopesByRange} from "./executionPayloadEnvelopesByRange.js";
21
21
  import {onExecutionPayloadEnvelopesByRoot} from "./executionPayloadEnvelopesByRoot.js";
22
+ import {onInclusionListsByIndices} from "./inclusionListsByIndices.js";
22
23
  import {onLightClientBootstrap} from "./lightClientBootstrap.js";
23
24
  import {onLightClientFinalityUpdate} from "./lightClientFinalityUpdate.js";
24
25
  import {onLightClientOptimisticUpdate} from "./lightClientOptimisticUpdate.js";
@@ -142,6 +143,10 @@ export function getReqRespHandlers({db, chain}: {db: IBeaconDb; chain: IBeaconCh
142
143
  },
143
144
  [ReqRespMethod.LightClientFinalityUpdate]: () => onLightClientFinalityUpdate(chain),
144
145
  [ReqRespMethod.LightClientOptimisticUpdate]: () => onLightClientOptimisticUpdate(chain),
146
+ [ReqRespMethod.InclusionListsByIndices]: (req, peerId, peerClient) => {
147
+ const body = deserializeRequestBody(ssz.heze.InclusionListsByIndicesRequest, req.data);
148
+ return onInclusionListsByIndices(body, chain, peerId, peerClient);
149
+ },
145
150
  };
146
151
 
147
152
  return (method) => handlers[method];
@@ -113,6 +113,12 @@ export const ExecutionPayloadEnvelopesByRange = toProtocol({
113
113
  contextBytesType: ContextBytesType.ForkDigest,
114
114
  });
115
115
 
116
+ export const InclusionListsByIndices = toProtocol({
117
+ method: ReqRespMethod.InclusionListsByIndices,
118
+ version: Version.V1,
119
+ contextBytesType: ContextBytesType.ForkDigest,
120
+ });
121
+
116
122
  export const LightClientBootstrap = toProtocol({
117
123
  method: ReqRespMethod.LightClientBootstrap,
118
124
  version: Version.V1,
@@ -107,12 +107,16 @@ export const rateLimitQuotas: (fork: ForkName, config: BeaconConfig) => Record<R
107
107
  [ReqRespMethod.LightClientFinalityUpdate]: {
108
108
  // Finality updates should not be requested more than once per epoch.
109
109
  // Allow 2 per slot and a very safe bound until there's more testing of real usage.
110
- byPeer: {quota: 2, quotaTimeMs: 12_000},
110
+ byPeer: {quota: 2, quotaTimeMs: config.getSlotDurationMs(fork)},
111
+ },
112
+ [ReqRespMethod.InclusionListsByIndices]: {
113
+ // Peers only backfill what gossip missed, so a small per-slot allowance is enough
114
+ byPeer: {quota: 5, quotaTimeMs: config.getSlotDurationMs(fork)},
111
115
  },
112
116
  [ReqRespMethod.LightClientOptimisticUpdate]: {
113
117
  // Optimistic updates should not be requested more than once per slot.
114
118
  // Allow 2 per slot and a very safe bound until there's more testing of real usage.
115
- byPeer: {quota: 2, quotaTimeMs: 12_000},
119
+ byPeer: {quota: 2, quotaTimeMs: config.getSlotDurationMs(fork)},
116
120
  },
117
121
  });
118
122
 
@@ -16,6 +16,7 @@ import {
16
16
  deneb,
17
17
  fulu,
18
18
  gloas,
19
+ heze,
19
20
  phase0,
20
21
  ssz,
21
22
  sszTypesFor,
@@ -53,6 +54,7 @@ export enum ReqRespMethod {
53
54
  LightClientUpdatesByRange = "light_client_updates_by_range",
54
55
  LightClientFinalityUpdate = "light_client_finality_update",
55
56
  LightClientOptimisticUpdate = "light_client_optimistic_update",
57
+ InclusionListsByIndices = "inclusion_lists_by_indices",
56
58
  }
57
59
 
58
60
  // To typesafe events to network
@@ -74,6 +76,7 @@ export type RequestBodyByMethod = {
74
76
  [ReqRespMethod.LightClientUpdatesByRange]: altair.LightClientUpdatesByRange;
75
77
  [ReqRespMethod.LightClientFinalityUpdate]: null;
76
78
  [ReqRespMethod.LightClientOptimisticUpdate]: null;
79
+ [ReqRespMethod.InclusionListsByIndices]: heze.InclusionListsByIndicesRequest;
77
80
  };
78
81
 
79
82
  type ResponseBodyByMethod = {
@@ -96,6 +99,7 @@ type ResponseBodyByMethod = {
96
99
  [ReqRespMethod.LightClientUpdatesByRange]: LightClientUpdate;
97
100
  [ReqRespMethod.LightClientFinalityUpdate]: LightClientFinalityUpdate;
98
101
  [ReqRespMethod.LightClientOptimisticUpdate]: LightClientOptimisticUpdate;
102
+ [ReqRespMethod.InclusionListsByIndices]: heze.SignedInclusionList;
99
103
  };
100
104
 
101
105
  /** Request SSZ type for each method and ForkName */
@@ -126,6 +130,7 @@ export const requestSszTypeByMethod: (
126
130
  [ReqRespMethod.LightClientUpdatesByRange]: ssz.altair.LightClientUpdatesByRange,
127
131
  [ReqRespMethod.LightClientFinalityUpdate]: null,
128
132
  [ReqRespMethod.LightClientOptimisticUpdate]: null,
133
+ [ReqRespMethod.InclusionListsByIndices]: ssz.heze.InclusionListsByIndicesRequest,
129
134
  });
130
135
 
131
136
  export type ResponseTypeGetter<T> = (fork: ForkName, version: number) => Type<T>;
@@ -158,6 +163,7 @@ export const responseSszTypeByMethod: {[K in ReqRespMethod]: ResponseTypeGetter<
158
163
  [ReqRespMethod.ExecutionPayloadEnvelopesByRange]: () => ssz.gloas.SignedExecutionPayloadEnvelope,
159
164
  [ReqRespMethod.LightClientOptimisticUpdate]: (fork) =>
160
165
  sszTypesFor(onlyPostAltairFork(fork)).LightClientOptimisticUpdate,
166
+ [ReqRespMethod.InclusionListsByIndices]: () => ssz.heze.SignedInclusionList,
161
167
  };
162
168
 
163
169
  function onlyPostAltairFork(fork: ForkName): ForkPostAltair {
@@ -3,6 +3,7 @@ import {ATTESTATION_SUBNET_COUNT, SLOTS_PER_EPOCH} from "@lodestar/params";
3
3
  import {computeEpochAtSlot} from "@lodestar/state-transition";
4
4
  import {Epoch, Slot, SubnetID, ssz} from "@lodestar/types";
5
5
  import {Logger, MapDef} from "@lodestar/utils";
6
+ import {HALF_SLOT_BPS} from "../../constants/index.js";
6
7
  import {ClockEvent, IClock} from "../../util/clock.js";
7
8
  import {NetworkCoreMetrics} from "../core/metrics.js";
8
9
  import {getActiveForkBoundaries} from "../forks.js";
@@ -163,9 +164,13 @@ export class AttnetsService implements IAttnetsService {
163
164
  */
164
165
  private onSlot = (clockSlot: Slot): void => {
165
166
  try {
166
- setTimeout(() => {
167
- this.onHalfSlot(clockSlot);
168
- }, this.config.SLOT_DURATION_MS * 0.5);
167
+ const fork = this.config.getForkName(clockSlot);
168
+ setTimeout(
169
+ () => {
170
+ this.onHalfSlot(clockSlot);
171
+ },
172
+ this.config.getSlotComponentDurationMs(fork, HALF_SLOT_BPS)
173
+ );
169
174
 
170
175
  for (const [dutiedSlot, dutiedInfo] of this.aggregatorSlotSubnet.entries()) {
171
176
  if (dutiedSlot === clockSlot + this.opts.slotsToSubscribeBeforeAggregatorDuty) {
@@ -5,6 +5,7 @@ import {
5
5
  IBeaconStateView,
6
6
  computeEpochAtSlot,
7
7
  computeStartSlotAtEpoch,
8
+ computeTimeAtSlot,
8
9
  isStatePostBellatrix,
9
10
  } from "@lodestar/state-transition";
10
11
  import {Epoch} from "@lodestar/types";
@@ -140,21 +141,21 @@ export async function runNodeNotifier(modules: NodeNotifierModules): Promise<voi
140
141
  }
141
142
 
142
143
  function timeToNextHalfSlot(config: BeaconConfig, chain: IBeaconChain, isFirstTime: boolean): number {
143
- const msPerSlot = config.SLOT_DURATION_MS;
144
- const msPerHalfSlot = msPerSlot / 2;
145
- const msFromGenesis = Date.now() - chain.genesisTime * 1000;
146
- const msToNextSlot =
147
- msFromGenesis < 0
148
- ? // For future genesis time, calculate time left in the slot
149
- -msFromGenesis % msPerSlot
150
- : // For past genesis time, calculate time until the next slot
151
- msPerSlot - (msFromGenesis % msPerSlot);
144
+ const currentSlot = chain.clock.currentSlot;
145
+ const nextSlotTimeSec = computeTimeAtSlot(config, currentSlot + 1, chain.genesisTime);
146
+ const nowMs = Date.now();
147
+
152
148
  if (isFirstTime) {
153
- // at the 1st time we may miss middle of the current clock slot
154
- return msToNextSlot > msPerHalfSlot ? msToNextSlot - msPerHalfSlot : msToNextSlot + msPerHalfSlot;
149
+ const currentSlotTimeSec = computeTimeAtSlot(config, currentSlot, chain.genesisTime);
150
+ const currentMidpointMs = ((currentSlotTimeSec + nextSlotTimeSec) / 2) * 1000;
151
+ if (currentMidpointMs > nowMs) {
152
+ return currentMidpointMs - nowMs;
153
+ }
155
154
  }
156
- // after the 1st time always wait until middle of next clock slot
157
- return msToNextSlot + msPerHalfSlot;
155
+
156
+ const nextSlotEndTimeSec = computeTimeAtSlot(config, currentSlot + 2, chain.genesisTime);
157
+ const nextMidpointMs = ((nextSlotTimeSec + nextSlotEndTimeSec) / 2) * 1000;
158
+ return Math.max(0, nextMidpointMs - nowMs);
158
159
  }
159
160
 
160
161
  function getHeadExecutionInfo(
@@ -918,16 +918,17 @@ export class BlockInputSync {
918
918
  * Poll unknown payloads of the current slot.
919
919
  */
920
920
  private async pollPayloadsAtSlot(slot: Slot, signal: AbortSignal): Promise<void> {
921
+ const fork = this.config.getForkName(slot);
921
922
  // fixed tick count so the loop cannot outlive its slot: for mainnet, it's 6 ticks
922
923
  const tickCount = Math.floor(
923
- (this.config.SLOT_DURATION_MS - this.config.getPayloadDueMs()) / PAYLOAD_POLL_INTERVAL_MS
924
+ (this.config.getSlotDurationMs(fork) - this.config.getPayloadDueMs(fork)) / PAYLOAD_POLL_INTERVAL_MS
924
925
  );
925
926
  // a root still missing on several ticks is searched on each of them, recorded once
926
927
  const searchedRoots = new Set<RootHex>();
927
928
  let polls = 0;
928
929
 
929
930
  try {
930
- await sleep(Math.max(0, this.config.getPayloadDueMs() - this.chain.clock.msFromSlot(slot)), signal);
931
+ await sleep(Math.max(0, this.config.getPayloadDueMs(fork) - this.chain.clock.msFromSlot(slot)), signal);
931
932
 
932
933
  for (polls = 0; polls < tickCount; polls++) {
933
934
  let importedCount = 0;
package/src/util/clock.ts CHANGED
@@ -78,9 +78,9 @@ export class Clock extends EventEmitter implements IClock {
78
78
 
79
79
  this.config = config;
80
80
  this.genesisTime = genesisTime;
81
- this.timeoutId = setTimeout(this.onNextSlot, this.msUntilNextSlot());
82
81
  this.signal = signal;
83
82
  this._currentSlot = getCurrentSlot(this.config, this.genesisTime);
83
+ this.timeoutId = setTimeout(this.onNextSlot, this.msUntilNextSlot());
84
84
  this.signal.addEventListener("abort", () => clearTimeout(this.timeoutId), {once: true});
85
85
  }
86
86
 
@@ -204,8 +204,7 @@ export class Clock extends EventEmitter implements IClock {
204
204
  };
205
205
 
206
206
  private msUntilNextSlot(): number {
207
- const milliSecondsPerSlot = this.config.SLOT_DURATION_MS;
208
- const diffInMilliSeconds = Date.now() - this.genesisTime * 1000;
209
- return milliSecondsPerSlot - (diffInMilliSeconds % milliSecondsPerSlot);
207
+ const nextSlotTimeSec = computeTimeAtSlot(this.config, this._currentSlot + 1, this.genesisTime);
208
+ return Math.max(0, nextSlotTimeSec * 1000 - Date.now());
210
209
  }
211
210
  }
@@ -6,10 +6,12 @@ import {
6
6
  FIELD_ELEMENTS_PER_BLOB,
7
7
  ForkName,
8
8
  ForkPostDeneb,
9
+ ForkPostGloas,
9
10
  ForkSeq,
10
11
  MAX_COMMITTEES_PER_SLOT,
11
12
  isForkPostElectra,
12
13
  isForkPostGloas,
14
+ isForkPostHeze,
13
15
  } from "@lodestar/params";
14
16
  import {BLSSignature, CommitteeIndex, RootHex, Slot, ValidatorIndex, ssz} from "@lodestar/types";
15
17
 
@@ -57,6 +59,8 @@ const ATTESTATION_DATA_SIZE = 128;
57
59
  // MAX_COMMITTEES_PER_SLOT is in bit, need to convert to byte
58
60
  const COMMITTEE_BITS_SIZE = Math.max(Math.ceil(MAX_COMMITTEES_PER_SLOT / 8), 1);
59
61
  const SIGNATURE_SIZE = 96;
62
+ // SyncAggregate is a fixed-size container, so minSize is its serialized size
63
+ const SYNC_AGGREGATE_SIZE = ssz.altair.SyncAggregate.minSize;
60
64
  const SINGLE_ATTESTATION_ATTDATA_OFFSET = 8 + 8;
61
65
  const SINGLE_ATTESTATION_SLOT_OFFSET = SINGLE_ATTESTATION_ATTDATA_OFFSET;
62
66
  const SINGLE_ATTESTATION_COMMITTEE_INDEX_OFFSET = 0;
@@ -447,30 +451,39 @@ export function getParentRootFromSignedBeaconBlockSerialized(data: Uint8Array):
447
451
  * BeaconBlockBody (GLOAS) fixed section before signedExecutionPayloadBid offset pointer:
448
452
  * randaoReveal(96) + eth1Data(72) + graffiti(32)
449
453
  * + proposerSlashings(4) + attesterSlashings(4) + attestations(4) + deposits(4) + voluntaryExits(4)
450
- * + syncAggregate(160) + blsToExecutionChanges(4) = 384 bytes
454
+ * + syncAggregate(SyncAggregate.minSize) + blsToExecutionChanges(4) = 384 bytes (mainnet preset)
451
455
  *
452
- * The 4-byte pointer at byte 568 (= 184+384) gives the offset of SignedExecutionPayloadBid
456
+ * Heze body: randaoReveal(96) + graffiti(32) + proposerSlashings(4) + attesterSlashings(4) + attestations(4) + voluntaryExits(4) + syncAggregate(SyncAggregate.minSize) + blsToExecutionChanges(4) = 308 bytes (mainnet preset)
457
+ *
458
+ * The 4-byte pointer at byte 568 (= 184+384) for Gloas and 492 (= 184+308) for Heze (mainnet preset) gives the offset of SignedExecutionPayloadBid
453
459
  * within BeaconBlockBody. parentBlockHash is at that bid's byte 100 (after offset+sig).
454
460
  */
455
461
  // BeaconBlock body starts after: msg_offset(4) + sig(96) + slot(8) + proposer_index(8) + parent_root(32) + state_root(32) + body_offset_ptr(4)
456
462
  const GLOAS_BODY_START_IN_SIGNED_BEACON_BLOCK =
457
463
  VARIABLE_FIELD_OFFSET + SIGNATURE_SIZE + SLOT_SIZE + 8 + ROOT_SIZE + ROOT_SIZE + VARIABLE_FIELD_OFFSET; // = 184
458
- const GLOAS_SIGNED_BID_OFFSET_POINTER_IN_BODY = 96 + 72 + 32 + 4 + 4 + 4 + 4 + 4 + 160 + 4; // = 384
459
- const GLOAS_SIGNED_BID_OFFSET_POINTER_IN_SIGNED_BEACON_BLOCK =
460
- GLOAS_BODY_START_IN_SIGNED_BEACON_BLOCK + GLOAS_SIGNED_BID_OFFSET_POINTER_IN_BODY; // = 568
464
+ const GLOAS_SIGNED_BID_OFFSET_POINTER_IN_BODY = 96 + 72 + 32 + 4 + 4 + 4 + 4 + 4 + SYNC_AGGREGATE_SIZE + 4; // = 384 at mainnet preset
465
+ // Heze removes eth1Data (72 B) and the deposits offset (4 B) from the body fixed section
466
+ const HEZE_SIGNED_BID_OFFSET_POINTER_IN_BODY = GLOAS_SIGNED_BID_OFFSET_POINTER_IN_BODY - 72 - VARIABLE_FIELD_OFFSET; // = 308
461
467
  // Within SignedExecutionPayloadBid, parentBlockHash is at byte 100 (msg_offset:4 + sig:96)
462
468
  const PARENT_BLOCK_HASH_OFFSET_IN_SIGNED_BID = VARIABLE_FIELD_OFFSET + SIGNATURE_SIZE; // = 100
463
469
 
464
- // CAUTION: update offsets if BeaconBlockBody fixed fields change after Gloas
465
- export function getParentBlockHashFromGloasSignedBeaconBlockSerialized(data: Uint8Array): RootHex | null {
466
- if (data.length < GLOAS_SIGNED_BID_OFFSET_POINTER_IN_SIGNED_BEACON_BLOCK + VARIABLE_FIELD_OFFSET) {
470
+ // CAUTION: update offsets if BeaconBlockBody fixed fields change after Heze
471
+ export function getParentBlockHashFromGloasSignedBeaconBlockSerialized(
472
+ data: Uint8Array,
473
+ fork: ForkPostGloas
474
+ ): RootHex | null {
475
+ const bidOffsetPointer =
476
+ GLOAS_BODY_START_IN_SIGNED_BEACON_BLOCK +
477
+ (isForkPostHeze(fork) ? HEZE_SIGNED_BID_OFFSET_POINTER_IN_BODY : GLOAS_SIGNED_BID_OFFSET_POINTER_IN_BODY);
478
+ if (data.length < bidOffsetPointer + VARIABLE_FIELD_OFFSET) {
467
479
  return null;
468
480
  }
469
481
  const bidOffset =
470
- data[GLOAS_SIGNED_BID_OFFSET_POINTER_IN_SIGNED_BEACON_BLOCK] |
471
- (data[GLOAS_SIGNED_BID_OFFSET_POINTER_IN_SIGNED_BEACON_BLOCK + 1] << 8) |
472
- (data[GLOAS_SIGNED_BID_OFFSET_POINTER_IN_SIGNED_BEACON_BLOCK + 2] << 16) |
473
- (data[GLOAS_SIGNED_BID_OFFSET_POINTER_IN_SIGNED_BEACON_BLOCK + 3] << 24);
482
+ (data[bidOffsetPointer] |
483
+ (data[bidOffsetPointer + 1] << 8) |
484
+ (data[bidOffsetPointer + 2] << 16) |
485
+ (data[bidOffsetPointer + 3] << 24)) >>>
486
+ 0;
474
487
 
475
488
  const parentBlockHashStart =
476
489
  GLOAS_BODY_START_IN_SIGNED_BEACON_BLOCK + bidOffset + PARENT_BLOCK_HASH_OFFSET_IN_SIGNED_BID;