@lodestar/fork-choice 1.41.0-rc.2 → 1.42.0-dev.04e52d162f

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.
@@ -9,6 +9,7 @@ import {
9
9
  ExecutionStatus,
10
10
  HEX_ZERO_HASH,
11
11
  LVHExecResponse,
12
+ PayloadExecutionStatus,
12
13
  PayloadStatus,
13
14
  ProtoBlock,
14
15
  ProtoNode,
@@ -541,7 +542,8 @@ export class ProtoArray {
541
542
  executionPayloadBlockHash: RootHex,
542
543
  executionPayloadNumber: number,
543
544
  executionPayloadStateRoot: RootHex,
544
- proposerBoostRoot: RootHex | null
545
+ proposerBoostRoot: RootHex | null,
546
+ executionStatus: PayloadExecutionStatus
545
547
  ): void {
546
548
  // First check if block exists
547
549
  const variants = this.indices.get(blockRoot);
@@ -591,7 +593,8 @@ export class ProtoArray {
591
593
  weight: 0,
592
594
  bestChild: undefined,
593
595
  bestDescendant: undefined,
594
- executionStatus: ExecutionStatus.Valid,
596
+ // TODO GLOAS: handle optimistic sync
597
+ executionStatus,
595
598
  executionPayloadBlockHash,
596
599
  executionPayloadNumber,
597
600
  stateRoot: executionPayloadStateRoot,
@@ -1059,10 +1062,8 @@ export class ProtoArray {
1059
1062
  });
1060
1063
  }
1061
1064
 
1062
- // Find the minimum index among all variants to ensure we don't prune too much
1063
- const finalizedIndex = Array.isArray(variants)
1064
- ? Math.min(...variants.filter((idx) => idx !== undefined))
1065
- : variants;
1065
+ // For Gloas, PENDING variant (index 0) is always the smallest since it's inserted first
1066
+ const finalizedIndex = Array.isArray(variants) ? variants[PayloadStatus.PENDING] : variants;
1066
1067
 
1067
1068
  if (finalizedIndex < this.pruneThreshold) {
1068
1069
  // Pruning at small numbers incurs more cost than benefit