@lodestar/state-transition 1.50.0-dev.1f38fe79fb → 1.50.0-dev.20062ed60e

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