@lodestar/fork-choice 2.1.0-dev.03db1e1994 → 2.1.0-dev.04f41d12f7
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/lib/forkChoice/errors.d.ts +11 -1
- package/lib/forkChoice/errors.d.ts.map +1 -1
- package/lib/forkChoice/errors.js +2 -0
- package/lib/forkChoice/errors.js.map +1 -1
- package/lib/forkChoice/forkChoice.d.ts +2 -2
- package/lib/forkChoice/forkChoice.d.ts.map +1 -1
- package/lib/forkChoice/forkChoice.js +3 -8
- package/lib/forkChoice/forkChoice.js.map +1 -1
- package/lib/forkChoice/interface.d.ts +1 -0
- package/lib/forkChoice/interface.d.ts.map +1 -1
- package/lib/forkChoice/interface.js +1 -0
- package/lib/forkChoice/interface.js.map +1 -1
- package/lib/forkChoice/nativeForkChoice.d.ts +244 -0
- package/lib/forkChoice/nativeForkChoice.d.ts.map +1 -0
- package/lib/forkChoice/nativeForkChoice.js +1657 -0
- package/lib/forkChoice/nativeForkChoice.js.map +1 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -1
- package/lib/protoArray/protoArray.d.ts +2 -1
- package/lib/protoArray/protoArray.d.ts.map +1 -1
- package/lib/protoArray/protoArray.js +16 -2
- package/lib/protoArray/protoArray.js.map +1 -1
- package/package.json +9 -8
- package/src/forkChoice/errors.ts +5 -1
- package/src/forkChoice/forkChoice.ts +3 -9
- package/src/forkChoice/interface.ts +1 -0
- package/src/forkChoice/nativeForkChoice.ts +2000 -0
- package/src/index.ts +1 -0
- package/src/protoArray/protoArray.ts +19 -2
|
@@ -1734,7 +1734,7 @@ export class ForkChoice implements IForkChoice {
|
|
|
1734
1734
|
* Return true if the block is "weak" ie. its weight is below REORG_HEAD_WEIGHT_THRESHOLD of the
|
|
1735
1735
|
* total attester weight per slot.
|
|
1736
1736
|
*
|
|
1737
|
-
* https://github.com/ethereum/consensus-specs/blob/v1.7.0-
|
|
1737
|
+
* https://github.com/ethereum/consensus-specs/blob/v1.7.0-beta.5/specs/phase0/fork-choice.md#is_head_weak
|
|
1738
1738
|
* https://github.com/ethereum/consensus-specs/blob/v1.7.0-alpha.11/specs/gloas/fork-choice.md#modified-is_head_weak
|
|
1739
1739
|
*/
|
|
1740
1740
|
private isHeadWeak(blockRoot: RootHex): boolean {
|
|
@@ -1753,10 +1753,6 @@ export class ForkChoice implements IForkChoice {
|
|
|
1753
1753
|
committeePercent: this.config.REORG_HEAD_WEIGHT_THRESHOLD,
|
|
1754
1754
|
});
|
|
1755
1755
|
|
|
1756
|
-
if (!isForkPostGloas(this.config.getForkName(node.slot))) {
|
|
1757
|
-
return node.weight < reorgThreshold;
|
|
1758
|
-
}
|
|
1759
|
-
|
|
1760
1756
|
let headWeight = node.attestationScore;
|
|
1761
1757
|
|
|
1762
1758
|
const {equivocatingIndices} = this.fcStore;
|
|
@@ -1797,7 +1793,7 @@ export class ForkChoice implements IForkChoice {
|
|
|
1797
1793
|
* Return true if the parent block is "strong" ie. its weight exceeds REORG_PARENT_WEIGHT_THRESHOLD
|
|
1798
1794
|
* of the total attester weight per slot.
|
|
1799
1795
|
*
|
|
1800
|
-
* https://github.com/ethereum/consensus-specs/blob/v1.7.0-
|
|
1796
|
+
* https://github.com/ethereum/consensus-specs/blob/v1.7.0-beta.5/specs/phase0/fork-choice.md#is_parent_strong
|
|
1801
1797
|
* https://github.com/ethereum/consensus-specs/blob/v1.7.0-alpha.12/specs/gloas/fork-choice.md#modified-is_parent_strong
|
|
1802
1798
|
*/
|
|
1803
1799
|
private isParentStrong(parentRoot: RootHex): boolean {
|
|
@@ -1812,9 +1808,7 @@ export class ForkChoice implements IForkChoice {
|
|
|
1812
1808
|
committeePercent: this.config.REORG_PARENT_WEIGHT_THRESHOLD,
|
|
1813
1809
|
});
|
|
1814
1810
|
|
|
1815
|
-
|
|
1816
|
-
const parentWeight = isForkPostGloas(this.config.getForkName(node.slot)) ? node.attestationScore : node.weight;
|
|
1817
|
-
return parentWeight > parentThreshold;
|
|
1811
|
+
return node.attestationScore > parentThreshold;
|
|
1818
1812
|
}
|
|
1819
1813
|
|
|
1820
1814
|
/**
|
|
@@ -70,6 +70,7 @@ export enum NotReorgedReason {
|
|
|
70
70
|
NotProposingOnTime = "notProposingOnTime",
|
|
71
71
|
NotProposerOfNextSlot = "notProposerOfNextSlot",
|
|
72
72
|
HeadBlockNotAvailable = "headBlockNotAvailable", // Should not happen because head block should be in cache
|
|
73
|
+
HeadStateNotAvailable = "headStateNotAvailable",
|
|
73
74
|
Unknown = "unknown", // A placeholder in case reason is not provided
|
|
74
75
|
}
|
|
75
76
|
|