@lodestar/fork-choice 1.41.0 → 1.42.0-dev.2f0347050b
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.
- package/README.md +1 -1
- package/lib/forkChoice/forkChoice.d.ts +6 -5
- package/lib/forkChoice/forkChoice.d.ts.map +1 -1
- package/lib/forkChoice/forkChoice.js +18 -23
- package/lib/forkChoice/forkChoice.js.map +1 -1
- package/lib/forkChoice/interface.d.ts +4 -4
- package/lib/forkChoice/interface.d.ts.map +1 -1
- package/lib/forkChoice/interface.js.map +1 -1
- package/lib/forkChoice/store.d.ts +2 -2
- package/lib/forkChoice/store.d.ts.map +1 -1
- package/lib/index.d.ts +2 -2
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/lib/protoArray/interface.d.ts +11 -3
- package/lib/protoArray/interface.d.ts.map +1 -1
- package/lib/protoArray/protoArray.d.ts +2 -2
- package/lib/protoArray/protoArray.d.ts.map +1 -1
- package/lib/protoArray/protoArray.js +5 -6
- package/lib/protoArray/protoArray.js.map +1 -1
- package/package.json +7 -7
- package/src/forkChoice/forkChoice.ts +35 -28
- package/src/forkChoice/interface.ts +7 -9
- package/src/forkChoice/store.ts +2 -2
- package/src/index.ts +3 -2
- package/src/protoArray/interface.ts +12 -7
- package/src/protoArray/protoArray.ts +7 -6
|
@@ -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
|
-
|
|
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
|
-
//
|
|
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
|