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