@lodestar/beacon-node 1.46.0-dev.2063820a22 → 1.46.0-dev.3d8f7cf440

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 (597) hide show
  1. package/lib/api/impl/api.js.map +1 -1
  2. package/lib/api/impl/beacon/blocks/index.d.ts +1 -1
  3. package/lib/api/impl/beacon/blocks/index.d.ts.map +1 -1
  4. package/lib/api/impl/beacon/blocks/index.js +37 -15
  5. package/lib/api/impl/beacon/blocks/index.js.map +1 -1
  6. package/lib/api/impl/beacon/blocks/utils.js.map +1 -1
  7. package/lib/api/impl/beacon/index.js.map +1 -1
  8. package/lib/api/impl/beacon/pool/index.d.ts +1 -1
  9. package/lib/api/impl/beacon/pool/index.d.ts.map +1 -1
  10. package/lib/api/impl/beacon/pool/index.js.map +1 -1
  11. package/lib/api/impl/beacon/rewards/index.d.ts +1 -1
  12. package/lib/api/impl/beacon/rewards/index.d.ts.map +1 -1
  13. package/lib/api/impl/beacon/rewards/index.js.map +1 -1
  14. package/lib/api/impl/beacon/state/index.d.ts +1 -1
  15. package/lib/api/impl/beacon/state/index.d.ts.map +1 -1
  16. package/lib/api/impl/beacon/state/index.js.map +1 -1
  17. package/lib/api/impl/beacon/state/utils.js.map +1 -1
  18. package/lib/api/impl/config/constants.d.ts +1 -0
  19. package/lib/api/impl/config/constants.d.ts.map +1 -1
  20. package/lib/api/impl/config/constants.js +3 -1
  21. package/lib/api/impl/config/constants.js.map +1 -1
  22. package/lib/api/impl/config/index.js.map +1 -1
  23. package/lib/api/impl/debug/index.d.ts +1 -1
  24. package/lib/api/impl/debug/index.d.ts.map +1 -1
  25. package/lib/api/impl/debug/index.js.map +1 -1
  26. package/lib/api/impl/errors.js.map +1 -1
  27. package/lib/api/impl/events/index.d.ts +1 -1
  28. package/lib/api/impl/events/index.d.ts.map +1 -1
  29. package/lib/api/impl/events/index.js.map +1 -1
  30. package/lib/api/impl/lightclient/index.d.ts +1 -1
  31. package/lib/api/impl/lightclient/index.d.ts.map +1 -1
  32. package/lib/api/impl/lightclient/index.js.map +1 -1
  33. package/lib/api/impl/lodestar/attesterSlashing.js.map +1 -1
  34. package/lib/api/impl/lodestar/index.d.ts +1 -1
  35. package/lib/api/impl/lodestar/index.d.ts.map +1 -1
  36. package/lib/api/impl/lodestar/index.js.map +1 -1
  37. package/lib/api/impl/node/index.js.map +1 -1
  38. package/lib/api/impl/node/utils.js.map +1 -1
  39. package/lib/api/impl/proof/index.js.map +1 -1
  40. package/lib/api/impl/utils.js.map +1 -1
  41. package/lib/api/impl/validator/index.d.ts.map +1 -1
  42. package/lib/api/impl/validator/index.js +17 -10
  43. package/lib/api/impl/validator/index.js.map +1 -1
  44. package/lib/api/impl/validator/utils.d.ts +1 -1
  45. package/lib/api/impl/validator/utils.d.ts.map +1 -1
  46. package/lib/api/impl/validator/utils.js.map +1 -1
  47. package/lib/api/rest/activeSockets.js.map +1 -1
  48. package/lib/api/rest/base.js.map +1 -1
  49. package/lib/api/rest/index.js.map +1 -1
  50. package/lib/api/rest/swaggerUI.js.map +1 -1
  51. package/lib/chain/ColumnReconstructionTracker.js.map +1 -1
  52. package/lib/chain/GetBlobsTracker.js.map +1 -1
  53. package/lib/chain/archiveStore/archiveStore.js +1 -2
  54. package/lib/chain/archiveStore/archiveStore.js.map +1 -1
  55. package/lib/chain/archiveStore/historicalState/getHistoricalState.js.map +1 -1
  56. package/lib/chain/archiveStore/historicalState/historicalStateRegen.js.map +1 -1
  57. package/lib/chain/archiveStore/historicalState/metrics.js.map +1 -1
  58. package/lib/chain/archiveStore/historicalState/types.js +1 -2
  59. package/lib/chain/archiveStore/historicalState/types.js.map +1 -1
  60. package/lib/chain/archiveStore/historicalState/worker.js.map +1 -1
  61. package/lib/chain/archiveStore/interface.js +1 -2
  62. package/lib/chain/archiveStore/interface.js.map +1 -1
  63. package/lib/chain/archiveStore/strategies/frequencyStateArchiveStrategy.d.ts.map +1 -1
  64. package/lib/chain/archiveStore/strategies/frequencyStateArchiveStrategy.js +1 -2
  65. package/lib/chain/archiveStore/strategies/frequencyStateArchiveStrategy.js.map +1 -1
  66. package/lib/chain/archiveStore/utils/archiveBlocks.js.map +1 -1
  67. package/lib/chain/archiveStore/utils/pruneHistory.js.map +1 -1
  68. package/lib/chain/archiveStore/utils/updateBackfillRange.js.map +1 -1
  69. package/lib/chain/balancesCache.js.map +1 -1
  70. package/lib/chain/beaconProposerCache.js.map +1 -1
  71. package/lib/chain/blocks/blockInput/blockInput.d.ts.map +1 -1
  72. package/lib/chain/blocks/blockInput/blockInput.js.map +1 -1
  73. package/lib/chain/blocks/blockInput/errors.js +1 -2
  74. package/lib/chain/blocks/blockInput/errors.js.map +1 -1
  75. package/lib/chain/blocks/blockInput/types.js +2 -4
  76. package/lib/chain/blocks/blockInput/types.js.map +1 -1
  77. package/lib/chain/blocks/blockInput/utils.js.map +1 -1
  78. package/lib/chain/blocks/importBlock.d.ts.map +1 -1
  79. package/lib/chain/blocks/importBlock.js +3 -3
  80. package/lib/chain/blocks/importBlock.js.map +1 -1
  81. package/lib/chain/blocks/importExecutionPayload.d.ts.map +1 -1
  82. package/lib/chain/blocks/importExecutionPayload.js +4 -6
  83. package/lib/chain/blocks/importExecutionPayload.js.map +1 -1
  84. package/lib/chain/blocks/index.d.ts.map +1 -1
  85. package/lib/chain/blocks/index.js +6 -0
  86. package/lib/chain/blocks/index.js.map +1 -1
  87. package/lib/chain/blocks/payloadEnvelopeInput/payloadEnvelopeInput.js.map +1 -1
  88. package/lib/chain/blocks/payloadEnvelopeInput/types.js +1 -2
  89. package/lib/chain/blocks/payloadEnvelopeInput/types.js.map +1 -1
  90. package/lib/chain/blocks/payloadEnvelopeProcessor.js.map +1 -1
  91. package/lib/chain/blocks/types.js +3 -6
  92. package/lib/chain/blocks/types.js.map +1 -1
  93. package/lib/chain/blocks/utils/chainSegment.d.ts.map +1 -1
  94. package/lib/chain/blocks/utils/chainSegment.js +31 -25
  95. package/lib/chain/blocks/utils/chainSegment.js.map +1 -1
  96. package/lib/chain/blocks/utils/checkpoint.js.map +1 -1
  97. package/lib/chain/blocks/utils/polarBearBanner.d.ts +2 -0
  98. package/lib/chain/blocks/utils/polarBearBanner.d.ts.map +1 -0
  99. package/lib/chain/blocks/utils/polarBearBanner.js +51 -0
  100. package/lib/chain/blocks/utils/polarBearBanner.js.map +1 -0
  101. package/lib/chain/blocks/verifyBlock.d.ts.map +1 -1
  102. package/lib/chain/blocks/verifyBlock.js +12 -0
  103. package/lib/chain/blocks/verifyBlock.js.map +1 -1
  104. package/lib/chain/blocks/verifyBlocksDataAvailability.js.map +1 -1
  105. package/lib/chain/blocks/verifyBlocksExecutionPayloads.js.map +1 -1
  106. package/lib/chain/blocks/verifyBlocksSanityChecks.js.map +1 -1
  107. package/lib/chain/blocks/verifyBlocksSignatures.js.map +1 -1
  108. package/lib/chain/blocks/verifyBlocksStateTransitionOnly.js.map +1 -1
  109. package/lib/chain/blocks/verifyExecutionPayloadEnvelope.js.map +1 -1
  110. package/lib/chain/blocks/verifyPayloadsDataAvailability.js.map +1 -1
  111. package/lib/chain/blocks/writeBlockInputToDb.js.map +1 -1
  112. package/lib/chain/blocks/writePayloadEnvelopeInputToDb.js.map +1 -1
  113. package/lib/chain/bls/maybeBatch.js.map +1 -1
  114. package/lib/chain/bls/multithread/index.js.map +1 -1
  115. package/lib/chain/bls/multithread/jobItem.js +1 -2
  116. package/lib/chain/bls/multithread/jobItem.js.map +1 -1
  117. package/lib/chain/bls/multithread/types.js +1 -2
  118. package/lib/chain/bls/multithread/types.js.map +1 -1
  119. package/lib/chain/bls/multithread/utils.js.map +1 -1
  120. package/lib/chain/bls/multithread/worker.js.map +1 -1
  121. package/lib/chain/bls/singleThread.js.map +1 -1
  122. package/lib/chain/bls/utils.js.map +1 -1
  123. package/lib/chain/builderCircuitBreaker.js.map +1 -1
  124. package/lib/chain/chain.d.ts +2 -2
  125. package/lib/chain/chain.d.ts.map +1 -1
  126. package/lib/chain/chain.js.map +1 -1
  127. package/lib/chain/emitter.d.ts +1 -1
  128. package/lib/chain/emitter.d.ts.map +1 -1
  129. package/lib/chain/emitter.js +1 -2
  130. package/lib/chain/emitter.js.map +1 -1
  131. package/lib/chain/errors/attestationError.js +1 -2
  132. package/lib/chain/errors/attestationError.js.map +1 -1
  133. package/lib/chain/errors/attesterSlashingError.js +1 -2
  134. package/lib/chain/errors/attesterSlashingError.js.map +1 -1
  135. package/lib/chain/errors/blobSidecarError.js +1 -2
  136. package/lib/chain/errors/blobSidecarError.js.map +1 -1
  137. package/lib/chain/errors/blockError.js +1 -2
  138. package/lib/chain/errors/blockError.js.map +1 -1
  139. package/lib/chain/errors/blsToExecutionChangeError.js +1 -2
  140. package/lib/chain/errors/blsToExecutionChangeError.js.map +1 -1
  141. package/lib/chain/errors/dataColumnSidecarError.js +1 -2
  142. package/lib/chain/errors/dataColumnSidecarError.js.map +1 -1
  143. package/lib/chain/errors/executionPayloadBid.js +1 -2
  144. package/lib/chain/errors/executionPayloadBid.js.map +1 -1
  145. package/lib/chain/errors/executionPayloadEnvelope.js +1 -2
  146. package/lib/chain/errors/executionPayloadEnvelope.js.map +1 -1
  147. package/lib/chain/errors/gossipValidation.js +2 -4
  148. package/lib/chain/errors/gossipValidation.js.map +1 -1
  149. package/lib/chain/errors/lightClientError.js +2 -4
  150. package/lib/chain/errors/lightClientError.js.map +1 -1
  151. package/lib/chain/errors/payloadAttestation.js +1 -2
  152. package/lib/chain/errors/payloadAttestation.js.map +1 -1
  153. package/lib/chain/errors/proposerPreferences.js +1 -2
  154. package/lib/chain/errors/proposerPreferences.js.map +1 -1
  155. package/lib/chain/errors/proposerSlashingError.js +1 -2
  156. package/lib/chain/errors/proposerSlashingError.js.map +1 -1
  157. package/lib/chain/errors/syncCommitteeError.js +1 -2
  158. package/lib/chain/errors/syncCommitteeError.js.map +1 -1
  159. package/lib/chain/errors/voluntaryExitError.js +1 -2
  160. package/lib/chain/errors/voluntaryExitError.js.map +1 -1
  161. package/lib/chain/forkChoice/index.js +1 -2
  162. package/lib/chain/forkChoice/index.js.map +1 -1
  163. package/lib/chain/initState.d.ts +1 -1
  164. package/lib/chain/initState.d.ts.map +1 -1
  165. package/lib/chain/initState.js.map +1 -1
  166. package/lib/chain/interface.js +1 -2
  167. package/lib/chain/interface.js.map +1 -1
  168. package/lib/chain/lightClient/index.d.ts +29 -0
  169. package/lib/chain/lightClient/index.d.ts.map +1 -1
  170. package/lib/chain/lightClient/index.js.map +1 -1
  171. package/lib/chain/lightClient/proofs.js.map +1 -1
  172. package/lib/chain/opPools/aggregatedAttestationPool.js +3 -5
  173. package/lib/chain/opPools/aggregatedAttestationPool.js.map +1 -1
  174. package/lib/chain/opPools/attestationPool.js.map +1 -1
  175. package/lib/chain/opPools/executionPayloadBidPool.js.map +1 -1
  176. package/lib/chain/opPools/opPool.js.map +1 -1
  177. package/lib/chain/opPools/payloadAttestationPool.js.map +1 -1
  178. package/lib/chain/opPools/proposerPreferencesPool.js.map +1 -1
  179. package/lib/chain/opPools/syncCommitteeMessagePool.js.map +1 -1
  180. package/lib/chain/opPools/syncContributionAndProofPool.js.map +1 -1
  181. package/lib/chain/opPools/types.js +2 -4
  182. package/lib/chain/opPools/types.js.map +1 -1
  183. package/lib/chain/opPools/utils.js.map +1 -1
  184. package/lib/chain/prepareNextSlot.d.ts +2 -1
  185. package/lib/chain/prepareNextSlot.d.ts.map +1 -1
  186. package/lib/chain/prepareNextSlot.js +107 -29
  187. package/lib/chain/prepareNextSlot.js.map +1 -1
  188. package/lib/chain/produceBlock/computeNewStateRoot.js.map +1 -1
  189. package/lib/chain/produceBlock/produceBlockBody.d.ts +1 -1
  190. package/lib/chain/produceBlock/produceBlockBody.d.ts.map +1 -1
  191. package/lib/chain/produceBlock/produceBlockBody.js +18 -12
  192. package/lib/chain/produceBlock/produceBlockBody.js.map +1 -1
  193. package/lib/chain/produceBlock/validateBlobsAndKzgCommitments.js.map +1 -1
  194. package/lib/chain/regen/errors.js +1 -2
  195. package/lib/chain/regen/errors.js.map +1 -1
  196. package/lib/chain/regen/interface.js +2 -4
  197. package/lib/chain/regen/interface.js.map +1 -1
  198. package/lib/chain/regen/queued.js.map +1 -1
  199. package/lib/chain/regen/regen.js.map +1 -1
  200. package/lib/chain/reprocess.js +1 -2
  201. package/lib/chain/reprocess.js.map +1 -1
  202. package/lib/chain/seenCache/seenAggregateAndProof.js.map +1 -1
  203. package/lib/chain/seenCache/seenAttestationData.js +1 -2
  204. package/lib/chain/seenCache/seenAttestationData.js.map +1 -1
  205. package/lib/chain/seenCache/seenAttesters.js.map +1 -1
  206. package/lib/chain/seenCache/seenBlockAttesters.js.map +1 -1
  207. package/lib/chain/seenCache/seenBlockProposers.d.ts +15 -4
  208. package/lib/chain/seenCache/seenBlockProposers.d.ts.map +1 -1
  209. package/lib/chain/seenCache/seenBlockProposers.js +35 -2
  210. package/lib/chain/seenCache/seenBlockProposers.js.map +1 -1
  211. package/lib/chain/seenCache/seenCommittee.js.map +1 -1
  212. package/lib/chain/seenCache/seenCommitteeContribution.js.map +1 -1
  213. package/lib/chain/seenCache/seenExecutionPayloadBids.js.map +1 -1
  214. package/lib/chain/seenCache/seenGossipBlockInput.d.ts +3 -3
  215. package/lib/chain/seenCache/seenGossipBlockInput.d.ts.map +1 -1
  216. package/lib/chain/seenCache/seenGossipBlockInput.js.map +1 -1
  217. package/lib/chain/seenCache/seenPayloadEnvelopeInput.d.ts +1 -1
  218. package/lib/chain/seenCache/seenPayloadEnvelopeInput.d.ts.map +1 -1
  219. package/lib/chain/seenCache/seenPayloadEnvelopeInput.js.map +1 -1
  220. package/lib/chain/serializeState.js.map +1 -1
  221. package/lib/chain/shufflingCache.js +1 -2
  222. package/lib/chain/shufflingCache.js.map +1 -1
  223. package/lib/chain/stateCache/datastore/db.js.map +1 -1
  224. package/lib/chain/stateCache/datastore/file.js.map +1 -1
  225. package/lib/chain/stateCache/fifoBlockStateCache.js.map +1 -1
  226. package/lib/chain/stateCache/mapMetrics.js.map +1 -1
  227. package/lib/chain/stateCache/persistentCheckpointsCache.d.ts +45 -1
  228. package/lib/chain/stateCache/persistentCheckpointsCache.d.ts.map +1 -1
  229. package/lib/chain/stateCache/persistentCheckpointsCache.js.map +1 -1
  230. package/lib/chain/stateCache/types.js +1 -2
  231. package/lib/chain/stateCache/types.js.map +1 -1
  232. package/lib/chain/validation/aggregateAndProof.js.map +1 -1
  233. package/lib/chain/validation/attestation.js.map +1 -1
  234. package/lib/chain/validation/attesterSlashing.js.map +1 -1
  235. package/lib/chain/validation/blobSidecar.js.map +1 -1
  236. package/lib/chain/validation/block.d.ts +4 -1
  237. package/lib/chain/validation/block.d.ts.map +1 -1
  238. package/lib/chain/validation/block.js +26 -15
  239. package/lib/chain/validation/block.js.map +1 -1
  240. package/lib/chain/validation/blsToExecutionChange.js.map +1 -1
  241. package/lib/chain/validation/dataColumnSidecar.d.ts.map +1 -1
  242. package/lib/chain/validation/dataColumnSidecar.js +21 -16
  243. package/lib/chain/validation/dataColumnSidecar.js.map +1 -1
  244. package/lib/chain/validation/executionPayloadBid.d.ts.map +1 -1
  245. package/lib/chain/validation/executionPayloadBid.js +7 -5
  246. package/lib/chain/validation/executionPayloadBid.js.map +1 -1
  247. package/lib/chain/validation/executionPayloadEnvelope.js.map +1 -1
  248. package/lib/chain/validation/lightClientFinalityUpdate.js.map +1 -1
  249. package/lib/chain/validation/lightClientOptimisticUpdate.js.map +1 -1
  250. package/lib/chain/validation/payloadAttestationMessage.js.map +1 -1
  251. package/lib/chain/validation/proposerPreferences.js.map +1 -1
  252. package/lib/chain/validation/proposerSlashing.js.map +1 -1
  253. package/lib/chain/validation/signatureSets/aggregateAndProof.js.map +1 -1
  254. package/lib/chain/validation/signatureSets/contributionAndProof.js.map +1 -1
  255. package/lib/chain/validation/signatureSets/selectionProof.js.map +1 -1
  256. package/lib/chain/validation/signatureSets/syncCommittee.js.map +1 -1
  257. package/lib/chain/validation/signatureSets/syncCommitteeContribution.js.map +1 -1
  258. package/lib/chain/validation/signatureSets/syncCommitteeSelectionProof.js.map +1 -1
  259. package/lib/chain/validation/syncCommittee.js.map +1 -1
  260. package/lib/chain/validation/syncCommitteeContributionAndProof.js.map +1 -1
  261. package/lib/chain/validation/voluntaryExit.js.map +1 -1
  262. package/lib/chain/validatorMonitor.js +1 -2
  263. package/lib/chain/validatorMonitor.js.map +1 -1
  264. package/lib/constants/network.js +2 -4
  265. package/lib/constants/network.js.map +1 -1
  266. package/lib/db/beacon.js.map +1 -1
  267. package/lib/db/buckets.d.ts +23 -23
  268. package/lib/db/buckets.d.ts.map +1 -1
  269. package/lib/db/buckets.js +1 -2
  270. package/lib/db/buckets.js.map +1 -1
  271. package/lib/db/repositories/attesterSlashing.js.map +1 -1
  272. package/lib/db/repositories/backfilledRanges.js.map +1 -1
  273. package/lib/db/repositories/blobSidecars.js.map +1 -1
  274. package/lib/db/repositories/blobSidecarsArchive.js.map +1 -1
  275. package/lib/db/repositories/block.js.map +1 -1
  276. package/lib/db/repositories/blockArchive.js.map +1 -1
  277. package/lib/db/repositories/blockArchiveIndex.js.map +1 -1
  278. package/lib/db/repositories/blsToExecutionChange.js.map +1 -1
  279. package/lib/db/repositories/checkpointState.js.map +1 -1
  280. package/lib/db/repositories/dataColumnSidecar.js.map +1 -1
  281. package/lib/db/repositories/dataColumnSidecarArchive.js.map +1 -1
  282. package/lib/db/repositories/executionPayloadEnvelope.js.map +1 -1
  283. package/lib/db/repositories/executionPayloadEnvelopeArchive.js.map +1 -1
  284. package/lib/db/repositories/lightclientBestUpdate.js.map +1 -1
  285. package/lib/db/repositories/lightclientCheckpointHeader.js.map +1 -1
  286. package/lib/db/repositories/lightclientSyncCommittee.js.map +1 -1
  287. package/lib/db/repositories/lightclientSyncCommitteeWitness.js.map +1 -1
  288. package/lib/db/repositories/proposerSlashing.js.map +1 -1
  289. package/lib/db/repositories/stateArchive.js.map +1 -1
  290. package/lib/db/repositories/stateArchiveIndex.js.map +1 -1
  291. package/lib/db/repositories/voluntaryExit.js.map +1 -1
  292. package/lib/execution/builder/cache.js.map +1 -1
  293. package/lib/execution/builder/http.js +1 -2
  294. package/lib/execution/builder/http.js.map +1 -1
  295. package/lib/execution/builder/index.js.map +1 -1
  296. package/lib/execution/engine/disabled.js.map +1 -1
  297. package/lib/execution/engine/http.d.ts.map +1 -1
  298. package/lib/execution/engine/http.js.map +1 -1
  299. package/lib/execution/engine/index.js.map +1 -1
  300. package/lib/execution/engine/interface.js +2 -4
  301. package/lib/execution/engine/interface.js.map +1 -1
  302. package/lib/execution/engine/jsonRpcHttpClient.d.ts +13 -10
  303. package/lib/execution/engine/jsonRpcHttpClient.d.ts.map +1 -1
  304. package/lib/execution/engine/jsonRpcHttpClient.js +1 -2
  305. package/lib/execution/engine/jsonRpcHttpClient.js.map +1 -1
  306. package/lib/execution/engine/jwt.js.map +1 -1
  307. package/lib/execution/engine/mock.js.map +1 -1
  308. package/lib/execution/engine/payloadIdCache.js.map +1 -1
  309. package/lib/execution/engine/types.js.map +1 -1
  310. package/lib/execution/engine/utils.d.ts +1 -1
  311. package/lib/execution/engine/utils.d.ts.map +1 -1
  312. package/lib/execution/engine/utils.js.map +1 -1
  313. package/lib/metrics/metrics/beacon.d.ts.map +1 -1
  314. package/lib/metrics/metrics/beacon.js.map +1 -1
  315. package/lib/metrics/metrics/lodestar.d.ts +15 -2
  316. package/lib/metrics/metrics/lodestar.d.ts.map +1 -1
  317. package/lib/metrics/metrics/lodestar.js +35 -1
  318. package/lib/metrics/metrics/lodestar.js.map +1 -1
  319. package/lib/metrics/metrics.js.map +1 -1
  320. package/lib/metrics/nodeJsMetrics.js.map +1 -1
  321. package/lib/metrics/server/http.d.ts +1 -1
  322. package/lib/metrics/server/http.d.ts.map +1 -1
  323. package/lib/metrics/server/http.js.map +1 -1
  324. package/lib/metrics/utils/avgMinMax.js.map +1 -1
  325. package/lib/metrics/utils/gauge.js.map +1 -1
  326. package/lib/metrics/utils/registryMetricCreator.js.map +1 -1
  327. package/lib/monitoring/clientStats.js.map +1 -1
  328. package/lib/monitoring/properties.js.map +1 -1
  329. package/lib/monitoring/service.js.map +1 -1
  330. package/lib/monitoring/system.d.ts.map +1 -1
  331. package/lib/monitoring/system.js.map +1 -1
  332. package/lib/monitoring/types.js +2 -4
  333. package/lib/monitoring/types.js.map +1 -1
  334. package/lib/network/core/events.d.ts.map +1 -1
  335. package/lib/network/core/events.js +2 -4
  336. package/lib/network/core/events.js.map +1 -1
  337. package/lib/network/core/metrics.d.ts +7 -6
  338. package/lib/network/core/metrics.d.ts.map +1 -1
  339. package/lib/network/core/metrics.js.map +1 -1
  340. package/lib/network/core/networkCore.d.ts +1 -1
  341. package/lib/network/core/networkCore.d.ts.map +1 -1
  342. package/lib/network/core/networkCore.js.map +1 -1
  343. package/lib/network/core/networkCoreWorker.js.map +1 -1
  344. package/lib/network/core/networkCoreWorkerHandler.js.map +1 -1
  345. package/lib/network/discv5/index.d.ts +1 -1
  346. package/lib/network/discv5/index.d.ts.map +1 -1
  347. package/lib/network/discv5/index.js.map +1 -1
  348. package/lib/network/discv5/utils.js +1 -2
  349. package/lib/network/discv5/utils.js.map +1 -1
  350. package/lib/network/discv5/worker.js.map +1 -1
  351. package/lib/network/events.d.ts.map +1 -1
  352. package/lib/network/events.js +2 -4
  353. package/lib/network/events.js.map +1 -1
  354. package/lib/network/forks.js.map +1 -1
  355. package/lib/network/gossip/encoding.js.map +1 -1
  356. package/lib/network/gossip/errors.js.map +1 -1
  357. package/lib/network/gossip/gossipsub.js.map +1 -1
  358. package/lib/network/gossip/interface.js +2 -4
  359. package/lib/network/gossip/interface.js.map +1 -1
  360. package/lib/network/gossip/metrics.d.ts +14 -12
  361. package/lib/network/gossip/metrics.d.ts.map +1 -1
  362. package/lib/network/gossip/metrics.js.map +1 -1
  363. package/lib/network/gossip/scoringParameters.d.ts +1 -1
  364. package/lib/network/gossip/scoringParameters.d.ts.map +1 -1
  365. package/lib/network/gossip/scoringParameters.js.map +1 -1
  366. package/lib/network/gossip/topic.d.ts +668 -23
  367. package/lib/network/gossip/topic.d.ts.map +1 -1
  368. package/lib/network/gossip/topic.js +3 -3
  369. package/lib/network/gossip/topic.js.map +1 -1
  370. package/lib/network/libp2p/error.js +1 -2
  371. package/lib/network/libp2p/error.js.map +1 -1
  372. package/lib/network/libp2p/index.js.map +1 -1
  373. package/lib/network/metadata.js +2 -4
  374. package/lib/network/metadata.js.map +1 -1
  375. package/lib/network/network.d.ts +1 -1
  376. package/lib/network/network.d.ts.map +1 -1
  377. package/lib/network/network.js.map +1 -1
  378. package/lib/network/peers/client.js +1 -2
  379. package/lib/network/peers/client.js.map +1 -1
  380. package/lib/network/peers/datastore.d.ts +3 -0
  381. package/lib/network/peers/datastore.d.ts.map +1 -1
  382. package/lib/network/peers/datastore.js.map +1 -1
  383. package/lib/network/peers/discover.d.ts +7 -0
  384. package/lib/network/peers/discover.d.ts.map +1 -1
  385. package/lib/network/peers/discover.js +2 -4
  386. package/lib/network/peers/discover.js.map +1 -1
  387. package/lib/network/peers/peerManager.d.ts +1 -0
  388. package/lib/network/peers/peerManager.d.ts.map +1 -1
  389. package/lib/network/peers/peerManager.js.map +1 -1
  390. package/lib/network/peers/peersData.js +1 -2
  391. package/lib/network/peers/peersData.js.map +1 -1
  392. package/lib/network/peers/score/interface.js +2 -4
  393. package/lib/network/peers/score/interface.js.map +1 -1
  394. package/lib/network/peers/score/score.js.map +1 -1
  395. package/lib/network/peers/score/store.js.map +1 -1
  396. package/lib/network/peers/score/utils.js.map +1 -1
  397. package/lib/network/peers/utils/assertPeerRelevance.js +1 -2
  398. package/lib/network/peers/utils/assertPeerRelevance.js.map +1 -1
  399. package/lib/network/peers/utils/enrSubnetsDeserialize.js.map +1 -1
  400. package/lib/network/peers/utils/getConnectedPeerIds.js.map +1 -1
  401. package/lib/network/peers/utils/prioritizePeers.js +1 -2
  402. package/lib/network/peers/utils/prioritizePeers.js.map +1 -1
  403. package/lib/network/peers/utils/subnetMap.js.map +1 -1
  404. package/lib/network/processor/aggregatorTracker.js.map +1 -1
  405. package/lib/network/processor/extractSlotRootFns.js.map +1 -1
  406. package/lib/network/processor/gossipHandlers.js.map +1 -1
  407. package/lib/network/processor/gossipQueues/index.js.map +1 -1
  408. package/lib/network/processor/gossipQueues/indexed.js.map +1 -1
  409. package/lib/network/processor/gossipQueues/linear.js.map +1 -1
  410. package/lib/network/processor/gossipQueues/types.js +2 -4
  411. package/lib/network/processor/gossipQueues/types.js.map +1 -1
  412. package/lib/network/processor/gossipValidatorFn.js.map +1 -1
  413. package/lib/network/processor/index.js +2 -4
  414. package/lib/network/processor/index.js.map +1 -1
  415. package/lib/network/reqresp/ReqRespBeaconNode.js.map +1 -1
  416. package/lib/network/reqresp/handlers/beaconBlocksByHead.js.map +1 -1
  417. package/lib/network/reqresp/handlers/beaconBlocksByRange.js.map +1 -1
  418. package/lib/network/reqresp/handlers/beaconBlocksByRoot.js.map +1 -1
  419. package/lib/network/reqresp/handlers/blobSidecarsByRange.js.map +1 -1
  420. package/lib/network/reqresp/handlers/blobSidecarsByRoot.js.map +1 -1
  421. package/lib/network/reqresp/handlers/dataColumnSidecarsByRange.js.map +1 -1
  422. package/lib/network/reqresp/handlers/dataColumnSidecarsByRoot.js.map +1 -1
  423. package/lib/network/reqresp/handlers/executionPayloadEnvelopesByRange.js.map +1 -1
  424. package/lib/network/reqresp/handlers/executionPayloadEnvelopesByRoot.js.map +1 -1
  425. package/lib/network/reqresp/handlers/index.js.map +1 -1
  426. package/lib/network/reqresp/handlers/lightClientBootstrap.js.map +1 -1
  427. package/lib/network/reqresp/handlers/lightClientFinalityUpdate.js +1 -1
  428. package/lib/network/reqresp/handlers/lightClientFinalityUpdate.js.map +1 -1
  429. package/lib/network/reqresp/handlers/lightClientOptimisticUpdate.js +1 -1
  430. package/lib/network/reqresp/handlers/lightClientOptimisticUpdate.js.map +1 -1
  431. package/lib/network/reqresp/handlers/lightClientUpdatesByRange.js +1 -1
  432. package/lib/network/reqresp/handlers/lightClientUpdatesByRange.js.map +1 -1
  433. package/lib/network/reqresp/interface.js +1 -2
  434. package/lib/network/reqresp/interface.js.map +1 -1
  435. package/lib/network/reqresp/protocols.d.ts.map +1 -1
  436. package/lib/network/reqresp/protocols.js +35 -9
  437. package/lib/network/reqresp/protocols.js.map +1 -1
  438. package/lib/network/reqresp/rateLimit.js +1 -1
  439. package/lib/network/reqresp/rateLimit.js.map +1 -1
  440. package/lib/network/reqresp/score.d.ts.map +1 -1
  441. package/lib/network/reqresp/score.js +20 -3
  442. package/lib/network/reqresp/score.js.map +1 -1
  443. package/lib/network/reqresp/types.js +2 -4
  444. package/lib/network/reqresp/types.js.map +1 -1
  445. package/lib/network/reqresp/utils/collect.js.map +1 -1
  446. package/lib/network/reqresp/utils/collectSequentialBlocksInRange.js +1 -2
  447. package/lib/network/reqresp/utils/collectSequentialBlocksInRange.js.map +1 -1
  448. package/lib/network/reqresp/utils/dataColumnResponseValidation.d.ts +1 -1
  449. package/lib/network/reqresp/utils/dataColumnResponseValidation.d.ts.map +1 -1
  450. package/lib/network/reqresp/utils/dataColumnResponseValidation.js.map +1 -1
  451. package/lib/network/statusCache.js.map +1 -1
  452. package/lib/network/subnets/attnetsService.js +1 -2
  453. package/lib/network/subnets/attnetsService.js.map +1 -1
  454. package/lib/network/subnets/interface.js.map +1 -1
  455. package/lib/network/subnets/syncnetsService.d.ts.map +1 -1
  456. package/lib/network/subnets/syncnetsService.js.map +1 -1
  457. package/lib/network/subnets/util.js.map +1 -1
  458. package/lib/network/util.js.map +1 -1
  459. package/lib/node/nodejs.d.ts +2 -2
  460. package/lib/node/nodejs.d.ts.map +1 -1
  461. package/lib/node/nodejs.js +1 -2
  462. package/lib/node/nodejs.js.map +1 -1
  463. package/lib/node/notifier.js.map +1 -1
  464. package/lib/node/utils/interop/deposits.js.map +1 -1
  465. package/lib/node/utils/interop/state.d.ts +1 -1
  466. package/lib/node/utils/interop/state.d.ts.map +1 -1
  467. package/lib/node/utils/interop/state.js.map +1 -1
  468. package/lib/node/utils/lightclient.js.map +1 -1
  469. package/lib/node/utils/state.js.map +1 -1
  470. package/lib/sync/backfill/backfill.d.ts +7 -0
  471. package/lib/sync/backfill/backfill.d.ts.map +1 -1
  472. package/lib/sync/backfill/backfill.js +3 -6
  473. package/lib/sync/backfill/backfill.js.map +1 -1
  474. package/lib/sync/backfill/errors.js +1 -2
  475. package/lib/sync/backfill/errors.js.map +1 -1
  476. package/lib/sync/backfill/verify.js.map +1 -1
  477. package/lib/sync/interface.js +1 -2
  478. package/lib/sync/interface.js.map +1 -1
  479. package/lib/sync/range/batch.d.ts.map +1 -1
  480. package/lib/sync/range/batch.js +16 -6
  481. package/lib/sync/range/batch.js.map +1 -1
  482. package/lib/sync/range/chain.d.ts +10 -0
  483. package/lib/sync/range/chain.d.ts.map +1 -1
  484. package/lib/sync/range/chain.js +1 -2
  485. package/lib/sync/range/chain.js.map +1 -1
  486. package/lib/sync/range/range.d.ts.map +1 -1
  487. package/lib/sync/range/range.js +2 -4
  488. package/lib/sync/range/range.js.map +1 -1
  489. package/lib/sync/range/utils/batches.js +1 -2
  490. package/lib/sync/range/utils/batches.js.map +1 -1
  491. package/lib/sync/range/utils/chainTarget.js.map +1 -1
  492. package/lib/sync/range/utils/hashBlocks.js.map +1 -1
  493. package/lib/sync/range/utils/peerBalancer.js.map +1 -1
  494. package/lib/sync/range/utils/updateChains.js.map +1 -1
  495. package/lib/sync/sync.js.map +1 -1
  496. package/lib/sync/types.js +3 -6
  497. package/lib/sync/types.js.map +1 -1
  498. package/lib/sync/unknownBlock.d.ts +23 -0
  499. package/lib/sync/unknownBlock.d.ts.map +1 -1
  500. package/lib/sync/unknownBlock.js.map +1 -1
  501. package/lib/sync/utils/downloadByRange.d.ts +4 -4
  502. package/lib/sync/utils/downloadByRange.d.ts.map +1 -1
  503. package/lib/sync/utils/downloadByRange.js +1 -2
  504. package/lib/sync/utils/downloadByRange.js.map +1 -1
  505. package/lib/sync/utils/downloadByRoot.d.ts +7 -7
  506. package/lib/sync/utils/downloadByRoot.d.ts.map +1 -1
  507. package/lib/sync/utils/downloadByRoot.js +1 -2
  508. package/lib/sync/utils/downloadByRoot.js.map +1 -1
  509. package/lib/sync/utils/pendingBlocksTree.js.map +1 -1
  510. package/lib/sync/utils/rateLimit.js.map +1 -1
  511. package/lib/sync/utils/remoteSyncType.d.ts.map +1 -1
  512. package/lib/sync/utils/remoteSyncType.js +2 -4
  513. package/lib/sync/utils/remoteSyncType.js.map +1 -1
  514. package/lib/util/address.js.map +1 -1
  515. package/lib/util/array.js.map +1 -1
  516. package/lib/util/asyncIterableToEvents.js +1 -2
  517. package/lib/util/asyncIterableToEvents.js.map +1 -1
  518. package/lib/util/binarySearch.js.map +1 -1
  519. package/lib/util/bitArray.js +1 -2
  520. package/lib/util/bitArray.js.map +1 -1
  521. package/lib/util/blobs.js.map +1 -1
  522. package/lib/util/bufferPool.js +1 -2
  523. package/lib/util/bufferPool.js.map +1 -1
  524. package/lib/util/chunkify.js.map +1 -1
  525. package/lib/util/clock.d.ts +2 -7
  526. package/lib/util/clock.d.ts.map +1 -1
  527. package/lib/util/clock.js +3 -9
  528. package/lib/util/clock.js.map +1 -1
  529. package/lib/util/dataColumns.js +2 -4
  530. package/lib/util/dataColumns.js.map +1 -1
  531. package/lib/util/dependentRoot.js.map +1 -1
  532. package/lib/util/enum.js.map +1 -1
  533. package/lib/util/error.js.map +1 -1
  534. package/lib/util/eventLoop.js.map +1 -1
  535. package/lib/util/execution.js +1 -2
  536. package/lib/util/execution.js.map +1 -1
  537. package/lib/util/file.js.map +1 -1
  538. package/lib/util/forkChoice.js.map +1 -1
  539. package/lib/util/forkName.js.map +1 -1
  540. package/lib/util/graffiti.js.map +1 -1
  541. package/lib/util/hex.js.map +1 -1
  542. package/lib/util/ip.js.map +1 -1
  543. package/lib/util/itTrigger.js.map +1 -1
  544. package/lib/util/map.js.map +1 -1
  545. package/lib/util/metadata.js.map +1 -1
  546. package/lib/util/multifork.js.map +1 -1
  547. package/lib/util/numpy.js.map +1 -1
  548. package/lib/util/peerId.js.map +1 -1
  549. package/lib/util/profile.js +1 -2
  550. package/lib/util/profile.js.map +1 -1
  551. package/lib/util/promises.js.map +1 -1
  552. package/lib/util/queue/errors.js +1 -2
  553. package/lib/util/queue/errors.js.map +1 -1
  554. package/lib/util/queue/fnQueue.js.map +1 -1
  555. package/lib/util/queue/itemQueue.d.ts.map +1 -1
  556. package/lib/util/queue/itemQueue.js.map +1 -1
  557. package/lib/util/queue/options.js +1 -2
  558. package/lib/util/queue/options.js.map +1 -1
  559. package/lib/util/serializedCache.js.map +1 -1
  560. package/lib/util/set.js.map +1 -1
  561. package/lib/util/shuffle.js.map +1 -1
  562. package/lib/util/sortBy.js.map +1 -1
  563. package/lib/util/sszBytes.js.map +1 -1
  564. package/lib/util/time.js.map +1 -1
  565. package/lib/util/timeSeries.js.map +1 -1
  566. package/lib/util/types.d.ts.map +1 -1
  567. package/lib/util/workerEvents.d.ts +1 -1
  568. package/lib/util/workerEvents.d.ts.map +1 -1
  569. package/lib/util/workerEvents.js.map +1 -1
  570. package/lib/util/wrapError.js.map +1 -1
  571. package/package.json +17 -17
  572. package/src/api/impl/beacon/blocks/index.ts +60 -16
  573. package/src/api/impl/config/constants.ts +4 -0
  574. package/src/api/impl/validator/index.ts +19 -6
  575. package/src/chain/blocks/importBlock.ts +3 -2
  576. package/src/chain/blocks/importExecutionPayload.ts +8 -4
  577. package/src/chain/blocks/index.ts +7 -0
  578. package/src/chain/blocks/utils/chainSegment.ts +35 -28
  579. package/src/chain/blocks/utils/polarBearBanner.ts +50 -0
  580. package/src/chain/blocks/verifyBlock.ts +16 -0
  581. package/src/chain/opPools/aggregatedAttestationPool.ts +1 -1
  582. package/src/chain/prepareNextSlot.ts +140 -39
  583. package/src/chain/produceBlock/produceBlockBody.ts +22 -5
  584. package/src/chain/seenCache/seenBlockProposers.ts +46 -5
  585. package/src/chain/validation/block.ts +36 -18
  586. package/src/chain/validation/dataColumnSidecar.ts +27 -17
  587. package/src/chain/validation/executionPayloadBid.ts +7 -4
  588. package/src/metrics/metrics/lodestar.ts +36 -1
  589. package/src/network/gossip/topic.ts +4 -2
  590. package/src/network/reqresp/handlers/lightClientFinalityUpdate.ts +1 -1
  591. package/src/network/reqresp/handlers/lightClientOptimisticUpdate.ts +1 -1
  592. package/src/network/reqresp/handlers/lightClientUpdatesByRange.ts +1 -1
  593. package/src/network/reqresp/protocols.ts +39 -11
  594. package/src/network/reqresp/rateLimit.ts +1 -1
  595. package/src/network/reqresp/score.ts +22 -3
  596. package/src/sync/range/batch.ts +19 -2
  597. package/src/util/clock.ts +2 -7
@@ -1,21 +1,57 @@
1
1
  import {computeStartSlotAtEpoch} from "@lodestar/state-transition";
2
- import {Epoch, Slot, ValidatorIndex} from "@lodestar/types";
2
+ import {Epoch, RootHex, Slot, ValidatorIndex} from "@lodestar/types";
3
3
  import {MapDef} from "@lodestar/utils";
4
4
 
5
+ /** Two distinct block roots signed by the same proposer for the same slot are sufficient to establish an equivocation */
6
+ const MAX_BLOCK_ROOTS_PER_PROPOSAL = 2;
7
+
5
8
  /**
6
9
  * Keeps a cache to filter block proposals from the same validator in the same slot.
7
10
  *
8
- * This cache is not bounded and for extremely long periods of non-finality it can grow a lot. However it's practically
9
- * limited by the possible shufflings in those epochs, and the stored data is very cheap
11
+ * Block roots with a signature verified against the block's proposer index are tracked separately from proposals
12
+ * accepted by gossip validation or block import. A root from a block signed by its declared proposer is potential
13
+ * equivocation evidence, but the block may still fail other validation. Such a block must not mark the proposal as
14
+ * known, since that would cause a later valid block for the same slot and proposer to be ignored as a repeat proposal.
15
+ *
16
+ * The cache is pruned on finalization and bounds the number of roots stored per proposer and slot
10
17
  */
11
18
  export class SeenBlockProposers {
12
19
  private readonly proposerIndexesBySlot = new MapDef<Slot, Set<ValidatorIndex>>(() => new Set<ValidatorIndex>());
13
- private finalizedSlot: Epoch = 0;
20
+ private readonly blockRootsBySlot = new MapDef<Slot, MapDef<ValidatorIndex, Set<RootHex>>>(
21
+ () => new MapDef<ValidatorIndex, Set<RootHex>>(() => new Set<RootHex>())
22
+ );
23
+ private finalizedSlot: Slot = 0;
14
24
 
15
25
  isKnown(blockSlot: Slot, proposerIndex: ValidatorIndex): boolean {
16
26
  return this.proposerIndexesBySlot.get(blockSlot)?.has(proposerIndex) === true;
17
27
  }
18
28
 
29
+ hasBlockRoot(blockSlot: Slot, proposerIndex: ValidatorIndex, blockRoot: RootHex): boolean {
30
+ return this.blockRootsBySlot.get(blockSlot)?.get(proposerIndex)?.has(blockRoot) === true;
31
+ }
32
+
33
+ isEquivocating(blockSlot: Slot, proposerIndex: ValidatorIndex): boolean {
34
+ return (this.blockRootsBySlot.get(blockSlot)?.get(proposerIndex)?.size ?? 0) >= MAX_BLOCK_ROOTS_PER_PROPOSAL;
35
+ }
36
+
37
+ getConflictingBlockRoots(blockSlot: Slot, proposerIndex: ValidatorIndex, blockRoot: RootHex): RootHex[] {
38
+ const roots = this.blockRootsBySlot.get(blockSlot)?.get(proposerIndex);
39
+ return roots === undefined ? [] : Array.from(roots).filter((root) => root !== blockRoot);
40
+ }
41
+
42
+ /** Record a block only after its proposer signature has been verified */
43
+ observeBlockRoot(blockSlot: Slot, proposerIndex: ValidatorIndex, blockRoot: RootHex): void {
44
+ if (blockSlot < this.finalizedSlot) {
45
+ throw Error(`blockSlot ${blockSlot} < finalizedSlot ${this.finalizedSlot}`);
46
+ }
47
+
48
+ const blockRoots = this.blockRootsBySlot.getOrDefault(blockSlot).getOrDefault(proposerIndex);
49
+ if (blockRoots.size < MAX_BLOCK_ROOTS_PER_PROPOSAL) {
50
+ blockRoots.add(blockRoot);
51
+ }
52
+ }
53
+
54
+ /** Mark a block as known from gossip or another block import path */
19
55
  add(blockSlot: Slot, proposerIndex: ValidatorIndex): void {
20
56
  if (blockSlot < this.finalizedSlot) {
21
57
  throw Error(`blockSlot ${blockSlot} < finalizedSlot ${this.finalizedSlot}`);
@@ -31,9 +67,14 @@ export class SeenBlockProposers {
31
67
  this.proposerIndexesBySlot.delete(slot);
32
68
  }
33
69
  }
70
+ for (const slot of this.blockRootsBySlot.keys()) {
71
+ if (slot < finalizedSlot) {
72
+ this.blockRootsBySlot.delete(slot);
73
+ }
74
+ }
34
75
  }
35
76
 
36
- seenAtEpoch(epoch: Slot, index: ValidatorIndex): boolean {
77
+ seenAtEpoch(epoch: Epoch, index: ValidatorIndex): boolean {
37
78
  const fromSlot = computeStartSlotAtEpoch(epoch);
38
79
  const toSlot = computeStartSlotAtEpoch(epoch + 1);
39
80
 
@@ -24,7 +24,7 @@ import {
24
24
  isExecutionBlockBodyType,
25
25
  isStatePostBellatrix,
26
26
  } from "@lodestar/state-transition";
27
- import {SignedBeaconBlock, deneb, gloas, isGloasBeaconBlock} from "@lodestar/types";
27
+ import {RootHex, SignedBeaconBlock, deneb, gloas, isGloasBeaconBlock} from "@lodestar/types";
28
28
  import {byteArrayEquals, sleep, toRootHex} from "@lodestar/utils";
29
29
  import {BlockErrorCode, BlockGossipError, GossipAction} from "../errors/index.js";
30
30
  import {IBeaconChain} from "../interface.js";
@@ -85,7 +85,12 @@ export async function validateGossipBlock(
85
85
 
86
86
  // [IGNORE] The block is the first block with valid signature received for the proposer for the slot, signed_beacon_block.message.slot.
87
87
  const proposerIndex = block.proposerIndex;
88
+ const hasBlockRoot = chain.seenBlockProposers.hasBlockRoot(blockSlot, proposerIndex, blockRoot);
88
89
  if (chain.seenBlockProposers.isKnown(blockSlot, proposerIndex)) {
90
+ if (!hasBlockRoot && !chain.seenBlockProposers.isEquivocating(blockSlot, proposerIndex)) {
91
+ await verifyBlockProposerSignature(chain, signedBlock, blockRoot, {verifyOnMainThread: false});
92
+ chain.seenBlockProposers.observeBlockRoot(blockSlot, proposerIndex, blockRoot);
93
+ }
89
94
  throw new BlockGossipError(GossipAction.IGNORE, {code: BlockErrorCode.REPEAT_PROPOSAL, proposerIndex});
90
95
  }
91
96
 
@@ -270,18 +275,8 @@ export async function validateGossipBlock(
270
275
  }
271
276
 
272
277
  // [REJECT] The proposer signature, signed_beacon_block.signature, is valid with respect to the proposer_index pubkey.
273
- if (!chain.seenBlockInputCache.isVerifiedProposerSignature(blockSlot, blockRoot, signedBlock.signature)) {
274
- const signatureSet = getBlockProposerSignatureSet(chain.config, signedBlock);
275
- // Don't batch so verification is not delayed
276
- if (!(await chain.bls.verifySignatureSets([signatureSet], {verifyOnMainThread: true}))) {
277
- throw new BlockGossipError(GossipAction.REJECT, {
278
- code: BlockErrorCode.PROPOSAL_SIGNATURE_INVALID,
279
- blockSlot,
280
- });
281
- }
282
-
283
- chain.seenBlockInputCache.markVerifiedProposerSignature(blockSlot, blockRoot, signedBlock.signature);
284
- }
278
+ await verifyBlockProposerSignature(chain, signedBlock, blockRoot);
279
+ chain.seenBlockProposers.observeBlockRoot(blockSlot, proposerIndex, blockRoot);
285
280
 
286
281
  // [REJECT] The block is proposed by the expected proposer_index for the block's slot in the context of the current
287
282
  // shuffling (defined by parent_root/slot). If the proposer_index cannot immediately be verified against the expected
@@ -291,11 +286,6 @@ export async function validateGossipBlock(
291
286
  throw new BlockGossipError(GossipAction.REJECT, {code: BlockErrorCode.INCORRECT_PROPOSER, proposerIndex});
292
287
  }
293
288
 
294
- // Check again in case there two blocks are processed concurrently
295
- if (chain.seenBlockProposers.isKnown(blockSlot, proposerIndex)) {
296
- throw new BlockGossipError(GossipAction.IGNORE, {code: BlockErrorCode.REPEAT_PROPOSAL, proposerIndex});
297
- }
298
-
299
289
  // Simple implementation of a pending block queue. Keeping the block here recycles the queue logic, and keeps the
300
290
  // gossip validation promise without any extra infrastructure.
301
291
  // Do the sleep at the end, since regen and signature validation can already take longer than `msToBlockSlot`.
@@ -305,7 +295,35 @@ export async function validateGossipBlock(
305
295
  await sleep(msToBlockSlot);
306
296
  }
307
297
 
298
+ // Check again after all async validation and the early-block delay so concurrent proposals cannot both pass
299
+ if (chain.seenBlockProposers.isKnown(blockSlot, proposerIndex)) {
300
+ throw new BlockGossipError(GossipAction.IGNORE, {code: BlockErrorCode.REPEAT_PROPOSAL, proposerIndex});
301
+ }
302
+
308
303
  chain.seenBlockProposers.add(blockSlot, proposerIndex);
309
304
 
310
305
  return {skippedSlots};
311
306
  }
307
+
308
+ export async function verifyBlockProposerSignature(
309
+ chain: IBeaconChain,
310
+ signedBlock: SignedBeaconBlock,
311
+ blockRoot: RootHex,
312
+ opts: {verifyOnMainThread?: boolean} = {}
313
+ ): Promise<void> {
314
+ const blockSlot = signedBlock.message.slot;
315
+ if (chain.seenBlockInputCache.isVerifiedProposerSignature(blockSlot, blockRoot, signedBlock.signature)) {
316
+ return;
317
+ }
318
+
319
+ const signatureSet = getBlockProposerSignatureSet(chain.config, signedBlock);
320
+ // Don't batch so verification is not delayed
321
+ if (!(await chain.bls.verifySignatureSets([signatureSet], {verifyOnMainThread: opts.verifyOnMainThread ?? true}))) {
322
+ throw new BlockGossipError(GossipAction.REJECT, {
323
+ code: BlockErrorCode.PROPOSAL_SIGNATURE_INVALID,
324
+ blockSlot,
325
+ });
326
+ }
327
+
328
+ chain.seenBlockInputCache.markVerifiedProposerSignature(blockSlot, blockRoot, signedBlock.signature);
329
+ }
@@ -2,15 +2,16 @@ import {ChainConfig, ChainForkConfig} from "@lodestar/config";
2
2
  import {
3
3
  KZG_COMMITMENTS_INCLUSION_PROOF_DEPTH,
4
4
  KZG_COMMITMENTS_SUBTREE_INDEX,
5
+ MIN_SEED_LOOKAHEAD,
5
6
  NUMBER_OF_COLUMNS,
7
+ isForkPostFulu,
6
8
  } from "@lodestar/params";
7
9
  import {
8
10
  computeEpochAtSlot,
9
11
  computeStartSlotAtEpoch,
10
12
  getBlockHeaderProposerSignatureSetByHeaderSlot,
11
- getBlockHeaderProposerSignatureSetByParentStateSlot,
12
13
  } from "@lodestar/state-transition";
13
- import {DataColumnSidecar, Root, Slot, SubnetID, fulu, gloas, ssz} from "@lodestar/types";
14
+ import {DataColumnSidecar, Root, Slot, SubnetID, ValidatorIndex, fulu, gloas, ssz} from "@lodestar/types";
14
15
  import {byteArrayEquals, toRootHex, verifyMerkleBranch} from "@lodestar/utils";
15
16
  import {BeaconMetrics} from "../../metrics/metrics/beacon.js";
16
17
  import {Metrics} from "../../metrics/metrics.js";
@@ -104,19 +105,23 @@ export async function validateGossipFuluDataColumnSidecar(
104
105
  });
105
106
  }
106
107
 
107
- // getBlockSlotState also checks for whether the current finalized checkpoint is an ancestor of the block.
108
- // As a result, we throw an IGNORE (whereas the spec says we should REJECT for this scenario).
109
- // this is something we should change this in the future to make the code airtight to the spec.
110
108
  // 7) [REJECT] The sidecar's block's parent passes validation.
111
- const blockState = await chain.regen
112
- .getBlockSlotState(parentBlock, blockHeader.slot, {dontTransferCache: true}, RegenCaller.validateGossipDataColumn)
113
- .catch(() => {
114
- throw new DataColumnSidecarGossipError(GossipAction.IGNORE, {
115
- code: DataColumnSidecarErrorCode.PARENT_UNKNOWN,
116
- parentRoot,
117
- slot: blockHeader.slot,
118
- });
119
- });
109
+ // Post-fulu, we can use parent state to get expected proposer index thanks to proposer lookahead
110
+ const parentEpoch = computeEpochAtSlot(parentBlock.slot);
111
+ const blockEpoch = computeEpochAtSlot(blockHeader.slot);
112
+ const getProposerIndex = async (): Promise<ValidatorIndex> => {
113
+ if (isForkPostFulu(chain.config.getForkName(parentBlock.slot)) && blockEpoch - parentEpoch <= MIN_SEED_LOOKAHEAD) {
114
+ const parentState = await chain.regen.getState(parentBlock.stateRoot, RegenCaller.validateGossipDataColumn);
115
+ return parentState.getBeaconProposer(blockHeader.slot);
116
+ }
117
+ const blockState = await chain.regen.getBlockSlotState(
118
+ parentBlock,
119
+ blockHeader.slot,
120
+ {dontTransferCache: true},
121
+ RegenCaller.validateGossipDataColumn
122
+ );
123
+ return blockState.getBeaconProposer(blockHeader.slot);
124
+ };
120
125
 
121
126
  // 13) [REJECT] The sidecar is proposed by the expected proposer_index for the block's slot in the context of the current
122
127
  // shuffling (defined by block_header.parent_root/block_header.slot). If the proposer_index cannot
@@ -124,7 +129,13 @@ export async function validateGossipFuluDataColumnSidecar(
124
129
  // while proposers for the block's branch are calculated -- in such a case do not REJECT, instead IGNORE
125
130
  // this message.
126
131
  const proposerIndex = blockHeader.proposerIndex;
127
- const expectedProposerIndex = blockState.getBeaconProposer(blockHeader.slot);
132
+ const expectedProposerIndex = await getProposerIndex().catch(() => {
133
+ throw new DataColumnSidecarGossipError(GossipAction.IGNORE, {
134
+ code: DataColumnSidecarErrorCode.PARENT_UNKNOWN,
135
+ parentRoot,
136
+ slot: blockHeader.slot,
137
+ });
138
+ });
128
139
 
129
140
  if (proposerIndex !== expectedProposerIndex) {
130
141
  throw new DataColumnSidecarGossipError(GossipAction.REJECT, {
@@ -137,9 +148,8 @@ export async function validateGossipFuluDataColumnSidecar(
137
148
  // 5) [REJECT] The proposer signature of sidecar.signed_block_header, is valid with respect to the block_header.proposer_index pubkey.
138
149
  const signature = dataColumnSidecar.signedBlockHeader.signature;
139
150
  if (!chain.seenBlockInputCache.isVerifiedProposerSignature(blockHeader.slot, blockRootHex, signature)) {
140
- const signatureSet = getBlockHeaderProposerSignatureSetByParentStateSlot(
151
+ const signatureSet = getBlockHeaderProposerSignatureSetByHeaderSlot(
141
152
  chain.config,
142
- blockState.slot,
143
153
  dataColumnSidecar.signedBlockHeader
144
154
  );
145
155
 
@@ -7,6 +7,7 @@ import {
7
7
  getExecutionPayloadBidSigningRoot,
8
8
  isActiveBuilder,
9
9
  isGasLimitTargetCompatible,
10
+ isStartSlotOfEpoch,
10
11
  isStatePostGloas,
11
12
  } from "@lodestar/state-transition";
12
13
  import {RootHex, Slot, ValidatorIndex, gloas} from "@lodestar/types";
@@ -46,8 +47,8 @@ function getMinBidValue(currentHighestBid: number): number {
46
47
  /**
47
48
  * Check whether a bid builds on one of the paths compatible with the local head branch.
48
49
  *
49
- * The direct parent path is always allowed for proposer-boost reorgs. Otherwise the bid
50
- * must build on the local head's full or empty payload variant, as selected for its slot.
50
+ * Building directly on the parent is allowed for proposer-boost reorgs outside epoch boundaries.
51
+ * Otherwise the bid must build on the local head's full or empty payload variant, as selected for its slot.
51
52
  */
52
53
  function isBidCompatibleWithHead(
53
54
  forkChoice: IForkChoice,
@@ -60,7 +61,9 @@ function isBidCompatibleWithHead(
60
61
  const buildsOnParentPayload = bidParentBlockHash === head.parentBlockHash;
61
62
 
62
63
  if (buildsOnParentBlock && buildsOnParentPayload) {
63
- return true;
64
+ // The spec allows this at epoch boundaries, but Lodestar does not propagate these bids because validating
65
+ // them requires an epoch transition for a parent state that cannot be used for proposer-boost reorgs.
66
+ return !isStartSlotOfEpoch(bidSlot);
64
67
  }
65
68
 
66
69
  if (bidParentBlockRoot !== head.blockRoot) {
@@ -343,7 +346,7 @@ async function validateExecutionPayloadBid(
343
346
  // [REJECT] `signed_execution_payload_bid.signature` is valid with respect to the `bid.builder_index`.
344
347
  const signatureSet = createSingleSignatureSetFromComponents(
345
348
  PublicKey.fromBytes(builder.pubkey),
346
- getExecutionPayloadBidSigningRoot(chain.config, state.slot, bid),
349
+ getExecutionPayloadBidSigningRoot(chain.config, bid),
347
350
  signedExecutionPayloadBid.signature
348
351
  );
349
352
 
@@ -424,7 +424,7 @@ export function createLodestarMetrics(
424
424
  jobWaitTime: register.histogram({
425
425
  name: "lodestar_bls_thread_pool_queue_job_wait_time_seconds",
426
426
  help: "Time from job added to the queue to starting the job in seconds",
427
- buckets: [0.01, 0.02, 0.5, 0.1, 0.3, 1],
427
+ buckets: [0.01, 0.02, 0.1, 0.3, 0.5, 1],
428
428
  }),
429
429
  queueLength: register.gauge({
430
430
  name: "lodestar_bls_thread_pool_queue_length",
@@ -1708,6 +1708,41 @@ export function createLodestarMetrics(
1708
1708
  }),
1709
1709
  },
1710
1710
 
1711
+ // Pre-verify builder-deposit signatures in the epochs before the Gloas fork (prepareNextSlot).
1712
+ builderDepositPreVerify: {
1713
+ duration: register.histogram({
1714
+ name: "lodestar_builder_deposit_preverify_duration_seconds",
1715
+ help: "Duration of one preVerifyBuilderDepositsPreGloas call (BLS batch verify + scan)",
1716
+ buckets: [1, 2, 3, 4],
1717
+ }),
1718
+ pendingDeposits: register.gauge({
1719
+ name: "lodestar_builder_deposit_preverify_pending_deposits",
1720
+ help: "Current state.pendingDeposits length (backlog to drain before the fork)",
1721
+ }),
1722
+ cachedDeposits: register.gauge({
1723
+ name: "lodestar_builder_deposit_preverify_cached_deposits",
1724
+ help: "Deposit signatures verified & cached so far this pre-fork window (valid + invalid)",
1725
+ }),
1726
+ scannedDeposits: register.gauge({
1727
+ name: "lodestar_builder_deposit_preverify_scanned_deposits",
1728
+ help: "Pending deposits examined by the last pre-verify call (< pending_deposits ⇒ cap hit)",
1729
+ }),
1730
+ builderPubkeys: register.gauge({
1731
+ name: "lodestar_builder_deposit_preverify_builder_pubkeys",
1732
+ help: "Distinct builder pubkeys tracked this window (validator deposits for these are pre-verified)",
1733
+ }),
1734
+ validSignatures: register.counter<{type: "builder" | "validator"}>({
1735
+ name: "lodestar_builder_deposit_preverify_valid_signatures_total",
1736
+ help: "Cumulative deposit signatures whose BLS verification passed (VALID), by credential type",
1737
+ labelNames: ["type"],
1738
+ }),
1739
+ invalidSignatures: register.counter<{type: "builder" | "validator"}>({
1740
+ name: "lodestar_builder_deposit_preverify_invalid_signatures_total",
1741
+ help: "Cumulative deposit signatures whose BLS verification failed (INVALID), by credential type",
1742
+ labelNames: ["type"],
1743
+ }),
1744
+ },
1745
+
1711
1746
  // reprocess attestations
1712
1747
  reprocessApiAttestations: {
1713
1748
  total: register.gauge({
@@ -8,11 +8,13 @@ import {
8
8
  MAX_DATA_COLUMN_SIDECAR_SIZE,
9
9
  MAX_SIGNED_AGGREGATE_AND_PROOF_SIZE,
10
10
  MAX_SIGNED_EXECUTION_PAYLOAD_BID_SIZE,
11
+ MAX_SIGNED_EXECUTION_PAYLOAD_BID_SIZE_HEZE,
11
12
  SYNC_COMMITTEE_SUBNET_COUNT,
12
13
  isForkPostAltair,
13
14
  isForkPostElectra,
14
15
  isForkPostFulu,
15
16
  isForkPostGloas,
17
+ isForkPostHeze,
16
18
  } from "@lodestar/params";
17
19
  import {Attestation, SingleAttestation, ssz, sszTypesFor} from "@lodestar/types";
18
20
  import {GossipAction, GossipActionError, GossipErrorCode} from "../../chain/errors/gossipValidation.js";
@@ -130,7 +132,7 @@ export function getGossipSSZType(topic: GossipTopic) {
130
132
  case GossipType.payload_attestation_message:
131
133
  return ssz.gloas.PayloadAttestationMessage;
132
134
  case GossipType.execution_payload_bid:
133
- return ssz.gloas.SignedExecutionPayloadBid;
135
+ return isForkPostGloas(fork) ? sszTypesFor(fork).SignedExecutionPayloadBid : ssz.gloas.SignedExecutionPayloadBid;
134
136
  case GossipType.proposer_preferences:
135
137
  return ssz.gloas.SignedProposerPreferences;
136
138
  }
@@ -154,7 +156,7 @@ export function getGossipSSZMaxSize(topic: GossipTopic, maxPayloadSize: number,
154
156
  case GossipType.execution_payload:
155
157
  return maxPayloadSize;
156
158
  case GossipType.execution_payload_bid:
157
- return MAX_SIGNED_EXECUTION_PAYLOAD_BID_SIZE;
159
+ return isForkPostHeze(fork) ? MAX_SIGNED_EXECUTION_PAYLOAD_BID_SIZE_HEZE : MAX_SIGNED_EXECUTION_PAYLOAD_BID_SIZE;
158
160
  default:
159
161
  return (sszType ?? getGossipSSZType(topic)).maxSize;
160
162
  }
@@ -12,7 +12,7 @@ export async function* onLightClientFinalityUpdate(chain: IBeaconChain): AsyncIt
12
12
  throw new ResponseError(RespStatus.RESOURCE_UNAVAILABLE, "No latest finality update available");
13
13
  }
14
14
 
15
- const boundary = chain.config.getForkBoundaryAtEpoch(computeEpochAtSlot(update.signatureSlot));
15
+ const boundary = chain.config.getForkBoundaryAtEpoch(computeEpochAtSlot(update.attestedHeader.beacon.slot));
16
16
  const type = responseSszTypeByMethod[ReqRespMethod.LightClientFinalityUpdate](boundary.fork, 0);
17
17
  yield {
18
18
  data: type.serialize(update),
@@ -12,7 +12,7 @@ export async function* onLightClientOptimisticUpdate(chain: IBeaconChain): Async
12
12
  throw new ResponseError(RespStatus.RESOURCE_UNAVAILABLE, "No latest optimistic update available");
13
13
  }
14
14
 
15
- const boundary = chain.config.getForkBoundaryAtEpoch(computeEpochAtSlot(update.signatureSlot));
15
+ const boundary = chain.config.getForkBoundaryAtEpoch(computeEpochAtSlot(update.attestedHeader.beacon.slot));
16
16
  const type = responseSszTypeByMethod[ReqRespMethod.LightClientOptimisticUpdate](boundary.fork, 0);
17
17
  yield {
18
18
  data: type.serialize(update),
@@ -27,7 +27,7 @@ export async function* onLightClientUpdatesByRange(
27
27
  const period = requestBody.startPeriod + i;
28
28
  try {
29
29
  const update = await chain.lightClientServer.getUpdate(period);
30
- const boundary = chain.config.getForkBoundaryAtEpoch(computeEpochAtSlot(update.signatureSlot));
30
+ const boundary = chain.config.getForkBoundaryAtEpoch(computeEpochAtSlot(update.attestedHeader.beacon.slot));
31
31
  const type = responseSszTypeByMethod[ReqRespMethod.LightClientUpdatesByRange](boundary.fork, 0);
32
32
 
33
33
  yield {
@@ -1,6 +1,6 @@
1
1
  import {BeaconConfig} from "@lodestar/config";
2
- import {ForkName} from "@lodestar/params";
3
- import {ContextBytesFactory, ContextBytesType, Encoding} from "@lodestar/reqresp";
2
+ import {ForkName, MAX_DATA_COLUMN_SIDECAR_SIZE, isForkPostGloas} from "@lodestar/params";
3
+ import {ContextBytesFactory, ContextBytesType, Encoding, TypeSizes} from "@lodestar/reqresp";
4
4
  import {rateLimitQuotas} from "./rateLimit.js";
5
5
  import {ProtocolNoHandler, ReqRespMethod, Version, requestSszTypeByMethod, responseSszTypeByMethod} from "./types.js";
6
6
 
@@ -143,15 +143,43 @@ type ProtocolSummary = {
143
143
  };
144
144
 
145
145
  function toProtocol(protocol: ProtocolSummary) {
146
- return (fork: ForkName, config: BeaconConfig): ProtocolNoHandler => ({
147
- method: protocol.method,
148
- version: protocol.version,
149
- encoding: Encoding.SSZ_SNAPPY,
150
- contextBytes: toContextBytes(protocol.contextBytesType, config),
151
- inboundRateLimits: rateLimitQuotas(fork, config)[protocol.method],
152
- requestSizes: requestSszTypeByMethod(fork, config)[protocol.method],
153
- responseSizes: (fork) => responseSszTypeByMethod[protocol.method](fork, protocol.version),
154
- });
146
+ return (fork: ForkName, config: BeaconConfig): ProtocolNoHandler => {
147
+ const requestType = requestSszTypeByMethod(fork, config)[protocol.method];
148
+ return {
149
+ method: protocol.method,
150
+ version: protocol.version,
151
+ encoding: Encoding.SSZ_SNAPPY,
152
+ contextBytes: toContextBytes(protocol.contextBytesType, config),
153
+ inboundRateLimits: rateLimitQuotas(fork, config)[protocol.method],
154
+ requestSizes: requestType === null ? null : clampTypeSizes(requestType, protocol.method, fork, config),
155
+ responseSizes: (fork) =>
156
+ clampTypeSizes(responseSszTypeByMethod[protocol.method](fork, protocol.version), protocol.method, fork, config),
157
+ };
158
+ };
159
+ }
160
+
161
+ /**
162
+ * Bound the sizes accepted from the ssz-snappy length-prefix. Gloas progressive containers have broad
163
+ * theoretical SSZ max sizes so the preset p2p bounds must be used instead.
164
+ *
165
+ * The length-prefix must be within the size bounds derived from the payload SSZ type or `MAX_PAYLOAD_SIZE`,
166
+ * whichever is smaller, see
167
+ * https://github.com/ethereum/consensus-specs/blob/v1.7.0-alpha.12/specs/phase0/p2p-interface.md#encoding-strategies.
168
+ * Type-specific SSZ bounds supersede the bounds derived from the SSZ type, see
169
+ * https://github.com/ethereum/consensus-specs/blob/v1.7.0-alpha.12/specs/gloas/p2p-interface.md#type-specific-ssz-bounds.
170
+ */
171
+ function clampTypeSizes(type: TypeSizes, method: ReqRespMethod, fork: ForkName, config: BeaconConfig): TypeSizes {
172
+ let typeSpecificBound = config.MAX_PAYLOAD_SIZE;
173
+ if (isForkPostGloas(fork)) {
174
+ switch (method) {
175
+ case ReqRespMethod.DataColumnSidecarsByRange:
176
+ case ReqRespMethod.DataColumnSidecarsByRoot:
177
+ typeSpecificBound = MAX_DATA_COLUMN_SIDECAR_SIZE;
178
+ break;
179
+ }
180
+ }
181
+
182
+ return {minSize: type.minSize, maxSize: Math.min(type.maxSize, typeSpecificBound)};
155
183
  }
156
184
 
157
185
  function toContextBytes(type: ContextBytesType, config: BeaconConfig): ContextBytesFactory {
@@ -87,7 +87,7 @@ export const rateLimitQuotas: (fork: ForkName, config: BeaconConfig) => Record<R
87
87
  ),
88
88
  },
89
89
  [ReqRespMethod.ExecutionPayloadEnvelopesByRange]: {
90
- byPeer: {quota: config.MAX_REQUEST_BLOCKS_DENEB, quotaTimeMs: 10_000},
90
+ byPeer: {quota: config.MAX_REQUEST_PAYLOADS, quotaTimeMs: 10_000},
91
91
  getRequestCount: getRequestCountFn(
92
92
  fork,
93
93
  config,
@@ -33,9 +33,28 @@ export function onOutgoingReqRespError(e: RequestError, method: ReqRespMethod):
33
33
 
34
34
  case RequestErrorCode.DIAL_TIMEOUT:
35
35
  case RequestErrorCode.DIAL_ERROR:
36
- return e.message.includes(multiStreamSelectErrorCodes.protocolSelectionFailed) && method === ReqRespMethod.Ping
37
- ? PeerAction.Fatal
38
- : PeerAction.LowToleranceError;
36
+ // `RequestError` renders `e.message` as just the error code (see `renderErrorMessage`), so the
37
+ // multistream "protocol selection failed" text is only on the wrapped inner error, which is
38
+ // available on `DIAL_ERROR` via `e.type.error` (`DIAL_TIMEOUT` carries no inner error).
39
+ if (
40
+ e.type.code === RequestErrorCode.DIAL_ERROR &&
41
+ e.type.error.message.includes(multiStreamSelectErrorCodes.protocolSelectionFailed)
42
+ ) {
43
+ // Peer does not support the protocol, a real incompatibility rather than a transient
44
+ // failure, so keep the stronger penalty (Fatal for Ping, as before).
45
+ return method === ReqRespMethod.Ping ? PeerAction.Fatal : PeerAction.LowToleranceError;
46
+ }
47
+ switch (method) {
48
+ // Ping and Status are liveness probes; their dial timeouts are dominated by transient
49
+ // network congestion rather than peer misbehavior, so penalize leniently to avoid
50
+ // self-inflicted peer starvation (https://github.com/ChainSafe/lodestar/issues/9562),
51
+ // while still applying some penalty so genuinely dead peers eventually free the slot.
52
+ case ReqRespMethod.Ping:
53
+ case ReqRespMethod.Status:
54
+ return PeerAction.HighToleranceError;
55
+ default:
56
+ return PeerAction.LowToleranceError;
57
+ }
39
58
  // TODO: Detect SSZDecodeError and return PeerAction.Fatal
40
59
 
41
60
  case RequestErrorCode.RESP_TIMEOUT:
@@ -5,6 +5,7 @@ import {LodestarError, byteArrayEquals, prettyPrintIndices, toRootHex} from "@lo
5
5
  import {isBlockInputColumns} from "../../chain/blocks/blockInput/blockInput.js";
6
6
  import {IBlockInput} from "../../chain/blocks/blockInput/types.js";
7
7
  import {isDaOutOfRange} from "../../chain/blocks/blockInput/utils.js";
8
+ import {PayloadError, PayloadErrorCode} from "../../chain/blocks/importExecutionPayload.js";
8
9
  import {PayloadEnvelopeInput} from "../../chain/blocks/payloadEnvelopeInput/payloadEnvelopeInput.js";
9
10
  import {BlockError, BlockErrorCode} from "../../chain/errors/index.js";
10
11
  import {ZERO_HASH} from "../../constants/constants.js";
@@ -702,7 +703,7 @@ export class Batch {
702
703
  throw new BatchError(this.wrongStatusErrorType(BatchStatus.Processing));
703
704
  }
704
705
 
705
- if (err instanceof BlockError && err.type.code === BlockErrorCode.EXECUTION_ENGINE_ERROR) {
706
+ if (isExecutionEngineError(err)) {
706
707
  this.onExecutionEngineError(this.state.attempt);
707
708
  } else {
708
709
  this.onProcessingError(this.state.attempt);
@@ -717,7 +718,7 @@ export class Batch {
717
718
  throw new BatchError(this.wrongStatusErrorType(BatchStatus.AwaitingValidation));
718
719
  }
719
720
 
720
- if (err instanceof BlockError && err.type.code === BlockErrorCode.EXECUTION_ENGINE_ERROR) {
721
+ if (isExecutionEngineError(err)) {
721
722
  this.onExecutionEngineError(this.state.attempt);
722
723
  } else {
723
724
  this.onProcessingError(this.state.attempt);
@@ -787,3 +788,19 @@ type BatchErrorMetadata = {
787
788
  };
788
789
 
789
790
  export class BatchError extends LodestarError<BatchErrorType & BatchErrorMetadata> {}
791
+
792
+ function isExecutionEngineError(err: Error): boolean {
793
+ if (!(err instanceof BlockError)) {
794
+ return false;
795
+ }
796
+
797
+ if (err.type.code === BlockErrorCode.EXECUTION_ENGINE_ERROR) {
798
+ return true;
799
+ }
800
+
801
+ return (
802
+ err.type.code === BlockErrorCode.BEACON_CHAIN_ERROR &&
803
+ err.type.error instanceof PayloadError &&
804
+ err.type.error.type.code === PayloadErrorCode.EXECUTION_ENGINE_ERROR
805
+ );
806
+ }
package/src/util/clock.ts CHANGED
@@ -94,10 +94,7 @@ export class Clock extends EventEmitter implements IClock {
94
94
  }
95
95
  /**
96
96
  * If it's too close to next slot given MAXIMUM_GOSSIP_CLOCK_DISPARITY, return currentSlot + 1.
97
- * Otherwise return currentSlot
98
- *
99
- * Spec: phase0/p2p-interface.md - gossip validation uses `current_time + MAXIMUM_GOSSIP_CLOCK_DISPARITY < message_time`
100
- * to reject future messages (strict `<`), so the boundary (exactly equal) is accepted, hence `<=` here.
97
+ * Spec: phase0/p2p-interface.md rejects future messages with strict `<`, hence `<=` here.
101
98
  */
102
99
  get currentSlotWithGossipDisparity(): Slot {
103
100
  const currentSlot = this.currentSlot;
@@ -123,9 +120,7 @@ export class Clock extends EventEmitter implements IClock {
123
120
 
124
121
  /**
125
122
  * Check if a slot is current slot given MAXIMUM_GOSSIP_CLOCK_DISPARITY.
126
- *
127
- * Uses `<=` for disparity checks because the spec rejects with strict `<`
128
- * (phase0/p2p-interface.md), meaning the boundary (exactly equal) is accepted.
123
+ * Spec: phase0/p2p-interface.md rejects future messages with strict `<`, hence `<=`.
129
124
  */
130
125
  isCurrentSlotGivenGossipDisparity(slot: Slot): boolean {
131
126
  const currentSlot = this.currentSlot;