@lodestar/beacon-node 1.52.0-dev.a9e15e2b94 → 1.52.0-dev.b17bb95924

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 (196) 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/blocks/importExecutionPayload.d.ts +1 -1
  21. package/lib/chain/blocks/importExecutionPayload.d.ts.map +1 -1
  22. package/lib/chain/blocks/importExecutionPayload.js +9 -3
  23. package/lib/chain/blocks/importExecutionPayload.js.map +1 -1
  24. package/lib/chain/blocks/index.d.ts.map +1 -1
  25. package/lib/chain/blocks/index.js +3 -17
  26. package/lib/chain/blocks/index.js.map +1 -1
  27. package/lib/chain/blocks/verifyBlock.d.ts.map +1 -1
  28. package/lib/chain/blocks/verifyBlock.js +12 -11
  29. package/lib/chain/blocks/verifyBlock.js.map +1 -1
  30. package/lib/chain/blocks/verifyBlocksSignatures.d.ts +2 -2
  31. package/lib/chain/blocks/verifyBlocksSignatures.d.ts.map +1 -1
  32. package/lib/chain/blocks/verifyBlocksSignatures.js +2 -1
  33. package/lib/chain/blocks/verifyBlocksSignatures.js.map +1 -1
  34. package/lib/chain/bls/utils.js +1 -1
  35. package/lib/chain/bls/utils.js.map +1 -1
  36. package/lib/chain/chain.d.ts +6 -5
  37. package/lib/chain/chain.d.ts.map +1 -1
  38. package/lib/chain/chain.js +74 -26
  39. package/lib/chain/chain.js.map +1 -1
  40. package/lib/chain/errors/attestationError.d.ts +15 -1
  41. package/lib/chain/errors/attestationError.d.ts.map +1 -1
  42. package/lib/chain/errors/attestationError.js +8 -0
  43. package/lib/chain/errors/attestationError.js.map +1 -1
  44. package/lib/chain/errors/executionPayloadBid.d.ts +3 -2
  45. package/lib/chain/errors/executionPayloadBid.d.ts.map +1 -1
  46. package/lib/chain/errors/executionPayloadBid.js +1 -1
  47. package/lib/chain/errors/executionPayloadBid.js.map +1 -1
  48. package/lib/chain/interface.d.ts +1 -1
  49. package/lib/chain/interface.d.ts.map +1 -1
  50. package/lib/chain/opPools/inclusionListStore.d.ts +4 -1
  51. package/lib/chain/opPools/inclusionListStore.d.ts.map +1 -1
  52. package/lib/chain/opPools/inclusionListStore.js +5 -2
  53. package/lib/chain/opPools/inclusionListStore.js.map +1 -1
  54. package/lib/chain/opPools/opPool.js +6 -6
  55. package/lib/chain/opPools/opPool.js.map +1 -1
  56. package/lib/chain/options.js +1 -1
  57. package/lib/chain/options.js.map +1 -1
  58. package/lib/chain/seenCache/seenAttesters.d.ts +1 -0
  59. package/lib/chain/seenCache/seenAttesters.d.ts.map +1 -1
  60. package/lib/chain/seenCache/seenAttesters.js +1 -1
  61. package/lib/chain/seenCache/seenAttesters.js.map +1 -1
  62. package/lib/chain/seenCache/seenBlockAttesters.d.ts +8 -2
  63. package/lib/chain/seenCache/seenBlockAttesters.d.ts.map +1 -1
  64. package/lib/chain/seenCache/seenBlockAttesters.js +43 -6
  65. package/lib/chain/seenCache/seenBlockAttesters.js.map +1 -1
  66. package/lib/chain/seenCache/seenExecutionPayloadBids.d.ts +13 -4
  67. package/lib/chain/seenCache/seenExecutionPayloadBids.d.ts.map +1 -1
  68. package/lib/chain/seenCache/seenExecutionPayloadBids.js +13 -12
  69. package/lib/chain/seenCache/seenExecutionPayloadBids.js.map +1 -1
  70. package/lib/chain/shufflingCache.d.ts +5 -0
  71. package/lib/chain/shufflingCache.d.ts.map +1 -1
  72. package/lib/chain/shufflingCache.js +39 -1
  73. package/lib/chain/shufflingCache.js.map +1 -1
  74. package/lib/chain/validation/aggregateAndProof.d.ts.map +1 -1
  75. package/lib/chain/validation/aggregateAndProof.js +37 -9
  76. package/lib/chain/validation/aggregateAndProof.js.map +1 -1
  77. package/lib/chain/validation/attestation.d.ts.map +1 -1
  78. package/lib/chain/validation/attestation.js +32 -16
  79. package/lib/chain/validation/attestation.js.map +1 -1
  80. package/lib/chain/validation/block.d.ts.map +1 -1
  81. package/lib/chain/validation/block.js +9 -1
  82. package/lib/chain/validation/block.js.map +1 -1
  83. package/lib/chain/validation/executionPayloadBid.d.ts.map +1 -1
  84. package/lib/chain/validation/executionPayloadBid.js +30 -40
  85. package/lib/chain/validation/executionPayloadBid.js.map +1 -1
  86. package/lib/chain/validation/payloadAttestationMessage.js +9 -0
  87. package/lib/chain/validation/payloadAttestationMessage.js.map +1 -1
  88. package/lib/chain/validatorMonitor.js +43 -43
  89. package/lib/chain/validatorMonitor.js.map +1 -1
  90. package/lib/metrics/metrics/lodestar.d.ts +2 -0
  91. package/lib/metrics/metrics/lodestar.d.ts.map +1 -1
  92. package/lib/metrics/metrics/lodestar.js +9 -0
  93. package/lib/metrics/metrics/lodestar.js.map +1 -1
  94. package/lib/network/gossip/gossipsub.js +2 -2
  95. package/lib/network/gossip/gossipsub.js.map +1 -1
  96. package/lib/network/gossip/topic.d.ts +1 -7
  97. package/lib/network/gossip/topic.d.ts.map +1 -1
  98. package/lib/network/gossip/topic.js +0 -13
  99. package/lib/network/gossip/topic.js.map +1 -1
  100. package/lib/network/network.d.ts +1 -0
  101. package/lib/network/network.d.ts.map +1 -1
  102. package/lib/network/network.js +20 -11
  103. package/lib/network/network.js.map +1 -1
  104. package/lib/network/processor/gossipHandlers.d.ts.map +1 -1
  105. package/lib/network/processor/gossipHandlers.js +19 -6
  106. package/lib/network/processor/gossipHandlers.js.map +1 -1
  107. package/lib/network/processor/gossipValidatorFn.d.ts.map +1 -1
  108. package/lib/network/processor/gossipValidatorFn.js +4 -1
  109. package/lib/network/processor/gossipValidatorFn.js.map +1 -1
  110. package/lib/network/processor/index.d.ts.map +1 -1
  111. package/lib/network/processor/index.js +4 -2
  112. package/lib/network/processor/index.js.map +1 -1
  113. package/lib/network/reqresp/utils/collect.d.ts +4 -4
  114. package/lib/network/reqresp/utils/collect.d.ts.map +1 -1
  115. package/lib/network/reqresp/utils/collect.js +9 -8
  116. package/lib/network/reqresp/utils/collect.js.map +1 -1
  117. package/lib/network/reqresp/utils/collectSequentialBlocksInRange.d.ts +1 -1
  118. package/lib/network/reqresp/utils/collectSequentialBlocksInRange.d.ts.map +1 -1
  119. package/lib/network/reqresp/utils/collectSequentialBlocksInRange.js +2 -2
  120. package/lib/network/reqresp/utils/collectSequentialBlocksInRange.js.map +1 -1
  121. package/lib/sync/range/batch.d.ts +6 -0
  122. package/lib/sync/range/batch.d.ts.map +1 -1
  123. package/lib/sync/range/batch.js +17 -0
  124. package/lib/sync/range/batch.js.map +1 -1
  125. package/lib/sync/range/chain.d.ts.map +1 -1
  126. package/lib/sync/range/chain.js +8 -1
  127. package/lib/sync/range/chain.js.map +1 -1
  128. package/lib/sync/range/range.d.ts.map +1 -1
  129. package/lib/sync/range/range.js +43 -3
  130. package/lib/sync/range/range.js.map +1 -1
  131. package/lib/sync/types.d.ts +12 -1
  132. package/lib/sync/types.d.ts.map +1 -1
  133. package/lib/sync/types.js +2 -0
  134. package/lib/sync/types.js.map +1 -1
  135. package/lib/sync/unknownBlock.d.ts +28 -1
  136. package/lib/sync/unknownBlock.d.ts.map +1 -1
  137. package/lib/sync/unknownBlock.js +234 -22
  138. package/lib/sync/unknownBlock.js.map +1 -1
  139. package/lib/sync/utils/downloadByRange.d.ts +14 -1
  140. package/lib/sync/utils/downloadByRange.d.ts.map +1 -1
  141. package/lib/sync/utils/downloadByRange.js +12 -2
  142. package/lib/sync/utils/downloadByRange.js.map +1 -1
  143. package/lib/sync/utils/downloadByRoot.d.ts +24 -2
  144. package/lib/sync/utils/downloadByRoot.d.ts.map +1 -1
  145. package/lib/sync/utils/downloadByRoot.js +43 -1
  146. package/lib/sync/utils/downloadByRoot.js.map +1 -1
  147. package/lib/util/eventLoop.d.ts +3 -3
  148. package/lib/util/eventLoop.d.ts.map +1 -1
  149. package/lib/util/eventLoop.js +3 -3
  150. package/lib/util/eventLoop.js.map +1 -1
  151. package/package.json +17 -17
  152. package/src/api/impl/beacon/blocks/index.ts +74 -47
  153. package/src/api/impl/beacon/pool/index.ts +9 -7
  154. package/src/api/impl/beacon/state/utils.ts +2 -1
  155. package/src/api/impl/debug/index.ts +6 -2
  156. package/src/api/impl/validator/index.ts +19 -7
  157. package/src/chain/ColumnReconstructionTracker.ts +5 -0
  158. package/src/chain/blocks/importExecutionPayload.ts +9 -2
  159. package/src/chain/blocks/index.ts +3 -31
  160. package/src/chain/blocks/verifyBlock.ts +14 -10
  161. package/src/chain/blocks/verifyBlocksSignatures.ts +3 -0
  162. package/src/chain/bls/utils.ts +1 -1
  163. package/src/chain/chain.ts +107 -43
  164. package/src/chain/errors/attestationError.ts +11 -1
  165. package/src/chain/errors/executionPayloadBid.ts +3 -2
  166. package/src/chain/interface.ts +1 -1
  167. package/src/chain/opPools/inclusionListStore.ts +5 -2
  168. package/src/chain/opPools/opPool.ts +6 -6
  169. package/src/chain/options.ts +1 -1
  170. package/src/chain/seenCache/seenAttesters.ts +1 -1
  171. package/src/chain/seenCache/seenBlockAttesters.ts +48 -6
  172. package/src/chain/seenCache/seenExecutionPayloadBids.ts +35 -15
  173. package/src/chain/shufflingCache.ts +40 -1
  174. package/src/chain/validation/aggregateAndProof.ts +43 -14
  175. package/src/chain/validation/attestation.ts +31 -20
  176. package/src/chain/validation/block.ts +9 -1
  177. package/src/chain/validation/executionPayloadBid.ts +40 -42
  178. package/src/chain/validation/payloadAttestationMessage.ts +10 -0
  179. package/src/chain/validatorMonitor.ts +43 -43
  180. package/src/metrics/metrics/lodestar.ts +9 -0
  181. package/src/network/gossip/gossipsub.ts +2 -2
  182. package/src/network/gossip/topic.ts +1 -14
  183. package/src/network/network.ts +33 -11
  184. package/src/network/processor/gossipHandlers.ts +25 -13
  185. package/src/network/processor/gossipValidatorFn.ts +4 -0
  186. package/src/network/processor/index.ts +7 -2
  187. package/src/network/reqresp/utils/collect.ts +16 -8
  188. package/src/network/reqresp/utils/collectSequentialBlocksInRange.ts +3 -2
  189. package/src/sync/range/batch.ts +20 -0
  190. package/src/sync/range/chain.ts +8 -0
  191. package/src/sync/range/range.ts +56 -3
  192. package/src/sync/types.ts +11 -0
  193. package/src/sync/unknownBlock.ts +272 -22
  194. package/src/sync/utils/downloadByRange.ts +29 -3
  195. package/src/sync/utils/downloadByRoot.ts +68 -2
  196. package/src/util/eventLoop.ts +3 -3
@@ -9,6 +9,7 @@ import {
9
9
  ForkPreDeneb,
10
10
  ForkPreGloas,
11
11
  ForkSeq,
12
+ GENESIS_EPOCH,
12
13
  GENESIS_SLOT,
13
14
  SLOTS_PER_EPOCH,
14
15
  SLOTS_PER_HISTORICAL_ROOT,
@@ -408,7 +409,7 @@ export function getValidatorApi(
408
409
  * Both the above scenarios could be problematic and hence validator shouldn't participate
409
410
  * or weigh its vote on a head till it resolves to a Valid execution status.
410
411
  * Following activities should be skipped on an Optimistic head (with Syncing status):
411
- * 1. Attestation if targetRoot is optimistic
412
+ * 1. Attestation if the head block voted for (post-gloas the variant voted for) or the targetRoot is optimistic
412
413
  * 2. SyncCommitteeContribution if if the root for which to produce contribution is Optimistic.
413
414
  * 3. ProduceBlock if the parentRoot (chain's current head) is optimistic. Must be checked
414
415
  * explicitly as only local payload production consults the EL, blinded blocks from an
@@ -1396,10 +1397,18 @@ export function getValidatorApi(
1396
1397
  // After Gloas, attestation.data.index signals payload status in fork-choice:
1397
1398
  // - 0 = EMPTY / not present, 1 = FULL / present
1398
1399
  // - same-slot attestations must always use index = 0
1400
+ // Validator shouldn't vote on an optimistic head, post-gloas that is the variant voted for
1399
1401
  if (canonicalBlock.slot !== slot) {
1400
1402
  index = canonicalBlock.payloadStatus === PayloadStatus.FULL ? 1 : 0;
1403
+ if (isOptimisticBlock(canonicalBlock)) {
1404
+ throw new NodeIsSyncing(
1405
+ `Head block's execution payload not yet validated, executionPayloadBlockHash=${canonicalBlock.executionPayloadBlockHash}`
1406
+ );
1407
+ }
1401
1408
  } else {
1402
1409
  index = 0;
1410
+ // Same-slot votes support the PENDING variant, which does not depend on the block's own payload
1411
+ notOnOptimisticBlockRoot(beaconBlockRoot);
1403
1412
  }
1404
1413
  } else if (isForkPostElectra(fork)) {
1405
1414
  index = 0;
@@ -1417,8 +1426,11 @@ export function getValidatorApi(
1417
1426
  headBlockRoot
1418
1427
  : headState.getBlockRootAtSlot(targetSlot);
1419
1428
 
1420
- // Check the execution status as validator shouldn't vote on an optimistic head
1421
- // Check on target is sufficient as a valid target would imply a valid source
1429
+ // Check the execution status as validator shouldn't vote on an optimistic head, post-gloas the
1430
+ // variant voted for is checked above. Check on target is sufficient for a valid source
1431
+ if (!isForkPostGloas(fork)) {
1432
+ notOnOptimisticBlockRoot(beaconBlockRoot);
1433
+ }
1422
1434
  notOnOptimisticBlockRoot(targetRoot);
1423
1435
  notOnOutOfRangeData(targetRoot);
1424
1436
 
@@ -1684,7 +1696,8 @@ export function getValidatorApi(
1684
1696
 
1685
1697
  // should not compare to headEpoch in order to handle skipped slots
1686
1698
  // Check if the epoch is in the future after waiting for requested slot
1687
- if (epoch > chain.clock.currentEpoch + 1) {
1699
+ // Before genesis the clock epoch is negative, treat it as GENESIS_EPOCH so the next epoch can be requested
1700
+ if (epoch > Math.max(chain.clock.currentEpoch, GENESIS_EPOCH) + 1) {
1688
1701
  throw new ApiError(400, "Cannot get duties for epoch more than one ahead");
1689
1702
  }
1690
1703
 
@@ -1747,7 +1760,7 @@ export function getValidatorApi(
1747
1760
 
1748
1761
  await waitForNextClosestEpoch();
1749
1762
 
1750
- if (epoch > chain.clock.currentEpoch + 1) {
1763
+ if (epoch > Math.max(chain.clock.currentEpoch, GENESIS_EPOCH) + 1) {
1751
1764
  throw new ApiError(400, "Cannot get PTC duties for epoch more than one ahead");
1752
1765
  }
1753
1766
 
@@ -2324,8 +2337,7 @@ export function getValidatorApi(
2324
2337
  metrics?.inclusionListsValid.inc({source: InclusionListSource.api});
2325
2338
  metrics?.inclusionListsValidSize.inc(totalBytes);
2326
2339
 
2327
- const isTimely =
2328
- secFromSlot >= 0 && secFromSlot * 1000 < chain.config.getInclusionListDueMs(chain.config.getForkName(slot));
2340
+ const isTimely = secFromSlot * 1000 < chain.config.getInclusionListDueMs(chain.config.getForkName(slot));
2329
2341
  chain.inclusionListStore.process(signedInclusionList, committeeIndices, isTimely);
2330
2342
 
2331
2343
  chain.emitter.emit(routes.events.EventType.inclusionList, {
@@ -19,6 +19,11 @@ const RECONSTRUCTION_DELAY_MIN_BPS = 667;
19
19
  */
20
20
  const RECONSTRUCTION_DELAY_MAX_BPS = 1000;
21
21
 
22
+ /**
23
+ * Maximum time a column request waits for a pending reconstruction, covers the delay and the recovery itself
24
+ */
25
+ export const RECONSTRUCTED_COLUMNS_WAIT_BPS = 2500;
26
+
22
27
  const QUEUE_MAX_LENGTH = 16;
23
28
 
24
29
  export type ColumnReconstructionInput = BlockInputColumns | PayloadEnvelopeInput;
@@ -7,6 +7,7 @@ import {
7
7
  InvalidBlockCode,
8
8
  LVHInvalidJudged,
9
9
  PayloadExecutionStatus,
10
+ PayloadStatus,
10
11
  getFinalizedExecutionBlockHash,
11
12
  getSafeExecutionBlockHash,
12
13
  } from "@lodestar/fork-choice";
@@ -117,7 +118,7 @@ function toForkChoiceExecutionStatus(status: ExecutionPayloadStatus): PayloadExe
117
118
  * 3. Regenerate state for envelope verification
118
119
  * 4. Verify envelope (fields against state, signature, and EL in parallel where possible)
119
120
  * 5. Persist verified payload envelope to hot DB (waits for write-queue space for backpressure)
120
- * 6. Update fork choice (transitions the block's PENDING variant to FULL)
121
+ * 6. Update fork choice (transitions the block's PENDING variant to FULL) and emit head events if the head changed
121
122
  * 7. Queue notifyForkchoiceUpdate to engine api
122
123
  * 8. Record metrics for payload envelope and column sources
123
124
  * 9. Emit `execution_payload` event
@@ -356,6 +357,7 @@ export async function importExecutionPayload(
356
357
 
357
358
  // 6. Update fork choice, transitions the block's PENDING variant to FULL
358
359
  const execStatus = toForkChoiceExecutionStatus(execResult.status);
360
+ const prevHead = this.forkChoice.getHead();
359
361
  try {
360
362
  this.forkChoice.onExecutionPayload(
361
363
  blockRootHex,
@@ -376,12 +378,17 @@ export async function importExecutionPayload(
376
378
  }
377
379
  throw e;
378
380
  }
381
+ const head = this.forkChoice.getHead();
382
+ this.emitHeadEvents(prevHead, head);
383
+ if (head.blockRoot !== prevHead.blockRoot) {
384
+ this.onHeadChanged(prevHead, head);
385
+ }
379
386
 
380
387
  // 7. Queue notifyForkchoiceUpdate to engine api
381
- const head = this.forkChoice.getHead();
382
388
  if (
383
389
  !this.opts.disableImportExecutionFcU &&
384
390
  blockRootHex === head.blockRoot &&
391
+ head.payloadStatus === PayloadStatus.FULL &&
385
392
  // Skip a payload that does not satisfy the inclusion list constraints, fork choice keeps the EMPTY
386
393
  // variant as head and the next prepare fcU keeps the engine on the parent payload
387
394
  this.forkChoice.isPayloadInclusionListSatisfied(blockRootHex)
@@ -1,7 +1,7 @@
1
1
  import {PayloadStatus} from "@lodestar/fork-choice";
2
2
  import {computeEpochAtSlot} from "@lodestar/state-transition";
3
3
  import {SignedBeaconBlock, Slot} from "@lodestar/types";
4
- import {isErrorAborted, toRootHex} from "@lodestar/utils";
4
+ import {isErrorAborted} from "@lodestar/utils";
5
5
  import {Metrics} from "../../metrics/metrics.js";
6
6
  import {nextEventLoop} from "../../util/eventLoop.js";
7
7
  import {JobItemQueue, isQueueErrorAborted} from "../../util/queue/index.js";
@@ -208,36 +208,9 @@ export async function processBlocks(
208
208
  this.logger.debug("Block error", {slot: err.signedBlock.message.slot}, err);
209
209
 
210
210
  if (err.type.code === BlockErrorCode.INVALID_SIGNATURE) {
211
- const {signedBlock} = err;
212
- const blockSlot = signedBlock.message.slot;
213
- const {state} = err.type;
214
- const forkTypes = this.config.getForkTypes(blockSlot);
215
- const blockRootHex = toRootHex(forkTypes.BeaconBlock.hashTreeRoot(signedBlock.message));
216
- this.persistInvalidSszValue(
217
- forkTypes.SignedBeaconBlock,
218
- signedBlock,
219
- `${blockSlot}_invalid_signature`,
220
- blockRootHex
221
- );
222
- this.persistInvalidSszBytes(
223
- "BeaconState",
224
- state.serialize(),
225
- toRootHex(state.hashTreeRoot()),
226
- `${state.slot}_invalid_signature`
227
- );
211
+ void this.persistInvalidSignature(err.type.state, err.signedBlock);
228
212
  } else if (err.type.code === BlockErrorCode.INVALID_STATE_ROOT) {
229
- const {signedBlock} = err;
230
- const blockSlot = signedBlock.message.slot;
231
- const {preState, postState} = err.type;
232
- const preRoot = preState.hashTreeRoot();
233
- const postRoot = postState.hashTreeRoot();
234
- this.persistInvalidStateRoot(preState, postState, signedBlock).catch((e) => {
235
- this.logger.error(
236
- "Error persisting invalid state root objects",
237
- {slot: blockSlot, preStateRoot: toRootHex(preRoot), postStateRoot: toRootHex(postRoot)},
238
- e
239
- );
240
- });
213
+ void this.persistInvalidStateRoot(err.type.preState, err.type.postState, err.signedBlock);
241
214
  }
242
215
  }
243
216
 
@@ -307,7 +280,6 @@ async function importPayloadEnvelopesOfKnownBlocks(
307
280
  });
308
281
  await importExecutionPayload.call(this, payloadInputs[i], dataAvailabilityStatuses[i], {validSignature: false});
309
282
  }
310
- // the new FULL variants are not seen by the head cached from the last block import
311
283
  this.recomputeForkChoiceHead(ForkchoiceCaller.importBlock);
312
284
 
313
285
  return result;
@@ -2,6 +2,7 @@ import {ExecutionStatus, ProtoBlock} from "@lodestar/fork-choice";
2
2
  import {ForkName, ForkSeq, isForkPostFulu} from "@lodestar/params";
3
3
  import {
4
4
  DataAvailabilityStatus,
5
+ EpochShuffling,
5
6
  IBeaconStateView,
6
7
  computeEpochAtSlot,
7
8
  getAttestingIndices,
@@ -111,22 +112,24 @@ export async function verifyBlocksInEpoch(
111
112
 
112
113
  // Store indexed attestations for each block to avoid recomputing them during import
113
114
  const indexedAttestationsByBlock: IndexedAttestation[][] = [];
115
+ const attestationShufflingsByBlock: EpochShuffling[][] = [];
114
116
  for (const [i, block] of blocks.entries()) {
115
- indexedAttestationsByBlock[i] = block.message.body.attestations.map((attestation) => {
117
+ attestationShufflingsByBlock[i] = block.message.body.attestations.map((attestation) => {
116
118
  const attEpoch = computeEpochAtSlot(attestation.data.slot);
117
119
  // calling getShufflingAtEpoch may take some time for NativeBeaconStateView
118
120
  // we should have the shuffling inside ShufflingCache most of the time
119
- const shuffling =
121
+ return (
120
122
  this.shufflingCache.getSync(attEpoch, preState0.getShufflingDecisionRoot(attEpoch)) ??
121
- preState0.getShufflingAtEpoch(attEpoch);
122
- // Unlike getIndexedAttestation, keep attestingIndices in committee order: sorting them dominates building
123
- // these on mainnet blocks. See FullyVerifiedBlock.indexedAttestations.
124
- return {
125
- attestingIndices: getAttestingIndices(shuffling, fork, attestation),
126
- data: attestation.data,
127
- signature: attestation.signature,
128
- };
123
+ preState0.getShufflingAtEpoch(attEpoch)
124
+ );
129
125
  });
126
+ // Unlike getIndexedAttestation, keep attestingIndices in committee order: sorting them dominates building
127
+ // these on mainnet blocks. See FullyVerifiedBlock.indexedAttestations.
128
+ indexedAttestationsByBlock[i] = block.message.body.attestations.map((attestation, j) => ({
129
+ attestingIndices: getAttestingIndices(attestationShufflingsByBlock[i][j], fork, attestation),
130
+ data: attestation.data,
131
+ signature: attestation.signature,
132
+ }));
130
133
  }
131
134
 
132
135
  // Pick the data-availability source by fork:
@@ -200,6 +203,7 @@ export async function verifyBlocksInEpoch(
200
203
  preState0,
201
204
  blocks,
202
205
  indexedAttestationsByBlock,
206
+ attestationShufflingsByBlock,
203
207
  opts
204
208
  ),
205
209
 
@@ -1,5 +1,6 @@
1
1
  import {BeaconConfig} from "@lodestar/config";
2
2
  import {
3
+ EpochShuffling,
3
4
  IBeaconStateView,
4
5
  SyncCommitteeCacheEmpty,
5
6
  getBlockSignatureSets,
@@ -28,6 +29,7 @@ export async function verifyBlocksSignatures(
28
29
  preState0: IBeaconStateView,
29
30
  blocks: SignedBeaconBlock[],
30
31
  indexedAttestationsByBlock: IndexedAttestation[][],
32
+ attestationShufflingsByBlock: EpochShuffling[][],
31
33
  opts: ImportBlockOpts
32
34
  ): Promise<{verifySignaturesTime: number}> {
33
35
  const isValidPromises: Promise<boolean>[] = [];
@@ -49,6 +51,7 @@ export async function verifyBlocksSignatures(
49
51
  bls.verifySignatureSets(
50
52
  getBlockSignatureSets(config, currentSyncCommitteeIndexed, preState0, block, indexedAttestationsByBlock[i], {
51
53
  skipProposerSignature: opts.validProposerSignature,
54
+ attestationShufflings: attestationShufflingsByBlock[i],
52
55
  }),
53
56
  // Prioritize block verification over attestations, since
54
57
  // attestations already buffer up to `MAX_BUFFER_WAIT_MS`
@@ -32,7 +32,7 @@ export function chunkSameMessageSignatureSets(sets: SameMessageSignatureSet[]):
32
32
  export function getAggregatedPubkeysCount(signatureSets: ISignatureSet[]): number {
33
33
  let pubkeysCount = 0;
34
34
  for (const set of signatureSets) {
35
- if (set.type === SignatureSetType.aggregate) {
35
+ if (set.type === SignatureSetType.aggregate || set.type === SignatureSetType.committee) {
36
36
  pubkeysCount += set.indices.length;
37
37
  }
38
38
  }
@@ -7,6 +7,8 @@ import {
7
7
  AncestorStatus,
8
8
  CheckpointWithHex,
9
9
  EpochDifference,
10
+ ForkChoiceError,
11
+ ForkChoiceErrorCode,
10
12
  ForkChoiceStateGetter,
11
13
  IForkChoice,
12
14
  PayloadStatus,
@@ -91,7 +93,7 @@ import {persistBlockInput} from "./blocks/writeBlockInputToDb.js";
91
93
  import {persistPayloadEnvelopeInput} from "./blocks/writePayloadEnvelopeInputToDb.js";
92
94
  import {BlsMultiThreadWorkerPool, BlsSingleThreadVerifier, IBlsVerifier} from "./bls/index.js";
93
95
  import {BuilderCircuitBreaker} from "./builderCircuitBreaker.js";
94
- import {ColumnReconstructionTracker} from "./ColumnReconstructionTracker.js";
96
+ import {ColumnReconstructionTracker, RECONSTRUCTED_COLUMNS_WAIT_BPS} from "./ColumnReconstructionTracker.js";
95
97
  import {ChainEvent, ChainEventEmitter, ReorgEventData} from "./emitter.js";
96
98
  import {ForkchoiceCaller, initializeForkChoice} from "./forkChoice/index.js";
97
99
  import {ForkChoiceExecutionEngine} from "./forkChoiceExecutionEngine.js";
@@ -699,7 +701,8 @@ export class BeaconChain implements IBeaconChain {
699
701
  const state = await this.regen.getBlockSlotState(block, slot, {dontTransferCache: true}, RegenCaller.restApi);
700
702
  return {
701
703
  state,
702
- executionOptimistic: isOptimisticBlock(block),
704
+ // The canonical variant can be FULL, a state reports the status of the payload its block builds on
705
+ executionOptimistic: isOptimisticBlock(this.forkChoice.getBlockHexDefaultStatus(block.blockRoot) ?? block),
703
706
  finalized: slot === finalizedBlock.slot && finalizedBlock.slot !== GENESIS_SLOT,
704
707
  };
705
708
  }
@@ -715,7 +718,7 @@ export class BeaconChain implements IBeaconChain {
715
718
  return (
716
719
  state && {
717
720
  state,
718
- executionOptimistic: isOptimisticBlock(block),
721
+ executionOptimistic: isOptimisticBlock(this.forkChoice.getBlockHexDefaultStatus(block.blockRoot) ?? block),
719
722
  finalized: slot === finalizedBlock.slot && finalizedBlock.slot !== GENESIS_SLOT,
720
723
  }
721
724
  );
@@ -863,7 +866,9 @@ export class BeaconChain implements IBeaconChain {
863
866
  const finalizedBlock = this.forkChoice.getFinalizedBlock();
864
867
  if (slot > finalizedBlock.slot) {
865
868
  // Unfinalized slot, attempt to find in fork-choice
866
- const block = this.forkChoice.getCanonicalBlockAtSlot(slot);
869
+ const canonicalBlock = this.forkChoice.getCanonicalBlockAtSlot(slot);
870
+ // The canonical variant can be FULL, a block reports the status of the payload it builds on
871
+ const block = canonicalBlock && this.forkChoice.getBlockHexDefaultStatus(canonicalBlock.blockRoot);
867
872
  if (block) {
868
873
  // Block found in fork-choice.
869
874
  // It may be in the block input cache, awaiting full DA reconstruction, check there first
@@ -1124,6 +1129,17 @@ export class BeaconChain implements IBeaconChain {
1124
1129
  // After gloas, columns are tracked in PayloadEnvelopeInput
1125
1130
  const payloadInput = this.seenPayloadEnvelopeInputCache.get(blockRootHex);
1126
1131
  if (payloadInput) {
1132
+ // Available with half the columns, peers that saw it attested expect the reconstructed rest
1133
+ if (
1134
+ !payloadInput.hasComputedAllData() &&
1135
+ payloadInput.hasAllData() &&
1136
+ indices.some((index) => !payloadInput.hasColumn(index))
1137
+ ) {
1138
+ this.columnReconstructionTracker.triggerColumnReconstruction(payloadInput);
1139
+ await payloadInput
1140
+ .waitForComputedAllData(this.config.getSlotComponentDurationMs(fork, RECONSTRUCTED_COLUMNS_WAIT_BPS))
1141
+ .catch(() => this.logger.debug("Columns not reconstructed in time", {slot: blockSlot, root: blockRootHex}));
1142
+ }
1127
1143
  for (let i = 0; i < indices.length; i++) {
1128
1144
  const index = indices[i];
1129
1145
  const sidecar = payloadInput.getColumn(index);
@@ -1145,6 +1161,17 @@ export class BeaconChain implements IBeaconChain {
1145
1161
  if (!isBlockInputColumns(blockInput)) {
1146
1162
  throw new Error(`Expected block input to have columns: slot=${blockSlot} root=${blockRootHex}`);
1147
1163
  }
1164
+ // Available with half the columns, peers that saw it attested expect the reconstructed rest
1165
+ if (
1166
+ !blockInput.hasComputedAllData() &&
1167
+ blockInput.hasAllData() &&
1168
+ indices.some((index) => !blockInput.hasColumn(index))
1169
+ ) {
1170
+ this.columnReconstructionTracker.triggerColumnReconstruction(blockInput);
1171
+ await blockInput
1172
+ .waitForComputedAllData(this.config.getSlotComponentDurationMs(fork, RECONSTRUCTED_COLUMNS_WAIT_BPS))
1173
+ .catch(() => this.logger.debug("Columns not reconstructed in time", {slot: blockSlot, root: blockRootHex}));
1174
+ }
1148
1175
  for (let i = 0; i < indices.length; i++) {
1149
1176
  const index = indices[i];
1150
1177
  const sidecar = blockInput.getColumn(index);
@@ -1471,9 +1498,10 @@ export class BeaconChain implements IBeaconChain {
1471
1498
 
1472
1499
  /**
1473
1500
  * Emit `head` and `head_v2` when the fork choice head differs between two observations. Every caller that
1474
- * can move the head, `updateAndGetHead()` and `updateTime()`, must capture the head before and pass both.
1501
+ * can move the head, `updateAndGetHead()`, `updateTime()` and `onExecutionPayload()`, must capture the head before
1502
+ * and pass both.
1475
1503
  */
1476
- private emitHeadEvents(prevHead: ProtoBlock, head: ProtoBlock): void {
1504
+ emitHeadEvents(prevHead: ProtoBlock, head: ProtoBlock): void {
1477
1505
  const headRootChanged = head.blockRoot !== prevHead.blockRoot;
1478
1506
 
1479
1507
  if (!headRootChanged && prevHead.payloadStatus === head.payloadStatus) {
@@ -1604,38 +1632,76 @@ export class BeaconChain implements IBeaconChain {
1604
1632
  }
1605
1633
 
1606
1634
  /**
1607
- * Invalid state root error is critical and it causes the node to stale most of the time so we want to always
1608
- * persist preState, postState and block for further investigation.
1635
+ * Invalid state root error is critical and it causes the node to stale most of the time so we want to persist
1636
+ * preState, postState and block for further investigation.
1609
1637
  */
1610
1638
  async persistInvalidStateRoot(
1611
1639
  preState: IBeaconStateView,
1612
1640
  postState: IBeaconStateView,
1613
1641
  block: SignedBeaconBlock
1614
1642
  ): Promise<void> {
1643
+ if (!this.opts.persistInvalidSszObjects) {
1644
+ return;
1645
+ }
1615
1646
  const blockSlot = block.message.slot;
1616
- const blockType = this.config.getForkTypes(blockSlot).SignedBeaconBlock;
1617
- const postStateRoot = postState.hashTreeRoot();
1618
- const logStr = `slot_${blockSlot}_invalid_state_root_${toRootHex(postStateRoot)}`;
1619
- await Promise.all([
1620
- this.persistSszObject(
1621
- `SignedBeaconBlock_slot_${blockSlot}`,
1622
- blockType.serialize(block),
1623
- toRootHex(this.config.getForkTypes(blockSlot).BeaconBlock.hashTreeRoot(block.message)),
1624
- `${logStr}_block`
1625
- ),
1626
- this.persistSszObject(
1627
- `preState_slot_${preState.slot}_BeaconState`,
1628
- preState.serialize(),
1629
- toRootHex(preState.hashTreeRoot()),
1630
- `${logStr}_pre_state`
1631
- ),
1632
- this.persistSszObject(
1633
- `postState_slot_${postState.slot}_BeaconState`,
1634
- postState.serialize(),
1635
- toRootHex(postStateRoot),
1636
- `${logStr}_post_state`
1637
- ),
1638
- ]);
1647
+ const forkTypes = this.config.getForkTypes(blockSlot);
1648
+ const preStateRoot = toRootHex(preState.hashTreeRoot());
1649
+ const postStateRoot = toRootHex(postState.hashTreeRoot());
1650
+ const logStr = `slot_${blockSlot}_invalid_state_root_${postStateRoot}`;
1651
+ try {
1652
+ await Promise.all([
1653
+ this.persistSszObject(
1654
+ `SignedBeaconBlock_slot_${blockSlot}`,
1655
+ forkTypes.SignedBeaconBlock.serialize(block),
1656
+ toRootHex(forkTypes.BeaconBlock.hashTreeRoot(block.message)),
1657
+ `${logStr}_block`
1658
+ ),
1659
+ this.persistSszObject(
1660
+ `preState_slot_${preState.slot}_BeaconState`,
1661
+ preState.serialize(),
1662
+ preStateRoot,
1663
+ `${logStr}_pre_state`
1664
+ ),
1665
+ this.persistSszObject(
1666
+ `postState_slot_${postState.slot}_BeaconState`,
1667
+ postState.serialize(),
1668
+ postStateRoot,
1669
+ `${logStr}_post_state`
1670
+ ),
1671
+ ]);
1672
+ } catch (e) {
1673
+ this.logger.error(
1674
+ "Error persisting invalid state root objects",
1675
+ {slot: blockSlot, preStateRoot, postStateRoot},
1676
+ e as Error
1677
+ );
1678
+ }
1679
+ }
1680
+
1681
+ async persistInvalidSignature(state: IBeaconStateView, block: SignedBeaconBlock): Promise<void> {
1682
+ if (!this.opts.persistInvalidSszObjects) {
1683
+ return;
1684
+ }
1685
+ const blockSlot = block.message.slot;
1686
+ const forkTypes = this.config.getForkTypes(blockSlot);
1687
+ try {
1688
+ await Promise.all([
1689
+ this.persistSszObject(
1690
+ forkTypes.SignedBeaconBlock.typeName,
1691
+ forkTypes.SignedBeaconBlock.serialize(block),
1692
+ toRootHex(forkTypes.BeaconBlock.hashTreeRoot(block.message)),
1693
+ `${blockSlot}_invalid_signature`
1694
+ ),
1695
+ this.persistSszObject(
1696
+ "BeaconState",
1697
+ state.serialize(),
1698
+ toRootHex(state.hashTreeRoot()),
1699
+ `${state.slot}_invalid_signature`
1700
+ ),
1701
+ ]);
1702
+ } catch (e) {
1703
+ this.logger.error("Error persisting invalid signature objects", {slot: blockSlot}, e as Error);
1704
+ }
1639
1705
  }
1640
1706
 
1641
1707
  persistInvalidSszValue<T>(type: Type<T>, sszObject: T, suffix?: string, rootHex?: RootHex): void {
@@ -1650,12 +1716,6 @@ export class BeaconChain implements IBeaconChain {
1650
1716
  }
1651
1717
  }
1652
1718
 
1653
- persistInvalidSszBytes(typeName: string, sszBytes: Uint8Array, rootHex: RootHex, suffix?: string): void {
1654
- if (this.opts.persistInvalidSszObjects) {
1655
- void this.persistSszObject(typeName, sszBytes, rootHex, suffix);
1656
- }
1657
- }
1658
-
1659
1719
  /**
1660
1720
  * Regenerate state for attestation verification, this does not happen with default chain option of maxSkipSlots = 32 .
1661
1721
  * However, need to handle just in case. Lodestar doesn't support multiple regen state requests for attestation verification
@@ -1855,14 +1915,18 @@ export class BeaconChain implements IBeaconChain {
1855
1915
  private onClockSlot(slot: Slot): void {
1856
1916
  this.logger.verbose("Clock slot", {slot});
1857
1917
 
1858
- // CRITICAL UPDATE
1859
- if (this.forkChoice.irrecoverableError) {
1860
- this.processShutdownCallback(this.forkChoice.irrecoverableError);
1861
- }
1862
-
1863
1918
  // updateTime() recomputes the head on epoch-boundary checkpoint pull-up and under fast confirmation
1864
1919
  const prevHead = this.forkChoice.getHead();
1865
- this.forkChoice.updateTime(slot);
1920
+ try {
1921
+ this.forkChoice.updateTime(slot);
1922
+ } catch (e) {
1923
+ // Per optimistic sync the node MAY exit once the justified checkpoint is INVALIDATED, fork choice has no head
1924
+ if (e instanceof ForkChoiceError && e.type.code === ForkChoiceErrorCode.INVALID_JUSTIFIED_EXECUTION_STATUS) {
1925
+ this.processShutdownCallback(e);
1926
+ return;
1927
+ }
1928
+ throw e;
1929
+ }
1866
1930
  this.emitHeadEvents(prevHead, this.forkChoice.getHead());
1867
1931
  this.metrics?.clockSlot.set(slot);
1868
1932
 
@@ -151,6 +151,14 @@ export enum AttestationErrorCode {
151
151
  * Gloas: index-1 attestation but the execution payload has not been seen yet
152
152
  */
153
153
  EXECUTION_PAYLOAD_NOT_SEEN = "ATTESTATION_ERROR_EXECUTION_PAYLOAD_NOT_SEEN",
154
+ /**
155
+ * Gloas: index-1 attestation to a block whose execution payload is not yet validated by the execution engine
156
+ */
157
+ EXECUTION_PAYLOAD_OPTIMISTIC = "ATTESTATION_ERROR_EXECUTION_PAYLOAD_OPTIMISTIC",
158
+ /**
159
+ * Gloas: index-1 attestation to a block whose execution payload was invalidated
160
+ */
161
+ EXECUTION_PAYLOAD_INVALID = "ATTESTATION_ERROR_EXECUTION_PAYLOAD_INVALID",
154
162
  }
155
163
 
156
164
  export type AttestationErrorType =
@@ -190,7 +198,9 @@ export type AttestationErrorType =
190
198
  | {code: AttestationErrorCode.ATTESTER_NOT_IN_COMMITTEE}
191
199
  | {code: AttestationErrorCode.INVALID_PAYLOAD_STATUS_VALUE; attDataIndex: number}
192
200
  | {code: AttestationErrorCode.PREMATURELY_INDICATED_PAYLOAD_PRESENT}
193
- | {code: AttestationErrorCode.EXECUTION_PAYLOAD_NOT_SEEN; beaconBlockRoot: RootHex};
201
+ | {code: AttestationErrorCode.EXECUTION_PAYLOAD_NOT_SEEN; beaconBlockRoot: RootHex}
202
+ | {code: AttestationErrorCode.EXECUTION_PAYLOAD_OPTIMISTIC; beaconBlockRoot: RootHex}
203
+ | {code: AttestationErrorCode.EXECUTION_PAYLOAD_INVALID; beaconBlockRoot: RootHex};
194
204
 
195
205
  export class AttestationError extends GossipActionError<AttestationErrorType> {
196
206
  getMetadata(): Record<string, string | number | null> {
@@ -7,7 +7,7 @@ export enum ExecutionPayloadBidErrorCode {
7
7
  NON_ZERO_EXECUTION_PAYMENT = "EXECUTION_PAYLOAD_BID_ERROR_NON_ZERO_EXECUTION_PAYMENT",
8
8
  BLOCK_HASH_EQUALS_PARENT_BLOCK_HASH = "EXECUTION_PAYLOAD_BID_ERROR_BLOCK_HASH_EQUALS_PARENT_BLOCK_HASH",
9
9
  INCOMPATIBLE_WITH_HEAD = "EXECUTION_PAYLOAD_BID_ERROR_INCOMPATIBLE_WITH_HEAD",
10
- BID_ALREADY_KNOWN = "EXECUTION_PAYLOAD_BID_ERROR_BID_ALREADY_KNOWN",
10
+ BID_LIMIT_REACHED = "EXECUTION_PAYLOAD_BID_ERROR_BID_LIMIT_REACHED",
11
11
  BID_TOO_LOW = "EXECUTION_PAYLOAD_BID_ERROR_BID_TOO_LOW",
12
12
  BID_TOO_HIGH = "EXECUTION_PAYLOAD_BID_ERROR_BID_TOO_HIGH",
13
13
  BUILDER_MAY_EXIT = "EXECUTION_PAYLOAD_BID_ERROR_BUILDER_MAY_EXIT",
@@ -46,11 +46,12 @@ export type ExecutionPayloadBidErrorType =
46
46
  headBlockRoot: RootHex;
47
47
  }
48
48
  | {
49
- code: ExecutionPayloadBidErrorCode.BID_ALREADY_KNOWN;
49
+ code: ExecutionPayloadBidErrorCode.BID_LIMIT_REACHED;
50
50
  builderIndex: BuilderIndex;
51
51
  slot: Slot;
52
52
  parentBlockRoot: RootHex;
53
53
  parentBlockHash: RootHex;
54
+ bidLimit: number;
54
55
  }
55
56
  | {code: ExecutionPayloadBidErrorCode.BID_TOO_LOW; bidValue: number; currentHighestBid: number}
56
57
  | {code: ExecutionPayloadBidErrorCode.BID_TOO_HIGH; bidValue: number; builderBalance: number}
@@ -303,8 +303,8 @@ export interface IBeaconChain {
303
303
  postState: IBeaconStateView,
304
304
  block: SignedBeaconBlock
305
305
  ): Promise<void>;
306
+ persistInvalidSignature(state: IBeaconStateView, block: SignedBeaconBlock): Promise<void>;
306
307
  persistInvalidSszValue<T>(type: Type<T>, sszObject: T, suffix?: string, rootHex?: RootHex): void;
307
- persistInvalidSszBytes(type: string, sszBytes: Uint8Array, rootHex: RootHex, suffix?: string): void;
308
308
  regenStateForAttestationVerification(
309
309
  attEpoch: Epoch,
310
310
  shufflingDependentRoot: RootHex,
@@ -164,9 +164,12 @@ export class InclusionListStore {
164
164
  return out;
165
165
  }
166
166
 
167
- /** Lists are retained for MIN_SLOTS_FOR_INCLUSION_LISTS_REQUESTS slots so InclusionListsByIndices can serve them */
167
+ /**
168
+ * Lists are kept one slot past the MIN_SLOTS_FOR_INCLUSION_LISTS_REQUESTS serving window, the lists of slot N are
169
+ * read when the payload of slot N + 1 is processed, which may happen during slot N + 2
170
+ */
168
171
  prune(clockSlot: Slot): void {
169
- const horizon = clockSlot - this.config.MIN_SLOTS_FOR_INCLUSION_LISTS_REQUESTS;
172
+ const horizon = clockSlot - this.config.MIN_SLOTS_FOR_INCLUSION_LISTS_REQUESTS - 1;
170
173
 
171
174
  for (const slot of this.inclusionLists.keys()) {
172
175
  if (slot < horizon) {
@@ -290,7 +290,7 @@ export class OpPool {
290
290
  const endAttesterSlashings = stepsMetrics?.startTimer();
291
291
  const attesterSlashings: AttesterSlashing[] = [];
292
292
  const maxAttesterSlashings = stateFork >= ForkSeq.electra ? MAX_ATTESTER_SLASHINGS_ELECTRA : MAX_ATTESTER_SLASHINGS;
293
- attesterSlashing: for (const [key, attesterSlashing] of this.attesterSlashings) {
293
+ for (const [key, attesterSlashing] of this.attesterSlashings) {
294
294
  const domains = getAttesterSlashingSignatureDomains(this.config, state.slot, attesterSlashing.attesterSlashing);
295
295
  if (!attesterSlashing.verifiedDomains.every((domain, i) => byteArrayEquals(domain, domains[i]))) {
296
296
  this.attesterSlashings.delete(key);
@@ -300,18 +300,15 @@ export class OpPool {
300
300
  const slashableIndices = new Set<ValidatorIndex>();
301
301
  for (let i = 0; i < attesterSlashing.intersectingIndices.length; i++) {
302
302
  const index = attesterSlashing.intersectingIndices[i];
303
- // If we already have a slashing for this index, we can continue on to the next slashing
303
+ // Covered by an earlier slashing in this block, the remaining indices may still be slashable
304
304
  if (toBeSlashedIndices.has(index)) {
305
- continue attesterSlashing;
305
+ continue;
306
306
  }
307
307
 
308
308
  const validator = state.getValidator(index);
309
309
  if (isSlashableAtEpoch(validator, stateEpoch)) {
310
310
  slashableIndices.add(index);
311
311
  }
312
- if (attesterSlashings.length >= maxAttesterSlashings) {
313
- break attesterSlashing;
314
- }
315
312
  }
316
313
 
317
314
  // If there were slashable indices in this slashing
@@ -321,6 +318,9 @@ export class OpPool {
321
318
  for (const index of slashableIndices) {
322
319
  toBeSlashedIndices.add(index);
323
320
  }
321
+ if (attesterSlashings.length >= maxAttesterSlashings) {
322
+ break;
323
+ }
324
324
  }
325
325
  }
326
326
  endAttesterSlashings?.({
@@ -132,7 +132,7 @@ export const defaultChainOptions: IChainOptions = {
132
132
  // - users can prune the persisted checkpoint state files manually to save disc space
133
133
  // - it helps debug easier when network is unfinalized
134
134
  nHistoricalStatesFileDataStore: true,
135
- nativeStateTransition: false,
135
+ nativeStateTransition: true,
136
136
  maxBlockStates: DEFAULT_MAX_BLOCK_STATES,
137
137
  maxCPStateEpochsInMemory: DEFAULT_MAX_CP_STATE_EPOCHS_IN_MEMORY,
138
138
  maxCPStateEpochsOnDisk: DEFAULT_MAX_CP_STATE_ON_DISK,
@@ -22,7 +22,7 @@ import {MapDef} from "@lodestar/utils";
22
22
  //
23
23
  // Assuming we're at epoch 99 while all other nodes at epoch 100, they all accept attestations at epoch 99, 100.
24
24
  // If MAX_RETAINED_EPOCH = 2 then lowestPermissibleEpoch is 97 which is more than enough
25
- const EPOCH_LOOKBACK_LIMIT = 2;
25
+ export const EPOCH_LOOKBACK_LIMIT = 2;
26
26
 
27
27
  /**
28
28
  * Keeps a cache to filter unaggregated attestations from the same validator in the same epoch.