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