@lodestar/beacon-node 1.52.0-dev.0ac7778d70 → 1.52.0-dev.11b8cc8613

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 (266) hide show
  1. package/lib/api/impl/beacon/blocks/index.d.ts.map +1 -1
  2. package/lib/api/impl/beacon/blocks/index.js +63 -39
  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 +3 -1
  6. package/lib/api/impl/beacon/pool/index.js.map +1 -1
  7. package/lib/api/impl/beacon/state/utils.d.ts.map +1 -1
  8. package/lib/api/impl/beacon/state/utils.js +2 -1
  9. package/lib/api/impl/beacon/state/utils.js.map +1 -1
  10. package/lib/api/impl/debug/index.d.ts.map +1 -1
  11. package/lib/api/impl/debug/index.js +6 -2
  12. package/lib/api/impl/debug/index.js.map +1 -1
  13. package/lib/api/impl/validator/index.d.ts.map +1 -1
  14. package/lib/api/impl/validator/index.js +17 -7
  15. package/lib/api/impl/validator/index.js.map +1 -1
  16. package/lib/chain/ColumnReconstructionTracker.d.ts +4 -0
  17. package/lib/chain/ColumnReconstructionTracker.d.ts.map +1 -1
  18. package/lib/chain/ColumnReconstructionTracker.js +4 -0
  19. package/lib/chain/ColumnReconstructionTracker.js.map +1 -1
  20. package/lib/chain/archiveStore/historicalState/getHistoricalState.d.ts.map +1 -1
  21. package/lib/chain/archiveStore/historicalState/getHistoricalState.js +7 -0
  22. package/lib/chain/archiveStore/historicalState/getHistoricalState.js.map +1 -1
  23. package/lib/chain/archiveStore/utils/pruneHistory.d.ts.map +1 -1
  24. package/lib/chain/archiveStore/utils/pruneHistory.js +8 -4
  25. package/lib/chain/archiveStore/utils/pruneHistory.js.map +1 -1
  26. package/lib/chain/blocks/blockInput/blockInput.d.ts.map +1 -1
  27. package/lib/chain/blocks/blockInput/blockInput.js +3 -1
  28. package/lib/chain/blocks/blockInput/blockInput.js.map +1 -1
  29. package/lib/chain/blocks/importExecutionPayload.d.ts +1 -1
  30. package/lib/chain/blocks/importExecutionPayload.d.ts.map +1 -1
  31. package/lib/chain/blocks/importExecutionPayload.js +25 -5
  32. package/lib/chain/blocks/importExecutionPayload.js.map +1 -1
  33. package/lib/chain/blocks/index.d.ts.map +1 -1
  34. package/lib/chain/blocks/index.js +3 -17
  35. package/lib/chain/blocks/index.js.map +1 -1
  36. package/lib/chain/blocks/verifyBlock.d.ts.map +1 -1
  37. package/lib/chain/blocks/verifyBlock.js +21 -17
  38. package/lib/chain/blocks/verifyBlock.js.map +1 -1
  39. package/lib/chain/blocks/verifyBlocksDataAvailability.d.ts +2 -2
  40. package/lib/chain/blocks/verifyBlocksDataAvailability.d.ts.map +1 -1
  41. package/lib/chain/blocks/verifyBlocksDataAvailability.js +3 -3
  42. package/lib/chain/blocks/verifyBlocksDataAvailability.js.map +1 -1
  43. package/lib/chain/blocks/verifyBlocksExecutionPayloads.d.ts.map +1 -1
  44. package/lib/chain/blocks/verifyBlocksExecutionPayloads.js +7 -5
  45. package/lib/chain/blocks/verifyBlocksExecutionPayloads.js.map +1 -1
  46. package/lib/chain/blocks/verifyBlocksSignatures.d.ts +2 -2
  47. package/lib/chain/blocks/verifyBlocksSignatures.d.ts.map +1 -1
  48. package/lib/chain/blocks/verifyBlocksSignatures.js +2 -1
  49. package/lib/chain/blocks/verifyBlocksSignatures.js.map +1 -1
  50. package/lib/chain/blocks/verifyPayloadsDataAvailability.d.ts +2 -2
  51. package/lib/chain/blocks/verifyPayloadsDataAvailability.d.ts.map +1 -1
  52. package/lib/chain/blocks/verifyPayloadsDataAvailability.js +3 -3
  53. package/lib/chain/blocks/verifyPayloadsDataAvailability.js.map +1 -1
  54. package/lib/chain/bls/utils.js +1 -1
  55. package/lib/chain/bls/utils.js.map +1 -1
  56. package/lib/chain/chain.d.ts +6 -5
  57. package/lib/chain/chain.d.ts.map +1 -1
  58. package/lib/chain/chain.js +74 -26
  59. package/lib/chain/chain.js.map +1 -1
  60. package/lib/chain/errors/attestationError.d.ts +15 -1
  61. package/lib/chain/errors/attestationError.d.ts.map +1 -1
  62. package/lib/chain/errors/attestationError.js +8 -0
  63. package/lib/chain/errors/attestationError.js.map +1 -1
  64. package/lib/chain/errors/executionPayloadBid.d.ts +3 -2
  65. package/lib/chain/errors/executionPayloadBid.d.ts.map +1 -1
  66. package/lib/chain/errors/executionPayloadBid.js +1 -1
  67. package/lib/chain/errors/executionPayloadBid.js.map +1 -1
  68. package/lib/chain/errors/executionPayloadEnvelope.d.ts +48 -0
  69. package/lib/chain/errors/executionPayloadEnvelope.d.ts.map +1 -1
  70. package/lib/chain/errors/executionPayloadEnvelope.js +7 -0
  71. package/lib/chain/errors/executionPayloadEnvelope.js.map +1 -1
  72. package/lib/chain/forkChoice/index.d.ts +1 -4
  73. package/lib/chain/forkChoice/index.d.ts.map +1 -1
  74. package/lib/chain/forkChoice/index.js +1 -4
  75. package/lib/chain/forkChoice/index.js.map +1 -1
  76. package/lib/chain/forkChoiceExecutionEngine.d.ts +5 -3
  77. package/lib/chain/forkChoiceExecutionEngine.d.ts.map +1 -1
  78. package/lib/chain/forkChoiceExecutionEngine.js +34 -11
  79. package/lib/chain/forkChoiceExecutionEngine.js.map +1 -1
  80. package/lib/chain/interface.d.ts +1 -1
  81. package/lib/chain/interface.d.ts.map +1 -1
  82. package/lib/chain/lightClient/index.d.ts +13 -6
  83. package/lib/chain/lightClient/index.d.ts.map +1 -1
  84. package/lib/chain/lightClient/index.js +95 -115
  85. package/lib/chain/lightClient/index.js.map +1 -1
  86. package/lib/chain/opPools/inclusionListStore.d.ts +4 -1
  87. package/lib/chain/opPools/inclusionListStore.d.ts.map +1 -1
  88. package/lib/chain/opPools/inclusionListStore.js +5 -2
  89. package/lib/chain/opPools/inclusionListStore.js.map +1 -1
  90. package/lib/chain/opPools/opPool.js +6 -6
  91. package/lib/chain/opPools/opPool.js.map +1 -1
  92. package/lib/chain/options.js +1 -1
  93. package/lib/chain/options.js.map +1 -1
  94. package/lib/chain/seenCache/seenAttesters.d.ts +1 -0
  95. package/lib/chain/seenCache/seenAttesters.d.ts.map +1 -1
  96. package/lib/chain/seenCache/seenAttesters.js +1 -1
  97. package/lib/chain/seenCache/seenAttesters.js.map +1 -1
  98. package/lib/chain/seenCache/seenBlockAttesters.d.ts +8 -2
  99. package/lib/chain/seenCache/seenBlockAttesters.d.ts.map +1 -1
  100. package/lib/chain/seenCache/seenBlockAttesters.js +43 -6
  101. package/lib/chain/seenCache/seenBlockAttesters.js.map +1 -1
  102. package/lib/chain/seenCache/seenExecutionPayloadBids.d.ts +13 -4
  103. package/lib/chain/seenCache/seenExecutionPayloadBids.d.ts.map +1 -1
  104. package/lib/chain/seenCache/seenExecutionPayloadBids.js +13 -12
  105. package/lib/chain/seenCache/seenExecutionPayloadBids.js.map +1 -1
  106. package/lib/chain/shufflingCache.d.ts +5 -0
  107. package/lib/chain/shufflingCache.d.ts.map +1 -1
  108. package/lib/chain/shufflingCache.js +39 -1
  109. package/lib/chain/shufflingCache.js.map +1 -1
  110. package/lib/chain/validation/aggregateAndProof.d.ts.map +1 -1
  111. package/lib/chain/validation/aggregateAndProof.js +37 -9
  112. package/lib/chain/validation/aggregateAndProof.js.map +1 -1
  113. package/lib/chain/validation/attestation.d.ts.map +1 -1
  114. package/lib/chain/validation/attestation.js +32 -16
  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 +9 -1
  118. package/lib/chain/validation/block.js.map +1 -1
  119. package/lib/chain/validation/dataColumnSidecar.d.ts.map +1 -1
  120. package/lib/chain/validation/dataColumnSidecar.js +8 -1
  121. package/lib/chain/validation/dataColumnSidecar.js.map +1 -1
  122. package/lib/chain/validation/executionPayloadBid.d.ts.map +1 -1
  123. package/lib/chain/validation/executionPayloadBid.js +30 -40
  124. package/lib/chain/validation/executionPayloadBid.js.map +1 -1
  125. package/lib/chain/validation/executionPayloadEnvelope.d.ts.map +1 -1
  126. package/lib/chain/validation/executionPayloadEnvelope.js +79 -4
  127. package/lib/chain/validation/executionPayloadEnvelope.js.map +1 -1
  128. package/lib/chain/validation/payloadAttestationMessage.js +9 -0
  129. package/lib/chain/validation/payloadAttestationMessage.js.map +1 -1
  130. package/lib/chain/validatorMonitor.js +43 -43
  131. package/lib/chain/validatorMonitor.js.map +1 -1
  132. package/lib/metrics/metrics/beacon.d.ts +4 -0
  133. package/lib/metrics/metrics/beacon.d.ts.map +1 -1
  134. package/lib/metrics/metrics/beacon.js +9 -0
  135. package/lib/metrics/metrics/beacon.js.map +1 -1
  136. package/lib/metrics/metrics/lodestar.d.ts +2 -0
  137. package/lib/metrics/metrics/lodestar.d.ts.map +1 -1
  138. package/lib/metrics/metrics/lodestar.js +9 -0
  139. package/lib/metrics/metrics/lodestar.js.map +1 -1
  140. package/lib/network/gossip/gossipsub.d.ts +1 -0
  141. package/lib/network/gossip/gossipsub.d.ts.map +1 -1
  142. package/lib/network/gossip/gossipsub.js +5 -2
  143. package/lib/network/gossip/gossipsub.js.map +1 -1
  144. package/lib/network/gossip/topic.d.ts +1 -7
  145. package/lib/network/gossip/topic.d.ts.map +1 -1
  146. package/lib/network/gossip/topic.js +0 -13
  147. package/lib/network/gossip/topic.js.map +1 -1
  148. package/lib/network/network.d.ts +1 -0
  149. package/lib/network/network.d.ts.map +1 -1
  150. package/lib/network/network.js +26 -12
  151. package/lib/network/network.js.map +1 -1
  152. package/lib/network/peers/peerManager.d.ts.map +1 -1
  153. package/lib/network/peers/peerManager.js +22 -2
  154. package/lib/network/peers/peerManager.js.map +1 -1
  155. package/lib/network/peers/utils/prioritizePeers.d.ts +2 -0
  156. package/lib/network/peers/utils/prioritizePeers.d.ts.map +1 -1
  157. package/lib/network/peers/utils/prioritizePeers.js +11 -2
  158. package/lib/network/peers/utils/prioritizePeers.js.map +1 -1
  159. package/lib/network/processor/gossipHandlers.d.ts.map +1 -1
  160. package/lib/network/processor/gossipHandlers.js +19 -6
  161. package/lib/network/processor/gossipHandlers.js.map +1 -1
  162. package/lib/network/processor/gossipValidatorFn.d.ts.map +1 -1
  163. package/lib/network/processor/gossipValidatorFn.js +4 -1
  164. package/lib/network/processor/gossipValidatorFn.js.map +1 -1
  165. package/lib/network/processor/index.d.ts.map +1 -1
  166. package/lib/network/processor/index.js +4 -2
  167. package/lib/network/processor/index.js.map +1 -1
  168. package/lib/network/reqresp/utils/collect.d.ts +4 -4
  169. package/lib/network/reqresp/utils/collect.d.ts.map +1 -1
  170. package/lib/network/reqresp/utils/collect.js +9 -8
  171. package/lib/network/reqresp/utils/collect.js.map +1 -1
  172. package/lib/network/reqresp/utils/collectSequentialBlocksInRange.d.ts +1 -1
  173. package/lib/network/reqresp/utils/collectSequentialBlocksInRange.d.ts.map +1 -1
  174. package/lib/network/reqresp/utils/collectSequentialBlocksInRange.js +2 -2
  175. package/lib/network/reqresp/utils/collectSequentialBlocksInRange.js.map +1 -1
  176. package/lib/sync/range/batch.d.ts +6 -0
  177. package/lib/sync/range/batch.d.ts.map +1 -1
  178. package/lib/sync/range/batch.js +17 -0
  179. package/lib/sync/range/batch.js.map +1 -1
  180. package/lib/sync/range/chain.d.ts.map +1 -1
  181. package/lib/sync/range/chain.js +8 -1
  182. package/lib/sync/range/chain.js.map +1 -1
  183. package/lib/sync/range/range.d.ts.map +1 -1
  184. package/lib/sync/range/range.js +43 -3
  185. package/lib/sync/range/range.js.map +1 -1
  186. package/lib/sync/types.d.ts +12 -1
  187. package/lib/sync/types.d.ts.map +1 -1
  188. package/lib/sync/types.js +2 -0
  189. package/lib/sync/types.js.map +1 -1
  190. package/lib/sync/unknownBlock.d.ts +28 -1
  191. package/lib/sync/unknownBlock.d.ts.map +1 -1
  192. package/lib/sync/unknownBlock.js +296 -24
  193. package/lib/sync/unknownBlock.js.map +1 -1
  194. package/lib/sync/utils/downloadByRange.d.ts +14 -1
  195. package/lib/sync/utils/downloadByRange.d.ts.map +1 -1
  196. package/lib/sync/utils/downloadByRange.js +12 -2
  197. package/lib/sync/utils/downloadByRange.js.map +1 -1
  198. package/lib/sync/utils/downloadByRoot.d.ts +24 -2
  199. package/lib/sync/utils/downloadByRoot.d.ts.map +1 -1
  200. package/lib/sync/utils/downloadByRoot.js +48 -5
  201. package/lib/sync/utils/downloadByRoot.js.map +1 -1
  202. package/lib/util/eventLoop.d.ts +3 -3
  203. package/lib/util/eventLoop.d.ts.map +1 -1
  204. package/lib/util/eventLoop.js +3 -3
  205. package/lib/util/eventLoop.js.map +1 -1
  206. package/package.json +26 -26
  207. package/src/api/impl/beacon/blocks/index.ts +74 -47
  208. package/src/api/impl/beacon/pool/index.ts +9 -7
  209. package/src/api/impl/beacon/state/utils.ts +2 -1
  210. package/src/api/impl/debug/index.ts +6 -2
  211. package/src/api/impl/validator/index.ts +19 -7
  212. package/src/chain/ColumnReconstructionTracker.ts +5 -0
  213. package/src/chain/archiveStore/historicalState/getHistoricalState.ts +9 -0
  214. package/src/chain/archiveStore/utils/pruneHistory.ts +9 -4
  215. package/src/chain/blocks/blockInput/blockInput.ts +4 -1
  216. package/src/chain/blocks/importExecutionPayload.ts +30 -4
  217. package/src/chain/blocks/index.ts +3 -31
  218. package/src/chain/blocks/verifyBlock.ts +24 -17
  219. package/src/chain/blocks/verifyBlocksDataAvailability.ts +4 -4
  220. package/src/chain/blocks/verifyBlocksExecutionPayloads.ts +7 -4
  221. package/src/chain/blocks/verifyBlocksSignatures.ts +3 -0
  222. package/src/chain/blocks/verifyPayloadsDataAvailability.ts +5 -4
  223. package/src/chain/bls/utils.ts +1 -1
  224. package/src/chain/chain.ts +107 -43
  225. package/src/chain/errors/attestationError.ts +11 -1
  226. package/src/chain/errors/executionPayloadBid.ts +3 -2
  227. package/src/chain/errors/executionPayloadEnvelope.ts +50 -0
  228. package/src/chain/forkChoice/index.ts +1 -4
  229. package/src/chain/forkChoiceExecutionEngine.ts +48 -15
  230. package/src/chain/interface.ts +1 -1
  231. package/src/chain/lightClient/index.ts +108 -142
  232. package/src/chain/opPools/inclusionListStore.ts +5 -2
  233. package/src/chain/opPools/opPool.ts +6 -6
  234. package/src/chain/options.ts +1 -1
  235. package/src/chain/seenCache/seenAttesters.ts +1 -1
  236. package/src/chain/seenCache/seenBlockAttesters.ts +48 -6
  237. package/src/chain/seenCache/seenExecutionPayloadBids.ts +35 -15
  238. package/src/chain/shufflingCache.ts +40 -1
  239. package/src/chain/validation/aggregateAndProof.ts +43 -14
  240. package/src/chain/validation/attestation.ts +31 -20
  241. package/src/chain/validation/block.ts +9 -1
  242. package/src/chain/validation/dataColumnSidecar.ts +7 -1
  243. package/src/chain/validation/executionPayloadBid.ts +40 -42
  244. package/src/chain/validation/executionPayloadEnvelope.ts +87 -3
  245. package/src/chain/validation/payloadAttestationMessage.ts +10 -0
  246. package/src/chain/validatorMonitor.ts +43 -43
  247. package/src/metrics/metrics/beacon.ts +9 -0
  248. package/src/metrics/metrics/lodestar.ts +9 -0
  249. package/src/network/gossip/gossipsub.ts +6 -2
  250. package/src/network/gossip/topic.ts +1 -14
  251. package/src/network/network.ts +39 -13
  252. package/src/network/peers/peerManager.ts +26 -2
  253. package/src/network/peers/utils/prioritizePeers.ts +14 -1
  254. package/src/network/processor/gossipHandlers.ts +25 -13
  255. package/src/network/processor/gossipValidatorFn.ts +4 -0
  256. package/src/network/processor/index.ts +7 -2
  257. package/src/network/reqresp/utils/collect.ts +16 -8
  258. package/src/network/reqresp/utils/collectSequentialBlocksInRange.ts +3 -2
  259. package/src/sync/range/batch.ts +20 -0
  260. package/src/sync/range/chain.ts +8 -0
  261. package/src/sync/range/range.ts +56 -3
  262. package/src/sync/types.ts +11 -0
  263. package/src/sync/unknownBlock.ts +340 -24
  264. package/src/sync/utils/downloadByRange.ts +29 -3
  265. package/src/sync/utils/downloadByRoot.ts +75 -7
  266. package/src/util/eventLoop.ts +3 -3
@@ -1216,137 +1216,137 @@ function createValidatorMonitorMetrics(register: RegistryMetricCreator, register
1216
1216
 
1217
1217
  return {
1218
1218
  validatorsConnected: register.gauge({
1219
- name: "lodestar_validator_monitor_validators",
1219
+ name: "validator_monitor_validators",
1220
1220
  help: "Count of validators that are specifically monitored by this beacon node",
1221
1221
  }),
1222
1222
 
1223
1223
  validatorsConnectedIndices: register.gauge<{indices: string}>({
1224
- name: "lodestar_validator_monitor_indices",
1224
+ name: "validator_monitor_indices",
1225
1225
  help: "Static metric with connected validator indices as label, value is always 1",
1226
1226
  labelNames: ["indices"],
1227
1227
  }),
1228
1228
 
1229
1229
  validatorsInSyncCommittee: register.gauge({
1230
- name: "lodestar_validator_monitor_validators_in_sync_committee",
1230
+ name: "validator_monitor_validators_in_sync_committee",
1231
1231
  help: "Count of validators monitored by this beacon node that are part of sync committee",
1232
1232
  }),
1233
1233
 
1234
1234
  // Validator Monitor Metrics (per-epoch summaries)
1235
1235
  prevEpochOnChainBalance: stateDerivedRegister?.gauge({
1236
- name: "lodestar_validator_monitor_prev_epoch_on_chain_balance",
1236
+ name: "validator_monitor_prev_epoch_on_chain_balance",
1237
1237
  help: "Total balance of all monitored validators after an epoch",
1238
1238
  }),
1239
1239
  prevEpochOnChainAttesterHit: register.gauge({
1240
- name: "lodestar_validator_monitor_prev_epoch_on_chain_attester_hit_total",
1240
+ name: "validator_monitor_prev_epoch_on_chain_attester_hit_total",
1241
1241
  help: "Incremented if validator's submitted attestation is included in some blocks",
1242
1242
  }),
1243
1243
  prevEpochOnChainAttesterMiss: register.gauge({
1244
- name: "lodestar_validator_monitor_prev_epoch_on_chain_attester_miss_total",
1244
+ name: "validator_monitor_prev_epoch_on_chain_attester_miss_total",
1245
1245
  help: "Incremented if validator's submitted attestation is not included in any blocks",
1246
1246
  }),
1247
1247
  prevEpochOnChainSourceAttesterHit: stateDerivedRegister?.gauge({
1248
- name: "lodestar_validator_monitor_prev_epoch_on_chain_source_attester_hit_total",
1248
+ name: "validator_monitor_prev_epoch_on_chain_source_attester_hit_total",
1249
1249
  help: "Incremented if the validator is flagged as a previous epoch source attester during per epoch processing",
1250
1250
  }),
1251
1251
  prevEpochOnChainSourceAttesterMiss: stateDerivedRegister?.gauge({
1252
- name: "lodestar_validator_monitor_prev_epoch_on_chain_source_attester_miss_total",
1252
+ name: "validator_monitor_prev_epoch_on_chain_source_attester_miss_total",
1253
1253
  help: "Incremented if the validator is not flagged as a previous epoch source attester during per epoch processing",
1254
1254
  }),
1255
1255
  prevEpochOnChainHeadAttesterHit: stateDerivedRegister?.gauge({
1256
- name: "lodestar_validator_monitor_prev_epoch_on_chain_head_attester_hit_total",
1256
+ name: "validator_monitor_prev_epoch_on_chain_head_attester_hit_total",
1257
1257
  help: "Incremented if the validator is flagged as a previous epoch head attester during per epoch processing",
1258
1258
  }),
1259
1259
  prevEpochOnChainHeadAttesterMiss: stateDerivedRegister?.gauge({
1260
- name: "lodestar_validator_monitor_prev_epoch_on_chain_head_attester_miss_total",
1260
+ name: "validator_monitor_prev_epoch_on_chain_head_attester_miss_total",
1261
1261
  help: "Incremented if the validator is not flagged as a previous epoch head attester during per epoch processing",
1262
1262
  }),
1263
1263
  prevOnChainAttesterCorrectHead: register.gauge({
1264
- name: "lodestar_validator_monitor_prev_epoch_on_chain_attester_correct_head_total",
1264
+ name: "validator_monitor_prev_epoch_on_chain_attester_correct_head_total",
1265
1265
  help: "Total count of times a validator votes correct head",
1266
1266
  }),
1267
1267
  prevOnChainAttesterIncorrectHead: register.gauge({
1268
- name: "lodestar_validator_monitor_prev_epoch_on_chain_attester_incorrect_head_total",
1268
+ name: "validator_monitor_prev_epoch_on_chain_attester_incorrect_head_total",
1269
1269
  help: "Total count of times a validator votes incorrect head",
1270
1270
  }),
1271
1271
  prevEpochOnChainTargetAttesterHit: stateDerivedRegister?.gauge({
1272
- name: "lodestar_validator_monitor_prev_epoch_on_chain_target_attester_hit_total",
1272
+ name: "validator_monitor_prev_epoch_on_chain_target_attester_hit_total",
1273
1273
  help: "Incremented if the validator is flagged as a previous epoch target attester during per epoch processing",
1274
1274
  }),
1275
1275
  prevEpochOnChainTargetAttesterMiss: stateDerivedRegister?.gauge({
1276
- name: "lodestar_validator_monitor_prev_epoch_on_chain_target_attester_miss_total",
1276
+ name: "validator_monitor_prev_epoch_on_chain_target_attester_miss_total",
1277
1277
  help: "Incremented if the validator is not flagged as a previous epoch target attester during per epoch processing",
1278
1278
  }),
1279
1279
  prevEpochOnChainInclusionDistance: register.histogram({
1280
- name: "lodestar_validator_monitor_prev_epoch_on_chain_inclusion_distance",
1280
+ name: "validator_monitor_prev_epoch_on_chain_inclusion_distance",
1281
1281
  help: "The attestation inclusion distance calculated during per epoch processing",
1282
1282
  // min inclusion distance is 1, usual values are 1,2,3 max is 32 (1 epoch)
1283
1283
  buckets: [1, 2, 3, 5, 10, 32],
1284
1284
  }),
1285
1285
  prevEpochAttestations: register.histogram({
1286
- name: "lodestar_validator_monitor_prev_epoch_attestations",
1286
+ name: "validator_monitor_prev_epoch_attestations",
1287
1287
  help: "The number of unagg. attestations seen in the previous epoch",
1288
1288
  buckets: [0, 1, 2, 3],
1289
1289
  }),
1290
1290
  prevEpochAttestationsMinDelaySeconds: register.histogram({
1291
- name: "lodestar_validator_monitor_prev_epoch_attestations_min_delay_seconds",
1291
+ name: "validator_monitor_prev_epoch_attestations_min_delay_seconds",
1292
1292
  help: "The min delay between when the validator should send the attestation and when it was received",
1293
1293
  buckets: [0.1, 0.25, 0.5, 1, 2, 5, 10],
1294
1294
  }),
1295
1295
  prevEpochAttestationAggregateInclusions: register.histogram({
1296
- name: "lodestar_validator_monitor_prev_epoch_attestation_aggregate_inclusions",
1296
+ name: "validator_monitor_prev_epoch_attestation_aggregate_inclusions",
1297
1297
  help: "The count of times an attestation was seen inside an aggregate",
1298
1298
  buckets: [0, 1, 2, 3, 5, 10],
1299
1299
  }),
1300
1300
  prevEpochAttestationBlockInclusions: register.histogram({
1301
- name: "lodestar_validator_monitor_prev_epoch_attestation_block_inclusions",
1301
+ name: "validator_monitor_prev_epoch_attestation_block_inclusions",
1302
1302
  help: "The count of times an attestation was seen inside a block",
1303
1303
  buckets: [0, 1, 2, 3, 5],
1304
1304
  }),
1305
1305
  prevEpochAttestationBlockMinInclusionDistance: register.histogram({
1306
- name: "lodestar_validator_monitor_prev_epoch_attestation_block_min_inclusion_distance",
1306
+ name: "validator_monitor_prev_epoch_attestation_block_min_inclusion_distance",
1307
1307
  help: "The minimum inclusion distance observed for the inclusion of an attestation in a block",
1308
1308
  buckets: [1, 2, 3, 5, 10, 32],
1309
1309
  }),
1310
1310
  prevEpochBeaconBlocks: register.histogram({
1311
- name: "lodestar_validator_monitor_prev_epoch_beacon_blocks",
1311
+ name: "validator_monitor_prev_epoch_beacon_blocks",
1312
1312
  help: "The number of beacon_blocks seen in the previous epoch",
1313
1313
  buckets: [0, 1, 2, 3, 5, 10],
1314
1314
  }),
1315
1315
  prevEpochBeaconBlocksMinDelaySeconds: register.histogram({
1316
- name: "lodestar_validator_monitor_prev_epoch_beacon_blocks_min_delay_seconds",
1316
+ name: "validator_monitor_prev_epoch_beacon_blocks_min_delay_seconds",
1317
1317
  help: "The min delay between when the validator should send the block and when it was received",
1318
1318
  buckets: [0.1, 0.25, 0.5, 1, 2, 5, 10],
1319
1319
  }),
1320
1320
  prevEpochAggregatesTotal: register.histogram({
1321
- name: "lodestar_validator_monitor_prev_epoch_aggregates",
1321
+ name: "validator_monitor_prev_epoch_aggregates",
1322
1322
  help: "The number of aggregates seen in the previous epoch",
1323
1323
  buckets: [0, 1, 2, 3, 5, 10],
1324
1324
  }),
1325
1325
  prevEpochAggregatesMinDelaySeconds: register.histogram({
1326
- name: "lodestar_validator_monitor_prev_epoch_aggregates_min_delay_seconds",
1326
+ name: "validator_monitor_prev_epoch_aggregates_min_delay_seconds",
1327
1327
  help: "The min delay between when the validator should send the aggregate and when it was received",
1328
1328
  buckets: [0.1, 0.25, 0.5, 1, 2, 5, 10],
1329
1329
  }),
1330
1330
  prevEpochSyncCommitteeHits: register.gauge({
1331
- name: "lodestar_validator_monitor_prev_epoch_sync_committee_hits",
1331
+ name: "validator_monitor_prev_epoch_sync_committee_hits",
1332
1332
  help: "Count of times in prev epoch connected validators participated in imported block's syncAggregate",
1333
1333
  }),
1334
1334
  prevEpochSyncCommitteeMisses: register.gauge({
1335
- name: "lodestar_validator_monitor_prev_epoch_sync_committee_misses",
1335
+ name: "validator_monitor_prev_epoch_sync_committee_misses",
1336
1336
  help: "Count of times in prev epoch connected validators fail to participate in imported block's syncAggregate",
1337
1337
  }),
1338
1338
  prevEpochSyncSignatureAggregateInclusions: register.histogram({
1339
- name: "lodestar_validator_monitor_prev_epoch_sync_signature_aggregate_inclusions",
1339
+ name: "validator_monitor_prev_epoch_sync_signature_aggregate_inclusions",
1340
1340
  help: "The count of times a sync signature was seen inside an aggregate",
1341
1341
  buckets: [0, 1, 2, 3, 5, 10],
1342
1342
  }),
1343
1343
  prevEpochAttestationSummary: register.gauge<{summary: string}>({
1344
- name: "lodestar_validator_monitor_prev_epoch_attestation_summary",
1344
+ name: "validator_monitor_prev_epoch_attestation_summary",
1345
1345
  help: "Best guess of the node of the result of previous epoch validators attestation actions and causality",
1346
1346
  labelNames: ["summary"],
1347
1347
  }),
1348
1348
  prevEpochBlockProposalSummary: register.gauge<{summary: string}>({
1349
- name: "lodestar_validator_monitor_prev_epoch_block_proposal_summary",
1349
+ name: "validator_monitor_prev_epoch_block_proposal_summary",
1350
1350
  help: "Best guess of the node of the result of previous epoch validators block proposal actions and causality",
1351
1351
  labelNames: ["summary"],
1352
1352
  }),
@@ -1354,18 +1354,18 @@ function createValidatorMonitorMetrics(register: RegistryMetricCreator, register
1354
1354
  // Validator Monitor Metrics (real-time)
1355
1355
 
1356
1356
  unaggregatedAttestationTotal: register.gauge<{src: OpSource}>({
1357
- name: "lodestar_validator_monitor_unaggregated_attestation_total",
1357
+ name: "validator_monitor_unaggregated_attestation_total",
1358
1358
  help: "Number of unaggregated attestations seen",
1359
1359
  labelNames: ["src"],
1360
1360
  }),
1361
1361
  unaggregatedAttestationDelaySeconds: register.histogram<{src: OpSource}>({
1362
- name: "lodestar_validator_monitor_unaggregated_attestation_delay_seconds",
1362
+ name: "validator_monitor_unaggregated_attestation_delay_seconds",
1363
1363
  help: "The delay between when the validator should send the attestation and when it was received",
1364
1364
  labelNames: ["src"],
1365
1365
  buckets: [0.1, 0.25, 0.5, 1, 2, 5, 10],
1366
1366
  }),
1367
1367
  unaggregatedAttestationSubmittedSentPeers: register.histogram({
1368
- name: "lodestar_validator_monitor_unaggregated_attestation_submitted_sent_peers_count",
1368
+ name: "validator_monitor_unaggregated_attestation_submitted_sent_peers_count",
1369
1369
  help: "Number of peers that an unaggregated attestation sent to",
1370
1370
  // as of Apr 2022, most of the time we sent to >30 peers per attestations
1371
1371
  // these bucket values just base on that fact to get equal range
@@ -1373,52 +1373,52 @@ function createValidatorMonitorMetrics(register: RegistryMetricCreator, register
1373
1373
  buckets: [0, 10, 20, 30],
1374
1374
  }),
1375
1375
  aggregatedAttestationTotal: register.gauge<{src: OpSource}>({
1376
- name: "lodestar_validator_monitor_aggregated_attestation_total",
1376
+ name: "validator_monitor_aggregated_attestation_total",
1377
1377
  help: "Number of aggregated attestations seen",
1378
1378
  labelNames: ["src"],
1379
1379
  }),
1380
1380
  aggregatedAttestationDelaySeconds: register.histogram<{src: OpSource}>({
1381
- name: "lodestar_validator_monitor_aggregated_attestation_delay_seconds",
1381
+ name: "validator_monitor_aggregated_attestation_delay_seconds",
1382
1382
  help: "The delay between then the validator should send the aggregate and when it was received",
1383
1383
  labelNames: ["src"],
1384
1384
  buckets: [0.1, 0.25, 0.5, 1, 2, 5, 10],
1385
1385
  }),
1386
1386
  attestationInAggregateTotal: register.gauge<{src: OpSource}>({
1387
- name: "lodestar_validator_monitor_attestation_in_aggregate_total",
1387
+ name: "validator_monitor_attestation_in_aggregate_total",
1388
1388
  help: "Number of times an attestation has been seen in an aggregate",
1389
1389
  labelNames: ["src"],
1390
1390
  }),
1391
1391
  attestationInAggregateDelaySeconds: register.histogram<{src: OpSource}>({
1392
- name: "lodestar_validator_monitor_attestation_in_aggregate_delay_seconds",
1392
+ name: "validator_monitor_attestation_in_aggregate_delay_seconds",
1393
1393
  help: "The delay between when the validator should send the aggregate and when it was received",
1394
1394
  labelNames: ["src"],
1395
1395
  buckets: [0.1, 0.25, 0.5, 1, 2, 5, 10],
1396
1396
  }),
1397
1397
  attestationInBlockTotal: register.gauge({
1398
- name: "lodestar_validator_monitor_attestation_in_block_total",
1398
+ name: "validator_monitor_attestation_in_block_total",
1399
1399
  help: "Number of times an attestation has been seen in a block",
1400
1400
  }),
1401
1401
  attestationInBlockDelaySlots: register.histogram({
1402
- name: "lodestar_validator_monitor_attestation_in_block_delay_slots",
1402
+ name: "validator_monitor_attestation_in_block_delay_slots",
1403
1403
  help: "The excess slots (beyond the minimum delay) between the attestation slot and the block slot",
1404
1404
  buckets: [0.1, 0.25, 0.5, 1, 2, 5, 10],
1405
1405
  }),
1406
1406
  attestationInBlockParticipants: register.histogram({
1407
- name: "lodestar_validator_monitor_attestation_in_block_participants",
1407
+ name: "validator_monitor_attestation_in_block_participants",
1408
1408
  help: "The total participants in attestations of monitored validators included in blocks",
1409
1409
  buckets: [1, 5, 20, 50, 100, 200],
1410
1410
  }),
1411
1411
  syncSignatureInAggregateTotal: register.gauge({
1412
- name: "lodestar_validator_monitor_sync_signature_in_aggregate_total",
1412
+ name: "validator_monitor_sync_signature_in_aggregate_total",
1413
1413
  help: "Number of times a sync signature has been seen in an aggregate",
1414
1414
  }),
1415
1415
  beaconBlockTotal: register.gauge<{src: OpSource}>({
1416
- name: "lodestar_validator_monitor_beacon_block_total",
1416
+ name: "validator_monitor_beacon_block_total",
1417
1417
  help: "Total number of beacon blocks seen",
1418
1418
  labelNames: ["src"],
1419
1419
  }),
1420
1420
  beaconBlockDelaySeconds: register.histogram<{src: OpSource}>({
1421
- name: "lodestar_validator_monitor_beacon_block_delay_seconds",
1421
+ name: "validator_monitor_beacon_block_delay_seconds",
1422
1422
  help: "The delay between when the validator should send the block and when it was received",
1423
1423
  labelNames: ["src"],
1424
1424
  // we also want other nodes to received our published before 4s so add bucket 3 and 3.5
@@ -1427,7 +1427,7 @@ function createValidatorMonitorMetrics(register: RegistryMetricCreator, register
1427
1427
 
1428
1428
  // Only for known
1429
1429
  proposerBalanceDeltaKnown: register.histogram({
1430
- name: "lodestar_validator_monitor_proposer_balance_delta_known_gwei",
1430
+ name: "validator_monitor_proposer_balance_delta_known_gwei",
1431
1431
  help: "Balance delta of known block proposer after importing a valid block",
1432
1432
  // Jul22 mainnet block reward is consistently between 29,000,000-28,000,000 GWei
1433
1433
  buckets: [10_000, 100_000, 1e6, 10e6, 20e6, 50e6, 100e6, 1000e6],
@@ -334,6 +334,15 @@ export function createBeaconMetrics(register: RegistryMetricCreator) {
334
334
  help: "Time taken to compute data column sidecars, including cells and inclusion proof",
335
335
  buckets: [0.1, 0.25, 0.5, 0.75, 1, 2, 5],
336
336
  }),
337
+ dataColumnSidecarProposerSignatureChecks: register.counter<{result: "cache_hit" | "verification"}>({
338
+ name: "beacon_data_column_sidecar_proposer_signature_checks_total",
339
+ help: "Gossip data column proposer signature checks answered by the cache or by a started verification",
340
+ labelNames: ["result"],
341
+ }),
342
+ dataColumnSidecarProposerSignatureBlocks: register.counter({
343
+ name: "beacon_data_column_sidecar_proposer_signature_blocks_total",
344
+ help: "Blocks whose proposer signature a gossip data column verified and cached first",
345
+ }),
337
346
  dataColumnSidecarInclusionProofVerificationTime: register.histogram({
338
347
  name: "beacon_data_column_sidecar_inclusion_proof_verification_seconds",
339
348
  help: "Time taken to verify data_column sidecar inclusion proof",
@@ -1784,6 +1784,15 @@ export function createLodestarMetrics(
1784
1784
  help: "Time from promise insertion until promise resolution when shuffling was ready in seconds",
1785
1785
  buckets: [0.5, 1, 1.5, 2],
1786
1786
  }),
1787
+ committeePubkeysComputeTime: register.histogram({
1788
+ name: "lodestar_shuffling_cache_committee_pubkeys_compute_seconds",
1789
+ help: "Time to aggregate the committee pubkeys of a shuffling off the main thread in seconds",
1790
+ buckets: [0.1, 0.25, 0.5, 1, 2, 5],
1791
+ }),
1792
+ committeePubkeysErrors: register.counter({
1793
+ name: "lodestar_shuffling_cache_committee_pubkeys_errors_total",
1794
+ help: "Total number of shufflings whose committee pubkeys could not be computed",
1795
+ }),
1787
1796
  },
1788
1797
 
1789
1798
  seenCache: {
@@ -25,7 +25,7 @@ import {getSlotDurations} from "@lodestar/state-transition";
25
25
  import {SubnetID} from "@lodestar/types";
26
26
  import {Logger, Map2d, Map2dArr} from "@lodestar/utils";
27
27
  import {RegistryMetricCreator} from "../../metrics/index.js";
28
- import {callImmediate, callInNextEventLoop} from "../../util/eventLoop.js";
28
+ import {callAfterIO, callInNextEventLoop} from "../../util/eventLoop.js";
29
29
  import {NetworkEvent, NetworkEventBus, NetworkEventData} from "../events.js";
30
30
  import {Libp2p} from "../interface.js";
31
31
  import {NetworkConfig} from "../networkConfig.js";
@@ -433,7 +433,7 @@ export class Eth2Gossipsub {
433
433
  // See https://github.com/ChainSafe/lodestar/issues/5604
434
434
  // A block arrives once per slot and cannot cause that lag, so it skips the 1ms timer delay
435
435
  if (topic.type === GossipType.beacon_block) {
436
- callImmediate(emitPendingMessage);
436
+ callAfterIO(emitPendingMessage);
437
437
  } else {
438
438
  callInNextEventLoop(emitPendingMessage);
439
439
  }
@@ -505,6 +505,10 @@ export class Eth2Gossipsub {
505
505
  getDirectPeers(): string[] {
506
506
  return Array.from(this.gossipsub.direct);
507
507
  }
508
+
509
+ isDirectPeer(peerIdStr: string): boolean {
510
+ return this.gossipsub.direct.has(peerIdStr);
511
+ }
508
512
  }
509
513
 
510
514
  /**
@@ -12,7 +12,7 @@ import {
12
12
  isForkPostGloas,
13
13
  } from "@lodestar/params";
14
14
  import {TypeSizes} from "@lodestar/reqresp";
15
- import {Attestation, SingleAttestation, ssz, sszTypesFor} from "@lodestar/types";
15
+ import {SingleAttestation, ssz, sszTypesFor} from "@lodestar/types";
16
16
  import {GossipAction, GossipActionError, GossipErrorCode} from "../../chain/errors/gossipValidation.js";
17
17
  import {computeMaxGloasDataColumnSidecarSize} from "../../util/sszBytes.js";
18
18
  import {NetworkConfig} from "../networkConfig.js";
@@ -173,19 +173,6 @@ export function sszDeserialize<T extends GossipTopic>(topic: T, serializedData:
173
173
  }
174
174
  }
175
175
 
176
- /**
177
- * @deprecated
178
- * Deserialize a gossip serialized data into an Attestation object.
179
- * No longer used post-electra. Use `sszDeserializeSingleAttestation` instead
180
- */
181
- export function sszDeserializeAttestation(fork: ForkName, serializedData: Uint8Array): Attestation {
182
- try {
183
- return sszTypesFor(fork).Attestation.deserialize(serializedData);
184
- } catch (_e) {
185
- throw new GossipActionError(GossipAction.REJECT, {code: GossipErrorCode.INVALID_SERIALIZED_BYTES_ERROR_CODE});
186
- }
187
- }
188
-
189
176
  /**
190
177
  * Deserialize a gossip seralized data into an SingleAttestation object.
191
178
  */
@@ -431,7 +431,7 @@ export class Network implements INetwork {
431
431
  }
432
432
 
433
433
  async publishBlsToExecutionChange(blsToExecutionChange: capella.SignedBLSToExecutionChange): Promise<number> {
434
- const publishChanges = [];
434
+ const publishChanges: Promise<number>[] = [];
435
435
  for (const boundary of getActiveForkBoundaries(this.config, this.clock.currentEpoch)) {
436
436
  const fork = ForkSeq[boundary.fork];
437
437
 
@@ -447,7 +447,11 @@ export class Network implements INetwork {
447
447
  if (publishChanges.length === 0) {
448
448
  throw Error("No capella+ fork active yet to publish blsToExecutionChange");
449
449
  }
450
- return Promise.any(publishChanges);
450
+ try {
451
+ return await Promise.any(publishChanges);
452
+ } finally {
453
+ await Promise.allSettled(publishChanges);
454
+ }
451
455
  }
452
456
 
453
457
  async publishProposerSlashing(proposerSlashing: phase0.ProposerSlashing): Promise<number> {
@@ -596,7 +600,8 @@ export class Network implements INetwork {
596
600
  request
597
601
  ),
598
602
  request,
599
- this.chain.serializedCache
603
+ this.chain.serializedCache,
604
+ () => this.reportInvalidResponse(peerId)
600
605
  );
601
606
  }
602
607
 
@@ -611,7 +616,8 @@ export class Network implements INetwork {
611
616
  ),
612
617
  request.length,
613
618
  responseSszTypeByMethod[ReqRespMethod.BeaconBlocksByRoot],
614
- this.chain.serializedCache
619
+ this.chain.serializedCache,
620
+ () => this.reportInvalidResponse(peerId)
615
621
  );
616
622
  }
617
623
 
@@ -623,28 +629,32 @@ export class Network implements INetwork {
623
629
  this.sendReqRespRequest(peerId, ReqRespMethod.BeaconBlocksByHead, [Version.V1], request),
624
630
  Math.min(request.count, this.config.MAX_REQUEST_BLOCKS_DENEB),
625
631
  responseSszTypeByMethod[ReqRespMethod.BeaconBlocksByHead],
626
- this.chain.serializedCache
632
+ this.chain.serializedCache,
633
+ () => this.reportInvalidResponse(peerId)
627
634
  );
628
635
  }
629
636
 
630
637
  async sendLightClientBootstrap(peerId: PeerIdStr, request: Root): Promise<LightClientBootstrap> {
631
638
  return collectExactOneTyped(
632
639
  this.sendReqRespRequest(peerId, ReqRespMethod.LightClientBootstrap, [Version.V1], request),
633
- responseSszTypeByMethod[ReqRespMethod.LightClientBootstrap]
640
+ responseSszTypeByMethod[ReqRespMethod.LightClientBootstrap],
641
+ () => this.reportInvalidResponse(peerId)
634
642
  );
635
643
  }
636
644
 
637
645
  async sendLightClientOptimisticUpdate(peerId: PeerIdStr): Promise<LightClientOptimisticUpdate> {
638
646
  return collectExactOneTyped(
639
647
  this.sendReqRespRequest(peerId, ReqRespMethod.LightClientOptimisticUpdate, [Version.V1], null),
640
- responseSszTypeByMethod[ReqRespMethod.LightClientOptimisticUpdate]
648
+ responseSszTypeByMethod[ReqRespMethod.LightClientOptimisticUpdate],
649
+ () => this.reportInvalidResponse(peerId)
641
650
  );
642
651
  }
643
652
 
644
653
  async sendLightClientFinalityUpdate(peerId: PeerIdStr): Promise<LightClientFinalityUpdate> {
645
654
  return collectExactOneTyped(
646
655
  this.sendReqRespRequest(peerId, ReqRespMethod.LightClientFinalityUpdate, [Version.V1], null),
647
- responseSszTypeByMethod[ReqRespMethod.LightClientFinalityUpdate]
656
+ responseSszTypeByMethod[ReqRespMethod.LightClientFinalityUpdate],
657
+ () => this.reportInvalidResponse(peerId)
648
658
  );
649
659
  }
650
660
 
@@ -655,7 +665,9 @@ export class Network implements INetwork {
655
665
  return collectMaxResponseTyped(
656
666
  this.sendReqRespRequest(peerId, ReqRespMethod.LightClientUpdatesByRange, [Version.V1], request),
657
667
  request.count,
658
- responseSszTypeByMethod[ReqRespMethod.LightClientUpdatesByRange]
668
+ responseSszTypeByMethod[ReqRespMethod.LightClientUpdatesByRange],
669
+ undefined,
670
+ () => this.reportInvalidResponse(peerId)
659
671
  );
660
672
  }
661
673
 
@@ -666,7 +678,9 @@ export class Network implements INetwork {
666
678
  return collectMaxResponseTyped(
667
679
  this.sendReqRespRequest(peerId, ReqRespMethod.DataColumnSidecarsByRange, [Version.V1], request),
668
680
  request.count * request.columns.length,
669
- responseSszTypeByMethod[ReqRespMethod.DataColumnSidecarsByRange]
681
+ responseSszTypeByMethod[ReqRespMethod.DataColumnSidecarsByRange],
682
+ undefined,
683
+ () => this.reportInvalidResponse(peerId)
670
684
  );
671
685
  }
672
686
 
@@ -678,7 +692,8 @@ export class Network implements INetwork {
678
692
  this.sendReqRespRequest(peerId, ReqRespMethod.DataColumnSidecarsByRoot, [Version.V1], request),
679
693
  request.reduce((total, {columns}) => total + columns.length, 0),
680
694
  responseSszTypeByMethod[ReqRespMethod.DataColumnSidecarsByRoot],
681
- this.chain.serializedCache
695
+ this.chain.serializedCache,
696
+ () => this.reportInvalidResponse(peerId)
682
697
  );
683
698
  }
684
699
 
@@ -689,7 +704,9 @@ export class Network implements INetwork {
689
704
  return collectMaxResponseTyped(
690
705
  this.sendReqRespRequest(peerId, ReqRespMethod.ExecutionPayloadEnvelopesByRange, [Version.V1], request),
691
706
  request.count,
692
- responseSszTypeByMethod[ReqRespMethod.ExecutionPayloadEnvelopesByRange]
707
+ responseSszTypeByMethod[ReqRespMethod.ExecutionPayloadEnvelopesByRange],
708
+ undefined,
709
+ () => this.reportInvalidResponse(peerId)
693
710
  );
694
711
  }
695
712
 
@@ -701,10 +718,19 @@ export class Network implements INetwork {
701
718
  this.sendReqRespRequest(peerId, ReqRespMethod.ExecutionPayloadEnvelopesByRoot, [Version.V1], request),
702
719
  request.length,
703
720
  responseSszTypeByMethod[ReqRespMethod.ExecutionPayloadEnvelopesByRoot],
704
- this.chain.serializedCache
721
+ this.chain.serializedCache,
722
+ () => this.reportInvalidResponse(peerId)
705
723
  );
706
724
  }
707
725
 
726
+ private async reportInvalidResponse(peerId: PeerIdStr): Promise<void> {
727
+ try {
728
+ await this.core.reportPeer(peerId, PeerAction.LowToleranceError, "InvalidResponseSsz");
729
+ } catch (error) {
730
+ this.logger.debug("Failed to report invalid response", {peerId}, error as Error);
731
+ }
732
+ }
733
+
708
734
  private sendReqRespRequest<Req>(
709
735
  peerId: PeerIdStr,
710
736
  method: ReqRespMethod,
@@ -449,7 +449,8 @@ export class PeerManager {
449
449
  .catch((e) => this.logger.verbose("cannot tag peer", {peerId: peer.toString()}, e as Error));
450
450
  peerData.relevantStatus = RelevantPeerStatus.relevant;
451
451
  }
452
- if (getConnection(this.libp2p, peer.toString())) {
452
+ // A peer rejected on connect is not tracked and may still send a status before its goodbye completes
453
+ if (peerData && getConnection(this.libp2p, peer.toString())) {
453
454
  const nodeId = peerData?.nodeId ?? computeNodeId(peer);
454
455
  // TODO(fulu): Are we sure we've run Metadata before this?
455
456
  const custodyGroupCount = peerData?.metadata?.custodyGroupCount ?? this.config.CUSTODY_REQUIREMENT;
@@ -554,6 +555,11 @@ export class PeerManager {
554
555
  // ban and disconnect peers with bad score, collect rest of healthy peers
555
556
  const connectedHealthyPeers: PeerId[] = [];
556
557
  for (const peer of connectedPeers) {
558
+ // Direct peers are trusted by the operator, a bad score never disconnects them
559
+ if (this.gossipsub.isDirectPeer(peer.toString())) {
560
+ connectedHealthyPeers.push(peer);
561
+ continue;
562
+ }
557
563
  switch (this.peerRpcScores.getScoreState(peer)) {
558
564
  case ScoreState.Banned:
559
565
  this.metrics?.peerManager.peersPruned.inc({reason: "banned"});
@@ -584,9 +590,11 @@ export class PeerManager {
584
590
  const prioritizeTimer = this.metrics?.peerManager.prioritizePeersDuration.startTimer();
585
591
  const {peersToDisconnect, peersToConnect, attnetQueries, syncnetQueries, custodyGroupQueries} = prioritizePeers(
586
592
  connectedHealthyPeers.map((peer) => {
587
- const peerData = this.connectedPeers.get(peer.toString());
593
+ const peerIdStr = peer.toString();
594
+ const peerData = this.connectedPeers.get(peerIdStr);
588
595
  return {
589
596
  id: peer,
597
+ direct: this.gossipsub.isDirectPeer(peerIdStr),
590
598
  direction: peerData?.direction ?? null,
591
599
  status: peerData?.status ?? null,
592
600
  attnets: peerData?.metadata?.attnets ?? null,
@@ -708,6 +716,10 @@ export class PeerManager {
708
716
  private updateGossipsubScores(): void {
709
717
  const gossipsubScores = new Map<string, number>();
710
718
  for (const peerIdStr of this.connectedPeers.keys()) {
719
+ // Direct peers are never disconnected, they must not take the negative score allowance of other peers
720
+ if (this.gossipsub.isDirectPeer(peerIdStr)) {
721
+ continue;
722
+ }
711
723
  gossipsubScores.set(peerIdStr, this.gossipsub.getScore(peerIdStr));
712
724
  }
713
725
 
@@ -786,6 +798,18 @@ export class PeerManager {
786
798
  return false;
787
799
  }
788
800
 
801
+ // The heartbeat only disconnects peers that are already connected, a peer with a bad score
802
+ // could otherwise reconnect right after and stay connected until the next heartbeat
803
+ const scoreState = this.peerRpcScores.getScoreState(remotePeer);
804
+ if (scoreState !== ScoreState.Healthy && !this.gossipsub.isDirectPeer(remotePeerStr)) {
805
+ this.logger.debug("Peer with bad score connected, disconnecting", {peer: remotePeerPrettyStr, scoreState});
806
+ void this.goodbyeAndDisconnect(
807
+ remotePeer,
808
+ scoreState === ScoreState.Banned ? GoodByeReasonCode.BANNED : GoodByeReasonCode.SCORE_TOO_LOW
809
+ );
810
+ return false;
811
+ }
812
+
789
813
  if (!opts.overwriteExisting && this.connectedPeers.has(remotePeerStr)) {
790
814
  return false;
791
815
  }
@@ -98,6 +98,7 @@ function computeStatusScore(ours: Status, theirs: Status | null, opts: Prioritiz
98
98
 
99
99
  type PeerInfo = {
100
100
  id: PeerId;
101
+ direct: boolean;
101
102
  direction: MessageStreamDirection | null;
102
103
  statusScore: StatusScore;
103
104
  attnets: phase0.AttestationSubnets;
@@ -140,6 +141,7 @@ export enum ExcessPeerDisconnectReason {
140
141
  export function prioritizePeers(
141
142
  connectedPeersInfo: {
142
143
  id: PeerId;
144
+ direct?: boolean;
143
145
  direction: MessageStreamDirection | null;
144
146
  status: Status | null;
145
147
  attnets: phase0.AttestationSubnets | null;
@@ -169,6 +171,7 @@ export function prioritizePeers(
169
171
  const connectedPeers = connectedPeersInfo.map(
170
172
  (peer): PeerInfo => ({
171
173
  id: peer.id,
174
+ direct: peer.direct ?? false,
172
175
  direction: peer.direction,
173
176
  statusScore: computeStatusScore(opts.status, peer.status, opts),
174
177
  attnets: peer.attnets ?? attnetsZero,
@@ -365,6 +368,11 @@ function pruneExcessPeers(
365
368
  const peersEligibleForPruning = sortedPeers
366
369
  // Then, iterate from highest score to lowest doing a manual filter for duties and outbound ratio
367
370
  .filter((peer) => {
371
+ // Direct peers are pinned by the operator, they count towards all targets but are never pruned
372
+ if (peer.direct) {
373
+ return false;
374
+ }
375
+
368
376
  // Peers with duties are not eligible for pruning
369
377
  if ((dutiesByPeer.get(peer) ?? 0) > 0) {
370
378
  return false;
@@ -488,11 +496,12 @@ function pruneExcessPeers(
488
496
  // otherwise we'll not able to accept new peer connection to consider better peers
489
497
  // see https://github.com/ChainSafe/lodestar/issues/5198
490
498
  const remainingPeersToDisconnect: PeerId[] = [];
491
- for (const {id} of sortedPeers) {
499
+ for (const {id, direct} of sortedPeers) {
492
500
  if (peersToDisconnectCount >= peersToDisconnectTarget) {
493
501
  break;
494
502
  }
495
503
  if (
504
+ direct ||
496
505
  noLongLivedSubnetPeersToDisconnect.includes(id) ||
497
506
  badScorePeersToDisconnect.includes(id) ||
498
507
  tooGroupedPeersToDisconnect.includes(id)
@@ -568,6 +577,10 @@ function findPeerToRemove(
568
577
  const peersOnSubnet = sortBy(peersOnMostGroupedSubnet, (peer) => peer.attnetsTrueBitIndices.length);
569
578
  let removedPeer: PeerInfo | null = null;
570
579
  for (const candidatePeer of peersOnSubnet) {
580
+ if (candidatePeer.direct) {
581
+ continue;
582
+ }
583
+
571
584
  // new logic of lodestar
572
585
  const attnetIndices = candidatePeer.attnetsTrueBitIndices;
573
586
  if (attnetIndices.length > 0) {