@lodestar/state-transition 1.50.0-dev.023ad6c012 → 1.50.0-dev.040a952dd7

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