@lodestar/beacon-node 1.45.0-dev.f2645825a8 → 1.45.0-dev.f6c521a123

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 (214) hide show
  1. package/lib/api/impl/beacon/blocks/index.d.ts.map +1 -1
  2. package/lib/api/impl/beacon/blocks/index.js +3 -2
  3. package/lib/api/impl/beacon/blocks/index.js.map +1 -1
  4. package/lib/api/impl/beacon/index.d.ts +1 -1
  5. package/lib/api/impl/beacon/index.d.ts.map +1 -1
  6. package/lib/api/impl/beacon/index.js.map +1 -1
  7. package/lib/api/impl/beacon/pool/index.d.ts.map +1 -1
  8. package/lib/api/impl/beacon/pool/index.js +6 -42
  9. package/lib/api/impl/beacon/pool/index.js.map +1 -1
  10. package/lib/api/impl/beacon/state/index.d.ts +1 -1
  11. package/lib/api/impl/beacon/state/index.d.ts.map +1 -1
  12. package/lib/api/impl/beacon/state/index.js +2 -2
  13. package/lib/api/impl/beacon/state/index.js.map +1 -1
  14. package/lib/api/impl/beacon/state/utils.d.ts +2 -1
  15. package/lib/api/impl/beacon/state/utils.d.ts.map +1 -1
  16. package/lib/api/impl/beacon/state/utils.js +9 -1
  17. package/lib/api/impl/beacon/state/utils.js.map +1 -1
  18. package/lib/api/impl/debug/index.d.ts +1 -1
  19. package/lib/api/impl/debug/index.d.ts.map +1 -1
  20. package/lib/api/impl/debug/index.js +2 -2
  21. package/lib/api/impl/debug/index.js.map +1 -1
  22. package/lib/api/impl/lodestar/index.js +2 -2
  23. package/lib/api/impl/lodestar/index.js.map +1 -1
  24. package/lib/api/impl/proof/index.d.ts +1 -1
  25. package/lib/api/impl/proof/index.d.ts.map +1 -1
  26. package/lib/api/impl/proof/index.js +2 -2
  27. package/lib/api/impl/proof/index.js.map +1 -1
  28. package/lib/api/impl/utils.d.ts +23 -0
  29. package/lib/api/impl/utils.d.ts.map +1 -1
  30. package/lib/api/impl/utils.js +44 -1
  31. package/lib/api/impl/utils.js.map +1 -1
  32. package/lib/api/impl/validator/index.d.ts +0 -14
  33. package/lib/api/impl/validator/index.d.ts.map +1 -1
  34. package/lib/api/impl/validator/index.js +58 -59
  35. package/lib/api/impl/validator/index.js.map +1 -1
  36. package/lib/api/rest/base.d.ts.map +1 -1
  37. package/lib/api/rest/base.js +14 -3
  38. package/lib/api/rest/base.js.map +1 -1
  39. package/lib/chain/blocks/importBlock.d.ts.map +1 -1
  40. package/lib/chain/blocks/importBlock.js +3 -21
  41. package/lib/chain/blocks/importBlock.js.map +1 -1
  42. package/lib/chain/blocks/utils/chainSegment.d.ts.map +1 -1
  43. package/lib/chain/blocks/utils/chainSegment.js +13 -5
  44. package/lib/chain/blocks/utils/chainSegment.js.map +1 -1
  45. package/lib/chain/blocks/verifyBlocksExecutionPayloads.js +1 -1
  46. package/lib/chain/blocks/verifyBlocksExecutionPayloads.js.map +1 -1
  47. package/lib/chain/blocks/verifyBlocksSanityChecks.js +1 -1
  48. package/lib/chain/blocks/verifyBlocksSanityChecks.js.map +1 -1
  49. package/lib/chain/blocks/verifyExecutionPayloadEnvelope.js +2 -2
  50. package/lib/chain/blocks/verifyExecutionPayloadEnvelope.js.map +1 -1
  51. package/lib/chain/builderCircuitBreaker.d.ts +31 -0
  52. package/lib/chain/builderCircuitBreaker.d.ts.map +1 -0
  53. package/lib/chain/builderCircuitBreaker.js +59 -0
  54. package/lib/chain/builderCircuitBreaker.js.map +1 -0
  55. package/lib/chain/chain.d.ts +2 -0
  56. package/lib/chain/chain.d.ts.map +1 -1
  57. package/lib/chain/chain.js +26 -2
  58. package/lib/chain/chain.js.map +1 -1
  59. package/lib/chain/errors/blockError.d.ts +48 -6
  60. package/lib/chain/errors/blockError.d.ts.map +1 -1
  61. package/lib/chain/errors/blockError.js +25 -4
  62. package/lib/chain/errors/blockError.js.map +1 -1
  63. package/lib/chain/errors/executionPayloadEnvelope.d.ts +11 -0
  64. package/lib/chain/errors/executionPayloadEnvelope.d.ts.map +1 -1
  65. package/lib/chain/errors/executionPayloadEnvelope.js +2 -0
  66. package/lib/chain/errors/executionPayloadEnvelope.js.map +1 -1
  67. package/lib/chain/interface.d.ts +2 -0
  68. package/lib/chain/interface.d.ts.map +1 -1
  69. package/lib/chain/interface.js.map +1 -1
  70. package/lib/chain/lightClient/index.d.ts.map +1 -1
  71. package/lib/chain/lightClient/index.js +11 -6
  72. package/lib/chain/lightClient/index.js.map +1 -1
  73. package/lib/chain/lightClient/proofs.d.ts.map +1 -1
  74. package/lib/chain/lightClient/proofs.js +28 -2
  75. package/lib/chain/lightClient/proofs.js.map +1 -1
  76. package/lib/chain/lightClient/types.d.ts +3 -1
  77. package/lib/chain/lightClient/types.d.ts.map +1 -1
  78. package/lib/chain/opPools/aggregatedAttestationPool.js +1 -1
  79. package/lib/chain/opPools/aggregatedAttestationPool.js.map +1 -1
  80. package/lib/chain/opPools/proposerPreferencesPool.d.ts +1 -1
  81. package/lib/chain/opPools/proposerPreferencesPool.d.ts.map +1 -1
  82. package/lib/chain/opPools/proposerPreferencesPool.js +1 -1
  83. package/lib/chain/opPools/proposerPreferencesPool.js.map +1 -1
  84. package/lib/chain/options.d.ts +4 -0
  85. package/lib/chain/options.d.ts.map +1 -1
  86. package/lib/chain/options.js.map +1 -1
  87. package/lib/chain/prepareNextSlot.d.ts.map +1 -1
  88. package/lib/chain/prepareNextSlot.js +12 -7
  89. package/lib/chain/prepareNextSlot.js.map +1 -1
  90. package/lib/chain/validation/aggregateAndProof.js +10 -6
  91. package/lib/chain/validation/aggregateAndProof.js.map +1 -1
  92. package/lib/chain/validation/attestation.d.ts.map +1 -1
  93. package/lib/chain/validation/attestation.js +10 -6
  94. package/lib/chain/validation/attestation.js.map +1 -1
  95. package/lib/chain/validation/block.d.ts.map +1 -1
  96. package/lib/chain/validation/block.js +53 -4
  97. package/lib/chain/validation/block.js.map +1 -1
  98. package/lib/chain/validation/executionPayloadBid.js +13 -12
  99. package/lib/chain/validation/executionPayloadBid.js.map +1 -1
  100. package/lib/chain/validation/executionPayloadEnvelope.d.ts.map +1 -1
  101. package/lib/chain/validation/executionPayloadEnvelope.js +29 -0
  102. package/lib/chain/validation/executionPayloadEnvelope.js.map +1 -1
  103. package/lib/chain/validation/proposerPreferences.d.ts.map +1 -1
  104. package/lib/chain/validation/proposerPreferences.js +3 -2
  105. package/lib/chain/validation/proposerPreferences.js.map +1 -1
  106. package/lib/chain/validation/signatureSets/aggregateAndProof.d.ts.map +1 -1
  107. package/lib/chain/validation/signatureSets/aggregateAndProof.js +2 -3
  108. package/lib/chain/validation/signatureSets/aggregateAndProof.js.map +1 -1
  109. package/lib/db/repositories/lightclientSyncCommitteeWitness.d.ts.map +1 -1
  110. package/lib/db/repositories/lightclientSyncCommitteeWitness.js +42 -7
  111. package/lib/db/repositories/lightclientSyncCommitteeWitness.js.map +1 -1
  112. package/lib/execution/builder/http.d.ts +18 -0
  113. package/lib/execution/builder/http.d.ts.map +1 -1
  114. package/lib/execution/builder/http.js +20 -11
  115. package/lib/execution/builder/http.js.map +1 -1
  116. package/lib/metrics/metrics/beacon.d.ts +6 -0
  117. package/lib/metrics/metrics/beacon.d.ts.map +1 -1
  118. package/lib/metrics/metrics/beacon.js +18 -0
  119. package/lib/metrics/metrics/beacon.js.map +1 -1
  120. package/lib/network/core/metrics.d.ts +65 -0
  121. package/lib/network/core/metrics.d.ts.map +1 -1
  122. package/lib/network/core/metrics.js +94 -0
  123. package/lib/network/core/metrics.js.map +1 -1
  124. package/lib/network/discv5/utils.d.ts.map +1 -1
  125. package/lib/network/discv5/utils.js +12 -3
  126. package/lib/network/discv5/utils.js.map +1 -1
  127. package/lib/network/gossip/encoding.d.ts +2 -2
  128. package/lib/network/gossip/encoding.d.ts.map +1 -1
  129. package/lib/network/gossip/encoding.js +22 -9
  130. package/lib/network/gossip/encoding.js.map +1 -1
  131. package/lib/network/gossip/gossipsub.d.ts.map +1 -1
  132. package/lib/network/gossip/gossipsub.js +4 -3
  133. package/lib/network/gossip/gossipsub.js.map +1 -1
  134. package/lib/network/gossip/topic.d.ts +80 -232
  135. package/lib/network/gossip/topic.d.ts.map +1 -1
  136. package/lib/network/gossip/topic.js +47 -4
  137. package/lib/network/gossip/topic.js.map +1 -1
  138. package/lib/network/peers/peerManager.d.ts.map +1 -1
  139. package/lib/network/peers/peerManager.js +10 -0
  140. package/lib/network/peers/peerManager.js.map +1 -1
  141. package/lib/network/peers/score/score.d.ts +3 -1
  142. package/lib/network/peers/score/score.d.ts.map +1 -1
  143. package/lib/network/peers/score/score.js +6 -1
  144. package/lib/network/peers/score/score.js.map +1 -1
  145. package/lib/network/peers/score/store.d.ts.map +1 -1
  146. package/lib/network/peers/score/store.js +6 -1
  147. package/lib/network/peers/score/store.js.map +1 -1
  148. package/lib/network/peers/utils/prioritizePeers.d.ts.map +1 -1
  149. package/lib/network/peers/utils/prioritizePeers.js +14 -0
  150. package/lib/network/peers/utils/prioritizePeers.js.map +1 -1
  151. package/lib/network/processor/gossipHandlers.d.ts.map +1 -1
  152. package/lib/network/processor/gossipHandlers.js +18 -8
  153. package/lib/network/processor/gossipHandlers.js.map +1 -1
  154. package/lib/network/reqresp/handlers/executionPayloadEnvelopesByRange.d.ts.map +1 -1
  155. package/lib/network/reqresp/handlers/executionPayloadEnvelopesByRange.js +4 -2
  156. package/lib/network/reqresp/handlers/executionPayloadEnvelopesByRange.js.map +1 -1
  157. package/lib/sync/sync.d.ts.map +1 -1
  158. package/lib/sync/sync.js +7 -0
  159. package/lib/sync/sync.js.map +1 -1
  160. package/lib/sync/unknownBlock.d.ts.map +1 -1
  161. package/lib/sync/unknownBlock.js +7 -2
  162. package/lib/sync/unknownBlock.js.map +1 -1
  163. package/package.json +23 -21
  164. package/src/api/impl/beacon/blocks/index.ts +3 -2
  165. package/src/api/impl/beacon/index.ts +1 -1
  166. package/src/api/impl/beacon/pool/index.ts +5 -52
  167. package/src/api/impl/beacon/state/index.ts +3 -2
  168. package/src/api/impl/beacon/state/utils.ts +11 -0
  169. package/src/api/impl/debug/index.ts +3 -2
  170. package/src/api/impl/lodestar/index.ts +2 -2
  171. package/src/api/impl/proof/index.ts +2 -2
  172. package/src/api/impl/utils.ts +51 -1
  173. package/src/api/impl/validator/index.ts +66 -64
  174. package/src/api/rest/base.ts +17 -3
  175. package/src/chain/blocks/importBlock.ts +1 -23
  176. package/src/chain/blocks/utils/chainSegment.ts +16 -5
  177. package/src/chain/blocks/verifyBlocksExecutionPayloads.ts +1 -1
  178. package/src/chain/blocks/verifyBlocksSanityChecks.ts +1 -1
  179. package/src/chain/blocks/verifyExecutionPayloadEnvelope.ts +2 -2
  180. package/src/chain/builderCircuitBreaker.ts +84 -0
  181. package/src/chain/chain.ts +38 -2
  182. package/src/chain/errors/blockError.ts +44 -7
  183. package/src/chain/errors/executionPayloadEnvelope.ts +9 -0
  184. package/src/chain/interface.ts +2 -0
  185. package/src/chain/lightClient/index.ts +12 -7
  186. package/src/chain/lightClient/proofs.ts +36 -1
  187. package/src/chain/lightClient/types.ts +3 -1
  188. package/src/chain/opPools/aggregatedAttestationPool.ts +1 -1
  189. package/src/chain/opPools/proposerPreferencesPool.ts +1 -1
  190. package/src/chain/options.ts +4 -0
  191. package/src/chain/prepareNextSlot.ts +11 -7
  192. package/src/chain/validation/aggregateAndProof.ts +12 -6
  193. package/src/chain/validation/attestation.ts +12 -6
  194. package/src/chain/validation/block.ts +69 -4
  195. package/src/chain/validation/executionPayloadBid.ts +16 -11
  196. package/src/chain/validation/executionPayloadEnvelope.ts +37 -0
  197. package/src/chain/validation/proposerPreferences.ts +3 -2
  198. package/src/chain/validation/signatureSets/aggregateAndProof.ts +3 -3
  199. package/src/db/repositories/lightclientSyncCommitteeWitness.ts +57 -9
  200. package/src/execution/builder/http.ts +30 -17
  201. package/src/metrics/metrics/beacon.ts +19 -0
  202. package/src/network/core/metrics.ts +94 -0
  203. package/src/network/discv5/utils.ts +11 -3
  204. package/src/network/gossip/encoding.ts +20 -7
  205. package/src/network/gossip/gossipsub.ts +9 -3
  206. package/src/network/gossip/topic.ts +58 -4
  207. package/src/network/peers/peerManager.ts +11 -0
  208. package/src/network/peers/score/score.ts +8 -1
  209. package/src/network/peers/score/store.ts +8 -1
  210. package/src/network/peers/utils/prioritizePeers.ts +15 -0
  211. package/src/network/processor/gossipHandlers.ts +18 -7
  212. package/src/network/reqresp/handlers/executionPayloadEnvelopesByRange.ts +4 -2
  213. package/src/sync/sync.ts +10 -0
  214. package/src/sync/unknownBlock.ts +8 -2
@@ -7,6 +7,7 @@ import {MapDef} from "@lodestar/utils";
7
7
  import {shuffle} from "../../../util/shuffle.js";
8
8
  import {sortBy} from "../../../util/sortBy.js";
9
9
  import {NetworkCoreMetrics} from "../../core/metrics.js";
10
+ import {SubnetType} from "../../metadata.js";
10
11
  import {RequestedSubnet} from "./subnetMap.js";
11
12
 
12
13
  /** Target number of peers we'd like to have connected to a given long-lived subnet */
@@ -189,6 +190,18 @@ export function prioritizePeers(
189
190
 
190
191
  const connectedPeerCount = connectedPeers.length;
191
192
 
193
+ // Track the outbound peers invariant (we keep at least OUTBOUND_PEERS_RATIO outbound peers).
194
+ // Report 0 when there are no peers so the gauge doesn't go stale at its last value.
195
+ if (metrics) {
196
+ let outboundPeerCount = 0;
197
+ for (const peer of connectedPeers) {
198
+ if (peer.direction === "outbound") {
199
+ outboundPeerCount++;
200
+ }
201
+ }
202
+ metrics.peerManager.outboundPeersRatio.set(connectedPeerCount > 0 ? outboundPeerCount / connectedPeerCount : 0);
203
+ }
204
+
192
205
  if (connectedPeerCount < targetPeers) {
193
206
  // Need more peers.
194
207
  // Instead of attempting to connect the exact amount necessary this will overshoot a little since the success
@@ -256,6 +269,7 @@ function requestSubnetPeers(
256
269
 
257
270
  for (const {subnet, toSlot} of activeAttnets) {
258
271
  const peersInSubnet = peersPerSubnet.get(subnet) ?? 0;
272
+ metrics?.peerManager.peersPerActiveSubnet.observe({type: SubnetType.attnets}, peersInSubnet);
259
273
  if (peersInSubnet < targetSubnetPeers) {
260
274
  // We need more peers
261
275
  attnetQueries.push({subnet, toSlot, maxPeersToDiscover: targetSubnetPeers - peersInSubnet});
@@ -282,6 +296,7 @@ function requestSubnetPeers(
282
296
 
283
297
  for (const {subnet, toSlot} of activeSyncnets) {
284
298
  const peersInSubnet = peersPerSubnet.get(subnet) ?? 0;
299
+ metrics?.peerManager.peersPerActiveSubnet.observe({type: SubnetType.syncnets}, peersInSubnet);
285
300
  if (peersInSubnet < targetSubnetPeers) {
286
301
  // We need more peers
287
302
  syncnetQueries.push({subnet, toSlot, maxPeersToDiscover: targetSubnetPeers - peersInSubnet});
@@ -176,7 +176,7 @@ function getSequentialHandlers(modules: ValidatorFnsModules, options: GossipHand
176
176
 
177
177
  // optimistically add gossip block to the seen cache
178
178
  // if validation fails, we will NOT forward this gossip block to peers
179
- // - if PARENT_UNKNOWN error, blockInput will then be queued inside BlockInputSync. If the gossip block is really invalid, it will be pruned there
179
+ // - if PARENT_BLOCK_UNKNOWN error, blockInput will then be queued inside BlockInputSync. If the gossip block is really invalid, it will be pruned there
180
180
  // - if other validator errors, blockInput will stay in the seen cache and will be pruned on finalization
181
181
  const blockInput = chain.seenBlockInputCache.getByBlock({
182
182
  block: signedBlock,
@@ -187,7 +187,7 @@ function getSequentialHandlers(modules: ValidatorFnsModules, options: GossipHand
187
187
  });
188
188
 
189
189
  // Optimistically seed the payload-envelope cache too, mirroring seenBlockInputCache above.
190
- // This ensures we have PayloadEnvelopeInput, even through "PARENT_UNKNOWN" error
190
+ // This ensures we have PayloadEnvelopeInput, even through "PARENT_BLOCK_UNKNOWN" error
191
191
  // see https://github.com/ChainSafe/lodestar/issues/9475
192
192
  if (isForkPostGloas(fork)) {
193
193
  chain.seenPayloadEnvelopeInputCache.add({
@@ -227,7 +227,8 @@ function getSequentialHandlers(modules: ValidatorFnsModules, options: GossipHand
227
227
  if (e instanceof BlockGossipError) {
228
228
  logger.debug("Gossip block has error", {slot, root: blockShortHex, code: e.type.code});
229
229
  if (
230
- (e.type.code === BlockErrorCode.PARENT_UNKNOWN || e.type.code === BlockErrorCode.PARENT_PAYLOAD_UNKNOWN) &&
230
+ (e.type.code === BlockErrorCode.PARENT_BLOCK_UNKNOWN ||
231
+ e.type.code === BlockErrorCode.PARENT_PAYLOAD_UNKNOWN) &&
231
232
  blockInput
232
233
  ) {
233
234
  chain.emitter.emit(ChainEvent.blockUnknownParent, {
@@ -661,14 +662,19 @@ function getSequentialHandlers(modules: ValidatorFnsModules, options: GossipHand
661
662
  break;
662
663
  }
663
664
  // ALREADY_KNOWN should not happen with ignoreIfKnown=true above
664
- // PARENT_UNKNOWN should not happen, we handled this in validateBeaconBlock() function above
665
+ // PARENT_BLOCK_UNKNOWN should not happen, we handled this in validateBeaconBlock() function above
665
666
  case BlockErrorCode.ALREADY_KNOWN:
666
- case BlockErrorCode.PARENT_UNKNOWN:
667
+ case BlockErrorCode.PARENT_BLOCK_UNKNOWN:
667
668
  case BlockErrorCode.PRESTATE_MISSING:
668
669
  case BlockErrorCode.EXECUTION_ENGINE_ERROR:
669
- // Errors might indicate an issue with our node or the connected EL client
670
+ // Errors might indicate an issue with our node or the connected EL client.
670
671
  logLevel = LogLevel.error;
671
672
  break;
673
+ case BlockErrorCode.EXECUTION_ENGINE_INVALID:
674
+ // the peer served a bad block
675
+ core.reportPeer(peerIdStr, PeerAction.LowToleranceError, "ExecutionEngineInvalid");
676
+ logLevel = LogLevel.warn;
677
+ break;
672
678
  default:
673
679
  // TODO: Should it use PeerId or string?
674
680
  core.reportPeer(peerIdStr, PeerAction.LowToleranceError, "BadGossipBlock");
@@ -1241,6 +1247,11 @@ function getSequentialHandlers(modules: ValidatorFnsModules, options: GossipHand
1241
1247
  payloadAttestationMessage.data.payloadPresent,
1242
1248
  payloadAttestationMessage.data.blobDataAvailable
1243
1249
  );
1250
+
1251
+ chain.emitter.emit(routes.events.EventType.payloadAttestationMessage, {
1252
+ version: config.getForkName(payloadAttestationMessage.data.slot),
1253
+ data: payloadAttestationMessage,
1254
+ });
1244
1255
  },
1245
1256
  [GossipType.execution_payload_bid]: async ({
1246
1257
  gossipData,
@@ -1274,7 +1285,7 @@ function getSequentialHandlers(modules: ValidatorFnsModules, options: GossipHand
1274
1285
  await validateGossipProposerPreferences(chain, signedProposerPreferences);
1275
1286
 
1276
1287
  chain.emitter.emit(routes.events.EventType.proposerPreferences, {
1277
- version: ForkName.gloas,
1288
+ version: config.getForkName(signedProposerPreferences.message.proposalSlot),
1278
1289
  data: signedProposerPreferences,
1279
1290
  });
1280
1291
  },
@@ -107,8 +107,10 @@ export function validateExecutionPayloadEnvelopesByRangeRequest(
107
107
  // The gloas req/resp spec uses MIN_EPOCHS_FOR_BLOCK_REQUESTS to define the minimum range peers MUST serve.
108
108
  // Archival nodes may still serve older retained payloads to allow genesis sync.
109
109
 
110
- if (count > config.MAX_REQUEST_BLOCKS_DENEB) {
111
- count = config.MAX_REQUEST_BLOCKS_DENEB;
110
+ // Spec: EnvelopesByRange response is bounded by MAX_REQUEST_PAYLOADS (consensus-specs #5383),
111
+ // distinct from the MAX_REQUEST_BLOCKS_DENEB cap used for block-by-range.
112
+ if (count > config.MAX_REQUEST_PAYLOADS) {
113
+ count = config.MAX_REQUEST_PAYLOADS;
112
114
  }
113
115
 
114
116
  return {startSlot, count};
package/src/sync/sync.ts CHANGED
@@ -75,6 +75,11 @@ export class BeaconSync implements IBeaconSync {
75
75
  if (metrics) {
76
76
  metrics.syncStatus.addCollect(() => this.scrapeMetrics(metrics));
77
77
  }
78
+
79
+ // A from-scratch or large-gap start boots not synced; updateSyncState resumes once synced
80
+ if (this.state !== SyncState.Synced) {
81
+ this.chain.forkChoice.pauseFastConfirmation();
82
+ }
78
83
  }
79
84
 
80
85
  close(): void {
@@ -228,6 +233,8 @@ export class BeaconSync implements IBeaconSync {
228
233
 
229
234
  // We have become synced, subscribe to all the gossip core topics
230
235
  if (state === SyncState.Synced && this.chain.clock.currentEpoch >= MIN_EPOCH_TO_START_GOSSIP) {
236
+ this.chain.forkChoice.resumeFastConfirmation();
237
+
231
238
  if (!this.network.isSubscribedToGossipCoreTopics()) {
232
239
  this.network
233
240
  .subscribeGossipCoreTopics()
@@ -251,6 +258,9 @@ export class BeaconSync implements IBeaconSync {
251
258
  else if (state !== SyncState.Synced) {
252
259
  const syncDiff = this.chain.clock.currentSlot - this.chain.forkChoice.getHead().slot;
253
260
  if (syncDiff > this.slotImportTolerance * 2) {
261
+ // Same debounce as gossip: transient blips keep the rule running, only a real gap pauses it
262
+ this.chain.forkChoice.pauseFastConfirmation();
263
+
254
264
  if (this.network.isSubscribedToGossipCoreTopics()) {
255
265
  this.logger.warn(`Node sync has fallen behind by ${syncDiff} slots`);
256
266
  this.network
@@ -819,7 +819,7 @@ export class BlockInputSync {
819
819
  // case BlockErrorCode.ALREADY_KNOWN:
820
820
  // case BlockErrorCode.GENESIS_BLOCK:
821
821
 
822
- case BlockErrorCode.PARENT_UNKNOWN:
822
+ case BlockErrorCode.PARENT_BLOCK_UNKNOWN:
823
823
  case BlockErrorCode.PRESTATE_MISSING:
824
824
  // Should not happen, mark as downloaded to try again latter
825
825
  this.logger.debug("Attempted to process block but its parent was still unknown", errorData, res.err);
@@ -841,10 +841,16 @@ export class BlockInputSync {
841
841
 
842
842
  case BlockErrorCode.EXECUTION_ENGINE_ERROR:
843
843
  // Removing the block(s) without penalizing the peers, hoping for EL to
844
- // recover on a latter download + verify attempt
844
+ // recover on a latter download + verify attempt.
845
845
  this.removeAllDescendants(pendingBlock);
846
846
  break;
847
847
 
848
+ case BlockErrorCode.EXECUTION_ENGINE_INVALID:
849
+ // the peer served a bad block
850
+ this.logger.debug("Execution engine rejected block from unknown parent sync", errorData, res.err);
851
+ this.removeAndDownScoreAllDescendants(pendingBlock);
852
+ break;
853
+
848
854
  default:
849
855
  // Block is not correct with respect to our chain. Log error loudly
850
856
  this.logger.debug("Error processing block from unknown parent sync", errorData, res.err);