@lodestar/state-transition 1.50.0-dev.023ad6c012 → 1.50.0-dev.03c05fa09a
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.map +1 -1
- package/lib/block/index.js +1 -1
- package/lib/block/index.js.map +1 -1
- package/lib/block/processDeposit.d.ts +2 -2
- package/lib/block/processDeposit.d.ts.map +1 -1
- package/lib/block/processDeposit.js.map +1 -1
- package/lib/block/processEth1Data.d.ts +3 -3
- package/lib/block/processEth1Data.d.ts.map +1 -1
- package/lib/block/processEth1Data.js.map +1 -1
- package/lib/block/processOperations.d.ts.map +1 -1
- package/lib/block/processOperations.js +8 -6
- package/lib/block/processOperations.js.map +1 -1
- package/lib/block/processParentExecutionPayload.d.ts.map +1 -1
- package/lib/block/processParentExecutionPayload.js +17 -16
- package/lib/block/processParentExecutionPayload.js.map +1 -1
- package/lib/block/processProposerSlashing.d.ts.map +1 -1
- package/lib/block/processProposerSlashing.js +0 -23
- package/lib/block/processProposerSlashing.js.map +1 -1
- package/lib/block/slashValidator.d.ts.map +1 -1
- package/lib/block/slashValidator.js +11 -0
- package/lib/block/slashValidator.js.map +1 -1
- package/lib/cache/stateCache.d.ts +2 -1
- package/lib/cache/stateCache.d.ts.map +1 -1
- package/lib/cache/stateCache.js.map +1 -1
- package/lib/cache/types.d.ts +2 -1
- package/lib/cache/types.d.ts.map +1 -1
- package/lib/epoch/index.d.ts.map +1 -1
- package/lib/epoch/index.js +3 -1
- package/lib/epoch/index.js.map +1 -1
- package/lib/epoch/processEth1DataReset.d.ts +2 -2
- package/lib/epoch/processEth1DataReset.d.ts.map +1 -1
- package/lib/epoch/processEth1DataReset.js.map +1 -1
- package/lib/epoch/processPendingDeposits.d.ts.map +1 -1
- package/lib/epoch/processPendingDeposits.js +8 -4
- package/lib/epoch/processPendingDeposits.js.map +1 -1
- package/lib/index.d.ts +3 -2
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -1
- package/lib/signatureSets/index.d.ts.map +1 -1
- package/lib/signatureSets/index.js +2 -2
- package/lib/signatureSets/index.js.map +1 -1
- package/lib/signatureSets/voluntaryExits.d.ts +2 -6
- package/lib/signatureSets/voluntaryExits.d.ts.map +1 -1
- package/lib/signatureSets/voluntaryExits.js +2 -32
- package/lib/signatureSets/voluntaryExits.js.map +1 -1
- package/lib/slot/upgradeStateToHeze.d.ts.map +1 -1
- package/lib/slot/upgradeStateToHeze.js +4 -4
- package/lib/slot/upgradeStateToHeze.js.map +1 -1
- package/lib/stateView/beaconStateView.d.ts +23 -21
- package/lib/stateView/beaconStateView.d.ts.map +1 -1
- package/lib/stateView/beaconStateView.js +77 -71
- package/lib/stateView/beaconStateView.js.map +1 -1
- package/lib/stateView/interface.d.ts +37 -21
- package/lib/stateView/interface.d.ts.map +1 -1
- package/lib/stateView/interface.js.map +1 -1
- package/lib/stateView/nativeBeaconStateView.d.ts +94 -100
- package/lib/stateView/nativeBeaconStateView.d.ts.map +1 -1
- package/lib/stateView/nativeBeaconStateView.js +353 -368
- package/lib/stateView/nativeBeaconStateView.js.map +1 -1
- package/lib/stateView/stateViewFactory.d.ts +6 -5
- package/lib/stateView/stateViewFactory.d.ts.map +1 -1
- package/lib/stateView/stateViewFactory.js +12 -8
- package/lib/stateView/stateViewFactory.js.map +1 -1
- package/lib/types.d.ts +2 -2
- package/lib/types.d.ts.map +1 -1
- package/lib/util/blindedBlock.d.ts +1 -1
- package/lib/util/blindedBlock.d.ts.map +1 -1
- package/lib/util/blindedBlock.js +5 -2
- package/lib/util/blindedBlock.js.map +1 -1
- package/lib/util/clock.d.ts +5 -0
- package/lib/util/clock.d.ts.map +1 -1
- package/lib/util/clock.js +19 -16
- package/lib/util/clock.js.map +1 -1
- package/lib/util/deposit.d.ts +2 -2
- package/lib/util/deposit.d.ts.map +1 -1
- package/lib/util/deposit.js.map +1 -1
- package/lib/util/genesis.d.ts.map +1 -1
- package/lib/util/genesis.js +46 -23
- package/lib/util/genesis.js.map +1 -1
- package/lib/util/slot.d.ts +3 -1
- package/lib/util/slot.d.ts.map +1 -1
- package/lib/util/slot.js +4 -0
- package/lib/util/slot.js.map +1 -1
- package/package.json +8 -8
- package/src/block/index.ts +4 -3
- package/src/block/processDeposit.ts +7 -2
- package/src/block/processEth1Data.ts +3 -3
- package/src/block/processOperations.ts +14 -11
- package/src/block/processParentExecutionPayload.ts +18 -17
- package/src/block/processProposerSlashing.ts +2 -28
- package/src/block/slashValidator.ts +13 -2
- package/src/cache/stateCache.ts +2 -0
- package/src/cache/types.ts +2 -1
- package/src/epoch/index.ts +4 -1
- package/src/epoch/processEth1DataReset.ts +2 -2
- package/src/epoch/processPendingDeposits.ts +14 -3
- package/src/index.ts +5 -1
- package/src/signatureSets/index.ts +4 -2
- package/src/signatureSets/voluntaryExits.ts +3 -55
- package/src/slot/upgradeStateToHeze.ts +6 -4
- package/src/stateView/beaconStateView.ts +84 -77
- package/src/stateView/interface.ts +65 -21
- package/src/stateView/nativeBeaconStateView.ts +368 -375
- package/src/stateView/stateViewFactory.ts +21 -12
- package/src/types.ts +2 -0
- package/src/util/blindedBlock.ts +8 -3
- package/src/util/clock.ts +25 -16
- package/src/util/deposit.ts +2 -2
- package/src/util/genesis.ts +56 -30
- package/src/util/slot.ts +6 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import {CompactMultiProof} from "@chainsafe/persistent-merkle-tree";
|
|
2
2
|
import {BitArray, ByteViews} from "@chainsafe/ssz";
|
|
3
|
+
import type {BeaconConfig} from "@lodestar/config";
|
|
3
4
|
import {ForkName, ForkSeq} from "@lodestar/params";
|
|
4
5
|
import {
|
|
5
6
|
BeaconBlock,
|
|
@@ -23,38 +24,38 @@ import {
|
|
|
23
24
|
electra,
|
|
24
25
|
fulu,
|
|
25
26
|
gloas,
|
|
27
|
+
isBlindedBeaconBlock,
|
|
26
28
|
phase0,
|
|
27
29
|
rewards,
|
|
30
|
+
ssz,
|
|
28
31
|
} from "@lodestar/types";
|
|
29
32
|
import {Checkpoint, Fork} from "@lodestar/types/phase0";
|
|
30
33
|
import {VoluntaryExitValidity} from "../block/processVoluntaryExit.js";
|
|
31
34
|
import {EffectiveBalanceIncrements} from "../cache/effectiveBalanceIncrements.js";
|
|
32
35
|
import {RewardCache} from "../cache/rewardCache.js";
|
|
33
36
|
import {SyncCommitteeCache} from "../cache/syncCommitteeCache.js";
|
|
37
|
+
import {EMPTY_SIGNATURE} from "../constants/constants.js";
|
|
34
38
|
import {SyncCommitteeWitness} from "../lightClient/types.js";
|
|
35
39
|
import {StateTransitionModules, StateTransitionOpts} from "../stateTransition.js";
|
|
36
40
|
import {EpochShuffling} from "../util/epochShuffling.js";
|
|
37
41
|
import {PreVerifyBuilderDepositsResult} from "../util/preVerifyBuilderDeposits.js";
|
|
38
42
|
import {computeNewStateRootStateTransitionOpts, getComputeNewStateRootResult} from "./computeNewStateRoot.js";
|
|
39
43
|
import {
|
|
40
|
-
|
|
44
|
+
BlockSTFInput,
|
|
41
45
|
ComputeNewStateRootResult,
|
|
42
46
|
IBeaconStateView,
|
|
43
47
|
IBeaconStateViewGloas,
|
|
44
48
|
IBeaconStateViewLatestFork,
|
|
45
49
|
IBeaconStateViewNative,
|
|
46
|
-
isStatePostGloas,
|
|
47
50
|
} from "./interface.js";
|
|
48
51
|
|
|
49
52
|
/**
|
|
50
53
|
* Wraps a native binding (the auto-generated JS interface produced by a `.node`
|
|
51
54
|
* file) and exposes it as a fully-conformant `IBeaconStateViewLatestFork`.
|
|
52
55
|
*
|
|
53
|
-
* The binding is typed `IBeaconStateViewNative
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
* that POJO back to a `BitArray` so beacon-node consumers see no difference from
|
|
57
|
-
* the TS-side `BeaconStateView`.
|
|
56
|
+
* The binding is typed `IBeaconStateViewNative`. This type models FFI-specific
|
|
57
|
+
* inputs and outputs, such as serialized blocks and typed arrays. The wrapper
|
|
58
|
+
* converts those values to the forms used by `IBeaconStateViewLatestFork`.
|
|
58
59
|
*
|
|
59
60
|
* Every getter that returns a value stable for the view's lifetime is cached so
|
|
60
61
|
* the binding is hit at most once per field per view. Only mutable counters
|
|
@@ -64,109 +65,98 @@ import {
|
|
|
64
65
|
*/
|
|
65
66
|
export class NativeBeaconStateView implements IBeaconStateViewLatestFork {
|
|
66
67
|
// phase0
|
|
67
|
-
private
|
|
68
|
-
private
|
|
69
|
-
private
|
|
70
|
-
private
|
|
71
|
-
private
|
|
72
|
-
private
|
|
73
|
-
private
|
|
74
|
-
private
|
|
75
|
-
private
|
|
76
|
-
private
|
|
77
|
-
private
|
|
78
|
-
private
|
|
68
|
+
private cachedForkName: ForkName | null = null;
|
|
69
|
+
private cachedForkSeq: ForkSeq | null = null;
|
|
70
|
+
private cachedSlot: Slot | null = null;
|
|
71
|
+
private cachedFork: Fork | null = null;
|
|
72
|
+
private cachedEpoch: Epoch | null = null;
|
|
73
|
+
private cachedGenesisTime: number | null = null;
|
|
74
|
+
private cachedGenesisValidatorsRoot: Root | null = null;
|
|
75
|
+
private cachedEth1Data: phase0.Eth1Data | null = null;
|
|
76
|
+
private cachedLatestBlockHeader: phase0.BeaconBlockHeader | null = null;
|
|
77
|
+
private cachedPreviousJustifiedCheckpoint: Checkpoint | null = null;
|
|
78
|
+
private cachedCurrentJustifiedCheckpoint: Checkpoint | null = null;
|
|
79
|
+
private cachedFinalizedCheckpoint: Checkpoint | null = null;
|
|
79
80
|
// shuffling / decision roots / proposers
|
|
80
|
-
private
|
|
81
|
-
private
|
|
82
|
-
private
|
|
81
|
+
private cachedPreviousDecisionRoot: RootHex | null = null;
|
|
82
|
+
private cachedCurrentDecisionRoot: RootHex | null = null;
|
|
83
|
+
private cachedNextDecisionRoot: RootHex | null = null;
|
|
83
84
|
// previousProposers can be null, so use undefined as the "not loaded" sentinel
|
|
84
|
-
private
|
|
85
|
-
private
|
|
86
|
-
private
|
|
85
|
+
private cachedPreviousProposers: ValidatorIndex[] | null | undefined = undefined;
|
|
86
|
+
private cachedCurrentProposers: ValidatorIndex[] | null = null;
|
|
87
|
+
private cachedNextProposers: ValidatorIndex[] | null = null;
|
|
87
88
|
// validators / balances
|
|
88
|
-
private
|
|
89
|
-
private
|
|
90
|
-
private
|
|
89
|
+
private cachedEffectiveBalanceIncrements: EffectiveBalanceIncrements | null = null;
|
|
90
|
+
private cachedValidatorCount: number | null = null;
|
|
91
|
+
private cachedActiveValidatorCount: number | null = null;
|
|
91
92
|
// backward compat
|
|
92
|
-
private
|
|
93
|
+
private cachedCreatedWithTransferCache: boolean | null = null;
|
|
93
94
|
// altair
|
|
94
|
-
private
|
|
95
|
-
private
|
|
96
|
-
private
|
|
97
|
-
private
|
|
98
|
-
private
|
|
99
|
-
private
|
|
95
|
+
private cachedCurrentSyncCommittee: SyncCommittee | null = null;
|
|
96
|
+
private cachedNextSyncCommittee: SyncCommittee | null = null;
|
|
97
|
+
private cachedPreviousEpochParticipation: Uint8Array | null = null;
|
|
98
|
+
private cachedCurrentEpochParticipation: Uint8Array | null = null;
|
|
99
|
+
private cachedCurrentSyncCommitteeIndexed: SyncCommitteeCache | null = null;
|
|
100
|
+
private cachedCurrentSyncCommitteeValidatorIndices: Uint32Array | null = null;
|
|
101
|
+
private cachedSyncProposerReward: number | null = null;
|
|
100
102
|
// bellatrix
|
|
101
|
-
private
|
|
102
|
-
private
|
|
103
|
-
private
|
|
104
|
-
private
|
|
103
|
+
private cachedLatestExecutionPayloadHeader: ExecutionPayloadHeader | null = null;
|
|
104
|
+
private cachedPayloadBlockNumber: number | null = null;
|
|
105
|
+
private cachedIsExecutionStateType: boolean | null = null;
|
|
106
|
+
private cachedIsMergeTransitionComplete: boolean | null = null;
|
|
105
107
|
// capella
|
|
106
|
-
private
|
|
108
|
+
private cachedHistoricalSummaries: capella.HistoricalSummaries | null = null;
|
|
107
109
|
// electra
|
|
108
|
-
private
|
|
109
|
-
private
|
|
110
|
-
private
|
|
111
|
-
private
|
|
112
|
-
private
|
|
113
|
-
private
|
|
110
|
+
private cachedPendingPartialWithdrawals: electra.PendingPartialWithdrawals | null = null;
|
|
111
|
+
private cachedPendingConsolidations: electra.PendingConsolidations | null = null;
|
|
112
|
+
private cachedPendingDeposits: electra.PendingDeposits | null = null;
|
|
113
|
+
private cachedPendingDepositsCount: number | null = null;
|
|
114
|
+
private cachedPendingPartialWithdrawalsCount: number | null = null;
|
|
115
|
+
private cachedPendingConsolidationsCount: number | null = null;
|
|
114
116
|
// fulu
|
|
115
|
-
private
|
|
116
|
-
// gloas
|
|
117
|
-
private _executionPayloadAvailability: BitArray | null = null;
|
|
118
|
-
private _latestBlockHash: Bytes32 | null = null;
|
|
119
|
-
private _latestExecutionPayloadBid: ExecutionPayloadBid | null = null;
|
|
120
|
-
private _payloadExpectedWithdrawals: capella.Withdrawal[] | null = null;
|
|
121
|
-
private _builderPendingPayments: gloas.BuilderPendingPayments | null = null;
|
|
122
|
-
private _builderPendingWithdrawals: gloas.BuilderPendingWithdrawals | null = null;
|
|
123
|
-
|
|
117
|
+
private cachedProposerLookahead: fulu.ProposerLookahead | null = null;
|
|
124
118
|
// Per-argument caches for argument-taking methods. The binding is treated as
|
|
125
119
|
// immutable for the view's lifetime, so a given argument always yields the
|
|
126
120
|
// same result. Maps grow only with touched arguments — typical call patterns
|
|
127
121
|
// (e.g. a handful of slots per attestation pool scan) keep them tiny.
|
|
128
|
-
private readonly
|
|
129
|
-
private readonly
|
|
130
|
-
private readonly
|
|
131
|
-
private readonly
|
|
132
|
-
private readonly
|
|
133
|
-
private readonly
|
|
134
|
-
private readonly
|
|
135
|
-
private readonly
|
|
136
|
-
private readonly
|
|
137
|
-
private readonly
|
|
138
|
-
private readonly
|
|
139
|
-
private readonly
|
|
140
|
-
private readonly
|
|
141
|
-
private readonly
|
|
142
|
-
private readonly _getEpochPTCs = new Map<Epoch, Uint32Array[]>();
|
|
143
|
-
private readonly _getBuilder = new Map<BuilderIndex, gloas.Builder>();
|
|
122
|
+
private readonly cachedBlockRootAtSlot = new Map<Slot, Root>();
|
|
123
|
+
private readonly cachedBlockRootAtEpoch = new Map<Epoch, Root>();
|
|
124
|
+
private readonly cachedStateRootAtSlot = new Map<Slot, Root>();
|
|
125
|
+
private readonly cachedRandaoMix = new Map<Epoch, Bytes32>();
|
|
126
|
+
private readonly cachedShufflingAtEpoch = new Map<Epoch, EpochShuffling>();
|
|
127
|
+
private readonly cachedBeaconCommittee = new Map<string, Uint32Array>();
|
|
128
|
+
private readonly cachedBeaconCommitteeCountPerSlot = new Map<Epoch, number>();
|
|
129
|
+
private readonly cachedShufflingDecisionRoot = new Map<Epoch, RootHex>();
|
|
130
|
+
private readonly cachedBeaconProposer = new Map<Slot, ValidatorIndex>();
|
|
131
|
+
private readonly cachedValidator = new Map<ValidatorIndex, phase0.Validator>();
|
|
132
|
+
private readonly cachedBalance = new Map<number, number>();
|
|
133
|
+
private readonly cachedIndexedSyncCommitteeAtEpoch = new Map<Epoch, SyncCommitteeCache>();
|
|
134
|
+
private readonly cachedIndexedSyncCommittee = new Map<Slot, SyncCommitteeCache>();
|
|
135
|
+
private readonly cachedSingleProof = new Map<bigint, Uint8Array[]>();
|
|
144
136
|
|
|
145
137
|
// No-arg method caches
|
|
146
|
-
private
|
|
147
|
-
private
|
|
148
|
-
private
|
|
149
|
-
private
|
|
150
|
-
private
|
|
151
|
-
private
|
|
152
|
-
private
|
|
153
|
-
private
|
|
154
|
-
private
|
|
155
|
-
private _computeUnrealizedCheckpoints: {
|
|
138
|
+
private cachedPreviousShuffling: EpochShuffling | null = null;
|
|
139
|
+
private cachedCurrentShuffling: EpochShuffling | null = null;
|
|
140
|
+
private cachedNextShuffling: EpochShuffling | null = null;
|
|
141
|
+
private cachedEffectiveBalanceIncrementsZeroInactive: EffectiveBalanceIncrements | null = null;
|
|
142
|
+
private cachedAllValidators: phase0.Validator[] | null = null;
|
|
143
|
+
private cachedAllBalances: number[] | null = null;
|
|
144
|
+
private cachedLatestWeakSubjectivityCheckpointEpoch: Epoch | null = null;
|
|
145
|
+
private cachedFinalizedRootProof: Uint8Array[] | null = null;
|
|
146
|
+
private cachedUnrealizedCheckpoints: {
|
|
156
147
|
justifiedCheckpoint: phase0.Checkpoint;
|
|
157
148
|
finalizedCheckpoint: phase0.Checkpoint;
|
|
158
149
|
} | null = null;
|
|
159
|
-
private
|
|
160
|
-
|
|
161
|
-
private
|
|
162
|
-
private
|
|
163
|
-
private
|
|
164
|
-
private
|
|
165
|
-
private
|
|
166
|
-
private
|
|
167
|
-
private
|
|
168
|
-
private
|
|
169
|
-
private _getExpectedWithdrawals: {
|
|
150
|
+
private cachedAnchorCheckpoint: {checkpoint: phase0.Checkpoint; blockHeader: phase0.BeaconBlockHeader} | null = null;
|
|
151
|
+
private cachedIsStateValidatorsNodesPopulated: boolean | null = null;
|
|
152
|
+
private cachedValue: BeaconState | null = null;
|
|
153
|
+
private cachedSerialized: Uint8Array | null = null;
|
|
154
|
+
private cachedSerializedSize: number | null = null;
|
|
155
|
+
private cachedSerializedValidators: Uint8Array | null = null;
|
|
156
|
+
private cachedSerializedValidatorsSize: number | null = null;
|
|
157
|
+
private cachedHashTreeRoot: Uint8Array | null = null;
|
|
158
|
+
private cachedSyncCommitteesWitness: SyncCommitteeWitness | null = null;
|
|
159
|
+
private cachedExpectedWithdrawals: {
|
|
170
160
|
expectedWithdrawals: capella.Withdrawal[];
|
|
171
161
|
processedBuilderWithdrawalsCount: number;
|
|
172
162
|
processedPartialWithdrawalsCount: number;
|
|
@@ -174,137 +164,140 @@ export class NativeBeaconStateView implements IBeaconStateViewLatestFork {
|
|
|
174
164
|
processedValidatorSweepCount: number;
|
|
175
165
|
} | null = null;
|
|
176
166
|
|
|
177
|
-
constructor(
|
|
167
|
+
constructor(
|
|
168
|
+
private readonly config: BeaconConfig,
|
|
169
|
+
readonly binding: IBeaconStateViewNative
|
|
170
|
+
) {}
|
|
178
171
|
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
if (this._executionPayloadAvailability === null) {
|
|
183
|
-
const pojo = this.binding.executionPayloadAvailability;
|
|
184
|
-
this._executionPayloadAvailability = new BitArray(pojo.uint8Array, pojo.bitLen);
|
|
185
|
-
}
|
|
172
|
+
release(): void {
|
|
173
|
+
this.binding.release();
|
|
174
|
+
}
|
|
186
175
|
|
|
187
|
-
|
|
176
|
+
get executionPayloadAvailability(): BitArray {
|
|
177
|
+
throw new Error("NativeBeaconStateView does not support Gloas");
|
|
188
178
|
}
|
|
189
179
|
|
|
190
180
|
// ─── phase0 ──────────────────────────────────────────────────────────────
|
|
191
181
|
|
|
192
182
|
get forkName(): ForkName {
|
|
193
|
-
if (this.
|
|
194
|
-
this.
|
|
183
|
+
if (this.cachedForkName === null) {
|
|
184
|
+
this.cachedForkName = this.binding.forkName;
|
|
195
185
|
}
|
|
196
|
-
return this.
|
|
186
|
+
return this.cachedForkName;
|
|
197
187
|
}
|
|
198
188
|
|
|
199
189
|
get forkSeq(): ForkSeq {
|
|
200
|
-
if (this.
|
|
201
|
-
this.
|
|
190
|
+
if (this.cachedForkSeq === null) {
|
|
191
|
+
this.cachedForkSeq = this.binding.forkSeq;
|
|
202
192
|
}
|
|
203
|
-
return this.
|
|
193
|
+
return this.cachedForkSeq;
|
|
204
194
|
}
|
|
205
195
|
|
|
206
196
|
get slot(): Slot {
|
|
207
|
-
if (this.
|
|
208
|
-
this.
|
|
197
|
+
if (this.cachedSlot === null) {
|
|
198
|
+
this.cachedSlot = this.binding.slot;
|
|
209
199
|
}
|
|
210
|
-
return this.
|
|
200
|
+
return this.cachedSlot;
|
|
211
201
|
}
|
|
212
202
|
|
|
213
203
|
get fork(): Fork {
|
|
214
|
-
if (this.
|
|
215
|
-
this.
|
|
204
|
+
if (this.cachedFork === null) {
|
|
205
|
+
this.cachedFork = this.binding.fork;
|
|
216
206
|
}
|
|
217
|
-
return this.
|
|
207
|
+
return this.cachedFork;
|
|
218
208
|
}
|
|
219
209
|
|
|
220
210
|
get epoch(): Epoch {
|
|
221
|
-
if (this.
|
|
222
|
-
this.
|
|
211
|
+
if (this.cachedEpoch === null) {
|
|
212
|
+
this.cachedEpoch = this.binding.epoch;
|
|
223
213
|
}
|
|
224
|
-
return this.
|
|
214
|
+
return this.cachedEpoch;
|
|
225
215
|
}
|
|
226
216
|
|
|
227
217
|
get genesisTime(): number {
|
|
228
|
-
if (this.
|
|
229
|
-
this.
|
|
218
|
+
if (this.cachedGenesisTime === null) {
|
|
219
|
+
this.cachedGenesisTime = this.binding.genesisTime;
|
|
230
220
|
}
|
|
231
|
-
return this.
|
|
221
|
+
return this.cachedGenesisTime;
|
|
232
222
|
}
|
|
233
223
|
|
|
234
224
|
get genesisValidatorsRoot(): Root {
|
|
235
|
-
if (this.
|
|
236
|
-
this.
|
|
225
|
+
if (this.cachedGenesisValidatorsRoot === null) {
|
|
226
|
+
this.cachedGenesisValidatorsRoot = this.binding.genesisValidatorsRoot;
|
|
237
227
|
}
|
|
238
|
-
return this.
|
|
228
|
+
return this.cachedGenesisValidatorsRoot;
|
|
239
229
|
}
|
|
240
230
|
|
|
241
231
|
get eth1Data(): phase0.Eth1Data {
|
|
242
|
-
if (this.
|
|
243
|
-
|
|
232
|
+
if (this.forkSeq >= ForkSeq.heze) {
|
|
233
|
+
throw new Error("eth1Data was removed from the beacon state in Heze");
|
|
234
|
+
}
|
|
235
|
+
if (this.cachedEth1Data === null) {
|
|
236
|
+
this.cachedEth1Data = this.binding.eth1Data;
|
|
244
237
|
}
|
|
245
|
-
return this.
|
|
238
|
+
return this.cachedEth1Data;
|
|
246
239
|
}
|
|
247
240
|
|
|
248
241
|
get latestBlockHeader(): phase0.BeaconBlockHeader {
|
|
249
|
-
if (this.
|
|
250
|
-
this.
|
|
242
|
+
if (this.cachedLatestBlockHeader === null) {
|
|
243
|
+
this.cachedLatestBlockHeader = this.binding.latestBlockHeader;
|
|
251
244
|
}
|
|
252
|
-
return this.
|
|
245
|
+
return this.cachedLatestBlockHeader;
|
|
253
246
|
}
|
|
254
247
|
|
|
255
248
|
get previousJustifiedCheckpoint(): Checkpoint {
|
|
256
|
-
if (this.
|
|
257
|
-
this.
|
|
249
|
+
if (this.cachedPreviousJustifiedCheckpoint === null) {
|
|
250
|
+
this.cachedPreviousJustifiedCheckpoint = this.binding.previousJustifiedCheckpoint;
|
|
258
251
|
}
|
|
259
|
-
return this.
|
|
252
|
+
return this.cachedPreviousJustifiedCheckpoint;
|
|
260
253
|
}
|
|
261
254
|
|
|
262
255
|
get currentJustifiedCheckpoint(): Checkpoint {
|
|
263
|
-
if (this.
|
|
264
|
-
this.
|
|
256
|
+
if (this.cachedCurrentJustifiedCheckpoint === null) {
|
|
257
|
+
this.cachedCurrentJustifiedCheckpoint = this.binding.currentJustifiedCheckpoint;
|
|
265
258
|
}
|
|
266
|
-
return this.
|
|
259
|
+
return this.cachedCurrentJustifiedCheckpoint;
|
|
267
260
|
}
|
|
268
261
|
|
|
269
262
|
get finalizedCheckpoint(): Checkpoint {
|
|
270
|
-
if (this.
|
|
271
|
-
this.
|
|
263
|
+
if (this.cachedFinalizedCheckpoint === null) {
|
|
264
|
+
this.cachedFinalizedCheckpoint = this.binding.finalizedCheckpoint;
|
|
272
265
|
}
|
|
273
|
-
return this.
|
|
266
|
+
return this.cachedFinalizedCheckpoint;
|
|
274
267
|
}
|
|
275
268
|
|
|
276
269
|
getBlockRootAtSlot(slot: Slot): Root {
|
|
277
|
-
let cached = this.
|
|
270
|
+
let cached = this.cachedBlockRootAtSlot.get(slot);
|
|
278
271
|
if (cached === undefined) {
|
|
279
272
|
cached = this.binding.getBlockRootAtSlot(slot);
|
|
280
|
-
this.
|
|
273
|
+
this.cachedBlockRootAtSlot.set(slot, cached);
|
|
281
274
|
}
|
|
282
275
|
return cached;
|
|
283
276
|
}
|
|
284
277
|
|
|
285
278
|
getBlockRootAtEpoch(epoch: Epoch): Root {
|
|
286
|
-
let cached = this.
|
|
279
|
+
let cached = this.cachedBlockRootAtEpoch.get(epoch);
|
|
287
280
|
if (cached === undefined) {
|
|
288
281
|
cached = this.binding.getBlockRootAtEpoch(epoch);
|
|
289
|
-
this.
|
|
282
|
+
this.cachedBlockRootAtEpoch.set(epoch, cached);
|
|
290
283
|
}
|
|
291
284
|
return cached;
|
|
292
285
|
}
|
|
293
286
|
|
|
294
287
|
getStateRootAtSlot(slot: Slot): Root {
|
|
295
|
-
let cached = this.
|
|
288
|
+
let cached = this.cachedStateRootAtSlot.get(slot);
|
|
296
289
|
if (cached === undefined) {
|
|
297
290
|
cached = this.binding.getStateRootAtSlot(slot);
|
|
298
|
-
this.
|
|
291
|
+
this.cachedStateRootAtSlot.set(slot, cached);
|
|
299
292
|
}
|
|
300
293
|
return cached;
|
|
301
294
|
}
|
|
302
295
|
|
|
303
296
|
getRandaoMix(epoch: Epoch): Bytes32 {
|
|
304
|
-
let cached = this.
|
|
297
|
+
let cached = this.cachedRandaoMix.get(epoch);
|
|
305
298
|
if (cached === undefined) {
|
|
306
299
|
cached = this.binding.getRandaoMix(epoch);
|
|
307
|
-
this.
|
|
300
|
+
this.cachedRandaoMix.set(epoch, cached);
|
|
308
301
|
}
|
|
309
302
|
return cached;
|
|
310
303
|
}
|
|
@@ -312,112 +305,112 @@ export class NativeBeaconStateView implements IBeaconStateViewLatestFork {
|
|
|
312
305
|
// Shuffling and committees
|
|
313
306
|
|
|
314
307
|
getShufflingAtEpoch(epoch: Epoch): EpochShuffling {
|
|
315
|
-
let cached = this.
|
|
308
|
+
let cached = this.cachedShufflingAtEpoch.get(epoch);
|
|
316
309
|
if (cached === undefined) {
|
|
317
310
|
cached = this.binding.getShufflingAtEpoch(epoch);
|
|
318
|
-
this.
|
|
311
|
+
this.cachedShufflingAtEpoch.set(epoch, cached);
|
|
319
312
|
}
|
|
320
313
|
return cached;
|
|
321
314
|
}
|
|
322
315
|
|
|
323
316
|
getBeaconCommittee(slot: Slot, index: CommitteeIndex): Uint32Array {
|
|
324
317
|
const key = `${slot}:${index}`;
|
|
325
|
-
let cached = this.
|
|
318
|
+
let cached = this.cachedBeaconCommittee.get(key);
|
|
326
319
|
if (cached === undefined) {
|
|
327
320
|
cached = this.binding.getBeaconCommittee(slot, index);
|
|
328
|
-
this.
|
|
321
|
+
this.cachedBeaconCommittee.set(key, cached);
|
|
329
322
|
}
|
|
330
323
|
return cached;
|
|
331
324
|
}
|
|
332
325
|
|
|
333
326
|
getBeaconCommitteeCountPerSlot(epoch: Epoch): number {
|
|
334
|
-
let cached = this.
|
|
327
|
+
let cached = this.cachedBeaconCommitteeCountPerSlot.get(epoch);
|
|
335
328
|
if (cached === undefined) {
|
|
336
329
|
cached = this.binding.getBeaconCommitteeCountPerSlot(epoch);
|
|
337
|
-
this.
|
|
330
|
+
this.cachedBeaconCommitteeCountPerSlot.set(epoch, cached);
|
|
338
331
|
}
|
|
339
332
|
return cached;
|
|
340
333
|
}
|
|
341
334
|
|
|
342
335
|
get previousDecisionRoot(): RootHex {
|
|
343
|
-
if (this.
|
|
344
|
-
this.
|
|
336
|
+
if (this.cachedPreviousDecisionRoot === null) {
|
|
337
|
+
this.cachedPreviousDecisionRoot = this.binding.previousDecisionRoot;
|
|
345
338
|
}
|
|
346
|
-
return this.
|
|
339
|
+
return this.cachedPreviousDecisionRoot;
|
|
347
340
|
}
|
|
348
341
|
|
|
349
342
|
get currentDecisionRoot(): RootHex {
|
|
350
|
-
if (this.
|
|
351
|
-
this.
|
|
343
|
+
if (this.cachedCurrentDecisionRoot === null) {
|
|
344
|
+
this.cachedCurrentDecisionRoot = this.binding.currentDecisionRoot;
|
|
352
345
|
}
|
|
353
|
-
return this.
|
|
346
|
+
return this.cachedCurrentDecisionRoot;
|
|
354
347
|
}
|
|
355
348
|
|
|
356
349
|
get nextDecisionRoot(): RootHex {
|
|
357
|
-
if (this.
|
|
358
|
-
this.
|
|
350
|
+
if (this.cachedNextDecisionRoot === null) {
|
|
351
|
+
this.cachedNextDecisionRoot = this.binding.nextDecisionRoot;
|
|
359
352
|
}
|
|
360
|
-
return this.
|
|
353
|
+
return this.cachedNextDecisionRoot;
|
|
361
354
|
}
|
|
362
355
|
|
|
363
356
|
getShufflingDecisionRoot(epoch: Epoch): RootHex {
|
|
364
|
-
let cached = this.
|
|
357
|
+
let cached = this.cachedShufflingDecisionRoot.get(epoch);
|
|
365
358
|
if (cached === undefined) {
|
|
366
359
|
cached = this.binding.getShufflingDecisionRoot(epoch);
|
|
367
|
-
this.
|
|
360
|
+
this.cachedShufflingDecisionRoot.set(epoch, cached);
|
|
368
361
|
}
|
|
369
362
|
return cached;
|
|
370
363
|
}
|
|
371
364
|
|
|
372
365
|
getPreviousShuffling(): EpochShuffling {
|
|
373
|
-
if (this.
|
|
374
|
-
this.
|
|
366
|
+
if (this.cachedPreviousShuffling === null) {
|
|
367
|
+
this.cachedPreviousShuffling = this.binding.getPreviousShuffling();
|
|
375
368
|
}
|
|
376
|
-
return this.
|
|
369
|
+
return this.cachedPreviousShuffling;
|
|
377
370
|
}
|
|
378
371
|
|
|
379
372
|
getCurrentShuffling(): EpochShuffling {
|
|
380
|
-
if (this.
|
|
381
|
-
this.
|
|
373
|
+
if (this.cachedCurrentShuffling === null) {
|
|
374
|
+
this.cachedCurrentShuffling = this.binding.getCurrentShuffling();
|
|
382
375
|
}
|
|
383
|
-
return this.
|
|
376
|
+
return this.cachedCurrentShuffling;
|
|
384
377
|
}
|
|
385
378
|
|
|
386
379
|
getNextShuffling(): EpochShuffling {
|
|
387
|
-
if (this.
|
|
388
|
-
this.
|
|
380
|
+
if (this.cachedNextShuffling === null) {
|
|
381
|
+
this.cachedNextShuffling = this.binding.getNextShuffling();
|
|
389
382
|
}
|
|
390
|
-
return this.
|
|
383
|
+
return this.cachedNextShuffling;
|
|
391
384
|
}
|
|
392
385
|
|
|
393
386
|
// Proposer shuffling
|
|
394
387
|
|
|
395
388
|
get previousProposers(): ValidatorIndex[] | null {
|
|
396
|
-
if (this.
|
|
397
|
-
this.
|
|
389
|
+
if (this.cachedPreviousProposers === undefined) {
|
|
390
|
+
this.cachedPreviousProposers = this.binding.previousProposers;
|
|
398
391
|
}
|
|
399
|
-
return this.
|
|
392
|
+
return this.cachedPreviousProposers;
|
|
400
393
|
}
|
|
401
394
|
|
|
402
395
|
get currentProposers(): ValidatorIndex[] {
|
|
403
|
-
if (this.
|
|
404
|
-
this.
|
|
396
|
+
if (this.cachedCurrentProposers === null) {
|
|
397
|
+
this.cachedCurrentProposers = this.binding.currentProposers;
|
|
405
398
|
}
|
|
406
|
-
return this.
|
|
399
|
+
return this.cachedCurrentProposers;
|
|
407
400
|
}
|
|
408
401
|
|
|
409
402
|
get nextProposers(): ValidatorIndex[] {
|
|
410
|
-
if (this.
|
|
411
|
-
this.
|
|
403
|
+
if (this.cachedNextProposers === null) {
|
|
404
|
+
this.cachedNextProposers = this.binding.nextProposers;
|
|
412
405
|
}
|
|
413
|
-
return this.
|
|
406
|
+
return this.cachedNextProposers;
|
|
414
407
|
}
|
|
415
408
|
|
|
416
409
|
getBeaconProposer(slot: Slot): ValidatorIndex {
|
|
417
|
-
let cached = this.
|
|
410
|
+
let cached = this.cachedBeaconProposer.get(slot);
|
|
418
411
|
if (cached === undefined) {
|
|
419
412
|
cached = this.binding.getBeaconProposer(slot);
|
|
420
|
-
this.
|
|
413
|
+
this.cachedBeaconProposer.set(slot, cached);
|
|
421
414
|
}
|
|
422
415
|
return cached;
|
|
423
416
|
}
|
|
@@ -425,33 +418,33 @@ export class NativeBeaconStateView implements IBeaconStateViewLatestFork {
|
|
|
425
418
|
// Validators and balances
|
|
426
419
|
|
|
427
420
|
get effectiveBalanceIncrements(): EffectiveBalanceIncrements {
|
|
428
|
-
if (this.
|
|
429
|
-
this.
|
|
421
|
+
if (this.cachedEffectiveBalanceIncrements === null) {
|
|
422
|
+
this.cachedEffectiveBalanceIncrements = this.binding.effectiveBalanceIncrements;
|
|
430
423
|
}
|
|
431
|
-
return this.
|
|
424
|
+
return this.cachedEffectiveBalanceIncrements;
|
|
432
425
|
}
|
|
433
426
|
|
|
434
427
|
getEffectiveBalanceIncrementsZeroInactive(): EffectiveBalanceIncrements {
|
|
435
|
-
if (this.
|
|
436
|
-
this.
|
|
428
|
+
if (this.cachedEffectiveBalanceIncrementsZeroInactive === null) {
|
|
429
|
+
this.cachedEffectiveBalanceIncrementsZeroInactive = this.binding.getEffectiveBalanceIncrementsZeroInactive();
|
|
437
430
|
}
|
|
438
|
-
return this.
|
|
431
|
+
return this.cachedEffectiveBalanceIncrementsZeroInactive;
|
|
439
432
|
}
|
|
440
433
|
|
|
441
434
|
getBalance(index: number): number {
|
|
442
|
-
let cached = this.
|
|
435
|
+
let cached = this.cachedBalance.get(index);
|
|
443
436
|
if (cached === undefined) {
|
|
444
437
|
cached = this.binding.getBalance(index);
|
|
445
|
-
this.
|
|
438
|
+
this.cachedBalance.set(index, cached);
|
|
446
439
|
}
|
|
447
440
|
return cached;
|
|
448
441
|
}
|
|
449
442
|
|
|
450
443
|
getValidator(index: ValidatorIndex): phase0.Validator {
|
|
451
|
-
let cached = this.
|
|
444
|
+
let cached = this.cachedValidator.get(index);
|
|
452
445
|
if (cached === undefined) {
|
|
453
446
|
cached = this.binding.getValidator(index);
|
|
454
|
-
this.
|
|
447
|
+
this.cachedValidator.set(index, cached);
|
|
455
448
|
}
|
|
456
449
|
return cached;
|
|
457
450
|
}
|
|
@@ -461,31 +454,31 @@ export class NativeBeaconStateView implements IBeaconStateViewLatestFork {
|
|
|
461
454
|
}
|
|
462
455
|
|
|
463
456
|
get validatorCount(): number {
|
|
464
|
-
if (this.
|
|
465
|
-
this.
|
|
457
|
+
if (this.cachedValidatorCount === null) {
|
|
458
|
+
this.cachedValidatorCount = this.binding.validatorCount;
|
|
466
459
|
}
|
|
467
|
-
return this.
|
|
460
|
+
return this.cachedValidatorCount;
|
|
468
461
|
}
|
|
469
462
|
|
|
470
463
|
get activeValidatorCount(): number {
|
|
471
|
-
if (this.
|
|
472
|
-
this.
|
|
464
|
+
if (this.cachedActiveValidatorCount === null) {
|
|
465
|
+
this.cachedActiveValidatorCount = this.binding.activeValidatorCount;
|
|
473
466
|
}
|
|
474
|
-
return this.
|
|
467
|
+
return this.cachedActiveValidatorCount;
|
|
475
468
|
}
|
|
476
469
|
|
|
477
470
|
getAllValidators(): phase0.Validator[] {
|
|
478
|
-
if (this.
|
|
479
|
-
this.
|
|
471
|
+
if (this.cachedAllValidators === null) {
|
|
472
|
+
this.cachedAllValidators = this.binding.getAllValidators();
|
|
480
473
|
}
|
|
481
|
-
return this.
|
|
474
|
+
return this.cachedAllValidators;
|
|
482
475
|
}
|
|
483
476
|
|
|
484
477
|
getAllBalances(): number[] {
|
|
485
|
-
if (this.
|
|
486
|
-
this.
|
|
478
|
+
if (this.cachedAllBalances === null) {
|
|
479
|
+
this.cachedAllBalances = this.binding.getAllBalances();
|
|
487
480
|
}
|
|
488
|
-
return this.
|
|
481
|
+
return this.cachedAllBalances;
|
|
489
482
|
}
|
|
490
483
|
|
|
491
484
|
// API
|
|
@@ -494,19 +487,30 @@ export class NativeBeaconStateView implements IBeaconStateViewLatestFork {
|
|
|
494
487
|
return this.binding.proposerRewards;
|
|
495
488
|
}
|
|
496
489
|
|
|
497
|
-
computeBlockRewards(block: BeaconBlock, proposerRewards?: RewardCache): Promise<rewards.BlockRewards> {
|
|
498
|
-
|
|
490
|
+
async computeBlockRewards(block: BeaconBlock, proposerRewards?: RewardCache): Promise<rewards.BlockRewards> {
|
|
491
|
+
const isBlinded = isBlindedBeaconBlock(block);
|
|
492
|
+
const signedBlockBytes = isBlinded
|
|
493
|
+
? this.config.getPostBellatrixForkTypes(block.slot).SignedBlindedBeaconBlock.serialize({
|
|
494
|
+
message: block as BlindedBeaconBlock,
|
|
495
|
+
signature: EMPTY_SIGNATURE,
|
|
496
|
+
} as SignedBlindedBeaconBlock)
|
|
497
|
+
: this.config.getForkTypes(block.slot).SignedBeaconBlock.serialize({
|
|
498
|
+
message: block,
|
|
499
|
+
signature: EMPTY_SIGNATURE,
|
|
500
|
+
} as SignedBeaconBlock);
|
|
501
|
+
|
|
502
|
+
return this.binding.computeBlockRewards(signedBlockBytes, isBlinded, proposerRewards);
|
|
499
503
|
}
|
|
500
504
|
|
|
501
|
-
computeAttestationsRewards(validatorIds?: (ValidatorIndex | string)[]): Promise<rewards.AttestationsRewards> {
|
|
505
|
+
async computeAttestationsRewards(validatorIds?: (ValidatorIndex | string)[]): Promise<rewards.AttestationsRewards> {
|
|
502
506
|
return this.binding.computeAttestationsRewards(validatorIds);
|
|
503
507
|
}
|
|
504
508
|
|
|
505
509
|
getLatestWeakSubjectivityCheckpointEpoch(): Epoch {
|
|
506
|
-
if (this.
|
|
507
|
-
this.
|
|
510
|
+
if (this.cachedLatestWeakSubjectivityCheckpointEpoch === null) {
|
|
511
|
+
this.cachedLatestWeakSubjectivityCheckpointEpoch = this.binding.getLatestWeakSubjectivityCheckpointEpoch();
|
|
508
512
|
}
|
|
509
|
-
return this.
|
|
513
|
+
return this.cachedLatestWeakSubjectivityCheckpointEpoch;
|
|
510
514
|
}
|
|
511
515
|
|
|
512
516
|
// Validation
|
|
@@ -525,17 +529,17 @@ export class NativeBeaconStateView implements IBeaconStateViewLatestFork {
|
|
|
525
529
|
// Proofs
|
|
526
530
|
|
|
527
531
|
getFinalizedRootProof(): Uint8Array[] {
|
|
528
|
-
if (this.
|
|
529
|
-
this.
|
|
532
|
+
if (this.cachedFinalizedRootProof === null) {
|
|
533
|
+
this.cachedFinalizedRootProof = this.binding.getFinalizedRootProof();
|
|
530
534
|
}
|
|
531
|
-
return this.
|
|
535
|
+
return this.cachedFinalizedRootProof;
|
|
532
536
|
}
|
|
533
537
|
|
|
534
538
|
getSingleProof(gindex: bigint): Uint8Array[] {
|
|
535
|
-
let cached = this.
|
|
539
|
+
let cached = this.cachedSingleProof.get(gindex);
|
|
536
540
|
if (cached === undefined) {
|
|
537
541
|
cached = this.binding.getSingleProof(gindex);
|
|
538
|
-
this.
|
|
542
|
+
this.cachedSingleProof.set(gindex, cached);
|
|
539
543
|
}
|
|
540
544
|
return cached;
|
|
541
545
|
}
|
|
@@ -550,17 +554,17 @@ export class NativeBeaconStateView implements IBeaconStateViewLatestFork {
|
|
|
550
554
|
justifiedCheckpoint: phase0.Checkpoint;
|
|
551
555
|
finalizedCheckpoint: phase0.Checkpoint;
|
|
552
556
|
} {
|
|
553
|
-
if (this.
|
|
554
|
-
this.
|
|
557
|
+
if (this.cachedUnrealizedCheckpoints === null) {
|
|
558
|
+
this.cachedUnrealizedCheckpoints = this.binding.computeUnrealizedCheckpoints();
|
|
555
559
|
}
|
|
556
|
-
return this.
|
|
560
|
+
return this.cachedUnrealizedCheckpoints;
|
|
557
561
|
}
|
|
558
562
|
|
|
559
563
|
computeAnchorCheckpoint(): {checkpoint: phase0.Checkpoint; blockHeader: phase0.BeaconBlockHeader} {
|
|
560
|
-
if (this.
|
|
561
|
-
this.
|
|
564
|
+
if (this.cachedAnchorCheckpoint === null) {
|
|
565
|
+
this.cachedAnchorCheckpoint = this.binding.computeAnchorCheckpoint();
|
|
562
566
|
}
|
|
563
|
-
return this.
|
|
567
|
+
return this.cachedAnchorCheckpoint;
|
|
564
568
|
}
|
|
565
569
|
|
|
566
570
|
// Backward compatibility
|
|
@@ -574,17 +578,17 @@ export class NativeBeaconStateView implements IBeaconStateViewLatestFork {
|
|
|
574
578
|
}
|
|
575
579
|
|
|
576
580
|
get createdWithTransferCache(): boolean {
|
|
577
|
-
if (this.
|
|
578
|
-
this.
|
|
581
|
+
if (this.cachedCreatedWithTransferCache === null) {
|
|
582
|
+
this.cachedCreatedWithTransferCache = this.binding.createdWithTransferCache;
|
|
579
583
|
}
|
|
580
|
-
return this.
|
|
584
|
+
return this.cachedCreatedWithTransferCache;
|
|
581
585
|
}
|
|
582
586
|
|
|
583
587
|
isStateValidatorsNodesPopulated(): boolean {
|
|
584
|
-
if (this.
|
|
585
|
-
this.
|
|
588
|
+
if (this.cachedIsStateValidatorsNodesPopulated === null) {
|
|
589
|
+
this.cachedIsStateValidatorsNodesPopulated = this.binding.isStateValidatorsNodesPopulated();
|
|
586
590
|
}
|
|
587
|
-
return this.
|
|
591
|
+
return this.cachedIsStateValidatorsNodesPopulated;
|
|
588
592
|
}
|
|
589
593
|
|
|
590
594
|
// Serialization
|
|
@@ -594,28 +598,28 @@ export class NativeBeaconStateView implements IBeaconStateViewLatestFork {
|
|
|
594
598
|
seedValidatorsBytes?: Uint8Array,
|
|
595
599
|
opts?: {preloadValidatorsAndBalances?: boolean}
|
|
596
600
|
): IBeaconStateView {
|
|
597
|
-
return new NativeBeaconStateView(this.binding.loadOtherState(stateBytes, seedValidatorsBytes, opts));
|
|
601
|
+
return new NativeBeaconStateView(this.config, this.binding.loadOtherState(stateBytes, seedValidatorsBytes, opts));
|
|
598
602
|
}
|
|
599
603
|
|
|
600
604
|
toValue(): BeaconState {
|
|
601
|
-
if (this.
|
|
602
|
-
this.
|
|
605
|
+
if (this.cachedValue === null) {
|
|
606
|
+
this.cachedValue = this.binding.toValue();
|
|
603
607
|
}
|
|
604
|
-
return this.
|
|
608
|
+
return this.cachedValue;
|
|
605
609
|
}
|
|
606
610
|
|
|
607
611
|
serialize(): Uint8Array {
|
|
608
|
-
if (this.
|
|
609
|
-
this.
|
|
612
|
+
if (this.cachedSerialized === null) {
|
|
613
|
+
this.cachedSerialized = this.binding.serialize();
|
|
610
614
|
}
|
|
611
|
-
return this.
|
|
615
|
+
return this.cachedSerialized;
|
|
612
616
|
}
|
|
613
617
|
|
|
614
618
|
serializedSize(): number {
|
|
615
|
-
if (this.
|
|
616
|
-
this.
|
|
619
|
+
if (this.cachedSerializedSize === null) {
|
|
620
|
+
this.cachedSerializedSize = this.binding.serializedSize();
|
|
617
621
|
}
|
|
618
|
-
return this.
|
|
622
|
+
return this.cachedSerializedSize;
|
|
619
623
|
}
|
|
620
624
|
|
|
621
625
|
serializeToBytes(output: ByteViews, offset: number): number {
|
|
@@ -623,17 +627,17 @@ export class NativeBeaconStateView implements IBeaconStateViewLatestFork {
|
|
|
623
627
|
}
|
|
624
628
|
|
|
625
629
|
serializeValidators(): Uint8Array {
|
|
626
|
-
if (this.
|
|
627
|
-
this.
|
|
630
|
+
if (this.cachedSerializedValidators === null) {
|
|
631
|
+
this.cachedSerializedValidators = this.binding.serializeValidators();
|
|
628
632
|
}
|
|
629
|
-
return this.
|
|
633
|
+
return this.cachedSerializedValidators;
|
|
630
634
|
}
|
|
631
635
|
|
|
632
636
|
serializedValidatorsSize(): number {
|
|
633
|
-
if (this.
|
|
634
|
-
this.
|
|
637
|
+
if (this.cachedSerializedValidatorsSize === null) {
|
|
638
|
+
this.cachedSerializedValidatorsSize = this.binding.serializedValidatorsSize();
|
|
635
639
|
}
|
|
636
|
-
return this.
|
|
640
|
+
return this.cachedSerializedValidatorsSize;
|
|
637
641
|
}
|
|
638
642
|
|
|
639
643
|
serializeValidatorsToBytes(output: ByteViews, offset: number): number {
|
|
@@ -641,47 +645,53 @@ export class NativeBeaconStateView implements IBeaconStateViewLatestFork {
|
|
|
641
645
|
}
|
|
642
646
|
|
|
643
647
|
hashTreeRoot(): Uint8Array {
|
|
644
|
-
if (this.
|
|
645
|
-
this.
|
|
648
|
+
if (this.cachedHashTreeRoot === null) {
|
|
649
|
+
this.cachedHashTreeRoot = this.binding.hashTreeRoot();
|
|
646
650
|
}
|
|
647
|
-
return this.
|
|
651
|
+
return this.cachedHashTreeRoot;
|
|
648
652
|
}
|
|
649
653
|
|
|
650
654
|
// State transition
|
|
651
655
|
|
|
652
|
-
computeNewStateRoot(input:
|
|
653
|
-
const postState =
|
|
654
|
-
this.binding.stateTransition(input.block, computeNewStateRootStateTransitionOpts, modules)
|
|
655
|
-
);
|
|
656
|
+
computeNewStateRoot(input: BlockSTFInput, modules: StateTransitionModules): ComputeNewStateRootResult {
|
|
657
|
+
const postState = this.stateTransition(input, computeNewStateRootStateTransitionOpts, modules);
|
|
656
658
|
return getComputeNewStateRootResult(postState);
|
|
657
659
|
}
|
|
658
660
|
|
|
659
661
|
stateTransition(
|
|
660
|
-
|
|
662
|
+
{block, ssz}: BlockSTFInput,
|
|
661
663
|
options: StateTransitionOpts,
|
|
662
|
-
|
|
664
|
+
_modules: StateTransitionModules
|
|
663
665
|
): IBeaconStateView {
|
|
664
|
-
|
|
666
|
+
const isBlinded = isBlindedBeaconBlock(block.message);
|
|
667
|
+
const signedBlockBytes =
|
|
668
|
+
ssz ??
|
|
669
|
+
(isBlinded
|
|
670
|
+
? this.config
|
|
671
|
+
.getPostBellatrixForkTypes(block.message.slot)
|
|
672
|
+
.SignedBlindedBeaconBlock.serialize(block as SignedBlindedBeaconBlock)
|
|
673
|
+
: this.config.getForkTypes(block.message.slot).SignedBeaconBlock.serialize(block as SignedBeaconBlock));
|
|
674
|
+
return new NativeBeaconStateView(this.config, this.binding.stateTransition(signedBlockBytes, isBlinded, options));
|
|
665
675
|
}
|
|
666
676
|
|
|
667
|
-
processSlots(slot: Slot, opts?: {dontTransferCache?: boolean},
|
|
668
|
-
return new NativeBeaconStateView(this.binding.processSlots(slot, opts
|
|
677
|
+
processSlots(slot: Slot, opts?: {dontTransferCache?: boolean}, _modules?: StateTransitionModules): IBeaconStateView {
|
|
678
|
+
return new NativeBeaconStateView(this.config, this.binding.processSlots(slot, opts));
|
|
669
679
|
}
|
|
670
680
|
|
|
671
681
|
// ─── altair ──────────────────────────────────────────────────────────────
|
|
672
682
|
|
|
673
683
|
get previousEpochParticipation(): Uint8Array {
|
|
674
|
-
if (this.
|
|
675
|
-
this.
|
|
684
|
+
if (this.cachedPreviousEpochParticipation === null) {
|
|
685
|
+
this.cachedPreviousEpochParticipation = this.binding.previousEpochParticipation;
|
|
676
686
|
}
|
|
677
|
-
return this.
|
|
687
|
+
return this.cachedPreviousEpochParticipation;
|
|
678
688
|
}
|
|
679
689
|
|
|
680
690
|
get currentEpochParticipation(): Uint8Array {
|
|
681
|
-
if (this.
|
|
682
|
-
this.
|
|
691
|
+
if (this.cachedCurrentEpochParticipation === null) {
|
|
692
|
+
this.cachedCurrentEpochParticipation = this.binding.currentEpochParticipation;
|
|
683
693
|
}
|
|
684
|
-
return this.
|
|
694
|
+
return this.cachedCurrentEpochParticipation;
|
|
685
695
|
}
|
|
686
696
|
|
|
687
697
|
getPreviousEpochParticipation(validatorIndex: ValidatorIndex): number {
|
|
@@ -693,52 +703,62 @@ export class NativeBeaconStateView implements IBeaconStateViewLatestFork {
|
|
|
693
703
|
}
|
|
694
704
|
|
|
695
705
|
get currentSyncCommittee(): altair.SyncCommittee {
|
|
696
|
-
if (this.
|
|
697
|
-
this.
|
|
706
|
+
if (this.cachedCurrentSyncCommittee === null) {
|
|
707
|
+
this.cachedCurrentSyncCommittee = this.binding.currentSyncCommittee;
|
|
698
708
|
}
|
|
699
|
-
return this.
|
|
709
|
+
return this.cachedCurrentSyncCommittee;
|
|
700
710
|
}
|
|
701
711
|
|
|
702
712
|
get nextSyncCommittee(): altair.SyncCommittee {
|
|
703
|
-
if (this.
|
|
704
|
-
this.
|
|
713
|
+
if (this.cachedNextSyncCommittee === null) {
|
|
714
|
+
this.cachedNextSyncCommittee = this.binding.nextSyncCommittee;
|
|
705
715
|
}
|
|
706
|
-
return this.
|
|
716
|
+
return this.cachedNextSyncCommittee;
|
|
707
717
|
}
|
|
708
718
|
|
|
709
719
|
get currentSyncCommitteeIndexed(): SyncCommitteeCache {
|
|
710
|
-
if (this.
|
|
711
|
-
this.
|
|
720
|
+
if (this.cachedCurrentSyncCommitteeIndexed === null) {
|
|
721
|
+
this.cachedCurrentSyncCommitteeIndexed = this.binding.currentSyncCommitteeIndexed;
|
|
722
|
+
}
|
|
723
|
+
return this.cachedCurrentSyncCommitteeIndexed;
|
|
724
|
+
}
|
|
725
|
+
|
|
726
|
+
get currentSyncCommitteeValidatorIndices(): Uint32Array {
|
|
727
|
+
if (this.cachedCurrentSyncCommitteeValidatorIndices === null) {
|
|
728
|
+
this.cachedCurrentSyncCommitteeValidatorIndices =
|
|
729
|
+
this.cachedCurrentSyncCommitteeIndexed?.validatorIndices ??
|
|
730
|
+
this.binding.currentSyncCommitteeValidatorIndices ??
|
|
731
|
+
this.currentSyncCommitteeIndexed.validatorIndices;
|
|
712
732
|
}
|
|
713
|
-
return this.
|
|
733
|
+
return this.cachedCurrentSyncCommitteeValidatorIndices;
|
|
714
734
|
}
|
|
715
735
|
|
|
716
736
|
get syncProposerReward(): number {
|
|
717
|
-
if (this.
|
|
718
|
-
this.
|
|
737
|
+
if (this.cachedSyncProposerReward === null) {
|
|
738
|
+
this.cachedSyncProposerReward = this.binding.syncProposerReward;
|
|
719
739
|
}
|
|
720
|
-
return this.
|
|
740
|
+
return this.cachedSyncProposerReward;
|
|
721
741
|
}
|
|
722
742
|
|
|
723
743
|
getIndexedSyncCommitteeAtEpoch(epoch: Epoch): SyncCommitteeCache {
|
|
724
|
-
let cached = this.
|
|
744
|
+
let cached = this.cachedIndexedSyncCommitteeAtEpoch.get(epoch);
|
|
725
745
|
if (cached === undefined) {
|
|
726
746
|
cached = this.binding.getIndexedSyncCommitteeAtEpoch(epoch);
|
|
727
|
-
this.
|
|
747
|
+
this.cachedIndexedSyncCommitteeAtEpoch.set(epoch, cached);
|
|
728
748
|
}
|
|
729
749
|
return cached;
|
|
730
750
|
}
|
|
731
751
|
|
|
732
752
|
getIndexedSyncCommittee(slot: Slot): SyncCommitteeCache {
|
|
733
|
-
let cached = this.
|
|
753
|
+
let cached = this.cachedIndexedSyncCommittee.get(slot);
|
|
734
754
|
if (cached === undefined) {
|
|
735
755
|
cached = this.binding.getIndexedSyncCommittee(slot);
|
|
736
|
-
this.
|
|
756
|
+
this.cachedIndexedSyncCommittee.set(slot, cached);
|
|
737
757
|
}
|
|
738
758
|
return cached;
|
|
739
759
|
}
|
|
740
760
|
|
|
741
|
-
computeSyncCommitteeRewards(
|
|
761
|
+
async computeSyncCommitteeRewards(
|
|
742
762
|
block: BeaconBlock,
|
|
743
763
|
validatorIds: (ValidatorIndex | string)[]
|
|
744
764
|
): Promise<rewards.SyncCommitteeRewards> {
|
|
@@ -746,40 +766,40 @@ export class NativeBeaconStateView implements IBeaconStateViewLatestFork {
|
|
|
746
766
|
}
|
|
747
767
|
|
|
748
768
|
getSyncCommitteesWitness(): SyncCommitteeWitness {
|
|
749
|
-
if (this.
|
|
750
|
-
this.
|
|
769
|
+
if (this.cachedSyncCommitteesWitness === null) {
|
|
770
|
+
this.cachedSyncCommitteesWitness = this.binding.getSyncCommitteesWitness();
|
|
751
771
|
}
|
|
752
|
-
return this.
|
|
772
|
+
return this.cachedSyncCommitteesWitness;
|
|
753
773
|
}
|
|
754
774
|
|
|
755
775
|
// ─── bellatrix ───────────────────────────────────────────────────────────
|
|
756
776
|
|
|
757
777
|
get latestExecutionPayloadHeader(): ExecutionPayloadHeader {
|
|
758
|
-
if (this.
|
|
759
|
-
this.
|
|
778
|
+
if (this.cachedLatestExecutionPayloadHeader === null) {
|
|
779
|
+
this.cachedLatestExecutionPayloadHeader = this.binding.latestExecutionPayloadHeader;
|
|
760
780
|
}
|
|
761
|
-
return this.
|
|
781
|
+
return this.cachedLatestExecutionPayloadHeader;
|
|
762
782
|
}
|
|
763
783
|
|
|
764
784
|
get payloadBlockNumber(): number {
|
|
765
|
-
if (this.
|
|
766
|
-
this.
|
|
785
|
+
if (this.cachedPayloadBlockNumber === null) {
|
|
786
|
+
this.cachedPayloadBlockNumber = this.binding.payloadBlockNumber;
|
|
767
787
|
}
|
|
768
|
-
return this.
|
|
788
|
+
return this.cachedPayloadBlockNumber;
|
|
769
789
|
}
|
|
770
790
|
|
|
771
791
|
get isExecutionStateType(): boolean {
|
|
772
|
-
if (this.
|
|
773
|
-
this.
|
|
792
|
+
if (this.cachedIsExecutionStateType === null) {
|
|
793
|
+
this.cachedIsExecutionStateType = this.binding.isExecutionStateType;
|
|
774
794
|
}
|
|
775
|
-
return this.
|
|
795
|
+
return this.cachedIsExecutionStateType;
|
|
776
796
|
}
|
|
777
797
|
|
|
778
798
|
get isMergeTransitionComplete(): boolean {
|
|
779
|
-
if (this.
|
|
780
|
-
this.
|
|
799
|
+
if (this.cachedIsMergeTransitionComplete === null) {
|
|
800
|
+
this.cachedIsMergeTransitionComplete = this.binding.isMergeTransitionComplete;
|
|
781
801
|
}
|
|
782
|
-
return this.
|
|
802
|
+
return this.cachedIsMergeTransitionComplete;
|
|
783
803
|
}
|
|
784
804
|
|
|
785
805
|
isExecutionEnabled(block: BeaconBlock | BlindedBeaconBlock): boolean {
|
|
@@ -789,10 +809,10 @@ export class NativeBeaconStateView implements IBeaconStateViewLatestFork {
|
|
|
789
809
|
// ─── capella ─────────────────────────────────────────────────────────────
|
|
790
810
|
|
|
791
811
|
get historicalSummaries(): capella.HistoricalSummaries {
|
|
792
|
-
if (this.
|
|
793
|
-
this.
|
|
812
|
+
if (this.cachedHistoricalSummaries === null) {
|
|
813
|
+
this.cachedHistoricalSummaries = this.binding.historicalSummaries;
|
|
794
814
|
}
|
|
795
|
-
return this.
|
|
815
|
+
return this.cachedHistoricalSummaries;
|
|
796
816
|
}
|
|
797
817
|
|
|
798
818
|
getExpectedWithdrawals(): {
|
|
@@ -802,154 +822,127 @@ export class NativeBeaconStateView implements IBeaconStateViewLatestFork {
|
|
|
802
822
|
processedBuildersSweepCount: number;
|
|
803
823
|
processedValidatorSweepCount: number;
|
|
804
824
|
} {
|
|
805
|
-
if (this.
|
|
806
|
-
this.
|
|
825
|
+
if (this.cachedExpectedWithdrawals === null) {
|
|
826
|
+
this.cachedExpectedWithdrawals = this.binding.getExpectedWithdrawals();
|
|
807
827
|
}
|
|
808
|
-
return this.
|
|
828
|
+
return this.cachedExpectedWithdrawals;
|
|
809
829
|
}
|
|
810
830
|
|
|
811
831
|
// ─── electra ─────────────────────────────────────────────────────────────
|
|
812
832
|
|
|
813
833
|
get pendingDeposits(): electra.PendingDeposits {
|
|
814
|
-
if (this.
|
|
815
|
-
this.
|
|
834
|
+
if (this.cachedPendingDeposits === null) {
|
|
835
|
+
this.cachedPendingDeposits = ssz.electra.PendingDeposits.deserialize(this.binding.pendingDeposits);
|
|
816
836
|
}
|
|
817
|
-
return this.
|
|
837
|
+
return this.cachedPendingDeposits;
|
|
818
838
|
}
|
|
819
839
|
|
|
820
840
|
get pendingDepositsCount(): number {
|
|
821
|
-
if (this.
|
|
822
|
-
this.
|
|
841
|
+
if (this.cachedPendingDepositsCount === null) {
|
|
842
|
+
this.cachedPendingDepositsCount = this.binding.pendingDepositsCount;
|
|
823
843
|
}
|
|
824
|
-
return this.
|
|
844
|
+
return this.cachedPendingDepositsCount;
|
|
825
845
|
}
|
|
826
846
|
|
|
827
847
|
get pendingPartialWithdrawals(): electra.PendingPartialWithdrawals {
|
|
828
|
-
if (this.
|
|
829
|
-
this.
|
|
848
|
+
if (this.cachedPendingPartialWithdrawals === null) {
|
|
849
|
+
this.cachedPendingPartialWithdrawals = ssz.electra.PendingPartialWithdrawals.deserialize(
|
|
850
|
+
this.binding.pendingPartialWithdrawals
|
|
851
|
+
);
|
|
830
852
|
}
|
|
831
|
-
return this.
|
|
853
|
+
return this.cachedPendingPartialWithdrawals;
|
|
832
854
|
}
|
|
833
855
|
|
|
834
856
|
get pendingPartialWithdrawalsCount(): number {
|
|
835
|
-
if (this.
|
|
836
|
-
this.
|
|
857
|
+
if (this.cachedPendingPartialWithdrawalsCount === null) {
|
|
858
|
+
this.cachedPendingPartialWithdrawalsCount = this.binding.pendingPartialWithdrawalsCount;
|
|
837
859
|
}
|
|
838
|
-
return this.
|
|
860
|
+
return this.cachedPendingPartialWithdrawalsCount;
|
|
839
861
|
}
|
|
840
862
|
|
|
841
863
|
get pendingConsolidations(): electra.PendingConsolidations {
|
|
842
|
-
if (this.
|
|
843
|
-
this.
|
|
864
|
+
if (this.cachedPendingConsolidations === null) {
|
|
865
|
+
this.cachedPendingConsolidations = ssz.electra.PendingConsolidations.deserialize(
|
|
866
|
+
this.binding.pendingConsolidations
|
|
867
|
+
);
|
|
844
868
|
}
|
|
845
|
-
return this.
|
|
869
|
+
return this.cachedPendingConsolidations;
|
|
846
870
|
}
|
|
847
871
|
|
|
848
872
|
get pendingConsolidationsCount(): number {
|
|
849
|
-
if (this.
|
|
850
|
-
this.
|
|
873
|
+
if (this.cachedPendingConsolidationsCount === null) {
|
|
874
|
+
this.cachedPendingConsolidationsCount = this.binding.pendingConsolidationsCount;
|
|
851
875
|
}
|
|
852
|
-
return this.
|
|
876
|
+
return this.cachedPendingConsolidationsCount;
|
|
853
877
|
}
|
|
854
878
|
|
|
855
879
|
// ─── fulu ────────────────────────────────────────────────────────────────
|
|
856
880
|
|
|
857
881
|
get proposerLookahead(): fulu.ProposerLookahead {
|
|
858
|
-
if (this.
|
|
859
|
-
this.
|
|
882
|
+
if (this.cachedProposerLookahead === null) {
|
|
883
|
+
this.cachedProposerLookahead = Array.from(this.binding.proposerLookahead);
|
|
860
884
|
}
|
|
861
|
-
return this.
|
|
885
|
+
return this.cachedProposerLookahead;
|
|
862
886
|
}
|
|
863
887
|
|
|
864
|
-
preVerifyBuilderDepositsPreGloas(
|
|
865
|
-
|
|
888
|
+
preVerifyBuilderDepositsPreGloas(
|
|
889
|
+
_maxBuilderDeposits: number,
|
|
890
|
+
_maxDurationMs: number
|
|
891
|
+
): PreVerifyBuilderDepositsResult {
|
|
892
|
+
throw new Error("NativeBeaconStateView does not support Gloas");
|
|
866
893
|
}
|
|
867
894
|
|
|
868
895
|
clearPreGloasBuilderDepositCache(): void {
|
|
869
|
-
|
|
896
|
+
throw new Error("NativeBeaconStateView does not support Gloas");
|
|
870
897
|
}
|
|
871
898
|
|
|
872
899
|
// ─── gloas ───────────────────────────────────────────────────────────────
|
|
873
900
|
|
|
874
901
|
get latestBlockHash(): Bytes32 {
|
|
875
|
-
|
|
876
|
-
this._latestBlockHash = this.binding.latestBlockHash;
|
|
877
|
-
}
|
|
878
|
-
return this._latestBlockHash;
|
|
902
|
+
throw new Error("NativeBeaconStateView does not support Gloas");
|
|
879
903
|
}
|
|
880
904
|
|
|
881
|
-
// executionPayloadAvailability getter is defined near the top of the class.
|
|
882
|
-
|
|
883
905
|
get latestExecutionPayloadBid(): ExecutionPayloadBid {
|
|
884
|
-
|
|
885
|
-
this._latestExecutionPayloadBid = this.binding.latestExecutionPayloadBid;
|
|
886
|
-
}
|
|
887
|
-
return this._latestExecutionPayloadBid;
|
|
906
|
+
throw new Error("NativeBeaconStateView does not support Gloas");
|
|
888
907
|
}
|
|
889
908
|
|
|
890
909
|
get payloadExpectedWithdrawals(): capella.Withdrawal[] {
|
|
891
|
-
|
|
892
|
-
this._payloadExpectedWithdrawals = this.binding.payloadExpectedWithdrawals;
|
|
893
|
-
}
|
|
894
|
-
return this._payloadExpectedWithdrawals;
|
|
910
|
+
throw new Error("NativeBeaconStateView does not support Gloas");
|
|
895
911
|
}
|
|
896
912
|
|
|
897
913
|
get builderPendingPayments(): gloas.BuilderPendingPayments {
|
|
898
|
-
|
|
899
|
-
this._builderPendingPayments = this.binding.builderPendingPayments;
|
|
900
|
-
}
|
|
901
|
-
return this._builderPendingPayments;
|
|
914
|
+
throw new Error("NativeBeaconStateView does not support Gloas");
|
|
902
915
|
}
|
|
903
916
|
|
|
904
917
|
get builderPendingWithdrawals(): gloas.BuilderPendingWithdrawals {
|
|
905
|
-
|
|
906
|
-
this._builderPendingWithdrawals = this.binding.builderPendingWithdrawals;
|
|
907
|
-
}
|
|
908
|
-
return this._builderPendingWithdrawals;
|
|
918
|
+
throw new Error("NativeBeaconStateView does not support Gloas");
|
|
909
919
|
}
|
|
910
920
|
|
|
911
|
-
getBuilder(
|
|
912
|
-
|
|
913
|
-
if (cached === undefined) {
|
|
914
|
-
cached = this.binding.getBuilder(index);
|
|
915
|
-
this._getBuilder.set(index, cached);
|
|
916
|
-
}
|
|
917
|
-
return cached;
|
|
921
|
+
getBuilder(_index: BuilderIndex): gloas.Builder {
|
|
922
|
+
throw new Error("NativeBeaconStateView does not support Gloas");
|
|
918
923
|
}
|
|
919
924
|
|
|
920
925
|
getBuildersLength(): number {
|
|
921
|
-
|
|
922
|
-
this._getBuildersLength = this.binding.getBuildersLength();
|
|
923
|
-
}
|
|
924
|
-
return this._getBuildersLength;
|
|
926
|
+
throw new Error("NativeBeaconStateView does not support Gloas");
|
|
925
927
|
}
|
|
926
928
|
|
|
927
|
-
canBuilderCoverBid(
|
|
928
|
-
|
|
929
|
+
canBuilderCoverBid(_builderIndex: BuilderIndex, _bidAmount: number): boolean {
|
|
930
|
+
throw new Error("NativeBeaconStateView does not support Gloas");
|
|
929
931
|
}
|
|
930
932
|
|
|
931
|
-
getEpochPTCs(
|
|
932
|
-
|
|
933
|
-
if (cached === undefined) {
|
|
934
|
-
cached = this.binding.getEpochPTCs(epoch);
|
|
935
|
-
this._getEpochPTCs.set(epoch, cached);
|
|
936
|
-
}
|
|
937
|
-
return cached;
|
|
933
|
+
getEpochPTCs(_epoch: Epoch): Uint32Array[] {
|
|
934
|
+
throw new Error("NativeBeaconStateView does not support Gloas");
|
|
938
935
|
}
|
|
939
936
|
|
|
940
|
-
getPayloadTimelinessCommittee(
|
|
941
|
-
|
|
937
|
+
getPayloadTimelinessCommittee(_slot: Slot): Uint32Array {
|
|
938
|
+
throw new Error("NativeBeaconStateView does not support Gloas");
|
|
942
939
|
}
|
|
943
940
|
|
|
944
|
-
getIndicesInPayloadTimelinessCommittee(
|
|
945
|
-
|
|
941
|
+
getIndicesInPayloadTimelinessCommittee(_validatorIndex: ValidatorIndex, _slot: Slot): number[] {
|
|
942
|
+
throw new Error("NativeBeaconStateView does not support Gloas");
|
|
946
943
|
}
|
|
947
944
|
|
|
948
|
-
withParentPayloadApplied(
|
|
949
|
-
|
|
950
|
-
if (!isStatePostGloas(view)) {
|
|
951
|
-
throw new Error("Expected gloas state from withParentPayloadApplied");
|
|
952
|
-
}
|
|
953
|
-
return view;
|
|
945
|
+
withParentPayloadApplied(_executionRequests: gloas.ExecutionRequests): IBeaconStateViewGloas {
|
|
946
|
+
throw new Error("NativeBeaconStateView does not support Gloas");
|
|
954
947
|
}
|
|
955
948
|
}
|