@lodestar/state-transition 1.41.0-dev.a35cbde8b3 → 1.41.0-dev.aeb5a213ee
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/cache/stateCache.d.ts +1 -1
- package/lib/cache/stateCache.d.ts.map +1 -1
- package/lib/index.d.ts +2 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -1
- package/lib/lightClient/proofs.d.ts +10 -0
- package/lib/lightClient/proofs.d.ts.map +1 -0
- package/lib/lightClient/proofs.js +63 -0
- package/lib/lightClient/proofs.js.map +1 -0
- package/lib/lightClient/types.d.ts +34 -0
- package/lib/lightClient/types.d.ts.map +1 -0
- package/lib/lightClient/types.js +2 -0
- package/lib/lightClient/types.js.map +1 -0
- package/lib/stateView/beaconStateView.d.ts +144 -0
- package/lib/stateView/beaconStateView.d.ts.map +1 -0
- package/lib/stateView/beaconStateView.js +498 -0
- package/lib/stateView/beaconStateView.js.map +1 -0
- package/lib/stateView/index.d.ts +3 -0
- package/lib/stateView/index.d.ts.map +1 -0
- package/lib/stateView/index.js +3 -0
- package/lib/stateView/index.js.map +1 -0
- package/lib/stateView/interface.d.ts +118 -0
- package/lib/stateView/interface.d.ts.map +1 -0
- package/lib/stateView/interface.js +2 -0
- package/lib/stateView/interface.js.map +1 -0
- package/lib/util/weakSubjectivity.js +1 -1
- package/lib/util/weakSubjectivity.js.map +1 -1
- package/package.json +7 -7
- package/src/cache/stateCache.ts +1 -1
- package/src/index.ts +2 -0
- package/src/lightClient/proofs.ts +83 -0
- package/src/lightClient/types.ts +33 -0
- package/src/stateView/beaconStateView.ts +746 -0
- package/src/stateView/index.ts +2 -0
- package/src/stateView/interface.ts +196 -0
- package/src/util/weakSubjectivity.ts +1 -1
|
@@ -0,0 +1,498 @@
|
|
|
1
|
+
import { ProofType, Tree, createProof } from "@chainsafe/persistent-merkle-tree";
|
|
2
|
+
import { PubkeyIndexMap } from "@chainsafe/pubkey-index-map";
|
|
3
|
+
import { ForkSeq, SLOTS_PER_HISTORICAL_ROOT } from "@lodestar/params";
|
|
4
|
+
import { getValidatorStatus, mapToGeneralStatus, } from "@lodestar/types";
|
|
5
|
+
import { VoluntaryExitValidity, getVoluntaryExitValidity } from "../block/processVoluntaryExit.js";
|
|
6
|
+
import { getExpectedWithdrawals } from "../block/processWithdrawals.js";
|
|
7
|
+
import { createCachedBeaconState, isStateValidatorsNodesPopulated, } from "../cache/stateCache.js";
|
|
8
|
+
import { computeUnrealizedCheckpoints } from "../epoch/computeUnrealizedCheckpoints.js";
|
|
9
|
+
import { getFinalizedRootProof, getSyncCommitteesWitness } from "../lightClient/proofs.js";
|
|
10
|
+
import { computeAttestationsRewards } from "../rewards/attestationsRewards.js";
|
|
11
|
+
import { computeBlockRewards } from "../rewards/blockRewards.js";
|
|
12
|
+
import { computeSyncCommitteeRewards } from "../rewards/syncCommitteeRewards.js";
|
|
13
|
+
import { processSlots, stateTransition } from "../stateTransition.js";
|
|
14
|
+
import { getEffectiveBalanceIncrementsZeroInactive } from "../util/balance.js";
|
|
15
|
+
import { getBlockRootAtSlot } from "../util/blockRoot.js";
|
|
16
|
+
import { computeAnchorCheckpoint } from "../util/computeAnchorCheckpoint.js";
|
|
17
|
+
import { computeEpochAtSlot, computeStartSlotAtEpoch } from "../util/epoch.js";
|
|
18
|
+
import { isExecutionEnabled, isExecutionStateType, isMergeTransitionComplete } from "../util/execution.js";
|
|
19
|
+
import { canBuilderCoverBid } from "../util/gloas.js";
|
|
20
|
+
import { loadState } from "../util/loadState/loadState.js";
|
|
21
|
+
import { getRandaoMix } from "../util/seed.js";
|
|
22
|
+
import { getStateTypeFromBytes } from "../util/sszBytes.js";
|
|
23
|
+
import { getLatestWeakSubjectivityCheckpointEpoch } from "../util/weakSubjectivity.js";
|
|
24
|
+
export class BeaconStateView {
|
|
25
|
+
cachedState;
|
|
26
|
+
config;
|
|
27
|
+
// Cached values extracted from the tree
|
|
28
|
+
// phase0
|
|
29
|
+
_fork = null;
|
|
30
|
+
_latestBlockHeader = null;
|
|
31
|
+
// altair
|
|
32
|
+
_currentSyncCommittee = null;
|
|
33
|
+
_nextSyncCommittee = null;
|
|
34
|
+
_previousEpochParticipation = null;
|
|
35
|
+
_currentEpochParticipation = null;
|
|
36
|
+
// bellatrix
|
|
37
|
+
_latestExecutionPayloadHeader = null;
|
|
38
|
+
// capella
|
|
39
|
+
_historicalSummaries = null;
|
|
40
|
+
// electra
|
|
41
|
+
_pendingPartialWithdrawals = null;
|
|
42
|
+
_pendingConsolidations = null;
|
|
43
|
+
_pendingDeposits = null;
|
|
44
|
+
// fulu
|
|
45
|
+
_proposerLookahead = null;
|
|
46
|
+
// gloas
|
|
47
|
+
_executionPayloadAvailability = null;
|
|
48
|
+
_latestExecutionPayloadBid = null;
|
|
49
|
+
constructor(cachedState) {
|
|
50
|
+
this.cachedState = cachedState;
|
|
51
|
+
this.config = cachedState.config;
|
|
52
|
+
}
|
|
53
|
+
// phase0
|
|
54
|
+
get slot() {
|
|
55
|
+
return this.cachedState.slot;
|
|
56
|
+
}
|
|
57
|
+
get fork() {
|
|
58
|
+
if (this._fork === null) {
|
|
59
|
+
this._fork = this.cachedState.fork.toValue();
|
|
60
|
+
}
|
|
61
|
+
return this._fork;
|
|
62
|
+
}
|
|
63
|
+
get epoch() {
|
|
64
|
+
return computeEpochAtSlot(this.slot);
|
|
65
|
+
}
|
|
66
|
+
get genesisTime() {
|
|
67
|
+
return this.cachedState.genesisTime;
|
|
68
|
+
}
|
|
69
|
+
get genesisValidatorsRoot() {
|
|
70
|
+
return this.cachedState.genesisValidatorsRoot;
|
|
71
|
+
}
|
|
72
|
+
get eth1Data() {
|
|
73
|
+
return this.cachedState.eth1Data;
|
|
74
|
+
}
|
|
75
|
+
get latestBlockHeader() {
|
|
76
|
+
if (this._latestBlockHeader === null) {
|
|
77
|
+
this._latestBlockHeader = this.cachedState.latestBlockHeader.toValue();
|
|
78
|
+
}
|
|
79
|
+
return this._latestBlockHeader;
|
|
80
|
+
}
|
|
81
|
+
get previousJustifiedCheckpoint() {
|
|
82
|
+
return this.cachedState.previousJustifiedCheckpoint;
|
|
83
|
+
}
|
|
84
|
+
get currentJustifiedCheckpoint() {
|
|
85
|
+
return this.cachedState.currentJustifiedCheckpoint;
|
|
86
|
+
}
|
|
87
|
+
get finalizedCheckpoint() {
|
|
88
|
+
return this.cachedState.finalizedCheckpoint;
|
|
89
|
+
}
|
|
90
|
+
getBlockRootAtSlot(slot) {
|
|
91
|
+
return getBlockRootAtSlot(this.cachedState, slot);
|
|
92
|
+
}
|
|
93
|
+
getBlockRootAtEpoch(epoch) {
|
|
94
|
+
return this.getBlockRootAtSlot(computeStartSlotAtEpoch(epoch));
|
|
95
|
+
}
|
|
96
|
+
getStateRootAtSlot(slot) {
|
|
97
|
+
return this.cachedState.stateRoots.get(slot % SLOTS_PER_HISTORICAL_ROOT);
|
|
98
|
+
}
|
|
99
|
+
getRandaoMix(epoch) {
|
|
100
|
+
return getRandaoMix(this.cachedState, epoch);
|
|
101
|
+
}
|
|
102
|
+
get previousEpochParticipation() {
|
|
103
|
+
if (this.config.getForkSeq(this.cachedState.slot) < ForkSeq.altair) {
|
|
104
|
+
throw new Error("previousEpochParticipation is not available before Altair");
|
|
105
|
+
}
|
|
106
|
+
if (this._previousEpochParticipation === null) {
|
|
107
|
+
this._previousEpochParticipation = this.cachedState.previousEpochParticipation.toValue();
|
|
108
|
+
}
|
|
109
|
+
return this._previousEpochParticipation;
|
|
110
|
+
}
|
|
111
|
+
// altair
|
|
112
|
+
get currentEpochParticipation() {
|
|
113
|
+
if (this.config.getForkSeq(this.cachedState.slot) < ForkSeq.altair) {
|
|
114
|
+
throw new Error("currentEpochParticipation is not available before Altair");
|
|
115
|
+
}
|
|
116
|
+
if (this._currentEpochParticipation === null) {
|
|
117
|
+
this._currentEpochParticipation = this.cachedState.currentEpochParticipation.toValue();
|
|
118
|
+
}
|
|
119
|
+
return this._currentEpochParticipation;
|
|
120
|
+
}
|
|
121
|
+
// bellatrix
|
|
122
|
+
get latestExecutionPayloadHeader() {
|
|
123
|
+
if (this.config.getForkSeq(this.cachedState.slot) < ForkSeq.bellatrix) {
|
|
124
|
+
throw new Error("latestExecutionPayloadHeader is not available before Bellatrix");
|
|
125
|
+
}
|
|
126
|
+
if (this._latestExecutionPayloadHeader === null) {
|
|
127
|
+
this._latestExecutionPayloadHeader = this.cachedState.latestExecutionPayloadHeader.toValue();
|
|
128
|
+
}
|
|
129
|
+
return this._latestExecutionPayloadHeader;
|
|
130
|
+
}
|
|
131
|
+
// capella
|
|
132
|
+
get historicalSummaries() {
|
|
133
|
+
if (this.config.getForkSeq(this.cachedState.slot) < ForkSeq.capella) {
|
|
134
|
+
throw new Error("Historical summaries are not supported before Capella");
|
|
135
|
+
}
|
|
136
|
+
if (this._historicalSummaries === null) {
|
|
137
|
+
this._historicalSummaries = this.cachedState.historicalSummaries.toValue();
|
|
138
|
+
}
|
|
139
|
+
return this._historicalSummaries;
|
|
140
|
+
}
|
|
141
|
+
// electra
|
|
142
|
+
get pendingDeposits() {
|
|
143
|
+
if (this.config.getForkSeq(this.cachedState.slot) < ForkSeq.electra) {
|
|
144
|
+
throw new Error("Pending deposits are not supported before Electra");
|
|
145
|
+
}
|
|
146
|
+
if (this._pendingDeposits === null) {
|
|
147
|
+
this._pendingDeposits = this.cachedState.pendingDeposits.toValue();
|
|
148
|
+
}
|
|
149
|
+
return this._pendingDeposits;
|
|
150
|
+
}
|
|
151
|
+
get pendingDepositsCount() {
|
|
152
|
+
if (this.config.getForkSeq(this.cachedState.slot) < ForkSeq.electra) {
|
|
153
|
+
throw new Error("Pending deposits are not supported before Electra");
|
|
154
|
+
}
|
|
155
|
+
return this.cachedState.pendingDeposits.length;
|
|
156
|
+
}
|
|
157
|
+
get pendingPartialWithdrawals() {
|
|
158
|
+
if (this.config.getForkSeq(this.cachedState.slot) < ForkSeq.electra) {
|
|
159
|
+
throw new Error("Pending partial withdrawals are not supported before Electra");
|
|
160
|
+
}
|
|
161
|
+
if (this._pendingPartialWithdrawals === null) {
|
|
162
|
+
this._pendingPartialWithdrawals = this.cachedState.pendingPartialWithdrawals.toValue();
|
|
163
|
+
}
|
|
164
|
+
return this._pendingPartialWithdrawals;
|
|
165
|
+
}
|
|
166
|
+
get pendingPartialWithdrawalsCount() {
|
|
167
|
+
if (this.config.getForkSeq(this.cachedState.slot) < ForkSeq.electra) {
|
|
168
|
+
throw new Error("Pending partial withdrawals are not supported before Electra");
|
|
169
|
+
}
|
|
170
|
+
return this.cachedState.pendingPartialWithdrawals.length;
|
|
171
|
+
}
|
|
172
|
+
get pendingConsolidations() {
|
|
173
|
+
if (this.config.getForkSeq(this.cachedState.slot) < ForkSeq.electra) {
|
|
174
|
+
throw new Error("Pending consolidations are not supported before Electra");
|
|
175
|
+
}
|
|
176
|
+
if (this._pendingConsolidations === null) {
|
|
177
|
+
this._pendingConsolidations = this.cachedState.pendingConsolidations.toValue();
|
|
178
|
+
}
|
|
179
|
+
return this._pendingConsolidations;
|
|
180
|
+
}
|
|
181
|
+
get pendingConsolidationsCount() {
|
|
182
|
+
if (this.config.getForkSeq(this.cachedState.slot) < ForkSeq.electra) {
|
|
183
|
+
throw new Error("Pending consolidations are not supported before Electra");
|
|
184
|
+
}
|
|
185
|
+
return this.cachedState.pendingConsolidations.length;
|
|
186
|
+
}
|
|
187
|
+
// fulu
|
|
188
|
+
get proposerLookahead() {
|
|
189
|
+
if (this.config.getForkSeq(this.cachedState.slot) < ForkSeq.fulu) {
|
|
190
|
+
throw new Error("Proposer lookahead is not supported before Fulu");
|
|
191
|
+
}
|
|
192
|
+
if (this._proposerLookahead === null) {
|
|
193
|
+
this._proposerLookahead = this.cachedState.proposerLookahead.toValue();
|
|
194
|
+
}
|
|
195
|
+
return this._proposerLookahead;
|
|
196
|
+
}
|
|
197
|
+
// gloas
|
|
198
|
+
get executionPayloadAvailability() {
|
|
199
|
+
if (this.config.getForkSeq(this.cachedState.slot) < ForkSeq.gloas) {
|
|
200
|
+
throw new Error("executionPayloadAvailability is not available before GLOAS");
|
|
201
|
+
}
|
|
202
|
+
if (this._executionPayloadAvailability === null) {
|
|
203
|
+
this._executionPayloadAvailability = this.cachedState.executionPayloadAvailability
|
|
204
|
+
.toValue()
|
|
205
|
+
.toBoolArray();
|
|
206
|
+
}
|
|
207
|
+
return this._executionPayloadAvailability;
|
|
208
|
+
}
|
|
209
|
+
get latestExecutionPayloadBid() {
|
|
210
|
+
if (this.config.getForkSeq(this.cachedState.slot) < ForkSeq.gloas) {
|
|
211
|
+
throw new Error("latestExecutionPayloadBid is not available before GLOAS");
|
|
212
|
+
}
|
|
213
|
+
if (this._latestExecutionPayloadBid === null) {
|
|
214
|
+
this._latestExecutionPayloadBid = this.cachedState.latestExecutionPayloadBid.toValue();
|
|
215
|
+
}
|
|
216
|
+
return this._latestExecutionPayloadBid;
|
|
217
|
+
}
|
|
218
|
+
getBuilder(index) {
|
|
219
|
+
if (this.config.getForkSeq(this.cachedState.slot) < ForkSeq.gloas) {
|
|
220
|
+
throw new Error("Builders are not supported before GLOAS");
|
|
221
|
+
}
|
|
222
|
+
return this.cachedState.builders.getReadonly(index);
|
|
223
|
+
}
|
|
224
|
+
canBuilderCoverBid(builderIndex, bidAmount) {
|
|
225
|
+
if (this.config.getForkSeq(this.cachedState.slot) < ForkSeq.gloas) {
|
|
226
|
+
throw new Error("Builders are not supported before GLOAS");
|
|
227
|
+
}
|
|
228
|
+
return canBuilderCoverBid(this.cachedState, builderIndex, bidAmount);
|
|
229
|
+
}
|
|
230
|
+
/**
|
|
231
|
+
* Return the index of the validator in the PTC committee for the given slot.
|
|
232
|
+
* return -1 if validator is not in the PTC committee for the given slot.
|
|
233
|
+
*/
|
|
234
|
+
validatorPTCCommitteeIndex(validatorIndex, slot) {
|
|
235
|
+
if (this.config.getForkSeq(this.cachedState.slot) < ForkSeq.gloas) {
|
|
236
|
+
throw new Error("PTC committees are not supported before GLOAS");
|
|
237
|
+
}
|
|
238
|
+
const ptcCommittee = this.cachedState.epochCtx.getPayloadTimelinessCommittee(slot);
|
|
239
|
+
return ptcCommittee.indexOf(validatorIndex);
|
|
240
|
+
}
|
|
241
|
+
// Shuffling and committees
|
|
242
|
+
getShufflingAtEpoch(epoch) {
|
|
243
|
+
return this.cachedState.epochCtx.getShufflingAtEpoch(epoch);
|
|
244
|
+
}
|
|
245
|
+
get previousDecisionRoot() {
|
|
246
|
+
return this.cachedState.epochCtx.previousDecisionRoot;
|
|
247
|
+
}
|
|
248
|
+
get currentDecisionRoot() {
|
|
249
|
+
return this.cachedState.epochCtx.currentDecisionRoot;
|
|
250
|
+
}
|
|
251
|
+
get nextDecisionRoot() {
|
|
252
|
+
return this.cachedState.epochCtx.nextDecisionRoot;
|
|
253
|
+
}
|
|
254
|
+
getShufflingDecisionRoot(epoch) {
|
|
255
|
+
return this.cachedState.epochCtx.getShufflingDecisionRoot(epoch);
|
|
256
|
+
}
|
|
257
|
+
getPreviousShuffling() {
|
|
258
|
+
return this.cachedState.epochCtx.previousShuffling;
|
|
259
|
+
}
|
|
260
|
+
getCurrentShuffling() {
|
|
261
|
+
return this.cachedState.epochCtx.currentShuffling;
|
|
262
|
+
}
|
|
263
|
+
getNextShuffling() {
|
|
264
|
+
return this.cachedState.epochCtx.nextShuffling;
|
|
265
|
+
}
|
|
266
|
+
// Proposer shuffling
|
|
267
|
+
get previousProposers() {
|
|
268
|
+
return this.cachedState.epochCtx.proposersPrevEpoch;
|
|
269
|
+
}
|
|
270
|
+
get currentProposers() {
|
|
271
|
+
return this.cachedState.epochCtx.getBeaconProposers();
|
|
272
|
+
}
|
|
273
|
+
get nextProposers() {
|
|
274
|
+
return this.cachedState.epochCtx.getBeaconProposersNextEpoch();
|
|
275
|
+
}
|
|
276
|
+
getBeaconProposer(slot) {
|
|
277
|
+
return this.cachedState.epochCtx.getBeaconProposer(slot);
|
|
278
|
+
}
|
|
279
|
+
computeAnchorCheckpoint() {
|
|
280
|
+
return computeAnchorCheckpoint(this.config, this.cachedState);
|
|
281
|
+
}
|
|
282
|
+
// Sync committees
|
|
283
|
+
get currentSyncCommittee() {
|
|
284
|
+
if (this.config.getForkSeq(this.cachedState.slot) < ForkSeq.altair) {
|
|
285
|
+
throw new Error("currentSyncCommittee is not available before Altair");
|
|
286
|
+
}
|
|
287
|
+
if (this._currentSyncCommittee === null) {
|
|
288
|
+
this._currentSyncCommittee = this.cachedState.currentSyncCommittee.toValue();
|
|
289
|
+
}
|
|
290
|
+
return this._currentSyncCommittee;
|
|
291
|
+
}
|
|
292
|
+
get nextSyncCommittee() {
|
|
293
|
+
if (this.config.getForkSeq(this.cachedState.slot) < ForkSeq.altair) {
|
|
294
|
+
throw new Error("nextSyncCommittee is not available before Altair");
|
|
295
|
+
}
|
|
296
|
+
if (this._nextSyncCommittee === null) {
|
|
297
|
+
this._nextSyncCommittee = this.cachedState.nextSyncCommittee.toValue();
|
|
298
|
+
}
|
|
299
|
+
return this._nextSyncCommittee;
|
|
300
|
+
}
|
|
301
|
+
get currentSyncCommitteeIndexed() {
|
|
302
|
+
return this.cachedState.epochCtx.currentSyncCommitteeIndexed;
|
|
303
|
+
}
|
|
304
|
+
get syncProposerReward() {
|
|
305
|
+
return this.cachedState.epochCtx.syncProposerReward;
|
|
306
|
+
}
|
|
307
|
+
getIndexedSyncCommitteeAtEpoch(epoch) {
|
|
308
|
+
return this.cachedState.epochCtx.getIndexedSyncCommitteeAtEpoch(epoch);
|
|
309
|
+
}
|
|
310
|
+
// Validators and balances
|
|
311
|
+
get effectiveBalanceIncrements() {
|
|
312
|
+
return this.cachedState.epochCtx.effectiveBalanceIncrements;
|
|
313
|
+
}
|
|
314
|
+
getEffectiveBalanceIncrementsZeroInactive() {
|
|
315
|
+
return getEffectiveBalanceIncrementsZeroInactive(this.cachedState);
|
|
316
|
+
}
|
|
317
|
+
getBalance(index) {
|
|
318
|
+
return this.cachedState.balances.get(index);
|
|
319
|
+
}
|
|
320
|
+
getValidator(index) {
|
|
321
|
+
return this.cachedState.validators.getReadonly(index).toValue();
|
|
322
|
+
}
|
|
323
|
+
getValidatorsByStatus(statuses, currentEpoch) {
|
|
324
|
+
const validators = [];
|
|
325
|
+
const validatorsArr = this.cachedState.validators.getAllReadonlyValues();
|
|
326
|
+
for (const validator of validatorsArr) {
|
|
327
|
+
const validatorStatus = getValidatorStatus(validator, currentEpoch);
|
|
328
|
+
if (statuses.has(validatorStatus) || statuses.has(mapToGeneralStatus(validatorStatus))) {
|
|
329
|
+
validators.push(validator);
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
return validators;
|
|
333
|
+
}
|
|
334
|
+
get validatorCount() {
|
|
335
|
+
return this.cachedState.validators.length;
|
|
336
|
+
}
|
|
337
|
+
get activeValidatorCount() {
|
|
338
|
+
return this.cachedState.epochCtx.currentShuffling.activeIndices.length;
|
|
339
|
+
}
|
|
340
|
+
getAllValidators() {
|
|
341
|
+
return this.cachedState.validators.getAllReadonlyValues();
|
|
342
|
+
}
|
|
343
|
+
getAllBalances() {
|
|
344
|
+
return this.cachedState.balances.getAll();
|
|
345
|
+
}
|
|
346
|
+
// Merge
|
|
347
|
+
get isExecutionStateType() {
|
|
348
|
+
return this.config.getForkSeq(this.cachedState.slot) >= ForkSeq.bellatrix;
|
|
349
|
+
}
|
|
350
|
+
isExecutionEnabled(block) {
|
|
351
|
+
if (this.config.getForkSeq(this.cachedState.slot) < ForkSeq.bellatrix) {
|
|
352
|
+
return false;
|
|
353
|
+
}
|
|
354
|
+
return isExecutionEnabled(this.cachedState, block);
|
|
355
|
+
}
|
|
356
|
+
get isMergeTransitionComplete() {
|
|
357
|
+
return isExecutionStateType(this.cachedState) && isMergeTransitionComplete(this.cachedState);
|
|
358
|
+
}
|
|
359
|
+
// Block production
|
|
360
|
+
getExpectedWithdrawals() {
|
|
361
|
+
const fork = this.config.getForkSeq(this.cachedState.slot);
|
|
362
|
+
return getExpectedWithdrawals(fork, this.cachedState);
|
|
363
|
+
}
|
|
364
|
+
// API
|
|
365
|
+
get proposerRewards() {
|
|
366
|
+
return this.cachedState.proposerRewards;
|
|
367
|
+
}
|
|
368
|
+
async computeBlockRewards(block, proposerRewards) {
|
|
369
|
+
return computeBlockRewards(this.cachedState.config, block, this.cachedState, proposerRewards);
|
|
370
|
+
}
|
|
371
|
+
async computeAttestationsRewards(validatorIds) {
|
|
372
|
+
return computeAttestationsRewards(this.cachedState.config, this.cachedState.epochCtx.pubkey2index, this.cachedState, validatorIds);
|
|
373
|
+
}
|
|
374
|
+
async computeSyncCommitteeRewards(block, validatorIds) {
|
|
375
|
+
return computeSyncCommitteeRewards(this.cachedState.config, this.cachedState.epochCtx.index2pubkey, block, this.cachedState, validatorIds);
|
|
376
|
+
}
|
|
377
|
+
getLatestWeakSubjectivityCheckpointEpoch() {
|
|
378
|
+
return getLatestWeakSubjectivityCheckpointEpoch(this.config, this.cachedState);
|
|
379
|
+
}
|
|
380
|
+
// Validation
|
|
381
|
+
getVoluntaryExitValidity(signedVoluntaryExit, verifySignature = true) {
|
|
382
|
+
const stateFork = this.config.getForkSeq(this.cachedState.slot);
|
|
383
|
+
return getVoluntaryExitValidity(stateFork, this.cachedState, signedVoluntaryExit, verifySignature);
|
|
384
|
+
}
|
|
385
|
+
isValidVoluntaryExit(signedVoluntaryExit, verifySignature) {
|
|
386
|
+
return this.getVoluntaryExitValidity(signedVoluntaryExit, verifySignature) === VoluntaryExitValidity.valid;
|
|
387
|
+
}
|
|
388
|
+
// Proofs
|
|
389
|
+
getFinalizedRootProof() {
|
|
390
|
+
return getFinalizedRootProof(this.cachedState);
|
|
391
|
+
}
|
|
392
|
+
getSyncCommitteesWitness() {
|
|
393
|
+
const fork = this.config.getForkName(this.cachedState.slot);
|
|
394
|
+
if (ForkSeq[fork] < ForkSeq.altair) {
|
|
395
|
+
throw new Error("Sync committees witness is not available before Altair");
|
|
396
|
+
}
|
|
397
|
+
return getSyncCommitteesWitness(fork, this.cachedState);
|
|
398
|
+
}
|
|
399
|
+
getSingleProof(gindex) {
|
|
400
|
+
return new Tree(this.cachedState.node).getSingleProof(gindex);
|
|
401
|
+
}
|
|
402
|
+
createMultiProof(descriptor) {
|
|
403
|
+
const stateNode = this.cachedState.node;
|
|
404
|
+
return createProof(stateNode, { type: ProofType.compactMulti, descriptor });
|
|
405
|
+
}
|
|
406
|
+
// Fork choice
|
|
407
|
+
computeUnrealizedCheckpoints() {
|
|
408
|
+
return computeUnrealizedCheckpoints(this.cachedState);
|
|
409
|
+
}
|
|
410
|
+
// this is for backward compatible
|
|
411
|
+
get clonedCount() {
|
|
412
|
+
return this.cachedState.clonedCount;
|
|
413
|
+
}
|
|
414
|
+
get clonedCountWithTransferCache() {
|
|
415
|
+
return this.cachedState.clonedCountWithTransferCache;
|
|
416
|
+
}
|
|
417
|
+
get createdWithTransferCache() {
|
|
418
|
+
return this.cachedState.createdWithTransferCache;
|
|
419
|
+
}
|
|
420
|
+
isStateValidatorsNodesPopulated() {
|
|
421
|
+
return isStateValidatorsNodesPopulated(this.cachedState);
|
|
422
|
+
}
|
|
423
|
+
// Serialization
|
|
424
|
+
loadOtherState(stateBytes, seedValidatorsBytes) {
|
|
425
|
+
const { state } = loadState(this.config, this.cachedState, stateBytes, seedValidatorsBytes);
|
|
426
|
+
const cachedState = createCachedBeaconState(state, {
|
|
427
|
+
config: this.config,
|
|
428
|
+
// as of Feb 2026, it's not necessary to sync pubkey cache as it's shared across states in Lodestar
|
|
429
|
+
pubkey2index: this.cachedState.epochCtx.pubkey2index,
|
|
430
|
+
index2pubkey: this.cachedState.epochCtx.index2pubkey,
|
|
431
|
+
}, {
|
|
432
|
+
skipSyncPubkeys: true,
|
|
433
|
+
});
|
|
434
|
+
// load all cache in order for consumers (usually regen.getState()) to process blocks faster
|
|
435
|
+
cachedState.validators.getAllReadonlyValues();
|
|
436
|
+
cachedState.balances.getAll();
|
|
437
|
+
return new BeaconStateView(cachedState);
|
|
438
|
+
}
|
|
439
|
+
serialize() {
|
|
440
|
+
return this.cachedState.serialize();
|
|
441
|
+
}
|
|
442
|
+
serializedSize() {
|
|
443
|
+
return this.cachedState.type.tree_serializedSize(this.cachedState.node);
|
|
444
|
+
}
|
|
445
|
+
serializeToBytes(output, offset) {
|
|
446
|
+
return this.cachedState.serializeToBytes(output, offset);
|
|
447
|
+
}
|
|
448
|
+
serializeValidators() {
|
|
449
|
+
return this.cachedState.validators.serialize();
|
|
450
|
+
}
|
|
451
|
+
serializedValidatorsSize() {
|
|
452
|
+
const type = this.cachedState.type.fields.validators;
|
|
453
|
+
return type.tree_serializedSize(this.cachedState.validators.node);
|
|
454
|
+
}
|
|
455
|
+
serializeValidatorsToBytes(output, offset) {
|
|
456
|
+
return this.cachedState.validators.serializeToBytes(output, offset);
|
|
457
|
+
}
|
|
458
|
+
hashTreeRoot() {
|
|
459
|
+
return this.cachedState.hashTreeRoot();
|
|
460
|
+
}
|
|
461
|
+
// State transition
|
|
462
|
+
stateTransition(signedBlock, options, { metrics, validatorMonitor }) {
|
|
463
|
+
const newState = stateTransition(this.cachedState, signedBlock, options, { metrics, validatorMonitor });
|
|
464
|
+
return new BeaconStateView(newState);
|
|
465
|
+
}
|
|
466
|
+
processSlots(slot, epochTransitionCacheOpts, modules) {
|
|
467
|
+
const newState = processSlots(this.cachedState, slot, epochTransitionCacheOpts, modules);
|
|
468
|
+
return new BeaconStateView(newState);
|
|
469
|
+
}
|
|
470
|
+
}
|
|
471
|
+
/**
|
|
472
|
+
* Create BeaconStateView for historical state regen, no need to sync pubkey cache there.
|
|
473
|
+
*/
|
|
474
|
+
export function createBeaconStateViewForHistoricalRegen(config, stateBytes) {
|
|
475
|
+
const state = getStateTypeFromBytes(config, stateBytes).deserializeToViewDU(stateBytes);
|
|
476
|
+
const pubkey2index = new PubkeyIndexMap();
|
|
477
|
+
syncPubkeyCache(state, pubkey2index);
|
|
478
|
+
const cachedState = createCachedBeaconState(state, {
|
|
479
|
+
config,
|
|
480
|
+
pubkey2index,
|
|
481
|
+
index2pubkey: [],
|
|
482
|
+
}, {
|
|
483
|
+
skipSyncPubkeys: true,
|
|
484
|
+
});
|
|
485
|
+
return new BeaconStateView(cachedState);
|
|
486
|
+
}
|
|
487
|
+
/**
|
|
488
|
+
* Populate a PubkeyIndexMap with any new entries based on a BeaconState
|
|
489
|
+
*/
|
|
490
|
+
function syncPubkeyCache(state, pubkey2index) {
|
|
491
|
+
// Get the validators sub tree once for all the loop
|
|
492
|
+
const newCount = state.validators.length;
|
|
493
|
+
for (let i = pubkey2index.size; i < newCount; i++) {
|
|
494
|
+
const pubkey = state.validators.getReadonly(i).pubkey;
|
|
495
|
+
pubkey2index.set(pubkey, i);
|
|
496
|
+
}
|
|
497
|
+
}
|
|
498
|
+
//# sourceMappingURL=beaconStateView.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"beaconStateView.js","sourceRoot":"","sources":["../../src/stateView/beaconStateView.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,SAAS,EAAE,IAAI,EAAE,WAAW,EAAC,MAAM,mCAAmC,CAAC;AAClG,OAAO,EAAC,cAAc,EAAC,MAAM,6BAA6B,CAAC;AAG3D,OAAO,EAAC,OAAO,EAAE,yBAAyB,EAAC,MAAM,kBAAkB,CAAC;AACpE,OAAO,EAkBL,kBAAkB,EAElB,kBAAkB,GAGnB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAC,qBAAqB,EAAE,wBAAwB,EAAC,MAAM,kCAAkC,CAAC;AACjG,OAAO,EAAC,sBAAsB,EAAC,MAAM,gCAAgC,CAAC;AAItE,OAAO,EAQL,uBAAuB,EACvB,+BAA+B,GAChC,MAAM,wBAAwB,CAAC;AAGhC,OAAO,EAAC,4BAA4B,EAAC,MAAM,0CAA0C,CAAC;AACtF,OAAO,EAAC,qBAAqB,EAAE,wBAAwB,EAAC,MAAM,0BAA0B,CAAC;AAEzF,OAAO,EAAC,0BAA0B,EAAC,MAAM,mCAAmC,CAAC;AAC7E,OAAO,EAAC,mBAAmB,EAAC,MAA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,IAAI;KACtB,CACF,CAAC;IAEF,OAAO,IAAI,eAAe,CAAC,WAAW,CAAC,CAAC;AAC1C,CAAC;AAED;;GAEG;AACH,SAAS,eAAe,CAAC,KAA0B,EAAE,YAA4B;IAC/E,oDAAoD;IAEpD,MAAM,QAAQ,GAAG,KAAK,CAAC,UAAU,CAAC,MAAM,CAAC;IACzC,KAAK,IAAI,CAAC,GAAG,YAAY,CAAC,IAAI,EAAE,CAAC,GAAG,QAAQ,EAAE,CAAC,EAAE,EAAE,CAAC;QAClD,MAAM,MAAM,GAAG,KAAK,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC;QACtD,YAAY,CAAC,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;IAC9B,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/stateView/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,gBAAgB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/stateView/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { CompactMultiProof } from "@chainsafe/persistent-merkle-tree";
|
|
2
|
+
import { ByteViews } from "@chainsafe/ssz";
|
|
3
|
+
import { BeaconBlock, BlindedBeaconBlock, BuilderIndex, Bytes32, Epoch, ExecutionPayloadBid, ExecutionPayloadHeader, Root, RootHex, SignedBeaconBlock, SignedBlindedBeaconBlock, Slot, ValidatorIndex, altair, capella, electra, fulu, gloas, phase0, rewards } from "@lodestar/types";
|
|
4
|
+
import { Checkpoint, Fork } from "@lodestar/types/phase0";
|
|
5
|
+
import { VoluntaryExitValidity } from "../block/processVoluntaryExit.js";
|
|
6
|
+
import { EffectiveBalanceIncrements } from "../cache/effectiveBalanceIncrements.js";
|
|
7
|
+
import { EpochTransitionCacheOpts } from "../cache/epochTransitionCache.js";
|
|
8
|
+
import { RewardCache } from "../cache/rewardCache.js";
|
|
9
|
+
import { SyncCommitteeCache } from "../cache/syncCommitteeCache.js";
|
|
10
|
+
import { SyncCommitteeWitness } from "../lightClient/types.js";
|
|
11
|
+
import { StateTransitionModules, StateTransitionOpts } from "../stateTransition.js";
|
|
12
|
+
import { EpochShuffling } from "../util/epochShuffling.js";
|
|
13
|
+
/**
|
|
14
|
+
* A read-only view of the BeaconState.
|
|
15
|
+
*/
|
|
16
|
+
export interface IBeaconStateView {
|
|
17
|
+
slot: Slot;
|
|
18
|
+
fork: Fork;
|
|
19
|
+
epoch: Epoch;
|
|
20
|
+
genesisTime: number;
|
|
21
|
+
genesisValidatorsRoot: Root;
|
|
22
|
+
eth1Data: phase0.Eth1Data;
|
|
23
|
+
latestBlockHeader: phase0.BeaconBlockHeader;
|
|
24
|
+
previousJustifiedCheckpoint: Checkpoint;
|
|
25
|
+
currentJustifiedCheckpoint: Checkpoint;
|
|
26
|
+
finalizedCheckpoint: Checkpoint;
|
|
27
|
+
getBlockRootAtSlot(slot: Slot): Root;
|
|
28
|
+
getBlockRootAtEpoch(epoch: Epoch): Root;
|
|
29
|
+
getStateRootAtSlot(slot: Slot): Root;
|
|
30
|
+
getRandaoMix(epoch: Epoch): Bytes32;
|
|
31
|
+
previousEpochParticipation: number[];
|
|
32
|
+
currentEpochParticipation: number[];
|
|
33
|
+
latestExecutionPayloadHeader: ExecutionPayloadHeader;
|
|
34
|
+
historicalSummaries: capella.HistoricalSummaries;
|
|
35
|
+
pendingDeposits: electra.PendingDeposits;
|
|
36
|
+
pendingDepositsCount: number;
|
|
37
|
+
pendingPartialWithdrawals: electra.PendingPartialWithdrawals;
|
|
38
|
+
pendingPartialWithdrawalsCount: number;
|
|
39
|
+
pendingConsolidations: electra.PendingConsolidations;
|
|
40
|
+
pendingConsolidationsCount: number;
|
|
41
|
+
proposerLookahead: fulu.ProposerLookahead;
|
|
42
|
+
executionPayloadAvailability: boolean[];
|
|
43
|
+
latestExecutionPayloadBid: ExecutionPayloadBid;
|
|
44
|
+
getBuilder(index: BuilderIndex): gloas.Builder;
|
|
45
|
+
canBuilderCoverBid(builderIndex: BuilderIndex, bidAmount: number): boolean;
|
|
46
|
+
validatorPTCCommitteeIndex(validatorIndex: ValidatorIndex, slot: Slot): number;
|
|
47
|
+
getShufflingAtEpoch(epoch: Epoch): EpochShuffling;
|
|
48
|
+
previousDecisionRoot: RootHex;
|
|
49
|
+
currentDecisionRoot: RootHex;
|
|
50
|
+
nextDecisionRoot: RootHex;
|
|
51
|
+
getShufflingDecisionRoot(epoch: Epoch): RootHex;
|
|
52
|
+
getPreviousShuffling(): EpochShuffling;
|
|
53
|
+
getCurrentShuffling(): EpochShuffling;
|
|
54
|
+
getNextShuffling(): EpochShuffling;
|
|
55
|
+
previousProposers: ValidatorIndex[] | null;
|
|
56
|
+
currentProposers: ValidatorIndex[];
|
|
57
|
+
nextProposers: ValidatorIndex[];
|
|
58
|
+
getBeaconProposer(slot: Slot): ValidatorIndex;
|
|
59
|
+
computeAnchorCheckpoint(): {
|
|
60
|
+
checkpoint: phase0.Checkpoint;
|
|
61
|
+
blockHeader: phase0.BeaconBlockHeader;
|
|
62
|
+
};
|
|
63
|
+
currentSyncCommittee: altair.SyncCommittee;
|
|
64
|
+
nextSyncCommittee: altair.SyncCommittee;
|
|
65
|
+
currentSyncCommitteeIndexed: SyncCommitteeCache;
|
|
66
|
+
syncProposerReward: number;
|
|
67
|
+
getIndexedSyncCommitteeAtEpoch(epoch: Epoch): SyncCommitteeCache;
|
|
68
|
+
effectiveBalanceIncrements: EffectiveBalanceIncrements;
|
|
69
|
+
getEffectiveBalanceIncrementsZeroInactive(): EffectiveBalanceIncrements;
|
|
70
|
+
getBalance(index: number): number;
|
|
71
|
+
getValidator(index: ValidatorIndex): phase0.Validator;
|
|
72
|
+
getValidatorsByStatus(statuses: Set<string>, currentEpoch: Epoch): phase0.Validator[];
|
|
73
|
+
validatorCount: number;
|
|
74
|
+
activeValidatorCount: number;
|
|
75
|
+
getAllValidators(): phase0.Validator[];
|
|
76
|
+
getAllBalances(): number[];
|
|
77
|
+
isExecutionStateType: boolean;
|
|
78
|
+
isMergeTransitionComplete: boolean;
|
|
79
|
+
isExecutionEnabled(block: BeaconBlock | BlindedBeaconBlock): boolean;
|
|
80
|
+
getExpectedWithdrawals(): {
|
|
81
|
+
expectedWithdrawals: capella.Withdrawal[];
|
|
82
|
+
processedBuilderWithdrawalsCount: number;
|
|
83
|
+
processedPartialWithdrawalsCount: number;
|
|
84
|
+
processedValidatorSweepCount: number;
|
|
85
|
+
};
|
|
86
|
+
proposerRewards: RewardCache;
|
|
87
|
+
computeBlockRewards(block: BeaconBlock, proposerRewards?: RewardCache): Promise<rewards.BlockRewards>;
|
|
88
|
+
computeAttestationsRewards(validatorIds?: (ValidatorIndex | string)[]): Promise<rewards.AttestationsRewards>;
|
|
89
|
+
computeSyncCommitteeRewards(block: BeaconBlock, validatorIds: (ValidatorIndex | string)[]): Promise<rewards.SyncCommitteeRewards>;
|
|
90
|
+
getLatestWeakSubjectivityCheckpointEpoch(): Epoch;
|
|
91
|
+
getVoluntaryExitValidity(signedVoluntaryExit: phase0.SignedVoluntaryExit, verifySignature: boolean): VoluntaryExitValidity;
|
|
92
|
+
isValidVoluntaryExit(signedVoluntaryExit: phase0.SignedVoluntaryExit, verifySignature: boolean): boolean;
|
|
93
|
+
getFinalizedRootProof(): Uint8Array[];
|
|
94
|
+
getSyncCommitteesWitness(): SyncCommitteeWitness;
|
|
95
|
+
getSingleProof(gindex: bigint): Uint8Array[];
|
|
96
|
+
createMultiProof(descriptor: Uint8Array): CompactMultiProof;
|
|
97
|
+
computeUnrealizedCheckpoints(): {
|
|
98
|
+
justifiedCheckpoint: phase0.Checkpoint;
|
|
99
|
+
finalizedCheckpoint: phase0.Checkpoint;
|
|
100
|
+
};
|
|
101
|
+
clonedCount: number;
|
|
102
|
+
clonedCountWithTransferCache: number;
|
|
103
|
+
createdWithTransferCache: boolean;
|
|
104
|
+
isStateValidatorsNodesPopulated(): boolean;
|
|
105
|
+
loadOtherState(stateBytes: Uint8Array, seedValidatorsBytes?: Uint8Array): IBeaconStateView;
|
|
106
|
+
serialize(): Uint8Array;
|
|
107
|
+
serializedSize(): number;
|
|
108
|
+
serializeToBytes(output: ByteViews, offset: number): number;
|
|
109
|
+
serializeValidators(): Uint8Array;
|
|
110
|
+
serializedValidatorsSize(): number;
|
|
111
|
+
serializeValidatorsToBytes(output: ByteViews, offset: number): number;
|
|
112
|
+
hashTreeRoot(): Uint8Array;
|
|
113
|
+
stateTransition(signedBlock: SignedBeaconBlock | SignedBlindedBeaconBlock, options: StateTransitionOpts, modules: StateTransitionModules): IBeaconStateView;
|
|
114
|
+
processSlots(slot: Slot, epochTransitionCacheOpts?: EpochTransitionCacheOpts & {
|
|
115
|
+
dontTransferCache?: boolean;
|
|
116
|
+
}, modules?: StateTransitionModules): IBeaconStateView;
|
|
117
|
+
}
|
|
118
|
+
//# sourceMappingURL=interface.d.ts.map
|