@lodestar/state-transition 1.49.0-rc.0 → 1.50.0-dev.01cc10ce70
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/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/processParentExecutionPayload.d.ts.map +1 -1
- package/lib/block/processParentExecutionPayload.js +23 -18
- package/lib/block/processParentExecutionPayload.js.map +1 -1
- package/lib/index.d.ts +3 -1
- 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 +15 -6
- package/lib/rewards/attestationsRewards.js.map +1 -1
- package/lib/stateView/beaconStateView.d.ts +24 -19
- package/lib/stateView/beaconStateView.d.ts.map +1 -1
- package/lib/stateView/beaconStateView.js +83 -63
- package/lib/stateView/beaconStateView.js.map +1 -1
- package/lib/stateView/interface.d.ts +36 -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 -98
- package/lib/stateView/nativeBeaconStateView.d.ts.map +1 -1
- package/lib/stateView/nativeBeaconStateView.js +343 -358
- package/lib/stateView/nativeBeaconStateView.js.map +1 -1
- package/lib/stateView/stateViewFactory.d.ts +10 -17
- package/lib/stateView/stateViewFactory.d.ts.map +1 -1
- package/lib/stateView/stateViewFactory.js +17 -13
- package/lib/stateView/stateViewFactory.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/index.d.ts +1 -0
- package/lib/util/index.d.ts.map +1 -1
- package/lib/util/index.js +1 -0
- package/lib/util/index.js.map +1 -1
- package/lib/util/sszBytes.d.ts +16 -17
- package/lib/util/sszBytes.d.ts.map +1 -1
- package/lib/util/sszBytes.js +93 -20
- package/lib/util/sszBytes.js.map +1 -1
- package/lib/util/weakSubjectivity.d.ts +11 -6
- package/lib/util/weakSubjectivity.d.ts.map +1 -1
- package/lib/util/weakSubjectivity.js +22 -28
- package/lib/util/weakSubjectivity.js.map +1 -1
- package/package.json +7 -7
- package/src/block/indexedBuilderState.ts +65 -0
- package/src/block/processBuilderDepositRequest.ts +6 -17
- package/src/block/processBuilderExitRequest.ts +5 -9
- package/src/block/processParentExecutionPayload.ts +27 -23
- package/src/index.ts +4 -1
- package/src/rewards/attestationsRewards.ts +17 -5
- package/src/stateView/beaconStateView.ts +93 -68
- package/src/stateView/interface.ts +63 -21
- package/src/stateView/nativeBeaconStateView.ts +360 -365
- package/src/stateView/stateViewFactory.ts +29 -27
- package/src/util/gloas.ts +2 -53
- package/src/util/index.ts +6 -0
- package/src/util/sszBytes.ts +129 -22
- package/src/util/weakSubjectivity.ts +43 -40
|
@@ -1,15 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { isBlindedBeaconBlock, ssz, } from "@lodestar/types";
|
|
2
|
+
import { EMPTY_SIGNATURE } from "../constants/constants.js";
|
|
2
3
|
import { computeNewStateRootStateTransitionOpts, getComputeNewStateRootResult } from "./computeNewStateRoot.js";
|
|
3
|
-
import { isStatePostGloas, } from "./interface.js";
|
|
4
4
|
/**
|
|
5
5
|
* Wraps a native binding (the auto-generated JS interface produced by a `.node`
|
|
6
6
|
* file) and exposes it as a fully-conformant `IBeaconStateViewLatestFork`.
|
|
7
7
|
*
|
|
8
|
-
* The binding is typed `IBeaconStateViewNative
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* that POJO back to a `BitArray` so beacon-node consumers see no difference from
|
|
12
|
-
* the TS-side `BeaconStateView`.
|
|
8
|
+
* The binding is typed `IBeaconStateViewNative`. This type models FFI-specific
|
|
9
|
+
* inputs and outputs, such as serialized blocks and typed arrays. The wrapper
|
|
10
|
+
* converts those values to the forms used by `IBeaconStateViewLatestFork`.
|
|
13
11
|
*
|
|
14
12
|
* Every getter that returns a value stable for the view's lifetime is cached so
|
|
15
13
|
* the binding is hit at most once per field per view. Only mutable counters
|
|
@@ -18,343 +16,334 @@ import { isStatePostGloas, } from "./interface.js";
|
|
|
18
16
|
* would need a per-arg map and isn't worth it without a hot-path signal.
|
|
19
17
|
*/
|
|
20
18
|
export class NativeBeaconStateView {
|
|
19
|
+
config;
|
|
21
20
|
binding;
|
|
22
21
|
// phase0
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
22
|
+
cachedForkName = null;
|
|
23
|
+
cachedForkSeq = null;
|
|
24
|
+
cachedSlot = null;
|
|
25
|
+
cachedFork = null;
|
|
26
|
+
cachedEpoch = null;
|
|
27
|
+
cachedGenesisTime = null;
|
|
28
|
+
cachedGenesisValidatorsRoot = null;
|
|
29
|
+
cachedEth1Data = null;
|
|
30
|
+
cachedLatestBlockHeader = null;
|
|
31
|
+
cachedPreviousJustifiedCheckpoint = null;
|
|
32
|
+
cachedCurrentJustifiedCheckpoint = null;
|
|
33
|
+
cachedFinalizedCheckpoint = null;
|
|
35
34
|
// shuffling / decision roots / proposers
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
35
|
+
cachedPreviousDecisionRoot = null;
|
|
36
|
+
cachedCurrentDecisionRoot = null;
|
|
37
|
+
cachedNextDecisionRoot = null;
|
|
39
38
|
// previousProposers can be null, so use undefined as the "not loaded" sentinel
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
39
|
+
cachedPreviousProposers = undefined;
|
|
40
|
+
cachedCurrentProposers = null;
|
|
41
|
+
cachedNextProposers = null;
|
|
43
42
|
// validators / balances
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
43
|
+
cachedEffectiveBalanceIncrements = null;
|
|
44
|
+
cachedValidatorCount = null;
|
|
45
|
+
cachedActiveValidatorCount = null;
|
|
47
46
|
// backward compat
|
|
48
|
-
|
|
47
|
+
cachedCreatedWithTransferCache = null;
|
|
49
48
|
// altair
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
49
|
+
cachedCurrentSyncCommittee = null;
|
|
50
|
+
cachedNextSyncCommittee = null;
|
|
51
|
+
cachedPreviousEpochParticipation = null;
|
|
52
|
+
cachedCurrentEpochParticipation = null;
|
|
53
|
+
cachedCurrentSyncCommitteeIndexed = null;
|
|
54
|
+
cachedSyncProposerReward = null;
|
|
56
55
|
// bellatrix
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
56
|
+
cachedLatestExecutionPayloadHeader = null;
|
|
57
|
+
cachedPayloadBlockNumber = null;
|
|
58
|
+
cachedIsExecutionStateType = null;
|
|
59
|
+
cachedIsMergeTransitionComplete = null;
|
|
61
60
|
// capella
|
|
62
|
-
|
|
61
|
+
cachedHistoricalSummaries = null;
|
|
63
62
|
// electra
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
63
|
+
cachedPendingPartialWithdrawals = null;
|
|
64
|
+
cachedPendingConsolidations = null;
|
|
65
|
+
cachedPendingDeposits = null;
|
|
66
|
+
cachedPendingDepositsCount = null;
|
|
67
|
+
cachedPendingPartialWithdrawalsCount = null;
|
|
68
|
+
cachedPendingConsolidationsCount = null;
|
|
70
69
|
// fulu
|
|
71
|
-
|
|
72
|
-
// gloas
|
|
73
|
-
_executionPayloadAvailability = null;
|
|
74
|
-
_latestBlockHash = null;
|
|
75
|
-
_latestExecutionPayloadBid = null;
|
|
76
|
-
_payloadExpectedWithdrawals = null;
|
|
70
|
+
cachedProposerLookahead = null;
|
|
77
71
|
// Per-argument caches for argument-taking methods. The binding is treated as
|
|
78
72
|
// immutable for the view's lifetime, so a given argument always yields the
|
|
79
73
|
// same result. Maps grow only with touched arguments — typical call patterns
|
|
80
74
|
// (e.g. a handful of slots per attestation pool scan) keep them tiny.
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
_getEpochPTCs = new Map();
|
|
96
|
-
_getBuilder = new Map();
|
|
75
|
+
cachedBlockRootAtSlot = new Map();
|
|
76
|
+
cachedBlockRootAtEpoch = new Map();
|
|
77
|
+
cachedStateRootAtSlot = new Map();
|
|
78
|
+
cachedRandaoMix = new Map();
|
|
79
|
+
cachedShufflingAtEpoch = new Map();
|
|
80
|
+
cachedBeaconCommittee = new Map();
|
|
81
|
+
cachedBeaconCommitteeCountPerSlot = new Map();
|
|
82
|
+
cachedShufflingDecisionRoot = new Map();
|
|
83
|
+
cachedBeaconProposer = new Map();
|
|
84
|
+
cachedValidator = new Map();
|
|
85
|
+
cachedBalance = new Map();
|
|
86
|
+
cachedIndexedSyncCommitteeAtEpoch = new Map();
|
|
87
|
+
cachedIndexedSyncCommittee = new Map();
|
|
88
|
+
cachedSingleProof = new Map();
|
|
97
89
|
// No-arg method caches
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
90
|
+
cachedPreviousShuffling = null;
|
|
91
|
+
cachedCurrentShuffling = null;
|
|
92
|
+
cachedNextShuffling = null;
|
|
93
|
+
cachedEffectiveBalanceIncrementsZeroInactive = null;
|
|
94
|
+
cachedAllValidators = null;
|
|
95
|
+
cachedAllBalances = null;
|
|
96
|
+
cachedLatestWeakSubjectivityCheckpointEpoch = null;
|
|
97
|
+
cachedFinalizedRootProof = null;
|
|
98
|
+
cachedUnrealizedCheckpoints = null;
|
|
99
|
+
cachedAnchorCheckpoint = null;
|
|
100
|
+
cachedIsStateValidatorsNodesPopulated = null;
|
|
101
|
+
cachedValue = null;
|
|
102
|
+
cachedSerialized = null;
|
|
103
|
+
cachedSerializedSize = null;
|
|
104
|
+
cachedSerializedValidators = null;
|
|
105
|
+
cachedSerializedValidatorsSize = null;
|
|
106
|
+
cachedHashTreeRoot = null;
|
|
107
|
+
cachedSyncCommitteesWitness = null;
|
|
108
|
+
cachedExpectedWithdrawals = null;
|
|
109
|
+
constructor(config, binding) {
|
|
110
|
+
this.config = config;
|
|
119
111
|
this.binding = binding;
|
|
120
112
|
}
|
|
121
|
-
|
|
122
|
-
|
|
113
|
+
release() {
|
|
114
|
+
this.binding.release();
|
|
115
|
+
}
|
|
123
116
|
get executionPayloadAvailability() {
|
|
124
|
-
|
|
125
|
-
const pojo = this.binding.executionPayloadAvailability;
|
|
126
|
-
this._executionPayloadAvailability = new BitArray(pojo.uint8Array, pojo.bitLen);
|
|
127
|
-
}
|
|
128
|
-
return this._executionPayloadAvailability;
|
|
117
|
+
throw new Error("NativeBeaconStateView does not support Gloas");
|
|
129
118
|
}
|
|
130
119
|
// ─── phase0 ──────────────────────────────────────────────────────────────
|
|
131
120
|
get forkName() {
|
|
132
|
-
if (this.
|
|
133
|
-
this.
|
|
121
|
+
if (this.cachedForkName === null) {
|
|
122
|
+
this.cachedForkName = this.binding.forkName;
|
|
134
123
|
}
|
|
135
|
-
return this.
|
|
124
|
+
return this.cachedForkName;
|
|
136
125
|
}
|
|
137
126
|
get forkSeq() {
|
|
138
|
-
if (this.
|
|
139
|
-
this.
|
|
127
|
+
if (this.cachedForkSeq === null) {
|
|
128
|
+
this.cachedForkSeq = this.binding.forkSeq;
|
|
140
129
|
}
|
|
141
|
-
return this.
|
|
130
|
+
return this.cachedForkSeq;
|
|
142
131
|
}
|
|
143
132
|
get slot() {
|
|
144
|
-
if (this.
|
|
145
|
-
this.
|
|
133
|
+
if (this.cachedSlot === null) {
|
|
134
|
+
this.cachedSlot = this.binding.slot;
|
|
146
135
|
}
|
|
147
|
-
return this.
|
|
136
|
+
return this.cachedSlot;
|
|
148
137
|
}
|
|
149
138
|
get fork() {
|
|
150
|
-
if (this.
|
|
151
|
-
this.
|
|
139
|
+
if (this.cachedFork === null) {
|
|
140
|
+
this.cachedFork = this.binding.fork;
|
|
152
141
|
}
|
|
153
|
-
return this.
|
|
142
|
+
return this.cachedFork;
|
|
154
143
|
}
|
|
155
144
|
get epoch() {
|
|
156
|
-
if (this.
|
|
157
|
-
this.
|
|
145
|
+
if (this.cachedEpoch === null) {
|
|
146
|
+
this.cachedEpoch = this.binding.epoch;
|
|
158
147
|
}
|
|
159
|
-
return this.
|
|
148
|
+
return this.cachedEpoch;
|
|
160
149
|
}
|
|
161
150
|
get genesisTime() {
|
|
162
|
-
if (this.
|
|
163
|
-
this.
|
|
151
|
+
if (this.cachedGenesisTime === null) {
|
|
152
|
+
this.cachedGenesisTime = this.binding.genesisTime;
|
|
164
153
|
}
|
|
165
|
-
return this.
|
|
154
|
+
return this.cachedGenesisTime;
|
|
166
155
|
}
|
|
167
156
|
get genesisValidatorsRoot() {
|
|
168
|
-
if (this.
|
|
169
|
-
this.
|
|
157
|
+
if (this.cachedGenesisValidatorsRoot === null) {
|
|
158
|
+
this.cachedGenesisValidatorsRoot = this.binding.genesisValidatorsRoot;
|
|
170
159
|
}
|
|
171
|
-
return this.
|
|
160
|
+
return this.cachedGenesisValidatorsRoot;
|
|
172
161
|
}
|
|
173
162
|
get eth1Data() {
|
|
174
|
-
if (this.
|
|
175
|
-
this.
|
|
163
|
+
if (this.cachedEth1Data === null) {
|
|
164
|
+
this.cachedEth1Data = this.binding.eth1Data;
|
|
176
165
|
}
|
|
177
|
-
return this.
|
|
166
|
+
return this.cachedEth1Data;
|
|
178
167
|
}
|
|
179
168
|
get latestBlockHeader() {
|
|
180
|
-
if (this.
|
|
181
|
-
this.
|
|
169
|
+
if (this.cachedLatestBlockHeader === null) {
|
|
170
|
+
this.cachedLatestBlockHeader = this.binding.latestBlockHeader;
|
|
182
171
|
}
|
|
183
|
-
return this.
|
|
172
|
+
return this.cachedLatestBlockHeader;
|
|
184
173
|
}
|
|
185
174
|
get previousJustifiedCheckpoint() {
|
|
186
|
-
if (this.
|
|
187
|
-
this.
|
|
175
|
+
if (this.cachedPreviousJustifiedCheckpoint === null) {
|
|
176
|
+
this.cachedPreviousJustifiedCheckpoint = this.binding.previousJustifiedCheckpoint;
|
|
188
177
|
}
|
|
189
|
-
return this.
|
|
178
|
+
return this.cachedPreviousJustifiedCheckpoint;
|
|
190
179
|
}
|
|
191
180
|
get currentJustifiedCheckpoint() {
|
|
192
|
-
if (this.
|
|
193
|
-
this.
|
|
181
|
+
if (this.cachedCurrentJustifiedCheckpoint === null) {
|
|
182
|
+
this.cachedCurrentJustifiedCheckpoint = this.binding.currentJustifiedCheckpoint;
|
|
194
183
|
}
|
|
195
|
-
return this.
|
|
184
|
+
return this.cachedCurrentJustifiedCheckpoint;
|
|
196
185
|
}
|
|
197
186
|
get finalizedCheckpoint() {
|
|
198
|
-
if (this.
|
|
199
|
-
this.
|
|
187
|
+
if (this.cachedFinalizedCheckpoint === null) {
|
|
188
|
+
this.cachedFinalizedCheckpoint = this.binding.finalizedCheckpoint;
|
|
200
189
|
}
|
|
201
|
-
return this.
|
|
190
|
+
return this.cachedFinalizedCheckpoint;
|
|
202
191
|
}
|
|
203
192
|
getBlockRootAtSlot(slot) {
|
|
204
|
-
let cached = this.
|
|
193
|
+
let cached = this.cachedBlockRootAtSlot.get(slot);
|
|
205
194
|
if (cached === undefined) {
|
|
206
195
|
cached = this.binding.getBlockRootAtSlot(slot);
|
|
207
|
-
this.
|
|
196
|
+
this.cachedBlockRootAtSlot.set(slot, cached);
|
|
208
197
|
}
|
|
209
198
|
return cached;
|
|
210
199
|
}
|
|
211
200
|
getBlockRootAtEpoch(epoch) {
|
|
212
|
-
let cached = this.
|
|
201
|
+
let cached = this.cachedBlockRootAtEpoch.get(epoch);
|
|
213
202
|
if (cached === undefined) {
|
|
214
203
|
cached = this.binding.getBlockRootAtEpoch(epoch);
|
|
215
|
-
this.
|
|
204
|
+
this.cachedBlockRootAtEpoch.set(epoch, cached);
|
|
216
205
|
}
|
|
217
206
|
return cached;
|
|
218
207
|
}
|
|
219
208
|
getStateRootAtSlot(slot) {
|
|
220
|
-
let cached = this.
|
|
209
|
+
let cached = this.cachedStateRootAtSlot.get(slot);
|
|
221
210
|
if (cached === undefined) {
|
|
222
211
|
cached = this.binding.getStateRootAtSlot(slot);
|
|
223
|
-
this.
|
|
212
|
+
this.cachedStateRootAtSlot.set(slot, cached);
|
|
224
213
|
}
|
|
225
214
|
return cached;
|
|
226
215
|
}
|
|
227
216
|
getRandaoMix(epoch) {
|
|
228
|
-
let cached = this.
|
|
217
|
+
let cached = this.cachedRandaoMix.get(epoch);
|
|
229
218
|
if (cached === undefined) {
|
|
230
219
|
cached = this.binding.getRandaoMix(epoch);
|
|
231
|
-
this.
|
|
220
|
+
this.cachedRandaoMix.set(epoch, cached);
|
|
232
221
|
}
|
|
233
222
|
return cached;
|
|
234
223
|
}
|
|
235
224
|
// Shuffling and committees
|
|
236
225
|
getShufflingAtEpoch(epoch) {
|
|
237
|
-
let cached = this.
|
|
226
|
+
let cached = this.cachedShufflingAtEpoch.get(epoch);
|
|
238
227
|
if (cached === undefined) {
|
|
239
228
|
cached = this.binding.getShufflingAtEpoch(epoch);
|
|
240
|
-
this.
|
|
229
|
+
this.cachedShufflingAtEpoch.set(epoch, cached);
|
|
241
230
|
}
|
|
242
231
|
return cached;
|
|
243
232
|
}
|
|
244
233
|
getBeaconCommittee(slot, index) {
|
|
245
234
|
const key = `${slot}:${index}`;
|
|
246
|
-
let cached = this.
|
|
235
|
+
let cached = this.cachedBeaconCommittee.get(key);
|
|
247
236
|
if (cached === undefined) {
|
|
248
237
|
cached = this.binding.getBeaconCommittee(slot, index);
|
|
249
|
-
this.
|
|
238
|
+
this.cachedBeaconCommittee.set(key, cached);
|
|
250
239
|
}
|
|
251
240
|
return cached;
|
|
252
241
|
}
|
|
253
242
|
getBeaconCommitteeCountPerSlot(epoch) {
|
|
254
|
-
let cached = this.
|
|
243
|
+
let cached = this.cachedBeaconCommitteeCountPerSlot.get(epoch);
|
|
255
244
|
if (cached === undefined) {
|
|
256
245
|
cached = this.binding.getBeaconCommitteeCountPerSlot(epoch);
|
|
257
|
-
this.
|
|
246
|
+
this.cachedBeaconCommitteeCountPerSlot.set(epoch, cached);
|
|
258
247
|
}
|
|
259
248
|
return cached;
|
|
260
249
|
}
|
|
261
250
|
get previousDecisionRoot() {
|
|
262
|
-
if (this.
|
|
263
|
-
this.
|
|
251
|
+
if (this.cachedPreviousDecisionRoot === null) {
|
|
252
|
+
this.cachedPreviousDecisionRoot = this.binding.previousDecisionRoot;
|
|
264
253
|
}
|
|
265
|
-
return this.
|
|
254
|
+
return this.cachedPreviousDecisionRoot;
|
|
266
255
|
}
|
|
267
256
|
get currentDecisionRoot() {
|
|
268
|
-
if (this.
|
|
269
|
-
this.
|
|
257
|
+
if (this.cachedCurrentDecisionRoot === null) {
|
|
258
|
+
this.cachedCurrentDecisionRoot = this.binding.currentDecisionRoot;
|
|
270
259
|
}
|
|
271
|
-
return this.
|
|
260
|
+
return this.cachedCurrentDecisionRoot;
|
|
272
261
|
}
|
|
273
262
|
get nextDecisionRoot() {
|
|
274
|
-
if (this.
|
|
275
|
-
this.
|
|
263
|
+
if (this.cachedNextDecisionRoot === null) {
|
|
264
|
+
this.cachedNextDecisionRoot = this.binding.nextDecisionRoot;
|
|
276
265
|
}
|
|
277
|
-
return this.
|
|
266
|
+
return this.cachedNextDecisionRoot;
|
|
278
267
|
}
|
|
279
268
|
getShufflingDecisionRoot(epoch) {
|
|
280
|
-
let cached = this.
|
|
269
|
+
let cached = this.cachedShufflingDecisionRoot.get(epoch);
|
|
281
270
|
if (cached === undefined) {
|
|
282
271
|
cached = this.binding.getShufflingDecisionRoot(epoch);
|
|
283
|
-
this.
|
|
272
|
+
this.cachedShufflingDecisionRoot.set(epoch, cached);
|
|
284
273
|
}
|
|
285
274
|
return cached;
|
|
286
275
|
}
|
|
287
276
|
getPreviousShuffling() {
|
|
288
|
-
if (this.
|
|
289
|
-
this.
|
|
277
|
+
if (this.cachedPreviousShuffling === null) {
|
|
278
|
+
this.cachedPreviousShuffling = this.binding.getPreviousShuffling();
|
|
290
279
|
}
|
|
291
|
-
return this.
|
|
280
|
+
return this.cachedPreviousShuffling;
|
|
292
281
|
}
|
|
293
282
|
getCurrentShuffling() {
|
|
294
|
-
if (this.
|
|
295
|
-
this.
|
|
283
|
+
if (this.cachedCurrentShuffling === null) {
|
|
284
|
+
this.cachedCurrentShuffling = this.binding.getCurrentShuffling();
|
|
296
285
|
}
|
|
297
|
-
return this.
|
|
286
|
+
return this.cachedCurrentShuffling;
|
|
298
287
|
}
|
|
299
288
|
getNextShuffling() {
|
|
300
|
-
if (this.
|
|
301
|
-
this.
|
|
289
|
+
if (this.cachedNextShuffling === null) {
|
|
290
|
+
this.cachedNextShuffling = this.binding.getNextShuffling();
|
|
302
291
|
}
|
|
303
|
-
return this.
|
|
292
|
+
return this.cachedNextShuffling;
|
|
304
293
|
}
|
|
305
294
|
// Proposer shuffling
|
|
306
295
|
get previousProposers() {
|
|
307
|
-
if (this.
|
|
308
|
-
this.
|
|
296
|
+
if (this.cachedPreviousProposers === undefined) {
|
|
297
|
+
this.cachedPreviousProposers = this.binding.previousProposers;
|
|
309
298
|
}
|
|
310
|
-
return this.
|
|
299
|
+
return this.cachedPreviousProposers;
|
|
311
300
|
}
|
|
312
301
|
get currentProposers() {
|
|
313
|
-
if (this.
|
|
314
|
-
this.
|
|
302
|
+
if (this.cachedCurrentProposers === null) {
|
|
303
|
+
this.cachedCurrentProposers = this.binding.currentProposers;
|
|
315
304
|
}
|
|
316
|
-
return this.
|
|
305
|
+
return this.cachedCurrentProposers;
|
|
317
306
|
}
|
|
318
307
|
get nextProposers() {
|
|
319
|
-
if (this.
|
|
320
|
-
this.
|
|
308
|
+
if (this.cachedNextProposers === null) {
|
|
309
|
+
this.cachedNextProposers = this.binding.nextProposers;
|
|
321
310
|
}
|
|
322
|
-
return this.
|
|
311
|
+
return this.cachedNextProposers;
|
|
323
312
|
}
|
|
324
313
|
getBeaconProposer(slot) {
|
|
325
|
-
let cached = this.
|
|
314
|
+
let cached = this.cachedBeaconProposer.get(slot);
|
|
326
315
|
if (cached === undefined) {
|
|
327
316
|
cached = this.binding.getBeaconProposer(slot);
|
|
328
|
-
this.
|
|
317
|
+
this.cachedBeaconProposer.set(slot, cached);
|
|
329
318
|
}
|
|
330
319
|
return cached;
|
|
331
320
|
}
|
|
332
321
|
// Validators and balances
|
|
333
322
|
get effectiveBalanceIncrements() {
|
|
334
|
-
if (this.
|
|
335
|
-
this.
|
|
323
|
+
if (this.cachedEffectiveBalanceIncrements === null) {
|
|
324
|
+
this.cachedEffectiveBalanceIncrements = this.binding.effectiveBalanceIncrements;
|
|
336
325
|
}
|
|
337
|
-
return this.
|
|
326
|
+
return this.cachedEffectiveBalanceIncrements;
|
|
338
327
|
}
|
|
339
328
|
getEffectiveBalanceIncrementsZeroInactive() {
|
|
340
|
-
if (this.
|
|
341
|
-
this.
|
|
329
|
+
if (this.cachedEffectiveBalanceIncrementsZeroInactive === null) {
|
|
330
|
+
this.cachedEffectiveBalanceIncrementsZeroInactive = this.binding.getEffectiveBalanceIncrementsZeroInactive();
|
|
342
331
|
}
|
|
343
|
-
return this.
|
|
332
|
+
return this.cachedEffectiveBalanceIncrementsZeroInactive;
|
|
344
333
|
}
|
|
345
334
|
getBalance(index) {
|
|
346
|
-
let cached = this.
|
|
335
|
+
let cached = this.cachedBalance.get(index);
|
|
347
336
|
if (cached === undefined) {
|
|
348
337
|
cached = this.binding.getBalance(index);
|
|
349
|
-
this.
|
|
338
|
+
this.cachedBalance.set(index, cached);
|
|
350
339
|
}
|
|
351
340
|
return cached;
|
|
352
341
|
}
|
|
353
342
|
getValidator(index) {
|
|
354
|
-
let cached = this.
|
|
343
|
+
let cached = this.cachedValidator.get(index);
|
|
355
344
|
if (cached === undefined) {
|
|
356
345
|
cached = this.binding.getValidator(index);
|
|
357
|
-
this.
|
|
346
|
+
this.cachedValidator.set(index, cached);
|
|
358
347
|
}
|
|
359
348
|
return cached;
|
|
360
349
|
}
|
|
@@ -362,44 +351,54 @@ export class NativeBeaconStateView {
|
|
|
362
351
|
return this.binding.getValidatorsByStatus(statuses, currentEpoch);
|
|
363
352
|
}
|
|
364
353
|
get validatorCount() {
|
|
365
|
-
if (this.
|
|
366
|
-
this.
|
|
354
|
+
if (this.cachedValidatorCount === null) {
|
|
355
|
+
this.cachedValidatorCount = this.binding.validatorCount;
|
|
367
356
|
}
|
|
368
|
-
return this.
|
|
357
|
+
return this.cachedValidatorCount;
|
|
369
358
|
}
|
|
370
359
|
get activeValidatorCount() {
|
|
371
|
-
if (this.
|
|
372
|
-
this.
|
|
360
|
+
if (this.cachedActiveValidatorCount === null) {
|
|
361
|
+
this.cachedActiveValidatorCount = this.binding.activeValidatorCount;
|
|
373
362
|
}
|
|
374
|
-
return this.
|
|
363
|
+
return this.cachedActiveValidatorCount;
|
|
375
364
|
}
|
|
376
365
|
getAllValidators() {
|
|
377
|
-
if (this.
|
|
378
|
-
this.
|
|
366
|
+
if (this.cachedAllValidators === null) {
|
|
367
|
+
this.cachedAllValidators = this.binding.getAllValidators();
|
|
379
368
|
}
|
|
380
|
-
return this.
|
|
369
|
+
return this.cachedAllValidators;
|
|
381
370
|
}
|
|
382
371
|
getAllBalances() {
|
|
383
|
-
if (this.
|
|
384
|
-
this.
|
|
372
|
+
if (this.cachedAllBalances === null) {
|
|
373
|
+
this.cachedAllBalances = this.binding.getAllBalances();
|
|
385
374
|
}
|
|
386
|
-
return this.
|
|
375
|
+
return this.cachedAllBalances;
|
|
387
376
|
}
|
|
388
377
|
// API
|
|
389
378
|
get proposerRewards() {
|
|
390
379
|
return this.binding.proposerRewards;
|
|
391
380
|
}
|
|
392
|
-
computeBlockRewards(block, proposerRewards) {
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
381
|
+
async computeBlockRewards(block, proposerRewards) {
|
|
382
|
+
const isBlinded = isBlindedBeaconBlock(block);
|
|
383
|
+
const signedBlockBytes = isBlinded
|
|
384
|
+
? this.config.getPostBellatrixForkTypes(block.slot).SignedBlindedBeaconBlock.serialize({
|
|
385
|
+
message: block,
|
|
386
|
+
signature: EMPTY_SIGNATURE,
|
|
387
|
+
})
|
|
388
|
+
: this.config.getForkTypes(block.slot).SignedBeaconBlock.serialize({
|
|
389
|
+
message: block,
|
|
390
|
+
signature: EMPTY_SIGNATURE,
|
|
391
|
+
});
|
|
392
|
+
return this.binding.computeBlockRewards(signedBlockBytes, isBlinded, proposerRewards);
|
|
393
|
+
}
|
|
394
|
+
async computeAttestationsRewards(validatorIds) {
|
|
396
395
|
return this.binding.computeAttestationsRewards(validatorIds);
|
|
397
396
|
}
|
|
398
397
|
getLatestWeakSubjectivityCheckpointEpoch() {
|
|
399
|
-
if (this.
|
|
400
|
-
this.
|
|
398
|
+
if (this.cachedLatestWeakSubjectivityCheckpointEpoch === null) {
|
|
399
|
+
this.cachedLatestWeakSubjectivityCheckpointEpoch = this.binding.getLatestWeakSubjectivityCheckpointEpoch();
|
|
401
400
|
}
|
|
402
|
-
return this.
|
|
401
|
+
return this.cachedLatestWeakSubjectivityCheckpointEpoch;
|
|
403
402
|
}
|
|
404
403
|
// Validation
|
|
405
404
|
getVoluntaryExitValidity(signedVoluntaryExit, verifySignature) {
|
|
@@ -410,16 +409,16 @@ export class NativeBeaconStateView {
|
|
|
410
409
|
}
|
|
411
410
|
// Proofs
|
|
412
411
|
getFinalizedRootProof() {
|
|
413
|
-
if (this.
|
|
414
|
-
this.
|
|
412
|
+
if (this.cachedFinalizedRootProof === null) {
|
|
413
|
+
this.cachedFinalizedRootProof = this.binding.getFinalizedRootProof();
|
|
415
414
|
}
|
|
416
|
-
return this.
|
|
415
|
+
return this.cachedFinalizedRootProof;
|
|
417
416
|
}
|
|
418
417
|
getSingleProof(gindex) {
|
|
419
|
-
let cached = this.
|
|
418
|
+
let cached = this.cachedSingleProof.get(gindex);
|
|
420
419
|
if (cached === undefined) {
|
|
421
420
|
cached = this.binding.getSingleProof(gindex);
|
|
422
|
-
this.
|
|
421
|
+
this.cachedSingleProof.set(gindex, cached);
|
|
423
422
|
}
|
|
424
423
|
return cached;
|
|
425
424
|
}
|
|
@@ -428,16 +427,16 @@ export class NativeBeaconStateView {
|
|
|
428
427
|
}
|
|
429
428
|
// Fork choice
|
|
430
429
|
computeUnrealizedCheckpoints() {
|
|
431
|
-
if (this.
|
|
432
|
-
this.
|
|
430
|
+
if (this.cachedUnrealizedCheckpoints === null) {
|
|
431
|
+
this.cachedUnrealizedCheckpoints = this.binding.computeUnrealizedCheckpoints();
|
|
433
432
|
}
|
|
434
|
-
return this.
|
|
433
|
+
return this.cachedUnrealizedCheckpoints;
|
|
435
434
|
}
|
|
436
435
|
computeAnchorCheckpoint() {
|
|
437
|
-
if (this.
|
|
438
|
-
this.
|
|
436
|
+
if (this.cachedAnchorCheckpoint === null) {
|
|
437
|
+
this.cachedAnchorCheckpoint = this.binding.computeAnchorCheckpoint();
|
|
439
438
|
}
|
|
440
|
-
return this.
|
|
439
|
+
return this.cachedAnchorCheckpoint;
|
|
441
440
|
}
|
|
442
441
|
// Backward compatibility
|
|
443
442
|
get clonedCount() {
|
|
@@ -447,86 +446,93 @@ export class NativeBeaconStateView {
|
|
|
447
446
|
return this.binding.clonedCountWithTransferCache;
|
|
448
447
|
}
|
|
449
448
|
get createdWithTransferCache() {
|
|
450
|
-
if (this.
|
|
451
|
-
this.
|
|
449
|
+
if (this.cachedCreatedWithTransferCache === null) {
|
|
450
|
+
this.cachedCreatedWithTransferCache = this.binding.createdWithTransferCache;
|
|
452
451
|
}
|
|
453
|
-
return this.
|
|
452
|
+
return this.cachedCreatedWithTransferCache;
|
|
454
453
|
}
|
|
455
454
|
isStateValidatorsNodesPopulated() {
|
|
456
|
-
if (this.
|
|
457
|
-
this.
|
|
455
|
+
if (this.cachedIsStateValidatorsNodesPopulated === null) {
|
|
456
|
+
this.cachedIsStateValidatorsNodesPopulated = this.binding.isStateValidatorsNodesPopulated();
|
|
458
457
|
}
|
|
459
|
-
return this.
|
|
458
|
+
return this.cachedIsStateValidatorsNodesPopulated;
|
|
460
459
|
}
|
|
461
460
|
// Serialization
|
|
462
461
|
loadOtherState(stateBytes, seedValidatorsBytes, opts) {
|
|
463
|
-
return new NativeBeaconStateView(this.binding.loadOtherState(stateBytes, seedValidatorsBytes, opts));
|
|
462
|
+
return new NativeBeaconStateView(this.config, this.binding.loadOtherState(stateBytes, seedValidatorsBytes, opts));
|
|
464
463
|
}
|
|
465
464
|
toValue() {
|
|
466
|
-
if (this.
|
|
467
|
-
this.
|
|
465
|
+
if (this.cachedValue === null) {
|
|
466
|
+
this.cachedValue = this.binding.toValue();
|
|
468
467
|
}
|
|
469
|
-
return this.
|
|
468
|
+
return this.cachedValue;
|
|
470
469
|
}
|
|
471
470
|
serialize() {
|
|
472
|
-
if (this.
|
|
473
|
-
this.
|
|
471
|
+
if (this.cachedSerialized === null) {
|
|
472
|
+
this.cachedSerialized = this.binding.serialize();
|
|
474
473
|
}
|
|
475
|
-
return this.
|
|
474
|
+
return this.cachedSerialized;
|
|
476
475
|
}
|
|
477
476
|
serializedSize() {
|
|
478
|
-
if (this.
|
|
479
|
-
this.
|
|
477
|
+
if (this.cachedSerializedSize === null) {
|
|
478
|
+
this.cachedSerializedSize = this.binding.serializedSize();
|
|
480
479
|
}
|
|
481
|
-
return this.
|
|
480
|
+
return this.cachedSerializedSize;
|
|
482
481
|
}
|
|
483
482
|
serializeToBytes(output, offset) {
|
|
484
483
|
return this.binding.serializeToBytes(output, offset);
|
|
485
484
|
}
|
|
486
485
|
serializeValidators() {
|
|
487
|
-
if (this.
|
|
488
|
-
this.
|
|
486
|
+
if (this.cachedSerializedValidators === null) {
|
|
487
|
+
this.cachedSerializedValidators = this.binding.serializeValidators();
|
|
489
488
|
}
|
|
490
|
-
return this.
|
|
489
|
+
return this.cachedSerializedValidators;
|
|
491
490
|
}
|
|
492
491
|
serializedValidatorsSize() {
|
|
493
|
-
if (this.
|
|
494
|
-
this.
|
|
492
|
+
if (this.cachedSerializedValidatorsSize === null) {
|
|
493
|
+
this.cachedSerializedValidatorsSize = this.binding.serializedValidatorsSize();
|
|
495
494
|
}
|
|
496
|
-
return this.
|
|
495
|
+
return this.cachedSerializedValidatorsSize;
|
|
497
496
|
}
|
|
498
497
|
serializeValidatorsToBytes(output, offset) {
|
|
499
498
|
return this.binding.serializeValidatorsToBytes(output, offset);
|
|
500
499
|
}
|
|
501
500
|
hashTreeRoot() {
|
|
502
|
-
if (this.
|
|
503
|
-
this.
|
|
501
|
+
if (this.cachedHashTreeRoot === null) {
|
|
502
|
+
this.cachedHashTreeRoot = this.binding.hashTreeRoot();
|
|
504
503
|
}
|
|
505
|
-
return this.
|
|
504
|
+
return this.cachedHashTreeRoot;
|
|
506
505
|
}
|
|
507
506
|
// State transition
|
|
508
507
|
computeNewStateRoot(input, modules) {
|
|
509
|
-
const postState =
|
|
508
|
+
const postState = this.stateTransition(input, computeNewStateRootStateTransitionOpts, modules);
|
|
510
509
|
return getComputeNewStateRootResult(postState);
|
|
511
510
|
}
|
|
512
|
-
stateTransition(
|
|
513
|
-
|
|
511
|
+
stateTransition({ block, ssz }, options, _modules) {
|
|
512
|
+
const isBlinded = isBlindedBeaconBlock(block.message);
|
|
513
|
+
const signedBlockBytes = ssz ??
|
|
514
|
+
(isBlinded
|
|
515
|
+
? this.config
|
|
516
|
+
.getPostBellatrixForkTypes(block.message.slot)
|
|
517
|
+
.SignedBlindedBeaconBlock.serialize(block)
|
|
518
|
+
: this.config.getForkTypes(block.message.slot).SignedBeaconBlock.serialize(block));
|
|
519
|
+
return new NativeBeaconStateView(this.config, this.binding.stateTransition(signedBlockBytes, isBlinded, options));
|
|
514
520
|
}
|
|
515
|
-
processSlots(slot, opts,
|
|
516
|
-
return new NativeBeaconStateView(this.binding.processSlots(slot, opts
|
|
521
|
+
processSlots(slot, opts, _modules) {
|
|
522
|
+
return new NativeBeaconStateView(this.config, this.binding.processSlots(slot, opts));
|
|
517
523
|
}
|
|
518
524
|
// ─── altair ──────────────────────────────────────────────────────────────
|
|
519
525
|
get previousEpochParticipation() {
|
|
520
|
-
if (this.
|
|
521
|
-
this.
|
|
526
|
+
if (this.cachedPreviousEpochParticipation === null) {
|
|
527
|
+
this.cachedPreviousEpochParticipation = this.binding.previousEpochParticipation;
|
|
522
528
|
}
|
|
523
|
-
return this.
|
|
529
|
+
return this.cachedPreviousEpochParticipation;
|
|
524
530
|
}
|
|
525
531
|
get currentEpochParticipation() {
|
|
526
|
-
if (this.
|
|
527
|
-
this.
|
|
532
|
+
if (this.cachedCurrentEpochParticipation === null) {
|
|
533
|
+
this.cachedCurrentEpochParticipation = this.binding.currentEpochParticipation;
|
|
528
534
|
}
|
|
529
|
-
return this.
|
|
535
|
+
return this.cachedCurrentEpochParticipation;
|
|
530
536
|
}
|
|
531
537
|
getPreviousEpochParticipation(validatorIndex) {
|
|
532
538
|
return this.previousEpochParticipation[validatorIndex];
|
|
@@ -535,202 +541,181 @@ export class NativeBeaconStateView {
|
|
|
535
541
|
return this.currentEpochParticipation[validatorIndex];
|
|
536
542
|
}
|
|
537
543
|
get currentSyncCommittee() {
|
|
538
|
-
if (this.
|
|
539
|
-
this.
|
|
544
|
+
if (this.cachedCurrentSyncCommittee === null) {
|
|
545
|
+
this.cachedCurrentSyncCommittee = this.binding.currentSyncCommittee;
|
|
540
546
|
}
|
|
541
|
-
return this.
|
|
547
|
+
return this.cachedCurrentSyncCommittee;
|
|
542
548
|
}
|
|
543
549
|
get nextSyncCommittee() {
|
|
544
|
-
if (this.
|
|
545
|
-
this.
|
|
550
|
+
if (this.cachedNextSyncCommittee === null) {
|
|
551
|
+
this.cachedNextSyncCommittee = this.binding.nextSyncCommittee;
|
|
546
552
|
}
|
|
547
|
-
return this.
|
|
553
|
+
return this.cachedNextSyncCommittee;
|
|
548
554
|
}
|
|
549
555
|
get currentSyncCommitteeIndexed() {
|
|
550
|
-
if (this.
|
|
551
|
-
this.
|
|
556
|
+
if (this.cachedCurrentSyncCommitteeIndexed === null) {
|
|
557
|
+
this.cachedCurrentSyncCommitteeIndexed = this.binding.currentSyncCommitteeIndexed;
|
|
552
558
|
}
|
|
553
|
-
return this.
|
|
559
|
+
return this.cachedCurrentSyncCommitteeIndexed;
|
|
554
560
|
}
|
|
555
561
|
get syncProposerReward() {
|
|
556
|
-
if (this.
|
|
557
|
-
this.
|
|
562
|
+
if (this.cachedSyncProposerReward === null) {
|
|
563
|
+
this.cachedSyncProposerReward = this.binding.syncProposerReward;
|
|
558
564
|
}
|
|
559
|
-
return this.
|
|
565
|
+
return this.cachedSyncProposerReward;
|
|
560
566
|
}
|
|
561
567
|
getIndexedSyncCommitteeAtEpoch(epoch) {
|
|
562
|
-
let cached = this.
|
|
568
|
+
let cached = this.cachedIndexedSyncCommitteeAtEpoch.get(epoch);
|
|
563
569
|
if (cached === undefined) {
|
|
564
570
|
cached = this.binding.getIndexedSyncCommitteeAtEpoch(epoch);
|
|
565
|
-
this.
|
|
571
|
+
this.cachedIndexedSyncCommitteeAtEpoch.set(epoch, cached);
|
|
566
572
|
}
|
|
567
573
|
return cached;
|
|
568
574
|
}
|
|
569
575
|
getIndexedSyncCommittee(slot) {
|
|
570
|
-
let cached = this.
|
|
576
|
+
let cached = this.cachedIndexedSyncCommittee.get(slot);
|
|
571
577
|
if (cached === undefined) {
|
|
572
578
|
cached = this.binding.getIndexedSyncCommittee(slot);
|
|
573
|
-
this.
|
|
579
|
+
this.cachedIndexedSyncCommittee.set(slot, cached);
|
|
574
580
|
}
|
|
575
581
|
return cached;
|
|
576
582
|
}
|
|
577
|
-
computeSyncCommitteeRewards(block, validatorIds) {
|
|
583
|
+
async computeSyncCommitteeRewards(block, validatorIds) {
|
|
578
584
|
return this.binding.computeSyncCommitteeRewards(block, validatorIds);
|
|
579
585
|
}
|
|
580
586
|
getSyncCommitteesWitness() {
|
|
581
|
-
if (this.
|
|
582
|
-
this.
|
|
587
|
+
if (this.cachedSyncCommitteesWitness === null) {
|
|
588
|
+
this.cachedSyncCommitteesWitness = this.binding.getSyncCommitteesWitness();
|
|
583
589
|
}
|
|
584
|
-
return this.
|
|
590
|
+
return this.cachedSyncCommitteesWitness;
|
|
585
591
|
}
|
|
586
592
|
// ─── bellatrix ───────────────────────────────────────────────────────────
|
|
587
593
|
get latestExecutionPayloadHeader() {
|
|
588
|
-
if (this.
|
|
589
|
-
this.
|
|
594
|
+
if (this.cachedLatestExecutionPayloadHeader === null) {
|
|
595
|
+
this.cachedLatestExecutionPayloadHeader = this.binding.latestExecutionPayloadHeader;
|
|
590
596
|
}
|
|
591
|
-
return this.
|
|
597
|
+
return this.cachedLatestExecutionPayloadHeader;
|
|
592
598
|
}
|
|
593
599
|
get payloadBlockNumber() {
|
|
594
|
-
if (this.
|
|
595
|
-
this.
|
|
600
|
+
if (this.cachedPayloadBlockNumber === null) {
|
|
601
|
+
this.cachedPayloadBlockNumber = this.binding.payloadBlockNumber;
|
|
596
602
|
}
|
|
597
|
-
return this.
|
|
603
|
+
return this.cachedPayloadBlockNumber;
|
|
598
604
|
}
|
|
599
605
|
get isExecutionStateType() {
|
|
600
|
-
if (this.
|
|
601
|
-
this.
|
|
606
|
+
if (this.cachedIsExecutionStateType === null) {
|
|
607
|
+
this.cachedIsExecutionStateType = this.binding.isExecutionStateType;
|
|
602
608
|
}
|
|
603
|
-
return this.
|
|
609
|
+
return this.cachedIsExecutionStateType;
|
|
604
610
|
}
|
|
605
611
|
get isMergeTransitionComplete() {
|
|
606
|
-
if (this.
|
|
607
|
-
this.
|
|
612
|
+
if (this.cachedIsMergeTransitionComplete === null) {
|
|
613
|
+
this.cachedIsMergeTransitionComplete = this.binding.isMergeTransitionComplete;
|
|
608
614
|
}
|
|
609
|
-
return this.
|
|
615
|
+
return this.cachedIsMergeTransitionComplete;
|
|
610
616
|
}
|
|
611
617
|
isExecutionEnabled(block) {
|
|
612
618
|
return this.binding.isExecutionEnabled(block);
|
|
613
619
|
}
|
|
614
620
|
// ─── capella ─────────────────────────────────────────────────────────────
|
|
615
621
|
get historicalSummaries() {
|
|
616
|
-
if (this.
|
|
617
|
-
this.
|
|
622
|
+
if (this.cachedHistoricalSummaries === null) {
|
|
623
|
+
this.cachedHistoricalSummaries = this.binding.historicalSummaries;
|
|
618
624
|
}
|
|
619
|
-
return this.
|
|
625
|
+
return this.cachedHistoricalSummaries;
|
|
620
626
|
}
|
|
621
627
|
getExpectedWithdrawals() {
|
|
622
|
-
if (this.
|
|
623
|
-
this.
|
|
628
|
+
if (this.cachedExpectedWithdrawals === null) {
|
|
629
|
+
this.cachedExpectedWithdrawals = this.binding.getExpectedWithdrawals();
|
|
624
630
|
}
|
|
625
|
-
return this.
|
|
631
|
+
return this.cachedExpectedWithdrawals;
|
|
626
632
|
}
|
|
627
633
|
// ─── electra ─────────────────────────────────────────────────────────────
|
|
628
634
|
get pendingDeposits() {
|
|
629
|
-
if (this.
|
|
630
|
-
this.
|
|
635
|
+
if (this.cachedPendingDeposits === null) {
|
|
636
|
+
this.cachedPendingDeposits = ssz.electra.PendingDeposits.deserialize(this.binding.pendingDeposits);
|
|
631
637
|
}
|
|
632
|
-
return this.
|
|
638
|
+
return this.cachedPendingDeposits;
|
|
633
639
|
}
|
|
634
640
|
get pendingDepositsCount() {
|
|
635
|
-
if (this.
|
|
636
|
-
this.
|
|
641
|
+
if (this.cachedPendingDepositsCount === null) {
|
|
642
|
+
this.cachedPendingDepositsCount = this.binding.pendingDepositsCount;
|
|
637
643
|
}
|
|
638
|
-
return this.
|
|
644
|
+
return this.cachedPendingDepositsCount;
|
|
639
645
|
}
|
|
640
646
|
get pendingPartialWithdrawals() {
|
|
641
|
-
if (this.
|
|
642
|
-
this.
|
|
647
|
+
if (this.cachedPendingPartialWithdrawals === null) {
|
|
648
|
+
this.cachedPendingPartialWithdrawals = ssz.electra.PendingPartialWithdrawals.deserialize(this.binding.pendingPartialWithdrawals);
|
|
643
649
|
}
|
|
644
|
-
return this.
|
|
650
|
+
return this.cachedPendingPartialWithdrawals;
|
|
645
651
|
}
|
|
646
652
|
get pendingPartialWithdrawalsCount() {
|
|
647
|
-
if (this.
|
|
648
|
-
this.
|
|
653
|
+
if (this.cachedPendingPartialWithdrawalsCount === null) {
|
|
654
|
+
this.cachedPendingPartialWithdrawalsCount = this.binding.pendingPartialWithdrawalsCount;
|
|
649
655
|
}
|
|
650
|
-
return this.
|
|
656
|
+
return this.cachedPendingPartialWithdrawalsCount;
|
|
651
657
|
}
|
|
652
658
|
get pendingConsolidations() {
|
|
653
|
-
if (this.
|
|
654
|
-
this.
|
|
659
|
+
if (this.cachedPendingConsolidations === null) {
|
|
660
|
+
this.cachedPendingConsolidations = ssz.electra.PendingConsolidations.deserialize(this.binding.pendingConsolidations);
|
|
655
661
|
}
|
|
656
|
-
return this.
|
|
662
|
+
return this.cachedPendingConsolidations;
|
|
657
663
|
}
|
|
658
664
|
get pendingConsolidationsCount() {
|
|
659
|
-
if (this.
|
|
660
|
-
this.
|
|
665
|
+
if (this.cachedPendingConsolidationsCount === null) {
|
|
666
|
+
this.cachedPendingConsolidationsCount = this.binding.pendingConsolidationsCount;
|
|
661
667
|
}
|
|
662
|
-
return this.
|
|
668
|
+
return this.cachedPendingConsolidationsCount;
|
|
663
669
|
}
|
|
664
670
|
// ─── fulu ────────────────────────────────────────────────────────────────
|
|
665
671
|
get proposerLookahead() {
|
|
666
|
-
if (this.
|
|
667
|
-
this.
|
|
672
|
+
if (this.cachedProposerLookahead === null) {
|
|
673
|
+
this.cachedProposerLookahead = Array.from(this.binding.proposerLookahead);
|
|
668
674
|
}
|
|
669
|
-
return this.
|
|
675
|
+
return this.cachedProposerLookahead;
|
|
670
676
|
}
|
|
671
|
-
preVerifyBuilderDepositsPreGloas(
|
|
672
|
-
|
|
677
|
+
preVerifyBuilderDepositsPreGloas(_maxBuilderDeposits, _maxDurationMs) {
|
|
678
|
+
throw new Error("NativeBeaconStateView does not support Gloas");
|
|
673
679
|
}
|
|
674
680
|
clearPreGloasBuilderDepositCache() {
|
|
675
|
-
|
|
681
|
+
throw new Error("NativeBeaconStateView does not support Gloas");
|
|
676
682
|
}
|
|
677
683
|
// ─── gloas ───────────────────────────────────────────────────────────────
|
|
678
684
|
get latestBlockHash() {
|
|
679
|
-
|
|
680
|
-
this._latestBlockHash = this.binding.latestBlockHash;
|
|
681
|
-
}
|
|
682
|
-
return this._latestBlockHash;
|
|
685
|
+
throw new Error("NativeBeaconStateView does not support Gloas");
|
|
683
686
|
}
|
|
684
|
-
// executionPayloadAvailability getter is defined near the top of the class.
|
|
685
687
|
get latestExecutionPayloadBid() {
|
|
686
|
-
|
|
687
|
-
this._latestExecutionPayloadBid = this.binding.latestExecutionPayloadBid;
|
|
688
|
-
}
|
|
689
|
-
return this._latestExecutionPayloadBid;
|
|
688
|
+
throw new Error("NativeBeaconStateView does not support Gloas");
|
|
690
689
|
}
|
|
691
690
|
get payloadExpectedWithdrawals() {
|
|
692
|
-
|
|
693
|
-
this._payloadExpectedWithdrawals = this.binding.payloadExpectedWithdrawals;
|
|
694
|
-
}
|
|
695
|
-
return this._payloadExpectedWithdrawals;
|
|
691
|
+
throw new Error("NativeBeaconStateView does not support Gloas");
|
|
696
692
|
}
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
693
|
+
get builderPendingPayments() {
|
|
694
|
+
throw new Error("NativeBeaconStateView does not support Gloas");
|
|
695
|
+
}
|
|
696
|
+
get builderPendingWithdrawals() {
|
|
697
|
+
throw new Error("NativeBeaconStateView does not support Gloas");
|
|
698
|
+
}
|
|
699
|
+
getBuilder(_index) {
|
|
700
|
+
throw new Error("NativeBeaconStateView does not support Gloas");
|
|
704
701
|
}
|
|
705
702
|
getBuildersLength() {
|
|
706
|
-
|
|
707
|
-
this._getBuildersLength = this.binding.getBuildersLength();
|
|
708
|
-
}
|
|
709
|
-
return this._getBuildersLength;
|
|
703
|
+
throw new Error("NativeBeaconStateView does not support Gloas");
|
|
710
704
|
}
|
|
711
|
-
canBuilderCoverBid(
|
|
712
|
-
|
|
705
|
+
canBuilderCoverBid(_builderIndex, _bidAmount) {
|
|
706
|
+
throw new Error("NativeBeaconStateView does not support Gloas");
|
|
713
707
|
}
|
|
714
|
-
getEpochPTCs(
|
|
715
|
-
|
|
716
|
-
if (cached === undefined) {
|
|
717
|
-
cached = this.binding.getEpochPTCs(epoch);
|
|
718
|
-
this._getEpochPTCs.set(epoch, cached);
|
|
719
|
-
}
|
|
720
|
-
return cached;
|
|
708
|
+
getEpochPTCs(_epoch) {
|
|
709
|
+
throw new Error("NativeBeaconStateView does not support Gloas");
|
|
721
710
|
}
|
|
722
|
-
getPayloadTimelinessCommittee(
|
|
723
|
-
|
|
711
|
+
getPayloadTimelinessCommittee(_slot) {
|
|
712
|
+
throw new Error("NativeBeaconStateView does not support Gloas");
|
|
724
713
|
}
|
|
725
|
-
getIndicesInPayloadTimelinessCommittee(
|
|
726
|
-
|
|
714
|
+
getIndicesInPayloadTimelinessCommittee(_validatorIndex, _slot) {
|
|
715
|
+
throw new Error("NativeBeaconStateView does not support Gloas");
|
|
727
716
|
}
|
|
728
|
-
withParentPayloadApplied(
|
|
729
|
-
|
|
730
|
-
if (!isStatePostGloas(view)) {
|
|
731
|
-
throw new Error("Expected gloas state from withParentPayloadApplied");
|
|
732
|
-
}
|
|
733
|
-
return view;
|
|
717
|
+
withParentPayloadApplied(_executionRequests) {
|
|
718
|
+
throw new Error("NativeBeaconStateView does not support Gloas");
|
|
734
719
|
}
|
|
735
720
|
}
|
|
736
721
|
//# sourceMappingURL=nativeBeaconStateView.js.map
|