@lodestar/state-transition 1.43.0-dev.e341cdc614 → 1.43.0-dev.e3c96e7a79
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/block/index.d.ts +2 -2
- package/lib/block/index.d.ts.map +1 -1
- package/lib/block/index.js +11 -4
- package/lib/block/index.js.map +1 -1
- package/lib/block/processConsolidationRequest.d.ts.map +1 -1
- package/lib/block/processConsolidationRequest.js +2 -1
- package/lib/block/processConsolidationRequest.js.map +1 -1
- package/lib/block/processParentExecutionPayload.d.ts +20 -0
- package/lib/block/processParentExecutionPayload.d.ts.map +1 -0
- package/lib/block/processParentExecutionPayload.js +100 -0
- package/lib/block/processParentExecutionPayload.js.map +1 -0
- package/lib/block/processWithdrawals.d.ts.map +1 -1
- package/lib/block/processWithdrawals.js +10 -4
- package/lib/block/processWithdrawals.js.map +1 -1
- package/lib/cache/epochCache.d.ts +3 -1
- package/lib/cache/epochCache.d.ts.map +1 -1
- package/lib/cache/epochCache.js +33 -15
- package/lib/cache/epochCache.js.map +1 -1
- package/lib/cache/epochTransitionCache.d.ts +5 -0
- package/lib/cache/epochTransitionCache.d.ts.map +1 -1
- package/lib/cache/epochTransitionCache.js +1 -0
- package/lib/cache/epochTransitionCache.js.map +1 -1
- package/lib/epoch/index.d.ts +3 -1
- package/lib/epoch/index.d.ts.map +1 -1
- package/lib/epoch/index.js +8 -1
- package/lib/epoch/index.js.map +1 -1
- package/lib/epoch/processPendingDeposits.d.ts.map +1 -1
- package/lib/epoch/processPendingDeposits.js +4 -2
- package/lib/epoch/processPendingDeposits.js.map +1 -1
- package/lib/epoch/processPtcWindow.d.ts +11 -0
- package/lib/epoch/processPtcWindow.d.ts.map +1 -0
- package/lib/epoch/processPtcWindow.js +28 -0
- package/lib/epoch/processPtcWindow.js.map +1 -0
- package/lib/signatureSets/executionPayloadEnvelope.js +1 -1
- package/lib/signatureSets/executionPayloadEnvelope.js.map +1 -1
- package/lib/signatureSets/index.d.ts +1 -0
- package/lib/signatureSets/index.d.ts.map +1 -1
- package/lib/signatureSets/index.js +1 -0
- package/lib/signatureSets/index.js.map +1 -1
- package/lib/signatureSets/proposerPreferences.d.ts +4 -0
- package/lib/signatureSets/proposerPreferences.d.ts.map +1 -0
- package/lib/signatureSets/proposerPreferences.js +8 -0
- package/lib/signatureSets/proposerPreferences.js.map +1 -0
- package/lib/slot/upgradeStateToElectra.d.ts.map +1 -1
- package/lib/slot/upgradeStateToElectra.js +2 -2
- package/lib/slot/upgradeStateToElectra.js.map +1 -1
- package/lib/slot/upgradeStateToGloas.d.ts.map +1 -1
- package/lib/slot/upgradeStateToGloas.js +3 -1
- package/lib/slot/upgradeStateToGloas.js.map +1 -1
- package/lib/stateTransition.js +1 -1
- package/lib/stateTransition.js.map +1 -1
- package/lib/stateView/beaconStateView.d.ts +13 -11
- package/lib/stateView/beaconStateView.d.ts.map +1 -1
- package/lib/stateView/beaconStateView.js +48 -35
- package/lib/stateView/beaconStateView.js.map +1 -1
- package/lib/stateView/interface.d.ts +21 -11
- package/lib/stateView/interface.d.ts.map +1 -1
- package/lib/stateView/interface.js.map +1 -1
- package/lib/util/computeAnchorCheckpoint.d.ts +1 -1
- package/lib/util/computeAnchorCheckpoint.d.ts.map +1 -1
- package/lib/util/computeAnchorCheckpoint.js +6 -19
- package/lib/util/computeAnchorCheckpoint.js.map +1 -1
- package/lib/util/epoch.d.ts.map +1 -1
- package/lib/util/epoch.js +6 -4
- package/lib/util/epoch.js.map +1 -1
- package/lib/util/gloas.d.ts +7 -3
- package/lib/util/gloas.d.ts.map +1 -1
- package/lib/util/gloas.js +25 -3
- package/lib/util/gloas.js.map +1 -1
- package/lib/util/loadState/loadState.js +4 -4
- package/lib/util/loadState/loadState.js.map +1 -1
- package/lib/util/validator.d.ts +14 -2
- package/lib/util/validator.d.ts.map +1 -1
- package/lib/util/validator.js +24 -2
- package/lib/util/validator.js.map +1 -1
- package/package.json +8 -8
- package/src/block/index.ts +12 -4
- package/src/block/processConsolidationRequest.ts +2 -1
- package/src/block/processParentExecutionPayload.ts +116 -0
- package/src/block/processWithdrawals.ts +12 -4
- package/src/cache/epochCache.ts +35 -33
- package/src/cache/epochTransitionCache.ts +7 -0
- package/src/epoch/index.ts +9 -0
- package/src/epoch/processPendingDeposits.ts +5 -2
- package/src/epoch/processPtcWindow.ts +38 -0
- package/src/signatureSets/executionPayloadEnvelope.ts +1 -1
- package/src/signatureSets/index.ts +1 -0
- package/src/signatureSets/proposerPreferences.ts +12 -0
- package/src/slot/upgradeStateToElectra.ts +4 -2
- package/src/slot/upgradeStateToGloas.ts +5 -1
- package/src/stateTransition.ts +1 -1
- package/src/stateView/beaconStateView.ts +57 -48
- package/src/stateView/interface.ts +28 -14
- package/src/util/computeAnchorCheckpoint.ts +6 -19
- package/src/util/epoch.ts +13 -4
- package/src/util/gloas.ts +46 -4
- package/src/util/loadState/loadState.ts +4 -4
- package/src/util/validator.ts +42 -2
- package/lib/block/processExecutionPayloadEnvelope.d.ts +0 -9
- package/lib/block/processExecutionPayloadEnvelope.d.ts.map +0 -1
- package/lib/block/processExecutionPayloadEnvelope.js +0 -106
- package/lib/block/processExecutionPayloadEnvelope.js.map +0 -1
- package/src/block/processExecutionPayloadEnvelope.ts +0 -175
package/src/cache/epochCache.ts
CHANGED
|
@@ -32,15 +32,15 @@ import {
|
|
|
32
32
|
calculateShufflingDecisionRoot,
|
|
33
33
|
computeEpochShuffling,
|
|
34
34
|
} from "../util/epochShuffling.js";
|
|
35
|
+
import {getPtcWindowEpochCacheData} from "../util/gloas.js";
|
|
35
36
|
import {
|
|
36
37
|
computeActivationExitEpoch,
|
|
37
38
|
computeEpochAtSlot,
|
|
38
|
-
computePayloadTimelinessCommitteesForEpoch,
|
|
39
39
|
computeProposers,
|
|
40
40
|
computeSyncPeriodAtEpoch,
|
|
41
|
-
getActivationChurnLimit,
|
|
42
41
|
getChurnLimit,
|
|
43
42
|
getSeed,
|
|
43
|
+
getValidatorActivationChurnLimit,
|
|
44
44
|
isActiveValidator,
|
|
45
45
|
isAggregatorFromCommitteeLength,
|
|
46
46
|
} from "../util/index.js";
|
|
@@ -56,7 +56,7 @@ import {sumTargetUnslashedBalanceIncrements} from "../util/targetUnslashedBalanc
|
|
|
56
56
|
import {EffectiveBalanceIncrements, getEffectiveBalanceIncrementsWithLen} from "./effectiveBalanceIncrements.js";
|
|
57
57
|
import {EpochTransitionCache} from "./epochTransitionCache.js";
|
|
58
58
|
import {PubkeyCache, createPubkeyCache, syncPubkeys} from "./pubkeyCache.js";
|
|
59
|
-
import {CachedBeaconStateAllForks, CachedBeaconStateFulu} from "./stateCache.js";
|
|
59
|
+
import {CachedBeaconStateAllForks, CachedBeaconStateFulu, CachedBeaconStateGloas} from "./stateCache.js";
|
|
60
60
|
import {
|
|
61
61
|
SyncCommitteeCache,
|
|
62
62
|
SyncCommitteeCacheEmpty,
|
|
@@ -226,11 +226,12 @@ export class EpochCache {
|
|
|
226
226
|
/** TODO: Indexed SyncCommitteeCache */
|
|
227
227
|
nextSyncCommitteeIndexed: SyncCommitteeCache;
|
|
228
228
|
|
|
229
|
-
// TODO GLOAS: See if we need to cache PTC for next epoch
|
|
230
229
|
// PTC for previous epoch, required for slot N block validating slot N-1 attestations
|
|
231
230
|
previousPayloadTimelinessCommittees: Uint32Array[];
|
|
232
231
|
// PTC for current epoch, computed eagerly at epoch transition
|
|
233
232
|
payloadTimelinessCommittees: Uint32Array[];
|
|
233
|
+
// PTC for next epoch, precomputed from the ptc window for future duty serving
|
|
234
|
+
nextPayloadTimelinessCommittees: Uint32Array[];
|
|
234
235
|
|
|
235
236
|
// TODO: Helper stats
|
|
236
237
|
syncPeriod: SyncPeriod;
|
|
@@ -270,6 +271,7 @@ export class EpochCache {
|
|
|
270
271
|
nextSyncCommitteeIndexed: SyncCommitteeCache;
|
|
271
272
|
previousPayloadTimelinessCommittees: Uint32Array[];
|
|
272
273
|
payloadTimelinessCommittees: Uint32Array[];
|
|
274
|
+
nextPayloadTimelinessCommittees: Uint32Array[];
|
|
273
275
|
epoch: Epoch;
|
|
274
276
|
syncPeriod: SyncPeriod;
|
|
275
277
|
}) {
|
|
@@ -301,6 +303,7 @@ export class EpochCache {
|
|
|
301
303
|
this.nextSyncCommitteeIndexed = data.nextSyncCommitteeIndexed;
|
|
302
304
|
this.previousPayloadTimelinessCommittees = data.previousPayloadTimelinessCommittees;
|
|
303
305
|
this.payloadTimelinessCommittees = data.payloadTimelinessCommittees;
|
|
306
|
+
this.nextPayloadTimelinessCommittees = data.nextPayloadTimelinessCommittees;
|
|
304
307
|
this.epoch = data.epoch;
|
|
305
308
|
this.syncPeriod = data.syncPeriod;
|
|
306
309
|
}
|
|
@@ -451,25 +454,13 @@ export class EpochCache {
|
|
|
451
454
|
nextSyncCommitteeIndexed = new SyncCommitteeCacheEmpty();
|
|
452
455
|
}
|
|
453
456
|
|
|
454
|
-
//
|
|
457
|
+
// Copy previous/current epoch PTC slices from state.ptcWindow once, then serve hot-path lookups from epochCtx.
|
|
455
458
|
let previousPayloadTimelinessCommittees: Uint32Array[] = [];
|
|
456
459
|
let payloadTimelinessCommittees: Uint32Array[] = [];
|
|
460
|
+
let nextPayloadTimelinessCommittees: Uint32Array[] = [];
|
|
457
461
|
if (currentEpoch >= config.GLOAS_FORK_EPOCH) {
|
|
458
|
-
payloadTimelinessCommittees =
|
|
459
|
-
state
|
|
460
|
-
currentEpoch,
|
|
461
|
-
currentShuffling.committees,
|
|
462
|
-
effectiveBalanceIncrements
|
|
463
|
-
);
|
|
464
|
-
|
|
465
|
-
if (!isGenesis && previousEpoch >= config.GLOAS_FORK_EPOCH) {
|
|
466
|
-
previousPayloadTimelinessCommittees = computePayloadTimelinessCommitteesForEpoch(
|
|
467
|
-
state,
|
|
468
|
-
previousEpoch,
|
|
469
|
-
previousShuffling.committees,
|
|
470
|
-
effectiveBalanceIncrements
|
|
471
|
-
);
|
|
472
|
-
}
|
|
462
|
+
({previousPayloadTimelinessCommittees, payloadTimelinessCommittees, nextPayloadTimelinessCommittees} =
|
|
463
|
+
getPtcWindowEpochCacheData(state as CachedBeaconStateGloas));
|
|
473
464
|
}
|
|
474
465
|
|
|
475
466
|
// Precompute churnLimit for efficient initiateValidatorExit() during block proposing MUST be recompute everytime the
|
|
@@ -487,7 +478,7 @@ export class EpochCache {
|
|
|
487
478
|
// the first block of the epoch process_block() call. So churnLimit must be computed at the end of the before epoch
|
|
488
479
|
// transition and the result is valid until the end of the next epoch transition
|
|
489
480
|
const churnLimit = getChurnLimit(config, currentShuffling.activeIndices.length);
|
|
490
|
-
const activationChurnLimit =
|
|
481
|
+
const activationChurnLimit = getValidatorActivationChurnLimit(
|
|
491
482
|
config,
|
|
492
483
|
config.getForkSeq(state.slot),
|
|
493
484
|
currentShuffling.activeIndices.length
|
|
@@ -546,6 +537,7 @@ export class EpochCache {
|
|
|
546
537
|
nextSyncCommitteeIndexed,
|
|
547
538
|
previousPayloadTimelinessCommittees,
|
|
548
539
|
payloadTimelinessCommittees,
|
|
540
|
+
nextPayloadTimelinessCommittees,
|
|
549
541
|
epoch: currentEpoch,
|
|
550
542
|
syncPeriod: computeSyncPeriodAtEpoch(currentEpoch),
|
|
551
543
|
});
|
|
@@ -592,6 +584,7 @@ export class EpochCache {
|
|
|
592
584
|
nextSyncCommitteeIndexed: this.nextSyncCommitteeIndexed,
|
|
593
585
|
previousPayloadTimelinessCommittees: this.previousPayloadTimelinessCommittees,
|
|
594
586
|
payloadTimelinessCommittees: this.payloadTimelinessCommittees,
|
|
587
|
+
nextPayloadTimelinessCommittees: this.nextPayloadTimelinessCommittees,
|
|
595
588
|
epoch: this.epoch,
|
|
596
589
|
syncPeriod: this.syncPeriod,
|
|
597
590
|
});
|
|
@@ -659,7 +652,7 @@ export class EpochCache {
|
|
|
659
652
|
// the first block of the epoch process_block() call. So churnLimit must be computed at the end of the before epoch
|
|
660
653
|
// transition and the result is valid until the end of the next epoch transition
|
|
661
654
|
this.churnLimit = getChurnLimit(this.config, this.currentShuffling.activeIndices.length);
|
|
662
|
-
this.activationChurnLimit =
|
|
655
|
+
this.activationChurnLimit = getValidatorActivationChurnLimit(
|
|
663
656
|
this.config,
|
|
664
657
|
this.config.getForkSeq(state.slot),
|
|
665
658
|
this.currentShuffling.activeIndices.length
|
|
@@ -695,21 +688,26 @@ export class EpochCache {
|
|
|
695
688
|
/**
|
|
696
689
|
* At fork boundary, this runs post-fork logic and it happens after `upgradeState*` is called.
|
|
697
690
|
*/
|
|
698
|
-
finalProcessEpoch(state: CachedBeaconStateAllForks): void {
|
|
691
|
+
finalProcessEpoch(state: CachedBeaconStateAllForks, epochTransitionCache: EpochTransitionCache): void {
|
|
699
692
|
// this.epoch was updated at the end of afterProcessEpoch()
|
|
700
693
|
const upcomingEpoch = this.epoch;
|
|
701
694
|
const epochAfterUpcoming = upcomingEpoch + 1;
|
|
702
695
|
|
|
703
696
|
this.proposersPrevEpoch = this.proposers;
|
|
704
697
|
if (upcomingEpoch >= this.config.GLOAS_FORK_EPOCH) {
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
698
|
+
if (epochTransitionCache.nextEpochPayloadTimelinessCommittees) {
|
|
699
|
+
// shift arrays from transition cache
|
|
700
|
+
this.previousPayloadTimelinessCommittees = this.payloadTimelinessCommittees;
|
|
701
|
+
this.payloadTimelinessCommittees = this.nextPayloadTimelinessCommittees;
|
|
702
|
+
this.nextPayloadTimelinessCommittees = epochTransitionCache.nextEpochPayloadTimelinessCommittees;
|
|
703
|
+
} else {
|
|
704
|
+
// Fork boundary: processPtcWindow didn't run, read from freshly initialized state.ptcWindow
|
|
705
|
+
({
|
|
706
|
+
previousPayloadTimelinessCommittees: this.previousPayloadTimelinessCommittees,
|
|
707
|
+
payloadTimelinessCommittees: this.payloadTimelinessCommittees,
|
|
708
|
+
nextPayloadTimelinessCommittees: this.nextPayloadTimelinessCommittees,
|
|
709
|
+
} = getPtcWindowEpochCacheData(state as CachedBeaconStateGloas));
|
|
710
|
+
}
|
|
713
711
|
}
|
|
714
712
|
if (upcomingEpoch >= this.config.FULU_FORK_EPOCH) {
|
|
715
713
|
// Populate proposer cache with lookahead from state
|
|
@@ -1034,12 +1032,16 @@ export class EpochCache {
|
|
|
1034
1032
|
throw new Error("Payload Timeliness Committee is not available before gloas fork");
|
|
1035
1033
|
}
|
|
1036
1034
|
|
|
1035
|
+
if (epoch === this.epoch - 1) {
|
|
1036
|
+
return this.previousPayloadTimelinessCommittees[slot % SLOTS_PER_EPOCH];
|
|
1037
|
+
}
|
|
1038
|
+
|
|
1037
1039
|
if (epoch === this.epoch) {
|
|
1038
1040
|
return this.payloadTimelinessCommittees[slot % SLOTS_PER_EPOCH];
|
|
1039
1041
|
}
|
|
1040
1042
|
|
|
1041
|
-
if (epoch === this.epoch
|
|
1042
|
-
return this.
|
|
1043
|
+
if (epoch === this.epoch + 1) {
|
|
1044
|
+
return this.nextPayloadTimelinessCommittees[slot % SLOTS_PER_EPOCH];
|
|
1043
1045
|
}
|
|
1044
1046
|
|
|
1045
1047
|
throw new Error(`Payload Timeliness Committee is not available for slot=${slot}`);
|
|
@@ -158,6 +158,12 @@ export interface EpochTransitionCache {
|
|
|
158
158
|
*/
|
|
159
159
|
nextShuffling: EpochShuffling | null;
|
|
160
160
|
|
|
161
|
+
/**
|
|
162
|
+
* Pre-computed PTC for epoch N + MIN_SEED_LOOKAHEAD + 1, populated by processPtcWindow (Gloas+).
|
|
163
|
+
* Used by finalProcessEpoch to shift PTC arrays in epoch cache without reading from state.
|
|
164
|
+
*/
|
|
165
|
+
nextEpochPayloadTimelinessCommittees: Uint32Array[] | null;
|
|
166
|
+
|
|
161
167
|
/**
|
|
162
168
|
* Altair specific, this is total active balances for the next epoch.
|
|
163
169
|
* This is only used in `afterProcessEpoch` to compute base reward and sync participant reward.
|
|
@@ -502,6 +508,7 @@ export function beforeProcessEpoch(
|
|
|
502
508
|
indicesToEject,
|
|
503
509
|
nextShufflingActiveIndices,
|
|
504
510
|
nextShuffling: null,
|
|
511
|
+
nextEpochPayloadTimelinessCommittees: null,
|
|
505
512
|
// to be updated in processEffectiveBalanceUpdates
|
|
506
513
|
nextEpochTotalActiveBalanceByIncrement: 0,
|
|
507
514
|
isActivePrevEpoch,
|
package/src/epoch/index.ts
CHANGED
|
@@ -28,6 +28,7 @@ import {processParticipationRecordUpdates} from "./processParticipationRecordUpd
|
|
|
28
28
|
import {processPendingConsolidations} from "./processPendingConsolidations.js";
|
|
29
29
|
import {processPendingDeposits} from "./processPendingDeposits.js";
|
|
30
30
|
import {processProposerLookahead} from "./processProposerLookahead.js";
|
|
31
|
+
import {processPtcWindow} from "./processPtcWindow.js";
|
|
31
32
|
import {processRandaoMixesReset} from "./processRandaoMixesReset.js";
|
|
32
33
|
import {processRegistryUpdates} from "./processRegistryUpdates.js";
|
|
33
34
|
import {processRewardsAndPenalties} from "./processRewardsAndPenalties.js";
|
|
@@ -55,6 +56,7 @@ export {
|
|
|
55
56
|
processPendingDeposits,
|
|
56
57
|
processPendingConsolidations,
|
|
57
58
|
processProposerLookahead,
|
|
59
|
+
processPtcWindow,
|
|
58
60
|
processBuilderPendingPayments,
|
|
59
61
|
};
|
|
60
62
|
|
|
@@ -81,6 +83,7 @@ export enum EpochTransitionStep {
|
|
|
81
83
|
processPendingDeposits = "processPendingDeposits",
|
|
82
84
|
processPendingConsolidations = "processPendingConsolidations",
|
|
83
85
|
processProposerLookahead = "processProposerLookahead",
|
|
86
|
+
processPtcWindow = "processPtcWindow",
|
|
84
87
|
processBuilderPendingPayments = "processBuilderPendingPayments",
|
|
85
88
|
}
|
|
86
89
|
|
|
@@ -211,4 +214,10 @@ export function processEpoch(
|
|
|
211
214
|
processProposerLookahead(fork, state as CachedBeaconStateFulu, cache);
|
|
212
215
|
timer?.();
|
|
213
216
|
}
|
|
217
|
+
|
|
218
|
+
if (fork >= ForkSeq.gloas) {
|
|
219
|
+
const timer = metrics?.epochTransitionStepTime.startTimer({step: EpochTransitionStep.processPtcWindow});
|
|
220
|
+
processPtcWindow(state as CachedBeaconStateGloas, cache);
|
|
221
|
+
timer?.();
|
|
222
|
+
}
|
|
214
223
|
}
|
|
@@ -5,7 +5,7 @@ import {CachedBeaconStateElectra, EpochTransitionCache} from "../types.js";
|
|
|
5
5
|
import {increaseBalance} from "../util/balance.js";
|
|
6
6
|
import {hasCompoundingWithdrawalCredential, isValidatorKnown} from "../util/electra.js";
|
|
7
7
|
import {computeStartSlotAtEpoch} from "../util/epoch.js";
|
|
8
|
-
import {getActivationExitChurnLimit} from "../util/validator.js";
|
|
8
|
+
import {getActivationChurnLimit, getActivationExitChurnLimit} from "../util/validator.js";
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* Starting from Electra:
|
|
@@ -17,8 +17,11 @@ import {getActivationExitChurnLimit} from "../util/validator.js";
|
|
|
17
17
|
* TODO Electra: Update ssz library to support batch push to `pendingDeposits`
|
|
18
18
|
*/
|
|
19
19
|
export function processPendingDeposits(state: CachedBeaconStateElectra, cache: EpochTransitionCache): void {
|
|
20
|
+
const fork = state.config.getForkSeq(state.slot);
|
|
20
21
|
const nextEpoch = state.epochCtx.epoch + 1;
|
|
21
|
-
const
|
|
22
|
+
const churnLimit =
|
|
23
|
+
fork >= ForkSeq.gloas ? getActivationChurnLimit(state.epochCtx) : getActivationExitChurnLimit(state.epochCtx);
|
|
24
|
+
const availableForProcessing = state.depositBalanceToConsume + BigInt(churnLimit);
|
|
22
25
|
let processedAmount = 0;
|
|
23
26
|
let nextDepositIndex = 0;
|
|
24
27
|
const depositsToPostpone = [];
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import {MIN_SEED_LOOKAHEAD} from "@lodestar/params";
|
|
2
|
+
import {ssz} from "@lodestar/types";
|
|
3
|
+
import {CachedBeaconStateGloas, EpochTransitionCache} from "../types.js";
|
|
4
|
+
import {computeEpochShuffling} from "../util/epochShuffling.js";
|
|
5
|
+
import {computePayloadTimelinessCommitteesForEpoch} from "../util/seed.js";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Update the `ptc_window` field in the beacon state by shifting out the oldest epoch's
|
|
9
|
+
* PTC entries and appending newly computed entries for the next lookahead epoch.
|
|
10
|
+
* Stashes the computed PTCs in the transition cache for finalProcessEpoch to shift
|
|
11
|
+
* into the epoch cache without reading from state.
|
|
12
|
+
*
|
|
13
|
+
* Spec: https://github.com/ethereum/consensus-specs/blob/v1.7.0-alpha.4/specs/gloas/beacon-chain.md#new-process_ptc_window
|
|
14
|
+
*/
|
|
15
|
+
export function processPtcWindow(state: CachedBeaconStateGloas, cache: EpochTransitionCache): void {
|
|
16
|
+
const nextEpoch = state.epochCtx.epoch + MIN_SEED_LOOKAHEAD + 1;
|
|
17
|
+
const nextEpochShuffling =
|
|
18
|
+
cache.nextShuffling ?? computeEpochShuffling(state, cache.nextShufflingActiveIndices, nextEpoch);
|
|
19
|
+
cache.nextShuffling = nextEpochShuffling;
|
|
20
|
+
|
|
21
|
+
const newNextPayloadTimelinessCommittees = computePayloadTimelinessCommitteesForEpoch(
|
|
22
|
+
state,
|
|
23
|
+
nextEpoch,
|
|
24
|
+
nextEpochShuffling.committees,
|
|
25
|
+
state.epochCtx.effectiveBalanceIncrements
|
|
26
|
+
);
|
|
27
|
+
|
|
28
|
+
// Stash for finalProcessEpoch to shift into epoch cache
|
|
29
|
+
cache.nextEpochPayloadTimelinessCommittees = newNextPayloadTimelinessCommittees;
|
|
30
|
+
|
|
31
|
+
// Write shifted window to state: current(N) + next(N+1) + newlyComputed(N+2)
|
|
32
|
+
// From the perspective of upcoming epoch N+1, this is previous + current + next
|
|
33
|
+
state.ptcWindow = ssz.gloas.PtcWindow.toViewDU([
|
|
34
|
+
...state.epochCtx.payloadTimelinessCommittees,
|
|
35
|
+
...state.epochCtx.nextPayloadTimelinessCommittees,
|
|
36
|
+
...newNextPayloadTimelinessCommittees,
|
|
37
|
+
]);
|
|
38
|
+
}
|
|
@@ -11,7 +11,7 @@ export function getExecutionPayloadEnvelopeSigningRoot(
|
|
|
11
11
|
config: BeaconConfig,
|
|
12
12
|
envelope: gloas.ExecutionPayloadEnvelope
|
|
13
13
|
): Uint8Array {
|
|
14
|
-
const domain = config.getDomain(envelope.
|
|
14
|
+
const domain = config.getDomain(envelope.payload.slotNumber, DOMAIN_BEACON_BUILDER);
|
|
15
15
|
|
|
16
16
|
return computeSigningRoot(ssz.gloas.ExecutionPayloadEnvelope, envelope, domain);
|
|
17
17
|
}
|
|
@@ -20,6 +20,7 @@ export * from "./executionPayloadEnvelope.js";
|
|
|
20
20
|
export * from "./indexedAttestation.js";
|
|
21
21
|
export * from "./indexedPayloadAttestation.js";
|
|
22
22
|
export * from "./proposer.js";
|
|
23
|
+
export * from "./proposerPreferences.js";
|
|
23
24
|
export * from "./proposerSlashings.js";
|
|
24
25
|
export * from "./randao.js";
|
|
25
26
|
export * from "./voluntaryExits.js";
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import {BeaconConfig} from "@lodestar/config";
|
|
2
|
+
import {DOMAIN_PROPOSER_PREFERENCES} from "@lodestar/params";
|
|
3
|
+
import {gloas, ssz} from "@lodestar/types";
|
|
4
|
+
import {computeSigningRoot} from "../util/index.js";
|
|
5
|
+
|
|
6
|
+
export function getProposerPreferencesSigningRoot(
|
|
7
|
+
config: BeaconConfig,
|
|
8
|
+
preferences: gloas.ProposerPreferences
|
|
9
|
+
): Uint8Array {
|
|
10
|
+
const domain = config.getDomain(preferences.proposalSlot, DOMAIN_PROPOSER_PREFERENCES);
|
|
11
|
+
return computeSigningRoot(ssz.gloas.ProposerPreferences, preferences, domain);
|
|
12
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {FAR_FUTURE_EPOCH, GENESIS_SLOT, UNSET_DEPOSIT_REQUESTS_START_INDEX} from "@lodestar/params";
|
|
1
|
+
import {FAR_FUTURE_EPOCH, ForkSeq, GENESIS_SLOT, UNSET_DEPOSIT_REQUESTS_START_INDEX} from "@lodestar/params";
|
|
2
2
|
import {ValidatorIndex, ssz} from "@lodestar/types";
|
|
3
3
|
import {CachedBeaconStateElectra, getCachedBeaconState} from "../cache/stateCache.js";
|
|
4
4
|
import {G2_POINT_AT_INFINITY} from "../constants/constants.js";
|
|
@@ -78,7 +78,9 @@ export function upgradeStateToElectra(stateDeneb: CachedBeaconStateDeneb): Cache
|
|
|
78
78
|
stateElectraView.commit();
|
|
79
79
|
const tmpElectraState = getCachedBeaconState(stateElectraView, stateDeneb);
|
|
80
80
|
stateElectraView.exitBalanceToConsume = BigInt(getActivationExitChurnLimit(tmpElectraState.epochCtx));
|
|
81
|
-
stateElectraView.consolidationBalanceToConsume = BigInt(
|
|
81
|
+
stateElectraView.consolidationBalanceToConsume = BigInt(
|
|
82
|
+
getConsolidationChurnLimit(ForkSeq.electra, tmpElectraState.epochCtx)
|
|
83
|
+
);
|
|
82
84
|
|
|
83
85
|
preActivation.sort((i0, i1) => {
|
|
84
86
|
const res = validatorsArr[i0].activationEligibilityEpoch - validatorsArr[i1].activationEligibilityEpoch;
|
|
@@ -5,7 +5,7 @@ import {isValidDepositSignature} from "../block/processDeposit.js";
|
|
|
5
5
|
import {applyDepositForBuilder} from "../block/processDepositRequest.js";
|
|
6
6
|
import {getCachedBeaconState} from "../cache/stateCache.js";
|
|
7
7
|
import {CachedBeaconStateFulu, CachedBeaconStateGloas} from "../types.js";
|
|
8
|
-
import {isBuilderWithdrawalCredential} from "../util/gloas.js";
|
|
8
|
+
import {initializePtcWindow, isBuilderWithdrawalCredential} from "../util/gloas.js";
|
|
9
9
|
import {isValidatorKnown} from "../util/index.js";
|
|
10
10
|
|
|
11
11
|
/**
|
|
@@ -48,6 +48,9 @@ export function upgradeStateToGloas(stateFulu: CachedBeaconStateFulu): CachedBea
|
|
|
48
48
|
stateGloasView.currentSyncCommittee = stateGloasCloned.currentSyncCommittee;
|
|
49
49
|
stateGloasView.nextSyncCommittee = stateGloasCloned.nextSyncCommittee;
|
|
50
50
|
stateGloasView.latestExecutionPayloadBid.blockHash = stateFulu.latestExecutionPayloadHeader.blockHash;
|
|
51
|
+
stateGloasView.latestExecutionPayloadBid.executionRequestsRoot = ssz.electra.ExecutionRequests.hashTreeRoot(
|
|
52
|
+
ssz.electra.ExecutionRequests.defaultValue()
|
|
53
|
+
);
|
|
51
54
|
stateGloasView.nextWithdrawalIndex = stateGloasCloned.nextWithdrawalIndex;
|
|
52
55
|
stateGloasView.nextWithdrawalValidatorIndex = stateGloasCloned.nextWithdrawalValidatorIndex;
|
|
53
56
|
stateGloasView.historicalSummaries = stateGloasCloned.historicalSummaries;
|
|
@@ -61,6 +64,7 @@ export function upgradeStateToGloas(stateFulu: CachedBeaconStateFulu): CachedBea
|
|
|
61
64
|
stateGloasView.pendingPartialWithdrawals = stateGloasCloned.pendingPartialWithdrawals;
|
|
62
65
|
stateGloasView.pendingConsolidations = stateGloasCloned.pendingConsolidations;
|
|
63
66
|
stateGloasView.proposerLookahead = stateGloasCloned.proposerLookahead;
|
|
67
|
+
stateGloasView.ptcWindow = ssz.gloas.PtcWindow.toViewDU(initializePtcWindow(stateFulu));
|
|
64
68
|
|
|
65
69
|
for (let i = 0; i < SLOTS_PER_HISTORICAL_ROOT; i++) {
|
|
66
70
|
stateGloasView.executionPayloadAvailability.set(i, true);
|
package/src/stateTransition.ts
CHANGED
|
@@ -282,7 +282,7 @@ function processSlotsWithTransientCache(
|
|
|
282
282
|
{
|
|
283
283
|
const timer = metrics?.epochTransitionStepTime.startTimer({step: EpochTransitionStep.finalProcessEpoch});
|
|
284
284
|
// last step to prepare epoch data that depends on the upgraded state, for example proposerLookahead of BeaconStateFulu
|
|
285
|
-
postState.epochCtx.finalProcessEpoch(postState);
|
|
285
|
+
postState.epochCtx.finalProcessEpoch(postState, epochTransitionCache);
|
|
286
286
|
timer?.();
|
|
287
287
|
}
|
|
288
288
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {CompactMultiProof, ProofType, Tree, createProof} from "@chainsafe/persistent-merkle-tree";
|
|
2
2
|
import {BitArray, ByteViews} from "@chainsafe/ssz";
|
|
3
3
|
import {BeaconConfig} from "@lodestar/config";
|
|
4
|
-
import {ForkName, ForkSeq, SLOTS_PER_HISTORICAL_ROOT
|
|
4
|
+
import {ForkName, ForkSeq, SLOTS_PER_HISTORICAL_ROOT} from "@lodestar/params";
|
|
5
5
|
import {
|
|
6
6
|
BeaconBlock,
|
|
7
7
|
BeaconState,
|
|
@@ -28,8 +28,7 @@ import {
|
|
|
28
28
|
rewards,
|
|
29
29
|
} from "@lodestar/types";
|
|
30
30
|
import {Checkpoint, Fork} from "@lodestar/types/phase0";
|
|
31
|
-
import {
|
|
32
|
-
import {ProcessExecutionPayloadEnvelopeOpts} from "../block/processExecutionPayloadEnvelope.js";
|
|
31
|
+
import {applyParentExecutionPayload} from "../block/processParentExecutionPayload.js";
|
|
33
32
|
import {VoluntaryExitValidity, getVoluntaryExitValidity} from "../block/processVoluntaryExit.js";
|
|
34
33
|
import {getExpectedWithdrawals} from "../block/processWithdrawals.js";
|
|
35
34
|
import {EffectiveBalanceIncrements} from "../cache/effectiveBalanceIncrements.js";
|
|
@@ -69,7 +68,7 @@ import {canBuilderCoverBid} from "../util/gloas.js";
|
|
|
69
68
|
import {loadState} from "../util/loadState/loadState.js";
|
|
70
69
|
import {getRandaoMix} from "../util/seed.js";
|
|
71
70
|
import {getLatestWeakSubjectivityCheckpointEpoch} from "../util/weakSubjectivity.js";
|
|
72
|
-
import {IBeaconStateView, IBeaconStateViewLatestFork} from "./interface.js";
|
|
71
|
+
import {IBeaconStateView, IBeaconStateViewGloas, IBeaconStateViewLatestFork, isStatePostGloas} from "./interface.js";
|
|
73
72
|
|
|
74
73
|
export class BeaconStateView implements IBeaconStateViewLatestFork {
|
|
75
74
|
private readonly config: BeaconConfig;
|
|
@@ -84,8 +83,6 @@ export class BeaconStateView implements IBeaconStateViewLatestFork {
|
|
|
84
83
|
private _currentEpochParticipation: Uint8Array | null = null;
|
|
85
84
|
// bellatrix
|
|
86
85
|
private _latestExecutionPayloadHeader: ExecutionPayloadHeader | null = null;
|
|
87
|
-
// Caches the cross-fork latestBlockHash value
|
|
88
|
-
private _latestBlockHash: Bytes32 | null = null;
|
|
89
86
|
// capella
|
|
90
87
|
private _historicalSummaries: capella.HistoricalSummaries | null = null;
|
|
91
88
|
// electra
|
|
@@ -218,9 +215,13 @@ export class BeaconStateView implements IBeaconStateViewLatestFork {
|
|
|
218
215
|
// bellatrix
|
|
219
216
|
|
|
220
217
|
get latestExecutionPayloadHeader(): ExecutionPayloadHeader {
|
|
221
|
-
|
|
218
|
+
const forkSeq = this.config.getForkSeq(this.cachedState.slot);
|
|
219
|
+
if (forkSeq < ForkSeq.bellatrix) {
|
|
222
220
|
throw new Error("latestExecutionPayloadHeader is not available before Bellatrix");
|
|
223
221
|
}
|
|
222
|
+
if (forkSeq >= ForkSeq.gloas) {
|
|
223
|
+
throw new Error("latestExecutionPayloadHeader is not available after Gloas");
|
|
224
|
+
}
|
|
224
225
|
|
|
225
226
|
if (this._latestExecutionPayloadHeader === null) {
|
|
226
227
|
this._latestExecutionPayloadHeader = (
|
|
@@ -231,30 +232,6 @@ export class BeaconStateView implements IBeaconStateViewLatestFork {
|
|
|
231
232
|
return this._latestExecutionPayloadHeader;
|
|
232
233
|
}
|
|
233
234
|
|
|
234
|
-
/**
|
|
235
|
-
* Cross-fork accessor for the execution block hash of the most recently included payload.
|
|
236
|
-
* Pre-gloas: reads from latestExecutionPayloadHeader.blockHash.
|
|
237
|
-
* Gloas+: reads the dedicated latestBlockHash field (EIP-7732).
|
|
238
|
-
*/
|
|
239
|
-
get latestBlockHash(): Bytes32 {
|
|
240
|
-
const forkSeq = this.config.getForkSeq(this.cachedState.slot);
|
|
241
|
-
if (forkSeq < ForkSeq.bellatrix) {
|
|
242
|
-
throw new Error("latestBlockHash is not available before Bellatrix");
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
if (this._latestBlockHash === null) {
|
|
246
|
-
if (forkSeq >= ForkSeq.gloas) {
|
|
247
|
-
this._latestBlockHash = (this.cachedState as CachedBeaconStateGloas).latestBlockHash;
|
|
248
|
-
} else {
|
|
249
|
-
this._latestBlockHash = (
|
|
250
|
-
this.cachedState as CachedBeaconStateExecutions
|
|
251
|
-
).latestExecutionPayloadHeader.blockHash;
|
|
252
|
-
}
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
return this._latestBlockHash;
|
|
256
|
-
}
|
|
257
|
-
|
|
258
235
|
/**
|
|
259
236
|
* The execution block number of the most recently included payload.
|
|
260
237
|
* Named payloadBlockNumber (not latestBlockNumber) to mirror ExecutionPayloadHeader.blockNumber pre-gloas.
|
|
@@ -365,6 +342,13 @@ export class BeaconStateView implements IBeaconStateViewLatestFork {
|
|
|
365
342
|
|
|
366
343
|
// gloas
|
|
367
344
|
|
|
345
|
+
get latestBlockHash(): Bytes32 {
|
|
346
|
+
if (this.config.getForkSeq(this.cachedState.slot) < ForkSeq.gloas) {
|
|
347
|
+
throw new Error("latestBlockHash is not available before Gloas");
|
|
348
|
+
}
|
|
349
|
+
return (this.cachedState as CachedBeaconStateGloas).latestBlockHash;
|
|
350
|
+
}
|
|
351
|
+
|
|
368
352
|
get executionPayloadAvailability(): BitArray {
|
|
369
353
|
if (this.config.getForkSeq(this.cachedState.slot) < ForkSeq.gloas) {
|
|
370
354
|
throw new Error("executionPayloadAvailability is not available before Gloas");
|
|
@@ -421,6 +405,23 @@ export class BeaconStateView implements IBeaconStateViewLatestFork {
|
|
|
421
405
|
return canBuilderCoverBid(this.cachedState as CachedBeaconStateGloas, builderIndex, bidAmount);
|
|
422
406
|
}
|
|
423
407
|
|
|
408
|
+
/**
|
|
409
|
+
* Return the PTCs for an epoch
|
|
410
|
+
*/
|
|
411
|
+
getEpochPTCs(epoch: Epoch): Uint32Array[] {
|
|
412
|
+
if (this.config.getForkSeq(this.cachedState.slot) < ForkSeq.gloas) {
|
|
413
|
+
throw new Error("PTC committees are not supported before Gloas");
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
const epochCtx = (this.cachedState as CachedBeaconStateGloas).epochCtx;
|
|
417
|
+
if (epoch === epochCtx.epoch) {
|
|
418
|
+
return epochCtx.payloadTimelinessCommittees;
|
|
419
|
+
}
|
|
420
|
+
if (epoch === epochCtx.nextEpoch) {
|
|
421
|
+
return epochCtx.nextPayloadTimelinessCommittees;
|
|
422
|
+
}
|
|
423
|
+
throw new Error(`PTC committees are not available for epoch=${epoch}`);
|
|
424
|
+
}
|
|
424
425
|
/**
|
|
425
426
|
* Return the index of the validator in the PTC committee for the given slot.
|
|
426
427
|
* return -1 if validator is not in the PTC committee for the given slot.
|
|
@@ -719,7 +720,11 @@ export class BeaconStateView implements IBeaconStateViewLatestFork {
|
|
|
719
720
|
|
|
720
721
|
// Serialization
|
|
721
722
|
|
|
722
|
-
loadOtherState(
|
|
723
|
+
loadOtherState(
|
|
724
|
+
stateBytes: Uint8Array,
|
|
725
|
+
seedValidatorsBytes?: Uint8Array,
|
|
726
|
+
opts?: {preloadValidatorsAndBalances?: boolean}
|
|
727
|
+
): IBeaconStateView {
|
|
723
728
|
const {state} = loadState(this.config, this.cachedState, stateBytes, seedValidatorsBytes);
|
|
724
729
|
|
|
725
730
|
const cachedState = createCachedBeaconState(
|
|
@@ -734,9 +739,10 @@ export class BeaconStateView implements IBeaconStateViewLatestFork {
|
|
|
734
739
|
}
|
|
735
740
|
);
|
|
736
741
|
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
742
|
+
if (opts?.preloadValidatorsAndBalances) {
|
|
743
|
+
cachedState.validators.getAllReadonlyValues();
|
|
744
|
+
cachedState.balances.getAll();
|
|
745
|
+
}
|
|
740
746
|
|
|
741
747
|
return new BeaconStateView(cachedState);
|
|
742
748
|
}
|
|
@@ -794,19 +800,22 @@ export class BeaconStateView implements IBeaconStateViewLatestFork {
|
|
|
794
800
|
return new BeaconStateView(newState);
|
|
795
801
|
}
|
|
796
802
|
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
):
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
throw Error(`processExecutionPayloadEnvelope is only available for gloas+ forks, got fork=${fork}`);
|
|
803
|
+
/**
|
|
804
|
+
* Spec: https://github.com/ethereum/consensus-specs/blob/v1.7.0-alpha.5/specs/gloas/validator.md#executionpayload
|
|
805
|
+
*/
|
|
806
|
+
withParentPayloadApplied(executionRequests: electra.ExecutionRequests): IBeaconStateViewGloas {
|
|
807
|
+
if (this.config.getForkSeq(this.cachedState.slot) < ForkSeq.gloas) {
|
|
808
|
+
throw new Error("withParentPayloadApplied is not available before Gloas");
|
|
804
809
|
}
|
|
805
|
-
const
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
);
|
|
810
|
-
|
|
810
|
+
const stateCopy = this.cachedState.clone(true) as CachedBeaconStateGloas;
|
|
811
|
+
|
|
812
|
+
applyParentExecutionPayload(stateCopy, executionRequests);
|
|
813
|
+
|
|
814
|
+
const stateView = new BeaconStateView(stateCopy);
|
|
815
|
+
if (!isStatePostGloas(stateView)) {
|
|
816
|
+
throw new Error("Expected gloas state after clone");
|
|
817
|
+
}
|
|
818
|
+
|
|
819
|
+
return stateView;
|
|
811
820
|
}
|
|
812
821
|
}
|
|
@@ -41,7 +41,6 @@ import {
|
|
|
41
41
|
rewards,
|
|
42
42
|
} from "@lodestar/types";
|
|
43
43
|
import {Checkpoint, Fork} from "@lodestar/types/phase0";
|
|
44
|
-
import {ProcessExecutionPayloadEnvelopeOpts} from "../block/processExecutionPayloadEnvelope.js";
|
|
45
44
|
import {VoluntaryExitValidity} from "../block/processVoluntaryExit.js";
|
|
46
45
|
import {EffectiveBalanceIncrements} from "../cache/effectiveBalanceIncrements.js";
|
|
47
46
|
import {EpochTransitionCacheOpts} from "../cache/epochTransitionCache.js";
|
|
@@ -138,7 +137,13 @@ export interface IBeaconStateView {
|
|
|
138
137
|
isStateValidatorsNodesPopulated(): boolean;
|
|
139
138
|
|
|
140
139
|
// Serialization
|
|
141
|
-
|
|
140
|
+
/** Set `preloadValidatorsAndBalances` only when the whole state will be consumed
|
|
141
|
+
* immediately (e.g. CP reload before block replay). */
|
|
142
|
+
loadOtherState(
|
|
143
|
+
stateBytes: Uint8Array,
|
|
144
|
+
seedValidatorsBytes?: Uint8Array,
|
|
145
|
+
opts?: {preloadValidatorsAndBalances?: boolean}
|
|
146
|
+
): IBeaconStateView;
|
|
142
147
|
toValue(): BeaconState;
|
|
143
148
|
serialize(): Uint8Array;
|
|
144
149
|
serializedSize(): number;
|
|
@@ -187,13 +192,6 @@ export interface IBeaconStateViewAltair extends IBeaconStateView {
|
|
|
187
192
|
export interface IBeaconStateViewBellatrix extends IBeaconStateViewAltair {
|
|
188
193
|
forkName: ForkPostBellatrix;
|
|
189
194
|
latestExecutionPayloadHeader: ExecutionPayloadHeader;
|
|
190
|
-
/**
|
|
191
|
-
* Cross-fork accessor for the execution block hash of the most recently included payload.
|
|
192
|
-
* Pre-gloas: returns latestExecutionPayloadHeader.blockHash (bellatrix–fulu).
|
|
193
|
-
* Gloas+: returns the dedicated latestBlockHash state field (EIP-7732).
|
|
194
|
-
* Throws before bellatrix.
|
|
195
|
-
*/
|
|
196
|
-
latestBlockHash: Bytes32;
|
|
197
195
|
/**
|
|
198
196
|
* The execution block number of the most recently included payload.
|
|
199
197
|
* Named payloadBlockNumber (not latestBlockNumber) to mirror ExecutionPayloadHeader.blockNumber pre-gloas.
|
|
@@ -244,16 +242,25 @@ export interface IBeaconStateViewFulu extends IBeaconStateViewElectra {
|
|
|
244
242
|
/** Gloas+ state fields — use isStatePostGloas() guard */
|
|
245
243
|
export interface IBeaconStateViewGloas extends IBeaconStateViewFulu {
|
|
246
244
|
forkName: ForkPostGloas;
|
|
245
|
+
/** Removed from BeaconState in gloas. Use `latestBlockHash` instead. */
|
|
246
|
+
latestExecutionPayloadHeader: never;
|
|
247
|
+
/** Removed from BeaconState in gloas. */
|
|
248
|
+
payloadBlockNumber: never;
|
|
249
|
+
latestBlockHash: Bytes32;
|
|
247
250
|
executionPayloadAvailability: BitArray;
|
|
248
251
|
latestExecutionPayloadBid: ExecutionPayloadBid;
|
|
249
252
|
payloadExpectedWithdrawals: capella.Withdrawal[];
|
|
250
253
|
getBuilder(index: BuilderIndex): gloas.Builder;
|
|
251
254
|
canBuilderCoverBid(builderIndex: BuilderIndex, bidAmount: number): boolean;
|
|
255
|
+
getEpochPTCs(epoch: Epoch): Uint32Array[];
|
|
252
256
|
getIndexInPayloadTimelinessCommittee(validatorIndex: ValidatorIndex, slot: Slot): number;
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
+
/**
|
|
258
|
+
* Clone the state and apply parent execution payload effects.
|
|
259
|
+
* Used during block production and prepareNextSlot so that withdrawals and
|
|
260
|
+
* operation selection (e.g. voluntary exits) see the same post-apply state that the block
|
|
261
|
+
* processor will see at import.
|
|
262
|
+
*/
|
|
263
|
+
withParentPayloadApplied(executionRequests: electra.ExecutionRequests): IBeaconStateViewGloas;
|
|
257
264
|
}
|
|
258
265
|
|
|
259
266
|
/**
|
|
@@ -262,7 +269,14 @@ export interface IBeaconStateViewGloas extends IBeaconStateViewFulu {
|
|
|
262
269
|
* forkName as ForkName since the class wraps any fork's state.
|
|
263
270
|
* Sub-interfaces retain their narrowed forkName discriminants for caller-side type guards.
|
|
264
271
|
*/
|
|
265
|
-
export type IBeaconStateViewLatestFork = Omit<
|
|
272
|
+
export type IBeaconStateViewLatestFork = Omit<
|
|
273
|
+
IBeaconStateViewGloas,
|
|
274
|
+
"forkName" | "latestExecutionPayloadHeader" | "payloadBlockNumber"
|
|
275
|
+
> & {
|
|
276
|
+
forkName: ForkName;
|
|
277
|
+
latestExecutionPayloadHeader: ExecutionPayloadHeader;
|
|
278
|
+
payloadBlockNumber: number;
|
|
279
|
+
};
|
|
266
280
|
export function isStatePostAltair(state: IBeaconStateView): state is IBeaconStateViewAltair {
|
|
267
281
|
return isForkPostAltair(state.forkName);
|
|
268
282
|
}
|