@lodestar/beacon-node 2.1.0-dev.475f7d67bc → 2.1.0-dev.4b0199a2eb

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 (378) hide show
  1. package/lib/api/impl/beacon/blocks/index.d.ts.map +1 -1
  2. package/lib/api/impl/beacon/blocks/index.js +1 -3
  3. package/lib/api/impl/beacon/blocks/index.js.map +1 -1
  4. package/lib/api/impl/beacon/pool/index.d.ts.map +1 -1
  5. package/lib/api/impl/beacon/pool/index.js +8 -0
  6. package/lib/api/impl/beacon/pool/index.js.map +1 -1
  7. package/lib/api/impl/beacon/state/index.d.ts.map +1 -1
  8. package/lib/api/impl/beacon/state/index.js +3 -2
  9. package/lib/api/impl/beacon/state/index.js.map +1 -1
  10. package/lib/api/impl/beacon/state/utils.js +1 -1
  11. package/lib/api/impl/beacon/state/utils.js.map +1 -1
  12. package/lib/api/impl/config/constants.d.ts +0 -1
  13. package/lib/api/impl/config/constants.d.ts.map +1 -1
  14. package/lib/api/impl/config/constants.js +1 -3
  15. package/lib/api/impl/config/constants.js.map +1 -1
  16. package/lib/api/impl/debug/index.d.ts.map +1 -1
  17. package/lib/api/impl/debug/index.js +0 -3
  18. package/lib/api/impl/debug/index.js.map +1 -1
  19. package/lib/api/impl/errors.d.ts +7 -0
  20. package/lib/api/impl/errors.d.ts.map +1 -1
  21. package/lib/api/impl/errors.js +9 -0
  22. package/lib/api/impl/errors.js.map +1 -1
  23. package/lib/api/impl/validator/index.d.ts.map +1 -1
  24. package/lib/api/impl/validator/index.js +4 -94
  25. package/lib/api/impl/validator/index.js.map +1 -1
  26. package/lib/api/rest/base.d.ts.map +1 -1
  27. package/lib/api/rest/base.js +6 -3
  28. package/lib/api/rest/base.js.map +1 -1
  29. package/lib/chain/ColumnReconstructionTracker.d.ts +3 -0
  30. package/lib/chain/ColumnReconstructionTracker.d.ts.map +1 -1
  31. package/lib/chain/ColumnReconstructionTracker.js +3 -1
  32. package/lib/chain/ColumnReconstructionTracker.js.map +1 -1
  33. package/lib/chain/GetBlobsTracker.d.ts +3 -0
  34. package/lib/chain/GetBlobsTracker.d.ts.map +1 -1
  35. package/lib/chain/GetBlobsTracker.js +3 -1
  36. package/lib/chain/GetBlobsTracker.js.map +1 -1
  37. package/lib/chain/blocks/importBlock.d.ts.map +1 -1
  38. package/lib/chain/blocks/importBlock.js +14 -5
  39. package/lib/chain/blocks/importBlock.js.map +1 -1
  40. package/lib/chain/blocks/importExecutionPayload.d.ts.map +1 -1
  41. package/lib/chain/blocks/importExecutionPayload.js +7 -56
  42. package/lib/chain/blocks/importExecutionPayload.js.map +1 -1
  43. package/lib/chain/blocks/payloadEnvelopeInput/types.d.ts +2 -1
  44. package/lib/chain/blocks/payloadEnvelopeInput/types.d.ts.map +1 -1
  45. package/lib/chain/blocks/types.d.ts +0 -4
  46. package/lib/chain/blocks/types.d.ts.map +1 -1
  47. package/lib/chain/blocks/types.js +0 -5
  48. package/lib/chain/blocks/types.js.map +1 -1
  49. package/lib/chain/chain.d.ts +3 -3
  50. package/lib/chain/chain.d.ts.map +1 -1
  51. package/lib/chain/chain.js +30 -10
  52. package/lib/chain/chain.js.map +1 -1
  53. package/lib/chain/errors/dataColumnSidecarError.d.ts +7 -0
  54. package/lib/chain/errors/dataColumnSidecarError.d.ts.map +1 -1
  55. package/lib/chain/errors/dataColumnSidecarError.js +1 -0
  56. package/lib/chain/errors/dataColumnSidecarError.js.map +1 -1
  57. package/lib/chain/errors/executionPayloadBid.d.ts +0 -15
  58. package/lib/chain/errors/executionPayloadBid.d.ts.map +1 -1
  59. package/lib/chain/errors/executionPayloadBid.js +0 -3
  60. package/lib/chain/errors/executionPayloadBid.js.map +1 -1
  61. package/lib/chain/errors/index.d.ts +0 -1
  62. package/lib/chain/errors/index.d.ts.map +1 -1
  63. package/lib/chain/errors/index.js +0 -1
  64. package/lib/chain/errors/index.js.map +1 -1
  65. package/lib/chain/forkChoice/index.d.ts +11 -2
  66. package/lib/chain/forkChoice/index.d.ts.map +1 -1
  67. package/lib/chain/forkChoice/index.js +180 -13
  68. package/lib/chain/forkChoice/index.js.map +1 -1
  69. package/lib/chain/forkChoiceExecutionEngine.d.ts +1 -2
  70. package/lib/chain/forkChoiceExecutionEngine.d.ts.map +1 -1
  71. package/lib/chain/forkChoiceExecutionEngine.js +0 -3
  72. package/lib/chain/forkChoiceExecutionEngine.js.map +1 -1
  73. package/lib/chain/interface.d.ts +3 -3
  74. package/lib/chain/interface.d.ts.map +1 -1
  75. package/lib/chain/interface.js.map +1 -1
  76. package/lib/chain/opPools/index.d.ts +0 -1
  77. package/lib/chain/opPools/index.d.ts.map +1 -1
  78. package/lib/chain/opPools/index.js +0 -1
  79. package/lib/chain/opPools/index.js.map +1 -1
  80. package/lib/chain/opPools/opPool.d.ts +9 -3
  81. package/lib/chain/opPools/opPool.d.ts.map +1 -1
  82. package/lib/chain/opPools/opPool.js +22 -16
  83. package/lib/chain/opPools/opPool.js.map +1 -1
  84. package/lib/chain/options.d.ts.map +1 -1
  85. package/lib/chain/options.js +1 -3
  86. package/lib/chain/options.js.map +1 -1
  87. package/lib/chain/produceBlock/produceBlockBody.d.ts +1 -3
  88. package/lib/chain/produceBlock/produceBlockBody.d.ts.map +1 -1
  89. package/lib/chain/produceBlock/produceBlockBody.js +3 -33
  90. package/lib/chain/produceBlock/produceBlockBody.js.map +1 -1
  91. package/lib/chain/regen/interface.d.ts +0 -1
  92. package/lib/chain/regen/interface.d.ts.map +1 -1
  93. package/lib/chain/regen/interface.js +0 -1
  94. package/lib/chain/regen/interface.js.map +1 -1
  95. package/lib/chain/seenCache/index.d.ts +1 -0
  96. package/lib/chain/seenCache/index.d.ts.map +1 -1
  97. package/lib/chain/seenCache/index.js +1 -0
  98. package/lib/chain/seenCache/index.js.map +1 -1
  99. package/lib/chain/seenCache/seenBlockProposers.d.ts +3 -0
  100. package/lib/chain/seenCache/seenBlockProposers.d.ts.map +1 -1
  101. package/lib/chain/seenCache/seenBlockProposers.js +6 -2
  102. package/lib/chain/seenCache/seenBlockProposers.js.map +1 -1
  103. package/lib/chain/seenCache/seenDataColumnSidecars.d.ts +17 -0
  104. package/lib/chain/seenCache/seenDataColumnSidecars.d.ts.map +1 -0
  105. package/lib/chain/seenCache/seenDataColumnSidecars.js +61 -0
  106. package/lib/chain/seenCache/seenDataColumnSidecars.js.map +1 -0
  107. package/lib/chain/seenCache/seenGossipBlockInput.js +1 -1
  108. package/lib/chain/seenCache/seenGossipBlockInput.js.map +1 -1
  109. package/lib/chain/seenCache/seenPayloadEnvelopeInput.d.ts +11 -2
  110. package/lib/chain/seenCache/seenPayloadEnvelopeInput.d.ts.map +1 -1
  111. package/lib/chain/seenCache/seenPayloadEnvelopeInput.js +28 -2
  112. package/lib/chain/seenCache/seenPayloadEnvelopeInput.js.map +1 -1
  113. package/lib/chain/validation/attestation.d.ts.map +1 -1
  114. package/lib/chain/validation/attestation.js +4 -2
  115. package/lib/chain/validation/attestation.js.map +1 -1
  116. package/lib/chain/validation/block.d.ts.map +1 -1
  117. package/lib/chain/validation/block.js +20 -7
  118. package/lib/chain/validation/block.js.map +1 -1
  119. package/lib/chain/validation/dataColumnSidecar.js +1 -1
  120. package/lib/chain/validation/dataColumnSidecar.js.map +1 -1
  121. package/lib/chain/validation/executionPayloadBid.d.ts.map +1 -1
  122. package/lib/chain/validation/executionPayloadBid.js +1 -34
  123. package/lib/chain/validation/executionPayloadBid.js.map +1 -1
  124. package/lib/chain/validation/index.d.ts +0 -1
  125. package/lib/chain/validation/index.d.ts.map +1 -1
  126. package/lib/chain/validation/index.js +0 -1
  127. package/lib/chain/validation/index.js.map +1 -1
  128. package/lib/chain/validation/proposerSlashing.js +5 -1
  129. package/lib/chain/validation/proposerSlashing.js.map +1 -1
  130. package/lib/chain/validation/voluntaryExit.js +2 -2
  131. package/lib/chain/validation/voluntaryExit.js.map +1 -1
  132. package/lib/execution/builder/validateBid.d.ts.map +1 -1
  133. package/lib/execution/builder/validateBid.js +1 -14
  134. package/lib/execution/builder/validateBid.js.map +1 -1
  135. package/lib/execution/engine/disabled.d.ts +0 -1
  136. package/lib/execution/engine/disabled.d.ts.map +1 -1
  137. package/lib/execution/engine/disabled.js +0 -3
  138. package/lib/execution/engine/disabled.js.map +1 -1
  139. package/lib/execution/engine/http.d.ts +2 -8
  140. package/lib/execution/engine/http.d.ts.map +1 -1
  141. package/lib/execution/engine/http.js +4 -27
  142. package/lib/execution/engine/http.js.map +1 -1
  143. package/lib/execution/engine/interface.d.ts +2 -13
  144. package/lib/execution/engine/interface.d.ts.map +1 -1
  145. package/lib/execution/engine/interface.js.map +1 -1
  146. package/lib/execution/engine/jsonRpcTransport.d.ts +2 -3
  147. package/lib/execution/engine/jsonRpcTransport.d.ts.map +1 -1
  148. package/lib/execution/engine/jsonRpcTransport.js +9 -33
  149. package/lib/execution/engine/jsonRpcTransport.js.map +1 -1
  150. package/lib/execution/engine/mock.d.ts +0 -1
  151. package/lib/execution/engine/mock.d.ts.map +1 -1
  152. package/lib/execution/engine/mock.js +3 -25
  153. package/lib/execution/engine/mock.js.map +1 -1
  154. package/lib/execution/engine/payloadIdCache.d.ts +1 -4
  155. package/lib/execution/engine/payloadIdCache.d.ts.map +1 -1
  156. package/lib/execution/engine/payloadIdCache.js +2 -16
  157. package/lib/execution/engine/payloadIdCache.js.map +1 -1
  158. package/lib/execution/engine/restTransport.d.ts +1 -2
  159. package/lib/execution/engine/restTransport.d.ts.map +1 -1
  160. package/lib/execution/engine/restTransport.js +0 -3
  161. package/lib/execution/engine/restTransport.js.map +1 -1
  162. package/lib/execution/engine/transport.d.ts +2 -3
  163. package/lib/execution/engine/transport.d.ts.map +1 -1
  164. package/lib/execution/engine/types.d.ts +0 -24
  165. package/lib/execution/engine/types.d.ts.map +1 -1
  166. package/lib/execution/engine/types.js +0 -12
  167. package/lib/execution/engine/types.js.map +1 -1
  168. package/lib/index.d.ts +1 -0
  169. package/lib/index.d.ts.map +1 -1
  170. package/lib/index.js +1 -0
  171. package/lib/index.js.map +1 -1
  172. package/lib/metrics/metrics/beacon.d.ts +0 -16
  173. package/lib/metrics/metrics/beacon.d.ts.map +1 -1
  174. package/lib/metrics/metrics/beacon.js +0 -35
  175. package/lib/metrics/metrics/beacon.js.map +1 -1
  176. package/lib/metrics/metrics/lodestar.d.ts +0 -9
  177. package/lib/metrics/metrics/lodestar.d.ts.map +1 -1
  178. package/lib/metrics/metrics/lodestar.js +0 -20
  179. package/lib/metrics/metrics/lodestar.js.map +1 -1
  180. package/lib/network/core/networkCore.d.ts +1 -3
  181. package/lib/network/core/networkCore.d.ts.map +1 -1
  182. package/lib/network/core/networkCore.js +1 -3
  183. package/lib/network/core/networkCore.js.map +1 -1
  184. package/lib/network/forks.d.ts +2 -2
  185. package/lib/network/forks.d.ts.map +1 -1
  186. package/lib/network/forks.js +3 -3
  187. package/lib/network/forks.js.map +1 -1
  188. package/lib/network/gossip/interface.d.ts +2 -8
  189. package/lib/network/gossip/interface.d.ts.map +1 -1
  190. package/lib/network/gossip/interface.js +0 -1
  191. package/lib/network/gossip/interface.js.map +1 -1
  192. package/lib/network/gossip/scoringParameters.js +19 -14
  193. package/lib/network/gossip/scoringParameters.js.map +1 -1
  194. package/lib/network/gossip/topic.d.ts +17 -29
  195. package/lib/network/gossip/topic.d.ts.map +1 -1
  196. package/lib/network/gossip/topic.js +1 -13
  197. package/lib/network/gossip/topic.js.map +1 -1
  198. package/lib/network/interface.d.ts +1 -2
  199. package/lib/network/interface.d.ts.map +1 -1
  200. package/lib/network/network.d.ts +2 -8
  201. package/lib/network/network.d.ts.map +1 -1
  202. package/lib/network/network.js +16 -45
  203. package/lib/network/network.js.map +1 -1
  204. package/lib/network/options.d.ts +0 -1
  205. package/lib/network/options.d.ts.map +1 -1
  206. package/lib/network/options.js +0 -1
  207. package/lib/network/options.js.map +1 -1
  208. package/lib/network/peers/discover.d.ts +1 -0
  209. package/lib/network/peers/discover.d.ts.map +1 -1
  210. package/lib/network/peers/discover.js +44 -48
  211. package/lib/network/peers/discover.js.map +1 -1
  212. package/lib/network/peers/score/store.d.ts.map +1 -1
  213. package/lib/network/peers/score/store.js +1 -2
  214. package/lib/network/peers/score/store.js.map +1 -1
  215. package/lib/network/processor/gossipHandlers.d.ts.map +1 -1
  216. package/lib/network/processor/gossipHandlers.js +85 -57
  217. package/lib/network/processor/gossipHandlers.js.map +1 -1
  218. package/lib/network/processor/gossipQueues/index.d.ts.map +1 -1
  219. package/lib/network/processor/gossipQueues/index.js +0 -6
  220. package/lib/network/processor/gossipQueues/index.js.map +1 -1
  221. package/lib/network/processor/gossipValidatorFn.d.ts.map +1 -1
  222. package/lib/network/processor/gossipValidatorFn.js +1 -5
  223. package/lib/network/processor/gossipValidatorFn.js.map +1 -1
  224. package/lib/network/processor/index.d.ts.map +1 -1
  225. package/lib/network/processor/index.js +0 -1
  226. package/lib/network/processor/index.js.map +1 -1
  227. package/lib/network/reqresp/ReqRespBeaconNode.d.ts.map +1 -1
  228. package/lib/network/reqresp/ReqRespBeaconNode.js +0 -6
  229. package/lib/network/reqresp/ReqRespBeaconNode.js.map +1 -1
  230. package/lib/network/reqresp/handlers/dataColumnSidecarsByRange.d.ts.map +1 -1
  231. package/lib/network/reqresp/handlers/dataColumnSidecarsByRange.js +3 -1
  232. package/lib/network/reqresp/handlers/dataColumnSidecarsByRange.js.map +1 -1
  233. package/lib/network/reqresp/handlers/index.d.ts.map +1 -1
  234. package/lib/network/reqresp/handlers/index.js +0 -5
  235. package/lib/network/reqresp/handlers/index.js.map +1 -1
  236. package/lib/network/reqresp/protocols.d.ts +0 -1
  237. package/lib/network/reqresp/protocols.d.ts.map +1 -1
  238. package/lib/network/reqresp/protocols.js +0 -5
  239. package/lib/network/reqresp/protocols.js.map +1 -1
  240. package/lib/network/reqresp/rateLimit.d.ts.map +1 -1
  241. package/lib/network/reqresp/rateLimit.js +0 -4
  242. package/lib/network/reqresp/rateLimit.js.map +1 -1
  243. package/lib/network/reqresp/types.d.ts +2 -5
  244. package/lib/network/reqresp/types.d.ts.map +1 -1
  245. package/lib/network/reqresp/types.js +0 -3
  246. package/lib/network/reqresp/types.js.map +1 -1
  247. package/lib/sync/range/chain.d.ts.map +1 -1
  248. package/lib/sync/range/chain.js +1 -0
  249. package/lib/sync/range/chain.js.map +1 -1
  250. package/lib/sync/range/range.d.ts.map +1 -1
  251. package/lib/sync/range/range.js +5 -1
  252. package/lib/sync/range/range.js.map +1 -1
  253. package/lib/sync/unknownBlock.d.ts.map +1 -1
  254. package/lib/sync/unknownBlock.js +14 -1
  255. package/lib/sync/unknownBlock.js.map +1 -1
  256. package/lib/sync/utils/downloadByRange.d.ts +6 -0
  257. package/lib/sync/utils/downloadByRange.d.ts.map +1 -1
  258. package/lib/sync/utils/downloadByRange.js +17 -8
  259. package/lib/sync/utils/downloadByRange.js.map +1 -1
  260. package/lib/sync/utils/downloadByRoot.d.ts.map +1 -1
  261. package/lib/sync/utils/downloadByRoot.js +1 -1
  262. package/lib/sync/utils/downloadByRoot.js.map +1 -1
  263. package/lib/sync/utils/pendingBlocksTree.d.ts.map +1 -1
  264. package/lib/sync/utils/pendingBlocksTree.js +6 -1
  265. package/lib/sync/utils/pendingBlocksTree.js.map +1 -1
  266. package/lib/util/dataColumns.d.ts +2 -1
  267. package/lib/util/dataColumns.d.ts.map +1 -1
  268. package/lib/util/dataColumns.js +7 -2
  269. package/lib/util/dataColumns.js.map +1 -1
  270. package/lib/util/execution.d.ts +2 -1
  271. package/lib/util/execution.d.ts.map +1 -1
  272. package/lib/util/execution.js +7 -2
  273. package/lib/util/execution.js.map +1 -1
  274. package/lib/util/sszBytes.d.ts.map +1 -1
  275. package/lib/util/sszBytes.js +6 -4
  276. package/lib/util/sszBytes.js.map +1 -1
  277. package/package.json +18 -21
  278. package/src/api/impl/beacon/blocks/index.ts +1 -5
  279. package/src/api/impl/beacon/pool/index.ts +11 -0
  280. package/src/api/impl/beacon/state/index.ts +3 -7
  281. package/src/api/impl/beacon/state/utils.ts +1 -1
  282. package/src/api/impl/config/constants.ts +0 -4
  283. package/src/api/impl/debug/index.ts +0 -4
  284. package/src/api/impl/errors.ts +10 -0
  285. package/src/api/impl/validator/index.ts +2 -123
  286. package/src/api/rest/base.ts +9 -3
  287. package/src/chain/ColumnReconstructionTracker.ts +5 -1
  288. package/src/chain/GetBlobsTracker.ts +5 -0
  289. package/src/chain/blocks/importBlock.ts +14 -7
  290. package/src/chain/blocks/importExecutionPayload.ts +7 -74
  291. package/src/chain/blocks/payloadEnvelopeInput/types.ts +8 -1
  292. package/src/chain/blocks/types.ts +0 -5
  293. package/src/chain/chain.ts +34 -9
  294. package/src/chain/errors/dataColumnSidecarError.ts +8 -0
  295. package/src/chain/errors/executionPayloadBid.ts +0 -18
  296. package/src/chain/errors/index.ts +0 -1
  297. package/src/chain/forkChoice/index.ts +233 -13
  298. package/src/chain/forkChoiceExecutionEngine.ts +1 -5
  299. package/src/chain/interface.ts +2 -2
  300. package/src/chain/opPools/index.ts +0 -1
  301. package/src/chain/opPools/opPool.ts +27 -16
  302. package/src/chain/options.ts +1 -3
  303. package/src/chain/produceBlock/produceBlockBody.ts +12 -66
  304. package/src/chain/regen/interface.ts +0 -1
  305. package/src/chain/seenCache/index.ts +1 -0
  306. package/src/chain/seenCache/seenBlockProposers.ts +12 -2
  307. package/src/chain/seenCache/seenDataColumnSidecars.ts +69 -0
  308. package/src/chain/seenCache/seenGossipBlockInput.ts +1 -1
  309. package/src/chain/seenCache/seenPayloadEnvelopeInput.ts +28 -2
  310. package/src/chain/validation/attestation.ts +4 -2
  311. package/src/chain/validation/block.ts +19 -7
  312. package/src/chain/validation/dataColumnSidecar.ts +1 -1
  313. package/src/chain/validation/executionPayloadBid.ts +2 -49
  314. package/src/chain/validation/index.ts +0 -1
  315. package/src/chain/validation/proposerSlashing.ts +5 -1
  316. package/src/chain/validation/voluntaryExit.ts +2 -2
  317. package/src/execution/builder/validateBid.ts +2 -23
  318. package/src/execution/engine/disabled.ts +0 -4
  319. package/src/execution/engine/http.ts +5 -40
  320. package/src/execution/engine/interface.ts +2 -24
  321. package/src/execution/engine/jsonRpcTransport.ts +9 -46
  322. package/src/execution/engine/mock.ts +3 -26
  323. package/src/execution/engine/payloadIdCache.ts +4 -25
  324. package/src/execution/engine/restTransport.ts +1 -15
  325. package/src/execution/engine/transport.ts +2 -5
  326. package/src/execution/engine/types.ts +0 -35
  327. package/src/index.ts +1 -0
  328. package/src/metrics/metrics/beacon.ts +0 -37
  329. package/src/metrics/metrics/lodestar.ts +0 -21
  330. package/src/network/core/networkCore.ts +1 -3
  331. package/src/network/forks.ts +7 -3
  332. package/src/network/gossip/interface.ts +0 -5
  333. package/src/network/gossip/scoringParameters.ts +23 -14
  334. package/src/network/gossip/topic.ts +0 -14
  335. package/src/network/interface.ts +0 -2
  336. package/src/network/network.ts +20 -55
  337. package/src/network/options.ts +0 -2
  338. package/src/network/peers/discover.ts +42 -52
  339. package/src/network/peers/score/store.ts +1 -2
  340. package/src/network/processor/gossipHandlers.ts +147 -76
  341. package/src/network/processor/gossipQueues/index.ts +0 -6
  342. package/src/network/processor/gossipValidatorFn.ts +0 -5
  343. package/src/network/processor/index.ts +0 -1
  344. package/src/network/reqresp/ReqRespBeaconNode.ts +0 -7
  345. package/src/network/reqresp/handlers/dataColumnSidecarsByRange.ts +4 -1
  346. package/src/network/reqresp/handlers/index.ts +0 -5
  347. package/src/network/reqresp/protocols.ts +0 -6
  348. package/src/network/reqresp/rateLimit.ts +0 -4
  349. package/src/network/reqresp/types.ts +0 -6
  350. package/src/sync/range/chain.ts +1 -0
  351. package/src/sync/range/range.ts +7 -1
  352. package/src/sync/unknownBlock.ts +20 -1
  353. package/src/sync/utils/downloadByRange.ts +30 -7
  354. package/src/sync/utils/downloadByRoot.ts +12 -9
  355. package/src/sync/utils/pendingBlocksTree.ts +6 -1
  356. package/src/util/dataColumns.ts +13 -1
  357. package/src/util/execution.ts +16 -1
  358. package/src/util/sszBytes.ts +7 -8
  359. package/lib/chain/errors/inclusionList.d.ts +0 -60
  360. package/lib/chain/errors/inclusionList.d.ts.map +0 -1
  361. package/lib/chain/errors/inclusionList.js +0 -19
  362. package/lib/chain/errors/inclusionList.js.map +0 -1
  363. package/lib/chain/opPools/inclusionListStore.d.ts +0 -66
  364. package/lib/chain/opPools/inclusionListStore.d.ts.map +0 -1
  365. package/lib/chain/opPools/inclusionListStore.js +0 -174
  366. package/lib/chain/opPools/inclusionListStore.js.map +0 -1
  367. package/lib/chain/validation/inclusionList.d.ts +0 -14
  368. package/lib/chain/validation/inclusionList.d.ts.map +0 -1
  369. package/lib/chain/validation/inclusionList.js +0 -150
  370. package/lib/chain/validation/inclusionList.js.map +0 -1
  371. package/lib/network/reqresp/handlers/inclusionListsByIndices.d.ts +0 -10
  372. package/lib/network/reqresp/handlers/inclusionListsByIndices.d.ts.map +0 -1
  373. package/lib/network/reqresp/handlers/inclusionListsByIndices.js +0 -30
  374. package/lib/network/reqresp/handlers/inclusionListsByIndices.js.map +0 -1
  375. package/src/chain/errors/inclusionList.ts +0 -38
  376. package/src/chain/opPools/inclusionListStore.ts +0 -211
  377. package/src/chain/validation/inclusionList.ts +0 -192
  378. package/src/network/reqresp/handlers/inclusionListsByIndices.ts +0 -44
@@ -1,150 +0,0 @@
1
- import { GENESIS_SLOT, MIN_SEED_LOOKAHEAD, isForkPostHeze } from "@lodestar/params";
2
- import { computeEpochAtSlot, computeStartSlotAtEpoch, getInclusionListCommittee, getInclusionListSignatureSet, } from "@lodestar/state-transition";
3
- import { toRootHex } from "@lodestar/utils";
4
- import { InclusionListError, InclusionListErrorCode } from "../errors/inclusionList.js";
5
- import { GossipAction } from "../errors/index.js";
6
- import { RegenCaller } from "../regen/index.js";
7
- import { isValidDependentRoot } from "./proposerPreferences.js";
8
- /**
9
- * Gossip validation for the `inclusion_list` topic, in spec rule order. Also applied to inclusion lists
10
- * submitted over the API before they are published.
11
- */
12
- export async function validateGossipInclusionList(chain, signedInclusionList) {
13
- const { slot, validatorIndex, transactions, dependentRoot } = signedInclusionList.message;
14
- let totalBytes = 0;
15
- for (let i = 0; i < transactions.length; i++) {
16
- totalBytes += transactions.getSize(i);
17
- }
18
- // A pre-heze slot has no inclusion list committee to validate against
19
- if (!isForkPostHeze(chain.config.getForkName(slot))) {
20
- throw new InclusionListError(GossipAction.IGNORE, {
21
- code: InclusionListErrorCode.PRE_HEZE_SLOT,
22
- inclusionListSlot: slot,
23
- });
24
- }
25
- // [IGNORE] The message is either the first or second valid message received from validatorIndex
26
- // for (message.slot, message.dependent_root)
27
- const dependentRootHex = toRootHex(dependentRoot);
28
- if (chain.inclusionListStore.seenTwice(slot, dependentRootHex, validatorIndex)) {
29
- throw new InclusionListError(GossipAction.IGNORE, {
30
- code: InclusionListErrorCode.MORE_THAN_TWO,
31
- validatorIndex,
32
- });
33
- }
34
- // [IGNORE] message.slot is equal to the current slot, with a MAXIMUM_GOSSIP_CLOCK_DISPARITY allowance
35
- if (!chain.clock.isCurrentSlotGivenGossipDisparity(slot)) {
36
- throw new InclusionListError(GossipAction.IGNORE, {
37
- code: InclusionListErrorCode.INVALID_SLOT,
38
- inclusionListSlot: slot,
39
- currentSlot: chain.clock.currentSlot,
40
- });
41
- }
42
- // [IGNORE] The size of message.transactions is greater than 0
43
- if (totalBytes === 0) {
44
- throw new InclusionListError(GossipAction.IGNORE, { code: InclusionListErrorCode.EMPTY_TRANSACTIONS });
45
- }
46
- // [REJECT] The size of message.transactions is within upperbound MAX_TRANSACTIONS_BYTES_PER_INCLUSION_LIST
47
- if (totalBytes > chain.config.MAX_TRANSACTIONS_BYTES_PER_INCLUSION_LIST) {
48
- throw new InclusionListError(GossipAction.REJECT, {
49
- code: InclusionListErrorCode.MAXIMUM_SIZE_EXCEEDED,
50
- totalBytes,
51
- maxBytes: chain.config.MAX_TRANSACTIONS_BYTES_PER_INCLUSION_LIST,
52
- });
53
- }
54
- // [REJECT] Every transaction in message.transactions is non-empty
55
- let emptyTransactionIndex = -1;
56
- for (let i = 0; i < transactions.length; i++) {
57
- if (transactions.getSize(i) === 0) {
58
- emptyTransactionIndex = i;
59
- break;
60
- }
61
- }
62
- if (emptyTransactionIndex !== -1) {
63
- throw new InclusionListError(GossipAction.REJECT, {
64
- code: InclusionListErrorCode.EMPTY_TRANSACTION,
65
- transactionIndex: emptyTransactionIndex,
66
- });
67
- }
68
- // [IGNORE] The block with root message.dependent_root has been seen
69
- const dependentBlock = chain.forkChoice.getBlockHexDefaultStatus(dependentRootHex);
70
- if (dependentBlock === null) {
71
- throw new InclusionListError(GossipAction.IGNORE, {
72
- code: InclusionListErrorCode.UNKNOWN_DEPENDENT_ROOT,
73
- dependentRoot: dependentRootHex,
74
- });
75
- }
76
- // [REJECT] The slot of the block with root message.dependent_root is strictly less than
77
- // compute_start_slot_at_epoch(compute_epoch_at_slot(message.slot) - MIN_SEED_LOOKAHEAD),
78
- // clamped to genesis like compute_shuffling_dependent_slot
79
- const epoch = computeEpochAtSlot(slot);
80
- const dependentEpoch = epoch - MIN_SEED_LOOKAHEAD;
81
- const maxDependentSlot = Math.max(GENESIS_SLOT, computeStartSlotAtEpoch(dependentEpoch) - 1);
82
- if (dependentBlock.slot > maxDependentSlot) {
83
- throw new InclusionListError(GossipAction.REJECT, {
84
- code: InclusionListErrorCode.INVALID_DEPENDENT_ROOT_SLOT,
85
- dependentRoot: dependentRootHex,
86
- dependentSlot: dependentBlock.slot,
87
- maxSlot: maxDependentSlot,
88
- });
89
- }
90
- // [IGNORE] is_valid_dependent_root(store, message.dependent_root, epoch - MIN_SEED_LOOKAHEAD)
91
- if (!isValidDependentRoot(chain.forkChoice, dependentBlock, dependentEpoch)) {
92
- throw new InclusionListError(GossipAction.IGNORE, {
93
- code: InclusionListErrorCode.INVALID_DEPENDENT_ROOT,
94
- dependentRoot: dependentRootHex,
95
- epoch: dependentEpoch,
96
- });
97
- }
98
- // [REJECT] validatorIndex is in get_inclusion_list_committee(state, message.slot), where state is the
99
- // state of the block with root message.dependent_root, i.e. the shuffling of `epoch` keyed by `dependent_root`
100
- const shuffling = await getShuffling(chain, epoch, dependentRootHex, dependentBlock);
101
- if (shuffling === null) {
102
- throw new InclusionListError(GossipAction.IGNORE, {
103
- code: InclusionListErrorCode.MISSING_SHUFFLING,
104
- dependentRoot: dependentRootHex,
105
- epoch,
106
- });
107
- }
108
- const committeeIndices = getInclusionListCommittee(shuffling, slot).getCommitteeIndices(validatorIndex);
109
- if (committeeIndices.length === 0) {
110
- throw new InclusionListError(GossipAction.REJECT, {
111
- code: InclusionListErrorCode.VALIDATOR_NOT_IN_COMMITTEE,
112
- validatorIndex,
113
- });
114
- }
115
- // [REJECT] The signature is valid with respect to the validator's public key
116
- // Domain from the list's own slot, so a list for the first Heze slot verifies while the clock is still in Gloas
117
- const signatureSet = getInclusionListSignatureSet(chain.config, slot, signedInclusionList);
118
- // With only 16 inclusion list committee members per slot, batching can delay gossip by 100ms.
119
- // Verify without batching so inclusion lists can be forwarded sooner.
120
- if (!(await chain.bls.verifySignatureSets([signatureSet], { batchable: false }))) {
121
- throw new InclusionListError(GossipAction.REJECT, { code: InclusionListErrorCode.INVALID_SIGNATURE });
122
- }
123
- // Check again after the async validation so concurrent lists of the same validator cannot all pass
124
- if (chain.inclusionListStore.seenTwice(slot, dependentRootHex, validatorIndex)) {
125
- throw new InclusionListError(GossipAction.IGNORE, {
126
- code: InclusionListErrorCode.MORE_THAN_TWO,
127
- validatorIndex,
128
- });
129
- }
130
- chain.inclusionListStore.markSeen(slot, dependentRootHex, validatorIndex);
131
- return { committeeIndices, totalBytes };
132
- }
133
- /**
134
- * The shuffling of `epoch` on the branch of `dependentBlock`. Usually cached from the head state; when the
135
- * dependent block is the head across empty epochs that state has not reached the lookahead start slot, so
136
- * the spec's `process_slots` step is a state regen
137
- */
138
- async function getShuffling(chain, epoch, dependentRootHex, dependentBlock) {
139
- const cached = await chain.shufflingCache.get(epoch, dependentRootHex);
140
- if (cached !== null) {
141
- return cached;
142
- }
143
- try {
144
- return await chain.regenStateForAttestationVerification(epoch, dependentRootHex, dependentBlock, RegenCaller.validateGossipInclusionList);
145
- }
146
- catch {
147
- return null;
148
- }
149
- }
150
- //# sourceMappingURL=inclusionList.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"inclusionList.js","sourceRoot":"","sources":["../../../src/chain/validation/inclusionList.ts"],"names":[],"mappings":"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"}
@@ -1,10 +0,0 @@
1
- import { PeerId } from "@libp2p/interface";
2
- import { ResponseOutgoing } from "@lodestar/reqresp";
3
- import { heze } from "@lodestar/types";
4
- import { IBeaconChain } from "../../../chain/index.js";
5
- /**
6
- * Only lists that passed gossip validation are stored and the store skips equivocators, so the spec's
7
- * "SHOULD NOT respond with lists that fail gossip validation or are from equivocators" holds by construction.
8
- */
9
- export declare function onInclusionListsByIndices(requestBody: heze.InclusionListsByIndicesRequest, chain: IBeaconChain, peerId: PeerId, peerClient: string): AsyncIterable<ResponseOutgoing>;
10
- //# sourceMappingURL=inclusionListsByIndices.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"inclusionListsByIndices.d.ts","sourceRoot":"","sources":["../../../../src/network/reqresp/handlers/inclusionListsByIndices.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,MAAM,EAAC,MAAM,mBAAmB,CAAC;AACzC,OAAO,EAAC,gBAAgB,EAAC,MAAM,mBAAmB,CAAC;AAEnD,OAAO,EAAC,IAAI,EAAM,MAAM,iBAAiB,CAAC;AAE1C,OAAO,EAAC,YAAY,EAAC,MAAM,yBAAyB,CAAC;AAGrD;;;GAGG;AACH,wBAAuB,yBAAyB,CAC9C,WAAW,EAAE,IAAI,CAAC,8BAA8B,EAChD,KAAK,EAAE,YAAY,EACnB,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,MAAM,GACjB,aAAa,CAAC,gBAAgB,CAAC,CA0BjC"}
@@ -1,30 +0,0 @@
1
- import { computeEpochAtSlot, computeStartSlotAtEpoch } from "@lodestar/state-transition";
2
- import { ssz } from "@lodestar/types";
3
- import { toRootHex } from "@lodestar/utils";
4
- import { prettyPrintPeerId } from "../../util.js";
5
- /**
6
- * Only lists that passed gossip validation are stored and the store skips equivocators, so the spec's
7
- * "SHOULD NOT respond with lists that fail gossip validation or are from equivocators" holds by construction.
8
- */
9
- export async function* onInclusionListsByIndices(requestBody, chain, peerId, peerClient) {
10
- const { slot, dependentRoot, indices } = requestBody;
11
- const minimumRequestSlot = Math.max(chain.clock.currentSlot - chain.config.MIN_SLOTS_FOR_INCLUSION_LISTS_REQUESTS, computeStartSlotAtEpoch(chain.config.HEZE_FORK_EPOCH));
12
- if (slot < minimumRequestSlot) {
13
- chain.logger.debug("Cannot serve InclusionListsByIndices: slot below minimum request slot", {
14
- slot,
15
- minimumRequestSlot,
16
- peer: prettyPrintPeerId(peerId),
17
- client: peerClient,
18
- });
19
- return;
20
- }
21
- const signedInclusionLists = chain.inclusionListStore.getByIndices(slot, toRootHex(dependentRoot), indices);
22
- const boundary = chain.config.getForkBoundaryAtEpoch(computeEpochAtSlot(slot));
23
- for (const signedInclusionList of signedInclusionLists.slice(0, chain.config.MAX_REQUEST_INCLUSION_LIST)) {
24
- yield {
25
- data: ssz.heze.SignedInclusionList.serialize(signedInclusionList),
26
- boundary,
27
- };
28
- }
29
- }
30
- //# sourceMappingURL=inclusionListsByIndices.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"inclusionListsByIndices.js","sourceRoot":"","sources":["../../../../src/network/reqresp/handlers/inclusionListsByIndices.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,kBAAkB,EAAE,uBAAuB,EAAC,MAAM,4BAA4B,CAAC;AACvF,OAAO,EAAO,GAAG,EAAC,MAAM,iBAAiB,CAAC;AAC1C,OAAO,EAAC,SAAS,EAAC,MAAM,iBAAiB,CAAC;AAE1C,OAAO,EAAC,iBAAiB,EAAC,MAAM,eAAe,CAAC;AAEhD;;;GAGG;AACH,MAAM,CAAC,KAAK,SAAS,CAAC,CAAC,yBAAyB,CAC9C,WAAgD,EAChD,KAAmB,EACnB,MAAc,EACd,UAAkB;IAElB,MAAM,EAAC,IAAI,EAAE,aAAa,EAAE,OAAO,EAAC,GAAG,WAAW,CAAC;IAEnD,MAAM,kBAAkB,GAAG,IAAI,CAAC,GAAG,CACjC,KAAK,CAAC,KAAK,CAAC,WAAW,GAAG,KAAK,CAAC,MAAM,CAAC,sCAAsC,EAC7E,uBAAuB,CAAC,KAAK,CAAC,MAAM,CAAC,eAAe,CAAC,CACtD,CAAC;IACF,IAAI,IAAI,GAAG,kBAAkB,EAAE,CAAC;QAC9B,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,uEAAuE,EAAE;YAC1F,IAAI;YACJ,kBAAkB;YAClB,IAAI,EAAE,iBAAiB,CAAC,MAAM,CAAC;YAC/B,MAAM,EAAE,UAAU;SACnB,CAAC,CAAC;QACH,OAAO;IACT,CAAC;IAED,MAAM,oBAAoB,GAAG,KAAK,CAAC,kBAAkB,CAAC,YAAY,CAAC,IAAI,EAAE,SAAS,CAAC,aAAa,CAAC,EAAE,OAAO,CAAC,CAAC;IAE5G,MAAM,QAAQ,GAAG,KAAK,CAAC,MAAM,CAAC,sBAAsB,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC,CAAC;IAC/E,KAAK,MAAM,mBAAmB,IAAI,oBAAoB,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,0BAA0B,CAAC,EAAE,CAAC;QACzG,MAAM;YACJ,IAAI,EAAE,GAAG,CAAC,IAAI,CAAC,mBAAmB,CAAC,SAAS,CAAC,mBAAmB,CAAC;YACjE,QAAQ;SACT,CAAC;IACJ,CAAC;AACH,CAAC"}
@@ -1,38 +0,0 @@
1
- import {Epoch, RootHex, Slot, ValidatorIndex} from "@lodestar/types";
2
- import {GossipActionError} from "./gossipValidation.js";
3
-
4
- export enum InclusionListErrorCode {
5
- EMPTY_TRANSACTIONS = "INCLUSION_LIST_ERROR_EMPTY_TRANSACTIONS",
6
- MAXIMUM_SIZE_EXCEEDED = "INCLUSION_LIST_ERROR_MAXIMUM_SIZE_EXCEEDED",
7
- EMPTY_TRANSACTION = "INCLUSION_LIST_ERROR_EMPTY_TRANSACTION",
8
- INVALID_SLOT = "INCLUSION_LIST_ERROR_INVALID_SLOT",
9
- MORE_THAN_TWO = "INCLUSION_LIST_ERROR_MORE_THAN_TWO",
10
- VALIDATOR_NOT_IN_COMMITTEE = "INCLUSION_LIST_ERROR_VALIDATOR_NOT_IN_COMMITTEE",
11
- UNKNOWN_DEPENDENT_ROOT = "INCLUSION_LIST_ERROR_UNKNOWN_DEPENDENT_ROOT",
12
- INVALID_DEPENDENT_ROOT_SLOT = "INCLUSION_LIST_ERROR_INVALID_DEPENDENT_ROOT_SLOT",
13
- INVALID_DEPENDENT_ROOT = "INCLUSION_LIST_ERROR_INVALID_DEPENDENT_ROOT",
14
- MISSING_SHUFFLING = "INCLUSION_LIST_ERROR_MISSING_SHUFFLING",
15
- INVALID_SIGNATURE = "INCLUSION_LIST_ERROR_INVALID_SIGNATURE",
16
- PRE_HEZE_SLOT = "INCLUSION_LIST_ERROR_PRE_HEZE_SLOT",
17
- }
18
-
19
- export type InclusionListErrorType =
20
- | {code: InclusionListErrorCode.EMPTY_TRANSACTIONS}
21
- | {code: InclusionListErrorCode.MAXIMUM_SIZE_EXCEEDED; totalBytes: number; maxBytes: number}
22
- | {code: InclusionListErrorCode.EMPTY_TRANSACTION; transactionIndex: number}
23
- | {code: InclusionListErrorCode.INVALID_SLOT; inclusionListSlot: Slot; currentSlot: Slot}
24
- | {code: InclusionListErrorCode.MORE_THAN_TWO; validatorIndex: ValidatorIndex}
25
- | {code: InclusionListErrorCode.VALIDATOR_NOT_IN_COMMITTEE; validatorIndex: ValidatorIndex}
26
- | {code: InclusionListErrorCode.UNKNOWN_DEPENDENT_ROOT; dependentRoot: RootHex}
27
- | {
28
- code: InclusionListErrorCode.INVALID_DEPENDENT_ROOT_SLOT;
29
- dependentRoot: RootHex;
30
- dependentSlot: Slot;
31
- maxSlot: Slot;
32
- }
33
- | {code: InclusionListErrorCode.INVALID_DEPENDENT_ROOT; dependentRoot: RootHex; epoch: Epoch}
34
- | {code: InclusionListErrorCode.MISSING_SHUFFLING; dependentRoot: RootHex; epoch: Epoch}
35
- | {code: InclusionListErrorCode.INVALID_SIGNATURE}
36
- | {code: InclusionListErrorCode.PRE_HEZE_SLOT; inclusionListSlot: Slot};
37
-
38
- export class InclusionListError extends GossipActionError<InclusionListErrorType> {}
@@ -1,211 +0,0 @@
1
- import {BitArray, SerializedList} from "@chainsafe/ssz";
2
- import {BeaconConfig} from "@lodestar/config";
3
- import {INCLUSION_LIST_COMMITTEE_SIZE} from "@lodestar/params";
4
- import {RootHex, Slot, ValidatorIndex, bellatrix, heze, ssz} from "@lodestar/types";
5
- import {MapDef, toHex, toRootHex} from "@lodestar/utils";
6
-
7
- export enum InclusionListInsertOutcome {
8
- /** Stored as a new entry. */
9
- New = "New",
10
- /** Slot is older than the prune horizon. */
11
- Old = "Old",
12
- /** Identical inclusion list already stored. */
13
- Seen = "Seen",
14
- /** New equivocation evidence: this validator already has a different inclusion list stored. */
15
- Equivocating = "Equivocating",
16
- /** Validator was already marked as an equivocator for this `(slot, dependent_root)`. */
17
- SubsequentEquivocation = "SubsequentEquivocation",
18
- }
19
-
20
- type InclusionListEntry = {
21
- signedInclusionList: heze.SignedInclusionList;
22
- /** Positions of the validator in `get_inclusion_list_committee(state, slot)`, several when the committee cycles */
23
- committeeIndices: number[];
24
- /** Received before the inclusion list deadline of its slot. */
25
- timely: boolean;
26
- };
27
-
28
- /**
29
- * Spec `InclusionListStore`: inclusion lists keyed by `(slot, dependent_root)`, one per validator index.
30
- * The committee position is recorded at insert time (gossip validation resolves it) so the bit-oriented
31
- * reads need no shuffling lookup. Signed lists are kept so InclusionListsByIndices can serve them.
32
- * A validator's first list stays stored and an equivocation marks the validator so reads skip it.
33
- */
34
- export class InclusionListStore {
35
- /** slot -> dependent_root -> validator index -> entry */
36
- private readonly inclusionLists = new MapDef<Slot, MapDef<RootHex, Map<ValidatorIndex, InclusionListEntry>>>(
37
- () => new MapDef<RootHex, Map<ValidatorIndex, InclusionListEntry>>(() => new Map())
38
- );
39
- /** slot -> dependent_root -> equivocating validator indices */
40
- private readonly equivocators = new MapDef<Slot, MapDef<RootHex, Set<ValidatorIndex>>>(
41
- () => new MapDef<RootHex, Set<ValidatorIndex>>(() => new Set())
42
- );
43
- /** slot -> dependent_root -> validator index -> count, for the p2p "first or second message" rule */
44
- private readonly seenCounts = new MapDef<Slot, MapDef<RootHex, Map<ValidatorIndex, number>>>(
45
- () => new MapDef<RootHex, Map<ValidatorIndex, number>>(() => new Map())
46
- );
47
-
48
- private lowestPermissibleSlot = 0;
49
-
50
- constructor(private readonly config: BeaconConfig) {}
51
-
52
- get size(): number {
53
- let count = 0;
54
- for (const byDependentRoot of this.inclusionLists.values()) {
55
- for (const entries of byDependentRoot.values()) {
56
- count += entries.size;
57
- }
58
- }
59
- return count;
60
- }
61
-
62
- /**
63
- * Late lists are stored with `timely=false` rather than dropped: they still count toward the
64
- * non-timely view used to validate another node's `inclusion_list_bits`.
65
- */
66
- process(
67
- signedInclusionList: heze.SignedInclusionList,
68
- committeeIndices: number[],
69
- timely: boolean
70
- ): InclusionListInsertOutcome {
71
- const inclusionList = signedInclusionList.message;
72
- const {slot, validatorIndex} = inclusionList;
73
-
74
- if (slot < this.lowestPermissibleSlot) {
75
- return InclusionListInsertOutcome.Old;
76
- }
77
-
78
- const dependentRoot = toRootHex(inclusionList.dependentRoot);
79
- const stored = this.inclusionLists.getOrDefault(slot).getOrDefault(dependentRoot);
80
-
81
- const entry = stored.get(validatorIndex);
82
- if (entry !== undefined) {
83
- if (ssz.heze.InclusionList.equals(entry.signedInclusionList.message, inclusionList)) {
84
- return InclusionListInsertOutcome.Seen;
85
- }
86
- const equivocators = this.equivocators.getOrDefault(slot).getOrDefault(dependentRoot);
87
- if (equivocators.has(validatorIndex)) {
88
- return InclusionListInsertOutcome.SubsequentEquivocation;
89
- }
90
- equivocators.add(validatorIndex);
91
- return InclusionListInsertOutcome.Equivocating;
92
- }
93
-
94
- stored.set(validatorIndex, {signedInclusionList, committeeIndices, timely});
95
- return InclusionListInsertOutcome.New;
96
- }
97
-
98
- /** Count a valid message of `validatorIndex` for the first-or-second message gossip rule */
99
- markSeen(slot: Slot, dependentRoot: RootHex, validatorIndex: ValidatorIndex): void {
100
- const counts = this.seenCounts.getOrDefault(slot).getOrDefault(dependentRoot);
101
- counts.set(validatorIndex, (counts.get(validatorIndex) ?? 0) + 1);
102
- }
103
-
104
- /** Gossip rule: at most two valid messages per validator for a `(slot, dependent_root)` */
105
- seenTwice(slot: Slot, dependentRoot: RootHex, validatorIndex: ValidatorIndex): boolean {
106
- return (this.seenCounts.get(slot)?.get(dependentRoot)?.get(validatorIndex) ?? 0) >= 2;
107
- }
108
-
109
- /** Deduplicated transactions from valid, non-equivocating inclusion lists at `(slot, dependentRoot)`. */
110
- getInclusionListTransactions(slot: Slot, dependentRoot: RootHex, onlyTimely = true): bellatrix.Transactions {
111
- const transactions: Uint8Array[] = [];
112
- const seen = new Set<string>();
113
-
114
- for (const {signedInclusionList} of this.getEligible(slot, dependentRoot, onlyTimely)) {
115
- for (const transaction of signedInclusionList.message.transactions) {
116
- const key = toHex(transaction);
117
- if (!seen.has(key)) {
118
- seen.add(key);
119
- transactions.push(transaction);
120
- }
121
- }
122
- }
123
-
124
- return SerializedList.fromArray(transactions);
125
- }
126
-
127
- /** Bit `i` is set when committee member `i` submitted a valid, non-equivocating inclusion list */
128
- getInclusionListBits(slot: Slot, dependentRoot: RootHex, onlyTimely = true): BitArray {
129
- const bits = BitArray.fromBitLen(INCLUSION_LIST_COMMITTEE_SIZE);
130
- for (const {committeeIndices} of this.getEligible(slot, dependentRoot, onlyTimely)) {
131
- for (const committeeIndex of committeeIndices) {
132
- bits.set(committeeIndex, true);
133
- }
134
- }
135
- return bits;
136
- }
137
-
138
- /**
139
- * True if `bits` has a bit set for every bit set in the local inclusion list bits.
140
- *
141
- * Intentionally deviates from the spec by only checking against timely lists, where the proposer would check
142
- * against every list it observed (only_timely=False in
143
- * https://github.com/ethereum/consensus-specs/blob/v1.7.0-beta.4/specs/heze/validator.md#signed-execution-payload-bid).
144
- * A bid that passed gossip must stay eligible, otherwise a list released after the deadline voids every bid and
145
- * a high early bid with empty bits crowds out the rest without ever paying.
146
- */
147
- isInclusionListBitsInclusive(slot: Slot, dependentRoot: RootHex, bits: BitArray): boolean {
148
- for (const {committeeIndices} of this.getEligible(slot, dependentRoot, true)) {
149
- if (committeeIndices.some((committeeIndex) => !bits.get(committeeIndex))) {
150
- return false;
151
- }
152
- }
153
- return true;
154
- }
155
-
156
- /** Inclusion lists for the given committee positions, to serve InclusionListsByIndices. */
157
- getByIndices(slot: Slot, dependentRoot: RootHex, indices: BitArray): heze.SignedInclusionList[] {
158
- const out: heze.SignedInclusionList[] = [];
159
- for (const {signedInclusionList, committeeIndices} of this.getEligible(slot, dependentRoot, false)) {
160
- if (committeeIndices.some((committeeIndex) => indices.get(committeeIndex))) {
161
- out.push(signedInclusionList);
162
- }
163
- }
164
- return out;
165
- }
166
-
167
- /**
168
- * Lists are kept one slot past the MIN_SLOTS_FOR_INCLUSION_LISTS_REQUESTS serving window, the lists of slot N are
169
- * read when the payload of slot N + 1 is processed, which may happen during slot N + 2
170
- */
171
- prune(clockSlot: Slot): void {
172
- const horizon = clockSlot - this.config.MIN_SLOTS_FOR_INCLUSION_LISTS_REQUESTS - 1;
173
-
174
- for (const slot of this.inclusionLists.keys()) {
175
- if (slot < horizon) {
176
- this.inclusionLists.delete(slot);
177
- }
178
- }
179
- for (const slot of this.equivocators.keys()) {
180
- if (slot < horizon) {
181
- this.equivocators.delete(slot);
182
- }
183
- }
184
- for (const slot of this.seenCounts.keys()) {
185
- if (slot < horizon) {
186
- this.seenCounts.delete(slot);
187
- }
188
- }
189
-
190
- this.lowestPermissibleSlot = Math.max(horizon, 0);
191
- }
192
-
193
- /** Entries at `(slot, dependentRoot)` from non-equivocating validators, timely when required. */
194
- private *getEligible(slot: Slot, dependentRoot: RootHex, onlyTimely: boolean): Generator<InclusionListEntry> {
195
- const stored = this.inclusionLists.get(slot)?.get(dependentRoot);
196
- if (!stored || stored.size === 0) {
197
- return;
198
- }
199
- const equivocators = this.equivocators.get(slot)?.get(dependentRoot);
200
-
201
- for (const [validatorIndex, entry] of stored) {
202
- if (equivocators?.has(validatorIndex)) {
203
- continue;
204
- }
205
- if (onlyTimely && !entry.timely) {
206
- continue;
207
- }
208
- yield entry;
209
- }
210
- }
211
- }
@@ -1,192 +0,0 @@
1
- import {ProtoBlock} from "@lodestar/fork-choice";
2
- import {GENESIS_SLOT, MIN_SEED_LOOKAHEAD, isForkPostHeze} from "@lodestar/params";
3
- import {
4
- EpochShuffling,
5
- computeEpochAtSlot,
6
- computeStartSlotAtEpoch,
7
- getInclusionListCommittee,
8
- getInclusionListSignatureSet,
9
- } from "@lodestar/state-transition";
10
- import {Epoch, RootHex, heze} from "@lodestar/types";
11
- import {toRootHex} from "@lodestar/utils";
12
- import {InclusionListError, InclusionListErrorCode} from "../errors/inclusionList.js";
13
- import {GossipAction} from "../errors/index.js";
14
- import {IBeaconChain} from "../interface.js";
15
- import {RegenCaller} from "../regen/index.js";
16
- import {isValidDependentRoot} from "./proposerPreferences.js";
17
-
18
- export type InclusionListValidationResult = {
19
- /** Positions of `validator_index` in `get_inclusion_list_committee(state, slot)`, several when the committee cycles */
20
- committeeIndices: number[];
21
- /** Sum of the byte lengths of `message.transactions` */
22
- totalBytes: number;
23
- };
24
-
25
- /**
26
- * Gossip validation for the `inclusion_list` topic, in spec rule order. Also applied to inclusion lists
27
- * submitted over the API before they are published.
28
- */
29
- export async function validateGossipInclusionList(
30
- chain: IBeaconChain,
31
- signedInclusionList: heze.SignedInclusionList
32
- ): Promise<InclusionListValidationResult> {
33
- const {slot, validatorIndex, transactions, dependentRoot} = signedInclusionList.message;
34
- let totalBytes = 0;
35
- for (let i = 0; i < transactions.length; i++) {
36
- totalBytes += transactions.getSize(i);
37
- }
38
-
39
- // A pre-heze slot has no inclusion list committee to validate against
40
- if (!isForkPostHeze(chain.config.getForkName(slot))) {
41
- throw new InclusionListError(GossipAction.IGNORE, {
42
- code: InclusionListErrorCode.PRE_HEZE_SLOT,
43
- inclusionListSlot: slot,
44
- });
45
- }
46
-
47
- // [IGNORE] The message is either the first or second valid message received from validatorIndex
48
- // for (message.slot, message.dependent_root)
49
- const dependentRootHex = toRootHex(dependentRoot);
50
- if (chain.inclusionListStore.seenTwice(slot, dependentRootHex, validatorIndex)) {
51
- throw new InclusionListError(GossipAction.IGNORE, {
52
- code: InclusionListErrorCode.MORE_THAN_TWO,
53
- validatorIndex,
54
- });
55
- }
56
-
57
- // [IGNORE] message.slot is equal to the current slot, with a MAXIMUM_GOSSIP_CLOCK_DISPARITY allowance
58
- if (!chain.clock.isCurrentSlotGivenGossipDisparity(slot)) {
59
- throw new InclusionListError(GossipAction.IGNORE, {
60
- code: InclusionListErrorCode.INVALID_SLOT,
61
- inclusionListSlot: slot,
62
- currentSlot: chain.clock.currentSlot,
63
- });
64
- }
65
-
66
- // [IGNORE] The size of message.transactions is greater than 0
67
- if (totalBytes === 0) {
68
- throw new InclusionListError(GossipAction.IGNORE, {code: InclusionListErrorCode.EMPTY_TRANSACTIONS});
69
- }
70
-
71
- // [REJECT] The size of message.transactions is within upperbound MAX_TRANSACTIONS_BYTES_PER_INCLUSION_LIST
72
- if (totalBytes > chain.config.MAX_TRANSACTIONS_BYTES_PER_INCLUSION_LIST) {
73
- throw new InclusionListError(GossipAction.REJECT, {
74
- code: InclusionListErrorCode.MAXIMUM_SIZE_EXCEEDED,
75
- totalBytes,
76
- maxBytes: chain.config.MAX_TRANSACTIONS_BYTES_PER_INCLUSION_LIST,
77
- });
78
- }
79
-
80
- // [REJECT] Every transaction in message.transactions is non-empty
81
- let emptyTransactionIndex = -1;
82
- for (let i = 0; i < transactions.length; i++) {
83
- if (transactions.getSize(i) === 0) {
84
- emptyTransactionIndex = i;
85
- break;
86
- }
87
- }
88
- if (emptyTransactionIndex !== -1) {
89
- throw new InclusionListError(GossipAction.REJECT, {
90
- code: InclusionListErrorCode.EMPTY_TRANSACTION,
91
- transactionIndex: emptyTransactionIndex,
92
- });
93
- }
94
-
95
- // [IGNORE] The block with root message.dependent_root has been seen
96
- const dependentBlock = chain.forkChoice.getBlockHexDefaultStatus(dependentRootHex);
97
- if (dependentBlock === null) {
98
- throw new InclusionListError(GossipAction.IGNORE, {
99
- code: InclusionListErrorCode.UNKNOWN_DEPENDENT_ROOT,
100
- dependentRoot: dependentRootHex,
101
- });
102
- }
103
-
104
- // [REJECT] The slot of the block with root message.dependent_root is strictly less than
105
- // compute_start_slot_at_epoch(compute_epoch_at_slot(message.slot) - MIN_SEED_LOOKAHEAD),
106
- // clamped to genesis like compute_shuffling_dependent_slot
107
- const epoch = computeEpochAtSlot(slot);
108
- const dependentEpoch = epoch - MIN_SEED_LOOKAHEAD;
109
- const maxDependentSlot = Math.max(GENESIS_SLOT, computeStartSlotAtEpoch(dependentEpoch) - 1);
110
- if (dependentBlock.slot > maxDependentSlot) {
111
- throw new InclusionListError(GossipAction.REJECT, {
112
- code: InclusionListErrorCode.INVALID_DEPENDENT_ROOT_SLOT,
113
- dependentRoot: dependentRootHex,
114
- dependentSlot: dependentBlock.slot,
115
- maxSlot: maxDependentSlot,
116
- });
117
- }
118
-
119
- // [IGNORE] is_valid_dependent_root(store, message.dependent_root, epoch - MIN_SEED_LOOKAHEAD)
120
- if (!isValidDependentRoot(chain.forkChoice, dependentBlock, dependentEpoch)) {
121
- throw new InclusionListError(GossipAction.IGNORE, {
122
- code: InclusionListErrorCode.INVALID_DEPENDENT_ROOT,
123
- dependentRoot: dependentRootHex,
124
- epoch: dependentEpoch,
125
- });
126
- }
127
-
128
- // [REJECT] validatorIndex is in get_inclusion_list_committee(state, message.slot), where state is the
129
- // state of the block with root message.dependent_root, i.e. the shuffling of `epoch` keyed by `dependent_root`
130
- const shuffling = await getShuffling(chain, epoch, dependentRootHex, dependentBlock);
131
- if (shuffling === null) {
132
- throw new InclusionListError(GossipAction.IGNORE, {
133
- code: InclusionListErrorCode.MISSING_SHUFFLING,
134
- dependentRoot: dependentRootHex,
135
- epoch,
136
- });
137
- }
138
- const committeeIndices = getInclusionListCommittee(shuffling, slot).getCommitteeIndices(validatorIndex);
139
- if (committeeIndices.length === 0) {
140
- throw new InclusionListError(GossipAction.REJECT, {
141
- code: InclusionListErrorCode.VALIDATOR_NOT_IN_COMMITTEE,
142
- validatorIndex,
143
- });
144
- }
145
-
146
- // [REJECT] The signature is valid with respect to the validator's public key
147
- // Domain from the list's own slot, so a list for the first Heze slot verifies while the clock is still in Gloas
148
- const signatureSet = getInclusionListSignatureSet(chain.config, slot, signedInclusionList);
149
- // With only 16 inclusion list committee members per slot, batching can delay gossip by 100ms.
150
- // Verify without batching so inclusion lists can be forwarded sooner.
151
- if (!(await chain.bls.verifySignatureSets([signatureSet], {batchable: false}))) {
152
- throw new InclusionListError(GossipAction.REJECT, {code: InclusionListErrorCode.INVALID_SIGNATURE});
153
- }
154
-
155
- // Check again after the async validation so concurrent lists of the same validator cannot all pass
156
- if (chain.inclusionListStore.seenTwice(slot, dependentRootHex, validatorIndex)) {
157
- throw new InclusionListError(GossipAction.IGNORE, {
158
- code: InclusionListErrorCode.MORE_THAN_TWO,
159
- validatorIndex,
160
- });
161
- }
162
- chain.inclusionListStore.markSeen(slot, dependentRootHex, validatorIndex);
163
-
164
- return {committeeIndices, totalBytes};
165
- }
166
-
167
- /**
168
- * The shuffling of `epoch` on the branch of `dependentBlock`. Usually cached from the head state; when the
169
- * dependent block is the head across empty epochs that state has not reached the lookahead start slot, so
170
- * the spec's `process_slots` step is a state regen
171
- */
172
- async function getShuffling(
173
- chain: IBeaconChain,
174
- epoch: Epoch,
175
- dependentRootHex: RootHex,
176
- dependentBlock: ProtoBlock
177
- ): Promise<EpochShuffling | null> {
178
- const cached = await chain.shufflingCache.get(epoch, dependentRootHex);
179
- if (cached !== null) {
180
- return cached;
181
- }
182
- try {
183
- return await chain.regenStateForAttestationVerification(
184
- epoch,
185
- dependentRootHex,
186
- dependentBlock,
187
- RegenCaller.validateGossipInclusionList
188
- );
189
- } catch {
190
- return null;
191
- }
192
- }