@lodestar/fork-choice 1.46.0 → 1.47.0-dev.02d2dbea03
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 +6 -1
- package/lib/forkChoice/errors.d.ts.map +1 -1
- package/lib/forkChoice/errors.js +1 -0
- package/lib/forkChoice/errors.js.map +1 -1
- package/lib/forkChoice/fastConfirmation/data.d.ts +1 -1
- package/lib/forkChoice/fastConfirmation/fastConfirmationRule.d.ts +4 -4
- package/lib/forkChoice/fastConfirmation/index.d.ts +3 -3
- package/lib/forkChoice/fastConfirmation/rules.d.ts +1 -1
- package/lib/forkChoice/fastConfirmation/types.d.ts +3 -3
- package/lib/forkChoice/fastConfirmation/types.d.ts.map +1 -1
- package/lib/forkChoice/fastConfirmation/utils.d.ts +3 -3
- package/lib/forkChoice/forkChoice.d.ts +12 -17
- package/lib/forkChoice/forkChoice.d.ts.map +1 -1
- package/lib/forkChoice/forkChoice.js +48 -31
- package/lib/forkChoice/forkChoice.js.map +1 -1
- package/lib/forkChoice/interface.d.ts +8 -8
- package/lib/forkChoice/interface.d.ts.map +1 -1
- package/lib/forkChoice/interface.js +1 -1
- package/lib/forkChoice/interface.js.map +1 -1
- package/lib/forkChoice/safeBlocks.d.ts +5 -13
- package/lib/forkChoice/safeBlocks.d.ts.map +1 -1
- package/lib/forkChoice/safeBlocks.js +23 -32
- package/lib/forkChoice/safeBlocks.js.map +1 -1
- package/lib/forkChoice/store.d.ts +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/metrics.d.ts +2 -2
- package/lib/protoArray/interface.d.ts +4 -4
- package/lib/protoArray/interface.d.ts.map +1 -1
- package/lib/protoArray/protoArray.d.ts +7 -10
- package/lib/protoArray/protoArray.d.ts.map +1 -1
- package/lib/protoArray/protoArray.js +51 -37
- package/lib/protoArray/protoArray.js.map +1 -1
- package/package.json +8 -8
- package/src/forkChoice/errors.ts +3 -1
- package/src/forkChoice/fastConfirmation/data.ts +2 -2
- package/src/forkChoice/fastConfirmation/fastConfirmationRule.ts +6 -6
- package/src/forkChoice/fastConfirmation/index.ts +3 -3
- package/src/forkChoice/fastConfirmation/rules.ts +3 -3
- package/src/forkChoice/fastConfirmation/types.ts +3 -3
- package/src/forkChoice/fastConfirmation/utils.ts +3 -3
- package/src/forkChoice/forkChoice.ts +71 -41
- package/src/forkChoice/interface.ts +6 -6
- package/src/forkChoice/safeBlocks.ts +27 -35
- package/src/forkChoice/store.ts +1 -1
- package/src/index.ts +2 -2
- package/src/metrics.ts +1 -1
- package/src/protoArray/interface.ts +4 -4
- package/src/protoArray/protoArray.ts +65 -41
|
@@ -122,7 +122,8 @@ export declare enum ForkChoiceErrorCode {
|
|
|
122
122
|
ATTEMPT_TO_REVERT_JUSTIFICATION = "FORKCHOICE_ERROR_ATTEMPT_TO_REVERT_JUSTIFICATION",
|
|
123
123
|
FORK_CHOICE_STORE_ERROR = "FORKCHOICE_ERROR_FORK_CHOICE_STORE_ERROR",
|
|
124
124
|
UNABLE_TO_SET_JUSTIFIED_CHECKPOINT = "FORKCHOICE_ERROR_UNABLE_TO_SET_JUSTIFIED_CHECKPOINT",
|
|
125
|
-
AFTER_BLOCK_FAILED = "FORKCHOICE_ERROR_AFTER_BLOCK_FAILED"
|
|
125
|
+
AFTER_BLOCK_FAILED = "FORKCHOICE_ERROR_AFTER_BLOCK_FAILED",
|
|
126
|
+
MISSING_EXECUTION_PAYLOAD_BLOCK_HASH = "FORKCHOICE_ERROR_MISSING_EXECUTION_PAYLOAD_BLOCK_HASH"
|
|
126
127
|
}
|
|
127
128
|
export type ForkChoiceErrorType = {
|
|
128
129
|
code: ForkChoiceErrorCode.INVALID_ATTESTATION;
|
|
@@ -163,6 +164,10 @@ export type ForkChoiceErrorType = {
|
|
|
163
164
|
} | {
|
|
164
165
|
code: ForkChoiceErrorCode.AFTER_BLOCK_FAILED;
|
|
165
166
|
error: Error;
|
|
167
|
+
} | {
|
|
168
|
+
code: ForkChoiceErrorCode.MISSING_EXECUTION_PAYLOAD_BLOCK_HASH;
|
|
169
|
+
root: RootHex;
|
|
170
|
+
slot: Slot;
|
|
166
171
|
};
|
|
167
172
|
export declare class ForkChoiceError extends LodestarError<ForkChoiceErrorType> {
|
|
168
173
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/forkChoice/errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,KAAK,EAAE,OAAO,EAAE,IAAI,EAAC,MAAM,iBAAiB,CAAC;AACrD,OAAO,EAAC,aAAa,EAAC,MAAM,iBAAiB,CAAC;AAE9C,oBAAY,gBAAgB;IAC1B,cAAc,mBAAmB;IACjC,WAAW,gBAAgB;IAC3B,cAAc,mBAAmB;IACjC,wBAAwB,6BAA6B;CACtD;AAED,MAAM,MAAM,YAAY,GACpB;IAAC,IAAI,EAAE,gBAAgB,CAAC,cAAc,CAAC;IAAC,IAAI,EAAE,OAAO,CAAC;IAAC,IAAI,EAAE,OAAO,GAAG,IAAI,CAAA;CAAC,GAC5E;IAAC,IAAI,EAAE,gBAAgB,CAAC,WAAW,CAAC;IAAC,WAAW,EAAE,IAAI,CAAC;IAAC,SAAS,EAAE,IAAI,CAAA;CAAC,GACxE;IAAC,IAAI,EAAE,gBAAgB,CAAC,cAAc,CAAC;IAAC,aAAa,EAAE,IAAI,CAAC;IAAC,SAAS,EAAE,IAAI,CAAA;CAAC,GAC7E;IAAC,IAAI,EAAE,gBAAgB,CAAC,wBAAwB,CAAC;IAAC,aAAa,EAAE,OAAO,CAAC;IAAC,aAAa,CAAC,EAAE,OAAO,CAAA;CAAC,CAAC;AAEvG,oBAAY,sBAAsB;IAChC;;OAEG;IACH,0BAA0B,+BAA+B;IACzD;;OAEG;IACH,kBAAkB,uBAAuB;IACzC;;;OAGG;IACH,gBAAgB,qBAAqB;I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71
71
|
ForkChoiceErrorCode["AFTER_BLOCK_FAILED"] = "FORKCHOICE_ERROR_AFTER_BLOCK_FAILED";
|
|
72
|
+
ForkChoiceErrorCode["MISSING_EXECUTION_PAYLOAD_BLOCK_HASH"] = "FORKCHOICE_ERROR_MISSING_EXECUTION_PAYLOAD_BLOCK_HASH";
|
|
72
73
|
})(ForkChoiceErrorCode || (ForkChoiceErrorCode = {}));
|
|
73
74
|
export class ForkChoiceError extends LodestarError {
|
|
74
75
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/forkChoice/errors.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,aAAa,EAAC,MAAM,iBAAiB,CAAC;AAE9C,MAAM,CAAN,IAAY,gBAKX;AALD,WAAY,gBAAgB;IAC1B,qDAAiC,CAAA;IACjC,+CAA2B,CAAA;IAC3B,qDAAiC,CAAA;IACjC,yEAAqD,CAAA;AACvD,CAAC,EALW,gBAAgB,KAAhB,gBAAgB,QAK3B;AAQD,MAAM,CAAN,IAAY,sBA+CX;AA/CD,WAAY,sBAAsB;IAChC;;OAEG;IACH,mFAAyD,CAAA;IACzD;;OAEG;IACH,mEAAyC,CAAA;IACzC;;;OAGG;IACH,+DAAqC,CAAA;IACrC;;OAEG;IACH,qEAA2C,CAAA;IAC3C;;OAEG;IACH,uDAA6B,CAAA;IAC7B;;OAEG;IACH,mDAAyB,CAAA;IACzB;;OAEG;IACH,2DAAiC,CAAA;IACjC;;OAEG;IACH,6EAAmD,CAAA;IACnD;;;OAGG;IACH,qDAA2B,CAAA;IAC3B;;OAEG;IACH,mEAAyC,CAAA;IACzC;;OAEG;IACH,2EAAiD,CAAA;AACnD,CAAC,EA/CW,sBAAsB,KAAtB,sBAAsB,QA+CjC;AAeD,MAAM,CAAN,IAAY,
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/forkChoice/errors.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,aAAa,EAAC,MAAM,iBAAiB,CAAC;AAE9C,MAAM,CAAN,IAAY,gBAKX;AALD,WAAY,gBAAgB;IAC1B,qDAAiC,CAAA;IACjC,+CAA2B,CAAA;IAC3B,qDAAiC,CAAA;IACjC,yEAAqD,CAAA;AACvD,CAAC,EALW,gBAAgB,KAAhB,gBAAgB,QAK3B;AAQD,MAAM,CAAN,IAAY,sBA+CX;AA/CD,WAAY,sBAAsB;IAChC;;OAEG;IACH,mFAAyD,CAAA;IACzD;;OAEG;IACH,mEAAyC,CAAA;IACzC;;;OAGG;IACH,+DAAqC,CAAA;IACrC;;OAEG;IACH,qEAA2C,CAAA;IAC3C;;OAEG;IACH,uDAA6B,CAAA;IAC7B;;OAEG;IACH,mDAAyB,CAAA;IACzB;;OAEG;IACH,2DAAiC,CAAA;IACjC;;OAEG;IACH,6EAAmD,CAAA;IACnD;;;OAGG;IACH,qDAA2B,CAAA;IAC3B;;OAEG;IACH,mEAAyC,CAAA;IACzC;;OAEG;IACH,2EAAiD,CAAA;AACnD,CAAC,EA/CW,sBAAsB,KAAtB,sBAAsB,QA+CjC;AAeD,MAAM,CAAN,IAAY,mBAcX;AAdD,WAAY,mBAAmB;IAC7B,mFAA4D,CAAA;IAC5D,uEAAgD,CAAA;IAChD,+EAAwD,CAAA;IACxD,+FAAwE,CAAA;IACxE,+FAAwE,CAAA;IACxE,6EAAsD,CAAA;IACtD,qFAA8D,CAAA;IAC9D,iFAA0D,CAAA;IAC1D,2GAAoF,CAAA;IACpF,2FAAoE,CAAA;IACpE,iHAA0F,CAAA;IAC1F,iFAA0D,CAAA;IAC1D,qHAA8F,CAAA;AAChG,CAAC,EAdW,mBAAmB,KAAnB,mBAAmB,QAc9B;AAiBD,MAAM,OAAO,eAAgB,SAAQ,aAAkC;CAAG"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FastConfirmationCache, FastConfirmationContext, FastConfirmationSnapshot, IFastConfirmationStore } from "./types.
|
|
1
|
+
import { FastConfirmationCache, FastConfirmationContext, FastConfirmationSnapshot, IFastConfirmationStore } from "./types.js";
|
|
2
2
|
export declare function createFastConfirmationCache(): FastConfirmationCache;
|
|
3
3
|
export declare function buildFastConfirmationSnapshot(ctx: FastConfirmationContext, store: IFastConfirmationStore, cache: FastConfirmationCache): FastConfirmationSnapshot;
|
|
4
4
|
//# sourceMappingURL=data.d.ts.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { RootHex } from "@lodestar/types";
|
|
2
2
|
import { Logger } from "@lodestar/utils";
|
|
3
|
-
import { FastConfirmationMetrics } from "./metrics.
|
|
4
|
-
import { FastConfirmationContext, FastConfirmationResult, IFastConfirmationRule, IFastConfirmationStore } from "./types.
|
|
5
|
-
export * from "./metrics.
|
|
6
|
-
export * from "./types.
|
|
3
|
+
import { FastConfirmationMetrics } from "./metrics.js";
|
|
4
|
+
import { FastConfirmationContext, FastConfirmationResult, IFastConfirmationRule, IFastConfirmationStore } from "./types.js";
|
|
5
|
+
export * from "./metrics.js";
|
|
6
|
+
export * from "./types.js";
|
|
7
7
|
export declare class FastConfirmationRule implements IFastConfirmationRule {
|
|
8
8
|
private readonly store;
|
|
9
9
|
readonly metrics: FastConfirmationMetrics | null;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export * from "./fastConfirmationRule.
|
|
2
|
-
export * from "./metrics.
|
|
3
|
-
export * from "./types.
|
|
1
|
+
export * from "./fastConfirmationRule.js";
|
|
2
|
+
export * from "./metrics.js";
|
|
3
|
+
export * from "./types.js";
|
|
4
4
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Logger } from "@lodestar/utils";
|
|
2
|
-
import { FastConfirmationCache, FastConfirmationContext, FastConfirmationRule, FastConfirmationRunResult, FastConfirmationSnapshot, IFastConfirmationStore } from "./types.
|
|
2
|
+
import { FastConfirmationCache, FastConfirmationContext, FastConfirmationRule, FastConfirmationRunResult, FastConfirmationSnapshot, IFastConfirmationStore } from "./types.js";
|
|
3
3
|
export declare const resetIfConfirmedUnavailable: FastConfirmationRule;
|
|
4
4
|
export declare const resetIfBehindOrNotAncestorOrUnsafe: FastConfirmationRule;
|
|
5
5
|
export declare const advanceIfObservedJustified: FastConfirmationRule;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { EffectiveBalanceIncrements, IBeaconStateView } from "@lodestar/state-transition";
|
|
2
2
|
import { Epoch, RootHex, Slot, ValidatorIndex } from "@lodestar/types";
|
|
3
3
|
import { Logger } from "@lodestar/utils";
|
|
4
|
-
import { ProtoBlock } from "../../protoArray/interface.
|
|
5
|
-
import { CheckpointWithHex } from "../store.
|
|
4
|
+
import { ProtoBlock } from "../../protoArray/interface.js";
|
|
5
|
+
import { CheckpointWithHex } from "../store.js";
|
|
6
6
|
export type FastConfirmationBalanceSource = {
|
|
7
7
|
state: IBeaconStateView | null;
|
|
8
8
|
balances: EffectiveBalanceIncrements;
|
|
@@ -15,7 +15,7 @@ export type ForkChoiceStateGetter = (opts: {
|
|
|
15
15
|
stateRoot?: never;
|
|
16
16
|
checkpoint: CheckpointWithHex;
|
|
17
17
|
}) => IBeaconStateView | null;
|
|
18
|
-
type IFastConfirmationSpecStore = {
|
|
18
|
+
export type IFastConfirmationSpecStore = {
|
|
19
19
|
confirmedRoot: RootHex;
|
|
20
20
|
previousEpochObservedJustifiedCheckpoint: CheckpointWithHex;
|
|
21
21
|
currentEpochObservedJustifiedCheckpoint: CheckpointWithHex;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/forkChoice/fastConfirmation/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,0BAA0B,EAAE,gBAAgB,EAAC,MAAM,4BAA4B,CAAC;AACxF,OAAO,EAAC,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,cAAc,EAAC,MAAM,iBAAiB,CAAC;AACrE,OAAO,EAAC,MAAM,EAAC,MAAM,iBAAiB,CAAC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ValidatorIndex } from "@lodestar/types";
|
|
3
3
|
import { Logger } from "@lodestar/utils";
|
|
4
|
-
import { ProtoBlock } from "../../protoArray/interface.
|
|
5
|
-
import { CheckpointWithHex } from "../store.
|
|
6
|
-
import { type BalanceSourceKey, FastConfirmationBalanceSource, FastConfirmationCache, FastConfirmationContext, FastConfirmationSnapshot, IFastConfirmationStore } from "./types.
|
|
4
|
+
import { ProtoBlock } from "../../protoArray/interface.js";
|
|
5
|
+
import { CheckpointWithHex } from "../store.js";
|
|
6
|
+
import { type BalanceSourceKey, FastConfirmationBalanceSource, FastConfirmationCache, FastConfirmationContext, FastConfirmationSnapshot, IFastConfirmationStore } from "./types.js";
|
|
7
7
|
export declare function getBlock(ctx: FastConfirmationContext, cache: FastConfirmationCache, root: RootHex): ProtoBlock | null;
|
|
8
8
|
export declare function getUnrealizedJustification(ctx: FastConfirmationContext, cache: FastConfirmationCache, blockRoot: RootHex): CheckpointWithHex | null;
|
|
9
9
|
export declare function getVotingSource(ctx: FastConfirmationContext, cache: FastConfirmationCache, blockRoot: RootHex): CheckpointWithHex | null;
|
|
@@ -5,6 +5,7 @@ import { Logger } from "@lodestar/utils";
|
|
|
5
5
|
import { ForkChoiceMetrics } from "../metrics.js";
|
|
6
6
|
import { BlockExecutionStatus, LVHExecResponse, PayloadExecutionStatus, PayloadStatus, ProtoBlock, ProtoNode } from "../protoArray/interface.js";
|
|
7
7
|
import { ProtoArray } from "../protoArray/protoArray.js";
|
|
8
|
+
import { type IFastConfirmationSpecStore } from "./fastConfirmation/fastConfirmationRule.js";
|
|
8
9
|
import { AncestorResult, EpochDifference, IForkChoice, NotReorgedReason, ShouldOverrideForkChoiceUpdateResult } from "./interface.js";
|
|
9
10
|
import { CheckpointWithHex, IForkChoiceStore } from "./store.js";
|
|
10
11
|
export type ForkChoiceOpts = {
|
|
@@ -128,6 +129,7 @@ export declare class ForkChoice implements IForkChoice {
|
|
|
128
129
|
*/
|
|
129
130
|
getHead(): ProtoBlock;
|
|
130
131
|
getConfirmedRoot(): RootHex;
|
|
132
|
+
getFastConfirmationStore(): IFastConfirmationSpecStore;
|
|
131
133
|
getConfirmedBlock(): ProtoBlock | null;
|
|
132
134
|
resumeFastConfirmation(): void;
|
|
133
135
|
pauseFastConfirmation(): void;
|
|
@@ -204,26 +206,18 @@ export declare class ForkChoice implements IForkChoice {
|
|
|
204
206
|
* @param windowStart is the slot after which (excluding) to provide present slots
|
|
205
207
|
*/
|
|
206
208
|
getSlotsPresent(windowStart: number): number;
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
209
|
+
getCanonicalPayloadCounts(fromSlot: Slot, toSlot: Slot, head: ProtoBlock): {
|
|
210
|
+
full: number;
|
|
211
|
+
empty: number;
|
|
210
212
|
};
|
|
211
213
|
/** Very expensive function, iterates the entire ProtoArray. Called only in debug API */
|
|
212
214
|
getHeads(): ProtoBlock[];
|
|
213
|
-
/**
|
|
214
|
-
* weight is in EFFECTIVE_BALANCE_INCREMENTS not gwei.
|
|
215
|
-
* For compliance test use only
|
|
216
|
-
*/
|
|
215
|
+
/** Returns exact Gwei weights for the compliance test. */
|
|
217
216
|
getViableHeads(): {
|
|
218
217
|
root: RootHex;
|
|
219
218
|
payloadStatus: PayloadStatus;
|
|
220
|
-
weight:
|
|
219
|
+
weight: bigint;
|
|
221
220
|
}[];
|
|
222
|
-
/**
|
|
223
|
-
* The cached justified total active balance, in EFFECTIVE_BALANCE_INCREMENT units.
|
|
224
|
-
* For compliance test use only
|
|
225
|
-
*/
|
|
226
|
-
getJustifiedTotalActiveBalanceByIncrement(): number;
|
|
227
221
|
/** This is for the debug API only */
|
|
228
222
|
getAllNodes(): ProtoNode[];
|
|
229
223
|
getFinalizedCheckpoint(): CheckpointWithHex;
|
|
@@ -493,6 +487,8 @@ export declare class ForkChoice implements IForkChoice {
|
|
|
493
487
|
* May need the justified balances of:
|
|
494
488
|
* - unrealizedJustified: Already available in `CheckpointWithBalance`
|
|
495
489
|
* Since this balances are already available the getter is just `() => balances`, without cache interaction
|
|
490
|
+
*
|
|
491
|
+
* @returns Whether either checkpoint was updated.
|
|
496
492
|
*/
|
|
497
493
|
private updateCheckpoints;
|
|
498
494
|
/**
|
|
@@ -535,6 +531,8 @@ export declare class ForkChoice implements IForkChoice {
|
|
|
535
531
|
* Equivalent to:
|
|
536
532
|
*
|
|
537
533
|
* https://github.com/ethereum/consensus-specs/blob/v1.1.10/specs/phase0/fork-choice.md#on_tick
|
|
534
|
+
*
|
|
535
|
+
* @returns Whether an epoch-boundary checkpoint was updated.
|
|
538
536
|
*/
|
|
539
537
|
private onTick;
|
|
540
538
|
/**
|
|
@@ -544,11 +542,8 @@ export declare class ForkChoice implements IForkChoice {
|
|
|
544
542
|
*
|
|
545
543
|
*/
|
|
546
544
|
private getPreliminaryProposerHead;
|
|
545
|
+
/** Returns whether it recomputed the head, so the caller can avoid a redundant `updateHead()`. */
|
|
547
546
|
private runFastConfirmation;
|
|
548
547
|
private createFastConfirmationContext;
|
|
549
548
|
}
|
|
550
|
-
export declare function getCommitteeFraction(justifiedTotalActiveBalanceByIncrement: number, config: {
|
|
551
|
-
slotsPerEpoch: number;
|
|
552
|
-
committeePercent: number;
|
|
553
|
-
}): number;
|
|
554
549
|
//# sourceMappingURL=forkChoice.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"forkChoice.d.ts","sourceRoot":"","sources":["../../src/forkChoice/forkChoice.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,eAAe,EAAC,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"forkChoice.d.ts","sourceRoot":"","sources":["../../src/forkChoice/forkChoice.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,eAAe,EAAC,MAAM,kBAAkB,CAAC;AAQjD,OAAO,EACL,sBAAsB,EAEtB,gBAAgB,EAQjB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,gBAAgB,EAChB,WAAW,EAEX,kBAAkB,EAClB,IAAI,EACJ,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H,OAAO,CAAC,UAAU;IAuDlB;;;;;;OAMG;IACH,OAAO,CAAC,cAAc;IAiBtB;;;OAGG;IACH,SAAS,CAAC,aAAa,CAAC,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,GAAG,OAAO,CAI1E;IAED;;OAEG;IACH,OAAO,CAAC,iBAAiB;IAMzB,OAAO,CAAC,qBAAqB;IAM7B,OAAO,CAAC,qBAAqB;IAQ7B,OAAO,CAAC,sBAAsB;IAU9B;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,OAAO,CAAC,iBAAiB;IAwBzB;;OAEG;IACH,OAAO,CAAC,2BAA2B;IAgBnC;;;;;;;;OAQG;IACH,OAAO,CAAC,qBAAqB;IA4B7B,OAAO,CAAC,uBAAuB;IAwJ/B;;;;;;;;;;OAUG;IACH,OAAO,CAAC,gBAAgB;IA8BxB;;;OAGG;IACH,OAAO,CAAC,uBAAuB;IAsB/B;;;;;;;;;;OAUG;IACH,OAAO,CAAC,MAAM;IAgCd;;;;;OAKG;IACH,OAAO,CAAC,0BAA0B;IA8ClC,kGAAkG;IAClG,OAAO,CAAC,mBAAmB;IAyC3B,OAAO,CAAC,6BAA6B;CA+CtC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MIN_SEED_LOOKAHEAD, SLOTS_PER_EPOCH, isForkPostGloas } from "@lodestar/params";
|
|
1
|
+
import { EFFECTIVE_BALANCE_INCREMENT, MIN_SEED_LOOKAHEAD, SLOTS_PER_EPOCH, isForkPostFulu, isForkPostGloas, } from "@lodestar/params";
|
|
2
2
|
import { DataAvailabilityStatus, ZERO_HASH, computeEpochAtSlot, computeSlotsSinceEpochStart, computeStartSlotAtEpoch, getAttesterSlashableIndices, isExecutionBlockBodyType, isStatePostBellatrix, } from "@lodestar/state-transition";
|
|
3
3
|
import { isGloasBeaconBlock, ssz, } from "@lodestar/types";
|
|
4
4
|
import { MapDef, fromHex, toRootHex, withObservedDuration } from "@lodestar/utils";
|
|
@@ -9,6 +9,7 @@ import { ForkChoiceError, ForkChoiceErrorCode, InvalidAttestationCode, InvalidBl
|
|
|
9
9
|
import { FastConfirmationRule, FastConfirmationSteps, } from "./fastConfirmation/fastConfirmationRule.js";
|
|
10
10
|
import { AncestorStatus, NotReorgedReason, } from "./interface.js";
|
|
11
11
|
import { toCheckpointWithHex } from "./store.js";
|
|
12
|
+
const EFFECTIVE_BALANCE_INCREMENT_BIGINT = BigInt(EFFECTIVE_BALANCE_INCREMENT);
|
|
12
13
|
export var UpdateHeadOpt;
|
|
13
14
|
(function (UpdateHeadOpt) {
|
|
14
15
|
UpdateHeadOpt["GetCanonicalHead"] = "getCanonicalHead";
|
|
@@ -154,6 +155,16 @@ export class ForkChoice {
|
|
|
154
155
|
getConfirmedRoot() {
|
|
155
156
|
return this.fastConfirmationRule?.getConfirmedRoot() ?? this.fcStore.justified.checkpoint.rootHex;
|
|
156
157
|
}
|
|
158
|
+
getFastConfirmationStore() {
|
|
159
|
+
return {
|
|
160
|
+
confirmedRoot: this.getConfirmedRoot(),
|
|
161
|
+
previousEpochObservedJustifiedCheckpoint: this.fcStore.previousEpochObservedJustifiedCheckpoint,
|
|
162
|
+
currentEpochObservedJustifiedCheckpoint: this.fcStore.currentEpochObservedJustifiedCheckpoint,
|
|
163
|
+
previousEpochGreatestUnrealizedCheckpoint: this.fcStore.previousEpochGreatestUnrealizedCheckpoint,
|
|
164
|
+
previousSlotHead: this.fcStore.previousSlotHead,
|
|
165
|
+
currentSlotHead: this.fcStore.currentSlotHead,
|
|
166
|
+
};
|
|
167
|
+
}
|
|
157
168
|
getConfirmedBlock() {
|
|
158
169
|
return this.getBlockHexDefaultStatus(this.getConfirmedRoot());
|
|
159
170
|
}
|
|
@@ -455,27 +466,17 @@ export class ForkChoice {
|
|
|
455
466
|
getSlotsPresent(windowStart) {
|
|
456
467
|
return this.protoArray.nodes.filter((node) => node.slot > windowStart).length;
|
|
457
468
|
}
|
|
458
|
-
|
|
459
|
-
return this.protoArray.
|
|
469
|
+
getCanonicalPayloadCounts(fromSlot, toSlot, head) {
|
|
470
|
+
return this.protoArray.getCanonicalPayloadCounts(fromSlot, toSlot, head.blockRoot, head.payloadStatus);
|
|
460
471
|
}
|
|
461
472
|
/** Very expensive function, iterates the entire ProtoArray. Called only in debug API */
|
|
462
473
|
getHeads() {
|
|
463
474
|
return this.protoArray.nodes.filter((node) => node.bestChild === undefined);
|
|
464
475
|
}
|
|
465
|
-
/**
|
|
466
|
-
* weight is in EFFECTIVE_BALANCE_INCREMENTS not gwei.
|
|
467
|
-
* For compliance test use only
|
|
468
|
-
*/
|
|
476
|
+
/** Returns exact Gwei weights for the compliance test. */
|
|
469
477
|
getViableHeads() {
|
|
470
478
|
return this.protoArray.getViableHeads(this.fcStore.currentSlot);
|
|
471
479
|
}
|
|
472
|
-
/**
|
|
473
|
-
* The cached justified total active balance, in EFFECTIVE_BALANCE_INCREMENT units.
|
|
474
|
-
* For compliance test use only
|
|
475
|
-
*/
|
|
476
|
-
getJustifiedTotalActiveBalanceByIncrement() {
|
|
477
|
-
return this.fcStore.justified.totalBalance;
|
|
478
|
-
}
|
|
479
480
|
/** This is for the debug API only */
|
|
480
481
|
getAllNodes() {
|
|
481
482
|
return this.protoArray.nodes;
|
|
@@ -841,11 +842,18 @@ export class ForkChoice {
|
|
|
841
842
|
while (this.fcStore.currentSlot < currentSlot) {
|
|
842
843
|
const previousSlot = this.fcStore.currentSlot;
|
|
843
844
|
// Note: we are relying upon `onTick` to update `fcStore.time` to ensure we don't get stuck in a loop.
|
|
844
|
-
this.onTick(previousSlot + 1);
|
|
845
|
+
const didUpdateCheckpoints = this.onTick(previousSlot + 1);
|
|
845
846
|
this.queuedAttestationsPreviousSlot = 0;
|
|
846
847
|
// Process any attestations that might now be eligible before running FCR for this slot.
|
|
847
848
|
this.processAttestationQueue();
|
|
848
|
-
this.runFastConfirmation();
|
|
849
|
+
const didRecomputeHead = this.runFastConfirmation();
|
|
850
|
+
// An epoch-boundary checkpoint pull-up can move the head's dependent root and stale the cached
|
|
851
|
+
// head before block 0 of the new epoch is imported, making isProposerBoostSameDependentRoot()
|
|
852
|
+
// wrong for that block. Recompute the head so it reflects the new checkpoint and the queued
|
|
853
|
+
// votes — unless fast confirmation already did, to avoid a redundant head calculation.
|
|
854
|
+
if (didUpdateCheckpoints && !didRecomputeHead) {
|
|
855
|
+
this.updateHead();
|
|
856
|
+
}
|
|
849
857
|
this.validatedAttestationDatas = new Set();
|
|
850
858
|
}
|
|
851
859
|
}
|
|
@@ -1315,7 +1323,7 @@ export class ForkChoice {
|
|
|
1315
1323
|
// the justified state) - fall back to the head state's effective balance
|
|
1316
1324
|
balance = state.effectiveBalanceIncrements[validatorIndex];
|
|
1317
1325
|
}
|
|
1318
|
-
headWeight += balance;
|
|
1326
|
+
headWeight += BigInt(balance) * EFFECTIVE_BALANCE_INCREMENT_BIGINT;
|
|
1319
1327
|
}
|
|
1320
1328
|
}
|
|
1321
1329
|
}
|
|
@@ -1394,18 +1402,24 @@ export class ForkChoice {
|
|
|
1394
1402
|
* May need the justified balances of:
|
|
1395
1403
|
* - unrealizedJustified: Already available in `CheckpointWithBalance`
|
|
1396
1404
|
* Since this balances are already available the getter is just `() => balances`, without cache interaction
|
|
1405
|
+
*
|
|
1406
|
+
* @returns Whether either checkpoint was updated.
|
|
1397
1407
|
*/
|
|
1398
1408
|
updateCheckpoints(justifiedCheckpoint, finalizedCheckpoint, getJustifiedBalances) {
|
|
1409
|
+
let updated = false;
|
|
1399
1410
|
// Update justified checkpoint.
|
|
1400
1411
|
if (justifiedCheckpoint.epoch > this.fcStore.justified.checkpoint.epoch) {
|
|
1401
1412
|
this.fcStore.justified = { checkpoint: justifiedCheckpoint, balances: getJustifiedBalances() };
|
|
1402
1413
|
this.justifiedProposerBoostScore = null;
|
|
1414
|
+
updated = true;
|
|
1403
1415
|
}
|
|
1404
1416
|
// Update finalized checkpoint.
|
|
1405
1417
|
if (finalizedCheckpoint.epoch > this.fcStore.finalizedCheckpoint.epoch) {
|
|
1406
1418
|
this.fcStore.finalizedCheckpoint = finalizedCheckpoint;
|
|
1407
1419
|
this.justifiedProposerBoostScore = null;
|
|
1420
|
+
updated = true;
|
|
1408
1421
|
}
|
|
1422
|
+
return updated;
|
|
1409
1423
|
}
|
|
1410
1424
|
/**
|
|
1411
1425
|
* Update unrealized checkpoints in store if necessary
|
|
@@ -1649,6 +1663,8 @@ export class ForkChoice {
|
|
|
1649
1663
|
* Equivalent to:
|
|
1650
1664
|
*
|
|
1651
1665
|
* https://github.com/ethereum/consensus-specs/blob/v1.1.10/specs/phase0/fork-choice.md#on_tick
|
|
1666
|
+
*
|
|
1667
|
+
* @returns Whether an epoch-boundary checkpoint was updated.
|
|
1652
1668
|
*/
|
|
1653
1669
|
onTick(time) {
|
|
1654
1670
|
const previousSlot = this.fcStore.currentSlot;
|
|
@@ -1668,10 +1684,10 @@ export class ForkChoice {
|
|
|
1668
1684
|
}
|
|
1669
1685
|
// Not a new epoch, return.
|
|
1670
1686
|
if (computeSlotsSinceEpochStart(time) !== 0) {
|
|
1671
|
-
return;
|
|
1687
|
+
return false;
|
|
1672
1688
|
}
|
|
1673
|
-
// If a new epoch, pull-up justification and finalization from previous epoch
|
|
1674
|
-
this.updateCheckpoints(this.fcStore.unrealizedJustified.checkpoint, this.fcStore.unrealizedFinalizedCheckpoint, () => this.fcStore.unrealizedJustified.balances);
|
|
1689
|
+
// If a new epoch, pull-up justification and finalization from previous epoch.
|
|
1690
|
+
return this.updateCheckpoints(this.fcStore.unrealizedJustified.checkpoint, this.fcStore.unrealizedFinalizedCheckpoint, () => this.fcStore.unrealizedJustified.balances);
|
|
1675
1691
|
}
|
|
1676
1692
|
/**
|
|
1677
1693
|
*
|
|
@@ -1687,11 +1703,9 @@ export class ForkChoice {
|
|
|
1687
1703
|
if (!isHeadLate) {
|
|
1688
1704
|
return { prelimProposerHead, prelimNotReorgedReason: NotReorgedReason.HeadBlockIsTimely };
|
|
1689
1705
|
}
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
if (isAtEpochBoundary) {
|
|
1694
|
-
return { prelimProposerHead, prelimNotReorgedReason: NotReorgedReason.AtEpochBoundary };
|
|
1706
|
+
const isShufflingStable = isForkPostFulu(this.config.getForkName(slot)) || slot % SLOTS_PER_EPOCH !== 0;
|
|
1707
|
+
if (!isShufflingStable) {
|
|
1708
|
+
return { prelimProposerHead, prelimNotReorgedReason: NotReorgedReason.NotShufflingStable };
|
|
1695
1709
|
}
|
|
1696
1710
|
// No reorg if headBlock and parentBlock are not ffg competitive
|
|
1697
1711
|
// https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.4/specs/phase0/fork-choice.md#is_ffg_competitive
|
|
@@ -1716,11 +1730,12 @@ export class ForkChoice {
|
|
|
1716
1730
|
prelimProposerHead = parentBlock;
|
|
1717
1731
|
return { prelimProposerHead };
|
|
1718
1732
|
}
|
|
1733
|
+
/** Returns whether it recomputed the head, so the caller can avoid a redundant `updateHead()`. */
|
|
1719
1734
|
runFastConfirmation() {
|
|
1720
1735
|
const fastConfirmationRule = this.fastConfirmationRule;
|
|
1721
1736
|
const fastConfirmationContext = this.fastConfirmationContext;
|
|
1722
1737
|
if (!fastConfirmationRule || !fastConfirmationContext)
|
|
1723
|
-
return;
|
|
1738
|
+
return false;
|
|
1724
1739
|
if (this.fastConfirmationPaused) {
|
|
1725
1740
|
// Keep consumers on a safe, available root while the rule is paused
|
|
1726
1741
|
this.fcStore.confirmedRoot = this.fcStore.finalizedCheckpoint.rootHex;
|
|
@@ -1731,7 +1746,7 @@ export class ForkChoice {
|
|
|
1731
1746
|
// Runs outside the timed try/catch below; a throw would escape to the clock listener
|
|
1732
1747
|
this.logger?.debug("Fast confirmation notify failed", { slot: this.fcStore.currentSlot }, err);
|
|
1733
1748
|
}
|
|
1734
|
-
return;
|
|
1749
|
+
return false;
|
|
1735
1750
|
}
|
|
1736
1751
|
withObservedDuration(this.metrics?.fastConfirmation.totalDuration.startTimer(), () => {
|
|
1737
1752
|
try {
|
|
@@ -1746,6 +1761,7 @@ export class ForkChoice {
|
|
|
1746
1761
|
this.logger?.debug("Fast confirmation failed", { slot: this.fcStore.currentSlot, head: this.head.blockRoot, confirmedRoot: this.fcStore.confirmedRoot }, err);
|
|
1747
1762
|
}
|
|
1748
1763
|
});
|
|
1764
|
+
return true;
|
|
1749
1765
|
}
|
|
1750
1766
|
createFastConfirmationContext() {
|
|
1751
1767
|
const confirmationByzantineThreshold = this.config.CONFIRMATION_BYZANTINE_THRESHOLD;
|
|
@@ -1796,10 +1812,11 @@ export class ForkChoice {
|
|
|
1796
1812
|
};
|
|
1797
1813
|
}
|
|
1798
1814
|
}
|
|
1799
|
-
//
|
|
1815
|
+
// https://github.com/ethereum/consensus-specs/blob/v1.6.1/specs/phase0/fork-choice.md#calculate_committee_fraction
|
|
1800
1816
|
// Calculates proposer boost score when committeePercent = config.PROPOSER_SCORE_BOOST
|
|
1801
|
-
|
|
1802
|
-
const
|
|
1803
|
-
|
|
1817
|
+
function getCommitteeFraction(justifiedTotalActiveBalanceByIncrement, config) {
|
|
1818
|
+
const committeeWeightGwei = (BigInt(justifiedTotalActiveBalanceByIncrement) * EFFECTIVE_BALANCE_INCREMENT_BIGINT) /
|
|
1819
|
+
BigInt(config.slotsPerEpoch);
|
|
1820
|
+
return (committeeWeightGwei * BigInt(config.committeePercent)) / 100n;
|
|
1804
1821
|
}
|
|
1805
1822
|
//# sourceMappingURL=forkChoice.js.map
|