@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.
Files changed (68) hide show
  1. package/lib/block/indexedBuilderState.d.ts +19 -0
  2. package/lib/block/indexedBuilderState.d.ts.map +1 -0
  3. package/lib/block/indexedBuilderState.js +60 -0
  4. package/lib/block/indexedBuilderState.js.map +1 -0
  5. package/lib/block/processBuilderDepositRequest.d.ts +2 -2
  6. package/lib/block/processBuilderDepositRequest.d.ts.map +1 -1
  7. package/lib/block/processBuilderDepositRequest.js +5 -4
  8. package/lib/block/processBuilderDepositRequest.js.map +1 -1
  9. package/lib/block/processBuilderExitRequest.d.ts +2 -2
  10. package/lib/block/processBuilderExitRequest.d.ts.map +1 -1
  11. package/lib/block/processBuilderExitRequest.js +4 -3
  12. package/lib/block/processBuilderExitRequest.js.map +1 -1
  13. package/lib/block/processParentExecutionPayload.d.ts.map +1 -1
  14. package/lib/block/processParentExecutionPayload.js +23 -18
  15. package/lib/block/processParentExecutionPayload.js.map +1 -1
  16. package/lib/index.d.ts +3 -1
  17. package/lib/index.d.ts.map +1 -1
  18. package/lib/index.js +2 -0
  19. package/lib/index.js.map +1 -1
  20. package/lib/rewards/attestationsRewards.d.ts.map +1 -1
  21. package/lib/rewards/attestationsRewards.js +15 -6
  22. package/lib/rewards/attestationsRewards.js.map +1 -1
  23. package/lib/stateView/beaconStateView.d.ts +24 -19
  24. package/lib/stateView/beaconStateView.d.ts.map +1 -1
  25. package/lib/stateView/beaconStateView.js +83 -63
  26. package/lib/stateView/beaconStateView.js.map +1 -1
  27. package/lib/stateView/interface.d.ts +36 -21
  28. package/lib/stateView/interface.d.ts.map +1 -1
  29. package/lib/stateView/interface.js.map +1 -1
  30. package/lib/stateView/nativeBeaconStateView.d.ts +94 -98
  31. package/lib/stateView/nativeBeaconStateView.d.ts.map +1 -1
  32. package/lib/stateView/nativeBeaconStateView.js +343 -358
  33. package/lib/stateView/nativeBeaconStateView.js.map +1 -1
  34. package/lib/stateView/stateViewFactory.d.ts +10 -17
  35. package/lib/stateView/stateViewFactory.d.ts.map +1 -1
  36. package/lib/stateView/stateViewFactory.js +17 -13
  37. package/lib/stateView/stateViewFactory.js.map +1 -1
  38. package/lib/util/gloas.d.ts +11 -14
  39. package/lib/util/gloas.d.ts.map +1 -1
  40. package/lib/util/gloas.js +2 -42
  41. package/lib/util/gloas.js.map +1 -1
  42. package/lib/util/index.d.ts +1 -0
  43. package/lib/util/index.d.ts.map +1 -1
  44. package/lib/util/index.js +1 -0
  45. package/lib/util/index.js.map +1 -1
  46. package/lib/util/sszBytes.d.ts +16 -17
  47. package/lib/util/sszBytes.d.ts.map +1 -1
  48. package/lib/util/sszBytes.js +93 -20
  49. package/lib/util/sszBytes.js.map +1 -1
  50. package/lib/util/weakSubjectivity.d.ts +11 -6
  51. package/lib/util/weakSubjectivity.d.ts.map +1 -1
  52. package/lib/util/weakSubjectivity.js +22 -28
  53. package/lib/util/weakSubjectivity.js.map +1 -1
  54. package/package.json +7 -7
  55. package/src/block/indexedBuilderState.ts +65 -0
  56. package/src/block/processBuilderDepositRequest.ts +6 -17
  57. package/src/block/processBuilderExitRequest.ts +5 -9
  58. package/src/block/processParentExecutionPayload.ts +27 -23
  59. package/src/index.ts +4 -1
  60. package/src/rewards/attestationsRewards.ts +17 -5
  61. package/src/stateView/beaconStateView.ts +93 -68
  62. package/src/stateView/interface.ts +63 -21
  63. package/src/stateView/nativeBeaconStateView.ts +360 -365
  64. package/src/stateView/stateViewFactory.ts +29 -27
  65. package/src/util/gloas.ts +2 -53
  66. package/src/util/index.ts +6 -0
  67. package/src/util/sszBytes.ts +129 -22
  68. package/src/util/weakSubjectivity.ts +43 -40
@@ -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,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
- _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;
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
- _getBlockRootAtSlot = new Map();
82
- _getBlockRootAtEpoch = new Map();
83
- _getStateRootAtSlot = new Map();
84
- _getRandaoMix = new Map();
85
- _getShufflingAtEpoch = new Map();
86
- _getBeaconCommittee = new Map();
87
- _getBeaconCommitteeCountPerSlot = new Map();
88
- _getShufflingDecisionRoot = new Map();
89
- _getBeaconProposer = new Map();
90
- _getValidator = new Map();
91
- _getBalance = new Map();
92
- _getIndexedSyncCommitteeAtEpoch = new Map();
93
- _getIndexedSyncCommittee = new Map();
94
- _getSingleProof = new Map();
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
- _getPreviousShuffling = null;
99
- _getCurrentShuffling = null;
100
- _getNextShuffling = null;
101
- _getEffectiveBalanceIncrementsZeroInactive = null;
102
- _getAllValidators = null;
103
- _getBuildersLength = null;
104
- _getAllBalances = null;
105
- _getLatestWeakSubjectivityCheckpointEpoch = null;
106
- _getFinalizedRootProof = null;
107
- _computeUnrealizedCheckpoints = null;
108
- _computeAnchorCheckpoint = null;
109
- _isStateValidatorsNodesPopulated = null;
110
- _toValue = null;
111
- _serialize = null;
112
- _serializedSize = null;
113
- _serializeValidators = null;
114
- _serializedValidatorsSize = null;
115
- _hashTreeRoot = null;
116
- _getSyncCommitteesWitness = null;
117
- _getExpectedWithdrawals = null;
118
- 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;
119
111
  this.binding = binding;
120
112
  }
121
- // Binding returns pojo object {uint8Array: Uint8Array; bitLen: number}
122
- // this class wrap it with BitArray to conform to the api
113
+ release() {
114
+ this.binding.release();
115
+ }
123
116
  get executionPayloadAvailability() {
124
- if (this._executionPayloadAvailability === null) {
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._forkName === null) {
133
- this._forkName = this.binding.forkName;
121
+ if (this.cachedForkName === null) {
122
+ this.cachedForkName = this.binding.forkName;
134
123
  }
135
- return this._forkName;
124
+ return this.cachedForkName;
136
125
  }
137
126
  get forkSeq() {
138
- if (this._forkSeq === null) {
139
- this._forkSeq = this.binding.forkSeq;
127
+ if (this.cachedForkSeq === null) {
128
+ this.cachedForkSeq = this.binding.forkSeq;
140
129
  }
141
- return this._forkSeq;
130
+ return this.cachedForkSeq;
142
131
  }
143
132
  get slot() {
144
- if (this._slot === null) {
145
- this._slot = this.binding.slot;
133
+ if (this.cachedSlot === null) {
134
+ this.cachedSlot = this.binding.slot;
146
135
  }
147
- return this._slot;
136
+ return this.cachedSlot;
148
137
  }
149
138
  get fork() {
150
- if (this._fork === null) {
151
- this._fork = this.binding.fork;
139
+ if (this.cachedFork === null) {
140
+ this.cachedFork = this.binding.fork;
152
141
  }
153
- return this._fork;
142
+ return this.cachedFork;
154
143
  }
155
144
  get epoch() {
156
- if (this._epoch === null) {
157
- this._epoch = this.binding.epoch;
145
+ if (this.cachedEpoch === null) {
146
+ this.cachedEpoch = this.binding.epoch;
158
147
  }
159
- return this._epoch;
148
+ return this.cachedEpoch;
160
149
  }
161
150
  get genesisTime() {
162
- if (this._genesisTime === null) {
163
- this._genesisTime = this.binding.genesisTime;
151
+ if (this.cachedGenesisTime === null) {
152
+ this.cachedGenesisTime = this.binding.genesisTime;
164
153
  }
165
- return this._genesisTime;
154
+ return this.cachedGenesisTime;
166
155
  }
167
156
  get genesisValidatorsRoot() {
168
- if (this._genesisValidatorsRoot === null) {
169
- this._genesisValidatorsRoot = this.binding.genesisValidatorsRoot;
157
+ if (this.cachedGenesisValidatorsRoot === null) {
158
+ this.cachedGenesisValidatorsRoot = this.binding.genesisValidatorsRoot;
170
159
  }
171
- return this._genesisValidatorsRoot;
160
+ return this.cachedGenesisValidatorsRoot;
172
161
  }
173
162
  get eth1Data() {
174
- if (this._eth1Data === null) {
175
- this._eth1Data = this.binding.eth1Data;
163
+ if (this.cachedEth1Data === null) {
164
+ this.cachedEth1Data = this.binding.eth1Data;
176
165
  }
177
- return this._eth1Data;
166
+ return this.cachedEth1Data;
178
167
  }
179
168
  get latestBlockHeader() {
180
- if (this._latestBlockHeader === null) {
181
- this._latestBlockHeader = this.binding.latestBlockHeader;
169
+ if (this.cachedLatestBlockHeader === null) {
170
+ this.cachedLatestBlockHeader = this.binding.latestBlockHeader;
182
171
  }
183
- return this._latestBlockHeader;
172
+ return this.cachedLatestBlockHeader;
184
173
  }
185
174
  get previousJustifiedCheckpoint() {
186
- if (this._previousJustifiedCheckpoint === null) {
187
- this._previousJustifiedCheckpoint = this.binding.previousJustifiedCheckpoint;
175
+ if (this.cachedPreviousJustifiedCheckpoint === null) {
176
+ this.cachedPreviousJustifiedCheckpoint = this.binding.previousJustifiedCheckpoint;
188
177
  }
189
- return this._previousJustifiedCheckpoint;
178
+ return this.cachedPreviousJustifiedCheckpoint;
190
179
  }
191
180
  get currentJustifiedCheckpoint() {
192
- if (this._currentJustifiedCheckpoint === null) {
193
- this._currentJustifiedCheckpoint = this.binding.currentJustifiedCheckpoint;
181
+ if (this.cachedCurrentJustifiedCheckpoint === null) {
182
+ this.cachedCurrentJustifiedCheckpoint = this.binding.currentJustifiedCheckpoint;
194
183
  }
195
- return this._currentJustifiedCheckpoint;
184
+ return this.cachedCurrentJustifiedCheckpoint;
196
185
  }
197
186
  get finalizedCheckpoint() {
198
- if (this._finalizedCheckpoint === null) {
199
- this._finalizedCheckpoint = this.binding.finalizedCheckpoint;
187
+ if (this.cachedFinalizedCheckpoint === null) {
188
+ this.cachedFinalizedCheckpoint = this.binding.finalizedCheckpoint;
200
189
  }
201
- return this._finalizedCheckpoint;
190
+ return this.cachedFinalizedCheckpoint;
202
191
  }
203
192
  getBlockRootAtSlot(slot) {
204
- let cached = this._getBlockRootAtSlot.get(slot);
193
+ let cached = this.cachedBlockRootAtSlot.get(slot);
205
194
  if (cached === undefined) {
206
195
  cached = this.binding.getBlockRootAtSlot(slot);
207
- this._getBlockRootAtSlot.set(slot, cached);
196
+ this.cachedBlockRootAtSlot.set(slot, cached);
208
197
  }
209
198
  return cached;
210
199
  }
211
200
  getBlockRootAtEpoch(epoch) {
212
- let cached = this._getBlockRootAtEpoch.get(epoch);
201
+ let cached = this.cachedBlockRootAtEpoch.get(epoch);
213
202
  if (cached === undefined) {
214
203
  cached = this.binding.getBlockRootAtEpoch(epoch);
215
- this._getBlockRootAtEpoch.set(epoch, cached);
204
+ this.cachedBlockRootAtEpoch.set(epoch, cached);
216
205
  }
217
206
  return cached;
218
207
  }
219
208
  getStateRootAtSlot(slot) {
220
- let cached = this._getStateRootAtSlot.get(slot);
209
+ let cached = this.cachedStateRootAtSlot.get(slot);
221
210
  if (cached === undefined) {
222
211
  cached = this.binding.getStateRootAtSlot(slot);
223
- this._getStateRootAtSlot.set(slot, cached);
212
+ this.cachedStateRootAtSlot.set(slot, cached);
224
213
  }
225
214
  return cached;
226
215
  }
227
216
  getRandaoMix(epoch) {
228
- let cached = this._getRandaoMix.get(epoch);
217
+ let cached = this.cachedRandaoMix.get(epoch);
229
218
  if (cached === undefined) {
230
219
  cached = this.binding.getRandaoMix(epoch);
231
- this._getRandaoMix.set(epoch, cached);
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._getShufflingAtEpoch.get(epoch);
226
+ let cached = this.cachedShufflingAtEpoch.get(epoch);
238
227
  if (cached === undefined) {
239
228
  cached = this.binding.getShufflingAtEpoch(epoch);
240
- this._getShufflingAtEpoch.set(epoch, cached);
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._getBeaconCommittee.get(key);
235
+ let cached = this.cachedBeaconCommittee.get(key);
247
236
  if (cached === undefined) {
248
237
  cached = this.binding.getBeaconCommittee(slot, index);
249
- this._getBeaconCommittee.set(key, cached);
238
+ this.cachedBeaconCommittee.set(key, cached);
250
239
  }
251
240
  return cached;
252
241
  }
253
242
  getBeaconCommitteeCountPerSlot(epoch) {
254
- let cached = this._getBeaconCommitteeCountPerSlot.get(epoch);
243
+ let cached = this.cachedBeaconCommitteeCountPerSlot.get(epoch);
255
244
  if (cached === undefined) {
256
245
  cached = this.binding.getBeaconCommitteeCountPerSlot(epoch);
257
- this._getBeaconCommitteeCountPerSlot.set(epoch, cached);
246
+ this.cachedBeaconCommitteeCountPerSlot.set(epoch, cached);
258
247
  }
259
248
  return cached;
260
249
  }
261
250
  get previousDecisionRoot() {
262
- if (this._previousDecisionRoot === null) {
263
- this._previousDecisionRoot = this.binding.previousDecisionRoot;
251
+ if (this.cachedPreviousDecisionRoot === null) {
252
+ this.cachedPreviousDecisionRoot = this.binding.previousDecisionRoot;
264
253
  }
265
- return this._previousDecisionRoot;
254
+ return this.cachedPreviousDecisionRoot;
266
255
  }
267
256
  get currentDecisionRoot() {
268
- if (this._currentDecisionRoot === null) {
269
- this._currentDecisionRoot = this.binding.currentDecisionRoot;
257
+ if (this.cachedCurrentDecisionRoot === null) {
258
+ this.cachedCurrentDecisionRoot = this.binding.currentDecisionRoot;
270
259
  }
271
- return this._currentDecisionRoot;
260
+ return this.cachedCurrentDecisionRoot;
272
261
  }
273
262
  get nextDecisionRoot() {
274
- if (this._nextDecisionRoot === null) {
275
- this._nextDecisionRoot = this.binding.nextDecisionRoot;
263
+ if (this.cachedNextDecisionRoot === null) {
264
+ this.cachedNextDecisionRoot = this.binding.nextDecisionRoot;
276
265
  }
277
- return this._nextDecisionRoot;
266
+ return this.cachedNextDecisionRoot;
278
267
  }
279
268
  getShufflingDecisionRoot(epoch) {
280
- let cached = this._getShufflingDecisionRoot.get(epoch);
269
+ let cached = this.cachedShufflingDecisionRoot.get(epoch);
281
270
  if (cached === undefined) {
282
271
  cached = this.binding.getShufflingDecisionRoot(epoch);
283
- this._getShufflingDecisionRoot.set(epoch, cached);
272
+ this.cachedShufflingDecisionRoot.set(epoch, cached);
284
273
  }
285
274
  return cached;
286
275
  }
287
276
  getPreviousShuffling() {
288
- if (this._getPreviousShuffling === null) {
289
- this._getPreviousShuffling = this.binding.getPreviousShuffling();
277
+ if (this.cachedPreviousShuffling === null) {
278
+ this.cachedPreviousShuffling = this.binding.getPreviousShuffling();
290
279
  }
291
- return this._getPreviousShuffling;
280
+ return this.cachedPreviousShuffling;
292
281
  }
293
282
  getCurrentShuffling() {
294
- if (this._getCurrentShuffling === null) {
295
- this._getCurrentShuffling = this.binding.getCurrentShuffling();
283
+ if (this.cachedCurrentShuffling === null) {
284
+ this.cachedCurrentShuffling = this.binding.getCurrentShuffling();
296
285
  }
297
- return this._getCurrentShuffling;
286
+ return this.cachedCurrentShuffling;
298
287
  }
299
288
  getNextShuffling() {
300
- if (this._getNextShuffling === null) {
301
- this._getNextShuffling = this.binding.getNextShuffling();
289
+ if (this.cachedNextShuffling === null) {
290
+ this.cachedNextShuffling = this.binding.getNextShuffling();
302
291
  }
303
- return this._getNextShuffling;
292
+ return this.cachedNextShuffling;
304
293
  }
305
294
  // Proposer shuffling
306
295
  get previousProposers() {
307
- if (this._previousProposers === undefined) {
308
- this._previousProposers = this.binding.previousProposers;
296
+ if (this.cachedPreviousProposers === undefined) {
297
+ this.cachedPreviousProposers = this.binding.previousProposers;
309
298
  }
310
- return this._previousProposers;
299
+ return this.cachedPreviousProposers;
311
300
  }
312
301
  get currentProposers() {
313
- if (this._currentProposers === null) {
314
- this._currentProposers = this.binding.currentProposers;
302
+ if (this.cachedCurrentProposers === null) {
303
+ this.cachedCurrentProposers = this.binding.currentProposers;
315
304
  }
316
- return this._currentProposers;
305
+ return this.cachedCurrentProposers;
317
306
  }
318
307
  get nextProposers() {
319
- if (this._nextProposers === null) {
320
- this._nextProposers = this.binding.nextProposers;
308
+ if (this.cachedNextProposers === null) {
309
+ this.cachedNextProposers = this.binding.nextProposers;
321
310
  }
322
- return this._nextProposers;
311
+ return this.cachedNextProposers;
323
312
  }
324
313
  getBeaconProposer(slot) {
325
- let cached = this._getBeaconProposer.get(slot);
314
+ let cached = this.cachedBeaconProposer.get(slot);
326
315
  if (cached === undefined) {
327
316
  cached = this.binding.getBeaconProposer(slot);
328
- this._getBeaconProposer.set(slot, cached);
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._effectiveBalanceIncrements === null) {
335
- this._effectiveBalanceIncrements = this.binding.effectiveBalanceIncrements;
323
+ if (this.cachedEffectiveBalanceIncrements === null) {
324
+ this.cachedEffectiveBalanceIncrements = this.binding.effectiveBalanceIncrements;
336
325
  }
337
- return this._effectiveBalanceIncrements;
326
+ return this.cachedEffectiveBalanceIncrements;
338
327
  }
339
328
  getEffectiveBalanceIncrementsZeroInactive() {
340
- if (this._getEffectiveBalanceIncrementsZeroInactive === null) {
341
- this._getEffectiveBalanceIncrementsZeroInactive = this.binding.getEffectiveBalanceIncrementsZeroInactive();
329
+ if (this.cachedEffectiveBalanceIncrementsZeroInactive === null) {
330
+ this.cachedEffectiveBalanceIncrementsZeroInactive = this.binding.getEffectiveBalanceIncrementsZeroInactive();
342
331
  }
343
- return this._getEffectiveBalanceIncrementsZeroInactive;
332
+ return this.cachedEffectiveBalanceIncrementsZeroInactive;
344
333
  }
345
334
  getBalance(index) {
346
- let cached = this._getBalance.get(index);
335
+ let cached = this.cachedBalance.get(index);
347
336
  if (cached === undefined) {
348
337
  cached = this.binding.getBalance(index);
349
- this._getBalance.set(index, cached);
338
+ this.cachedBalance.set(index, cached);
350
339
  }
351
340
  return cached;
352
341
  }
353
342
  getValidator(index) {
354
- let cached = this._getValidator.get(index);
343
+ let cached = this.cachedValidator.get(index);
355
344
  if (cached === undefined) {
356
345
  cached = this.binding.getValidator(index);
357
- this._getValidator.set(index, cached);
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._validatorCount === null) {
366
- this._validatorCount = this.binding.validatorCount;
354
+ if (this.cachedValidatorCount === null) {
355
+ this.cachedValidatorCount = this.binding.validatorCount;
367
356
  }
368
- return this._validatorCount;
357
+ return this.cachedValidatorCount;
369
358
  }
370
359
  get activeValidatorCount() {
371
- if (this._activeValidatorCount === null) {
372
- this._activeValidatorCount = this.binding.activeValidatorCount;
360
+ if (this.cachedActiveValidatorCount === null) {
361
+ this.cachedActiveValidatorCount = this.binding.activeValidatorCount;
373
362
  }
374
- return this._activeValidatorCount;
363
+ return this.cachedActiveValidatorCount;
375
364
  }
376
365
  getAllValidators() {
377
- if (this._getAllValidators === null) {
378
- this._getAllValidators = this.binding.getAllValidators();
366
+ if (this.cachedAllValidators === null) {
367
+ this.cachedAllValidators = this.binding.getAllValidators();
379
368
  }
380
- return this._getAllValidators;
369
+ return this.cachedAllValidators;
381
370
  }
382
371
  getAllBalances() {
383
- if (this._getAllBalances === null) {
384
- this._getAllBalances = this.binding.getAllBalances();
372
+ if (this.cachedAllBalances === null) {
373
+ this.cachedAllBalances = this.binding.getAllBalances();
385
374
  }
386
- return this._getAllBalances;
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
- return this.binding.computeBlockRewards(block, proposerRewards);
394
- }
395
- 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) {
396
395
  return this.binding.computeAttestationsRewards(validatorIds);
397
396
  }
398
397
  getLatestWeakSubjectivityCheckpointEpoch() {
399
- if (this._getLatestWeakSubjectivityCheckpointEpoch === null) {
400
- this._getLatestWeakSubjectivityCheckpointEpoch = this.binding.getLatestWeakSubjectivityCheckpointEpoch();
398
+ if (this.cachedLatestWeakSubjectivityCheckpointEpoch === null) {
399
+ this.cachedLatestWeakSubjectivityCheckpointEpoch = this.binding.getLatestWeakSubjectivityCheckpointEpoch();
401
400
  }
402
- return this._getLatestWeakSubjectivityCheckpointEpoch;
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._getFinalizedRootProof === null) {
414
- this._getFinalizedRootProof = this.binding.getFinalizedRootProof();
412
+ if (this.cachedFinalizedRootProof === null) {
413
+ this.cachedFinalizedRootProof = this.binding.getFinalizedRootProof();
415
414
  }
416
- return this._getFinalizedRootProof;
415
+ return this.cachedFinalizedRootProof;
417
416
  }
418
417
  getSingleProof(gindex) {
419
- let cached = this._getSingleProof.get(gindex);
418
+ let cached = this.cachedSingleProof.get(gindex);
420
419
  if (cached === undefined) {
421
420
  cached = this.binding.getSingleProof(gindex);
422
- this._getSingleProof.set(gindex, cached);
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._computeUnrealizedCheckpoints === null) {
432
- this._computeUnrealizedCheckpoints = this.binding.computeUnrealizedCheckpoints();
430
+ if (this.cachedUnrealizedCheckpoints === null) {
431
+ this.cachedUnrealizedCheckpoints = this.binding.computeUnrealizedCheckpoints();
433
432
  }
434
- return this._computeUnrealizedCheckpoints;
433
+ return this.cachedUnrealizedCheckpoints;
435
434
  }
436
435
  computeAnchorCheckpoint() {
437
- if (this._computeAnchorCheckpoint === null) {
438
- this._computeAnchorCheckpoint = this.binding.computeAnchorCheckpoint();
436
+ if (this.cachedAnchorCheckpoint === null) {
437
+ this.cachedAnchorCheckpoint = this.binding.computeAnchorCheckpoint();
439
438
  }
440
- return this._computeAnchorCheckpoint;
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._createdWithTransferCache === null) {
451
- this._createdWithTransferCache = this.binding.createdWithTransferCache;
449
+ if (this.cachedCreatedWithTransferCache === null) {
450
+ this.cachedCreatedWithTransferCache = this.binding.createdWithTransferCache;
452
451
  }
453
- return this._createdWithTransferCache;
452
+ return this.cachedCreatedWithTransferCache;
454
453
  }
455
454
  isStateValidatorsNodesPopulated() {
456
- if (this._isStateValidatorsNodesPopulated === null) {
457
- this._isStateValidatorsNodesPopulated = this.binding.isStateValidatorsNodesPopulated();
455
+ if (this.cachedIsStateValidatorsNodesPopulated === null) {
456
+ this.cachedIsStateValidatorsNodesPopulated = this.binding.isStateValidatorsNodesPopulated();
458
457
  }
459
- return this._isStateValidatorsNodesPopulated;
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._toValue === null) {
467
- this._toValue = this.binding.toValue();
465
+ if (this.cachedValue === null) {
466
+ this.cachedValue = this.binding.toValue();
468
467
  }
469
- return this._toValue;
468
+ return this.cachedValue;
470
469
  }
471
470
  serialize() {
472
- if (this._serialize === null) {
473
- this._serialize = this.binding.serialize();
471
+ if (this.cachedSerialized === null) {
472
+ this.cachedSerialized = this.binding.serialize();
474
473
  }
475
- return this._serialize;
474
+ return this.cachedSerialized;
476
475
  }
477
476
  serializedSize() {
478
- if (this._serializedSize === null) {
479
- this._serializedSize = this.binding.serializedSize();
477
+ if (this.cachedSerializedSize === null) {
478
+ this.cachedSerializedSize = this.binding.serializedSize();
480
479
  }
481
- return this._serializedSize;
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._serializeValidators === null) {
488
- this._serializeValidators = this.binding.serializeValidators();
486
+ if (this.cachedSerializedValidators === null) {
487
+ this.cachedSerializedValidators = this.binding.serializeValidators();
489
488
  }
490
- return this._serializeValidators;
489
+ return this.cachedSerializedValidators;
491
490
  }
492
491
  serializedValidatorsSize() {
493
- if (this._serializedValidatorsSize === null) {
494
- this._serializedValidatorsSize = this.binding.serializedValidatorsSize();
492
+ if (this.cachedSerializedValidatorsSize === null) {
493
+ this.cachedSerializedValidatorsSize = this.binding.serializedValidatorsSize();
495
494
  }
496
- return this._serializedValidatorsSize;
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._hashTreeRoot === null) {
503
- this._hashTreeRoot = this.binding.hashTreeRoot();
501
+ if (this.cachedHashTreeRoot === null) {
502
+ this.cachedHashTreeRoot = this.binding.hashTreeRoot();
504
503
  }
505
- return this._hashTreeRoot;
504
+ return this.cachedHashTreeRoot;
506
505
  }
507
506
  // State transition
508
507
  computeNewStateRoot(input, modules) {
509
- const postState = new NativeBeaconStateView(this.binding.stateTransition(input.block, computeNewStateRootStateTransitionOpts, modules));
508
+ const postState = this.stateTransition(input, computeNewStateRootStateTransitionOpts, modules);
510
509
  return getComputeNewStateRootResult(postState);
511
510
  }
512
- stateTransition(signedBlock, options, modules) {
513
- 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));
514
520
  }
515
- processSlots(slot, opts, modules) {
516
- 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));
517
523
  }
518
524
  // ─── altair ──────────────────────────────────────────────────────────────
519
525
  get previousEpochParticipation() {
520
- if (this._previousEpochParticipation === null) {
521
- this._previousEpochParticipation = this.binding.previousEpochParticipation;
526
+ if (this.cachedPreviousEpochParticipation === null) {
527
+ this.cachedPreviousEpochParticipation = this.binding.previousEpochParticipation;
522
528
  }
523
- return this._previousEpochParticipation;
529
+ return this.cachedPreviousEpochParticipation;
524
530
  }
525
531
  get currentEpochParticipation() {
526
- if (this._currentEpochParticipation === null) {
527
- this._currentEpochParticipation = this.binding.currentEpochParticipation;
532
+ if (this.cachedCurrentEpochParticipation === null) {
533
+ this.cachedCurrentEpochParticipation = this.binding.currentEpochParticipation;
528
534
  }
529
- return this._currentEpochParticipation;
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._currentSyncCommittee === null) {
539
- this._currentSyncCommittee = this.binding.currentSyncCommittee;
544
+ if (this.cachedCurrentSyncCommittee === null) {
545
+ this.cachedCurrentSyncCommittee = this.binding.currentSyncCommittee;
540
546
  }
541
- return this._currentSyncCommittee;
547
+ return this.cachedCurrentSyncCommittee;
542
548
  }
543
549
  get nextSyncCommittee() {
544
- if (this._nextSyncCommittee === null) {
545
- this._nextSyncCommittee = this.binding.nextSyncCommittee;
550
+ if (this.cachedNextSyncCommittee === null) {
551
+ this.cachedNextSyncCommittee = this.binding.nextSyncCommittee;
546
552
  }
547
- return this._nextSyncCommittee;
553
+ return this.cachedNextSyncCommittee;
548
554
  }
549
555
  get currentSyncCommitteeIndexed() {
550
- if (this._currentSyncCommitteeIndexed === null) {
551
- this._currentSyncCommitteeIndexed = this.binding.currentSyncCommitteeIndexed;
556
+ if (this.cachedCurrentSyncCommitteeIndexed === null) {
557
+ this.cachedCurrentSyncCommitteeIndexed = this.binding.currentSyncCommitteeIndexed;
552
558
  }
553
- return this._currentSyncCommitteeIndexed;
559
+ return this.cachedCurrentSyncCommitteeIndexed;
554
560
  }
555
561
  get syncProposerReward() {
556
- if (this._syncProposerReward === null) {
557
- this._syncProposerReward = this.binding.syncProposerReward;
562
+ if (this.cachedSyncProposerReward === null) {
563
+ this.cachedSyncProposerReward = this.binding.syncProposerReward;
558
564
  }
559
- return this._syncProposerReward;
565
+ return this.cachedSyncProposerReward;
560
566
  }
561
567
  getIndexedSyncCommitteeAtEpoch(epoch) {
562
- let cached = this._getIndexedSyncCommitteeAtEpoch.get(epoch);
568
+ let cached = this.cachedIndexedSyncCommitteeAtEpoch.get(epoch);
563
569
  if (cached === undefined) {
564
570
  cached = this.binding.getIndexedSyncCommitteeAtEpoch(epoch);
565
- this._getIndexedSyncCommitteeAtEpoch.set(epoch, cached);
571
+ this.cachedIndexedSyncCommitteeAtEpoch.set(epoch, cached);
566
572
  }
567
573
  return cached;
568
574
  }
569
575
  getIndexedSyncCommittee(slot) {
570
- let cached = this._getIndexedSyncCommittee.get(slot);
576
+ let cached = this.cachedIndexedSyncCommittee.get(slot);
571
577
  if (cached === undefined) {
572
578
  cached = this.binding.getIndexedSyncCommittee(slot);
573
- this._getIndexedSyncCommittee.set(slot, cached);
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._getSyncCommitteesWitness === null) {
582
- this._getSyncCommitteesWitness = this.binding.getSyncCommitteesWitness();
587
+ if (this.cachedSyncCommitteesWitness === null) {
588
+ this.cachedSyncCommitteesWitness = this.binding.getSyncCommitteesWitness();
583
589
  }
584
- return this._getSyncCommitteesWitness;
590
+ return this.cachedSyncCommitteesWitness;
585
591
  }
586
592
  // ─── bellatrix ───────────────────────────────────────────────────────────
587
593
  get latestExecutionPayloadHeader() {
588
- if (this._latestExecutionPayloadHeader === null) {
589
- this._latestExecutionPayloadHeader = this.binding.latestExecutionPayloadHeader;
594
+ if (this.cachedLatestExecutionPayloadHeader === null) {
595
+ this.cachedLatestExecutionPayloadHeader = this.binding.latestExecutionPayloadHeader;
590
596
  }
591
- return this._latestExecutionPayloadHeader;
597
+ return this.cachedLatestExecutionPayloadHeader;
592
598
  }
593
599
  get payloadBlockNumber() {
594
- if (this._payloadBlockNumber === null) {
595
- this._payloadBlockNumber = this.binding.payloadBlockNumber;
600
+ if (this.cachedPayloadBlockNumber === null) {
601
+ this.cachedPayloadBlockNumber = this.binding.payloadBlockNumber;
596
602
  }
597
- return this._payloadBlockNumber;
603
+ return this.cachedPayloadBlockNumber;
598
604
  }
599
605
  get isExecutionStateType() {
600
- if (this._isExecutionStateType === null) {
601
- this._isExecutionStateType = this.binding.isExecutionStateType;
606
+ if (this.cachedIsExecutionStateType === null) {
607
+ this.cachedIsExecutionStateType = this.binding.isExecutionStateType;
602
608
  }
603
- return this._isExecutionStateType;
609
+ return this.cachedIsExecutionStateType;
604
610
  }
605
611
  get isMergeTransitionComplete() {
606
- if (this._isMergeTransitionComplete === null) {
607
- this._isMergeTransitionComplete = this.binding.isMergeTransitionComplete;
612
+ if (this.cachedIsMergeTransitionComplete === null) {
613
+ this.cachedIsMergeTransitionComplete = this.binding.isMergeTransitionComplete;
608
614
  }
609
- return this._isMergeTransitionComplete;
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._historicalSummaries === null) {
617
- this._historicalSummaries = this.binding.historicalSummaries;
622
+ if (this.cachedHistoricalSummaries === null) {
623
+ this.cachedHistoricalSummaries = this.binding.historicalSummaries;
618
624
  }
619
- return this._historicalSummaries;
625
+ return this.cachedHistoricalSummaries;
620
626
  }
621
627
  getExpectedWithdrawals() {
622
- if (this._getExpectedWithdrawals === null) {
623
- this._getExpectedWithdrawals = this.binding.getExpectedWithdrawals();
628
+ if (this.cachedExpectedWithdrawals === null) {
629
+ this.cachedExpectedWithdrawals = this.binding.getExpectedWithdrawals();
624
630
  }
625
- return this._getExpectedWithdrawals;
631
+ return this.cachedExpectedWithdrawals;
626
632
  }
627
633
  // ─── electra ─────────────────────────────────────────────────────────────
628
634
  get pendingDeposits() {
629
- if (this._pendingDeposits === null) {
630
- this._pendingDeposits = this.binding.pendingDeposits;
635
+ if (this.cachedPendingDeposits === null) {
636
+ this.cachedPendingDeposits = ssz.electra.PendingDeposits.deserialize(this.binding.pendingDeposits);
631
637
  }
632
- return this._pendingDeposits;
638
+ return this.cachedPendingDeposits;
633
639
  }
634
640
  get pendingDepositsCount() {
635
- if (this._pendingDepositsCount === null) {
636
- this._pendingDepositsCount = this.binding.pendingDepositsCount;
641
+ if (this.cachedPendingDepositsCount === null) {
642
+ this.cachedPendingDepositsCount = this.binding.pendingDepositsCount;
637
643
  }
638
- return this._pendingDepositsCount;
644
+ return this.cachedPendingDepositsCount;
639
645
  }
640
646
  get pendingPartialWithdrawals() {
641
- if (this._pendingPartialWithdrawals === null) {
642
- this._pendingPartialWithdrawals = this.binding.pendingPartialWithdrawals;
647
+ if (this.cachedPendingPartialWithdrawals === null) {
648
+ this.cachedPendingPartialWithdrawals = ssz.electra.PendingPartialWithdrawals.deserialize(this.binding.pendingPartialWithdrawals);
643
649
  }
644
- return this._pendingPartialWithdrawals;
650
+ return this.cachedPendingPartialWithdrawals;
645
651
  }
646
652
  get pendingPartialWithdrawalsCount() {
647
- if (this._pendingPartialWithdrawalsCount === null) {
648
- this._pendingPartialWithdrawalsCount = this.binding.pendingPartialWithdrawalsCount;
653
+ if (this.cachedPendingPartialWithdrawalsCount === null) {
654
+ this.cachedPendingPartialWithdrawalsCount = this.binding.pendingPartialWithdrawalsCount;
649
655
  }
650
- return this._pendingPartialWithdrawalsCount;
656
+ return this.cachedPendingPartialWithdrawalsCount;
651
657
  }
652
658
  get pendingConsolidations() {
653
- if (this._pendingConsolidations === null) {
654
- this._pendingConsolidations = this.binding.pendingConsolidations;
659
+ if (this.cachedPendingConsolidations === null) {
660
+ this.cachedPendingConsolidations = ssz.electra.PendingConsolidations.deserialize(this.binding.pendingConsolidations);
655
661
  }
656
- return this._pendingConsolidations;
662
+ return this.cachedPendingConsolidations;
657
663
  }
658
664
  get pendingConsolidationsCount() {
659
- if (this._pendingConsolidationsCount === null) {
660
- this._pendingConsolidationsCount = this.binding.pendingConsolidationsCount;
665
+ if (this.cachedPendingConsolidationsCount === null) {
666
+ this.cachedPendingConsolidationsCount = this.binding.pendingConsolidationsCount;
661
667
  }
662
- return this._pendingConsolidationsCount;
668
+ return this.cachedPendingConsolidationsCount;
663
669
  }
664
670
  // ─── fulu ────────────────────────────────────────────────────────────────
665
671
  get proposerLookahead() {
666
- if (this._proposerLookahead === null) {
667
- this._proposerLookahead = this.binding.proposerLookahead;
672
+ if (this.cachedProposerLookahead === null) {
673
+ this.cachedProposerLookahead = Array.from(this.binding.proposerLookahead);
668
674
  }
669
- return this._proposerLookahead;
675
+ return this.cachedProposerLookahead;
670
676
  }
671
- preVerifyBuilderDepositsPreGloas(maxBuilderDeposits, maxDurationMs) {
672
- return this.binding.preVerifyBuilderDepositsPreGloas(maxBuilderDeposits, maxDurationMs);
677
+ preVerifyBuilderDepositsPreGloas(_maxBuilderDeposits, _maxDurationMs) {
678
+ throw new Error("NativeBeaconStateView does not support Gloas");
673
679
  }
674
680
  clearPreGloasBuilderDepositCache() {
675
- this.binding.clearPreGloasBuilderDepositCache();
681
+ throw new Error("NativeBeaconStateView does not support Gloas");
676
682
  }
677
683
  // ─── gloas ───────────────────────────────────────────────────────────────
678
684
  get latestBlockHash() {
679
- if (this._latestBlockHash === null) {
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
- if (this._latestExecutionPayloadBid === null) {
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
- if (this._payloadExpectedWithdrawals === null) {
693
- this._payloadExpectedWithdrawals = this.binding.payloadExpectedWithdrawals;
694
- }
695
- return this._payloadExpectedWithdrawals;
691
+ throw new Error("NativeBeaconStateView does not support Gloas");
696
692
  }
697
- getBuilder(index) {
698
- let cached = this._getBuilder.get(index);
699
- if (cached === undefined) {
700
- cached = this.binding.getBuilder(index);
701
- this._getBuilder.set(index, cached);
702
- }
703
- return cached;
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
- if (this._getBuildersLength === null) {
707
- this._getBuildersLength = this.binding.getBuildersLength();
708
- }
709
- return this._getBuildersLength;
703
+ throw new Error("NativeBeaconStateView does not support Gloas");
710
704
  }
711
- canBuilderCoverBid(builderIndex, bidAmount) {
712
- return this.binding.canBuilderCoverBid(builderIndex, bidAmount);
705
+ canBuilderCoverBid(_builderIndex, _bidAmount) {
706
+ throw new Error("NativeBeaconStateView does not support Gloas");
713
707
  }
714
- getEpochPTCs(epoch) {
715
- let cached = this._getEpochPTCs.get(epoch);
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(slot) {
723
- return this.binding.getPayloadTimelinessCommittee(slot);
711
+ getPayloadTimelinessCommittee(_slot) {
712
+ throw new Error("NativeBeaconStateView does not support Gloas");
724
713
  }
725
- getIndicesInPayloadTimelinessCommittee(validatorIndex, slot) {
726
- return this.binding.getIndicesInPayloadTimelinessCommittee(validatorIndex, slot);
714
+ getIndicesInPayloadTimelinessCommittee(_validatorIndex, _slot) {
715
+ throw new Error("NativeBeaconStateView does not support Gloas");
727
716
  }
728
- withParentPayloadApplied(executionRequests) {
729
- const view = new NativeBeaconStateView(this.binding.withParentPayloadApplied(executionRequests));
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