@lodestar/state-transition 1.50.0-dev.2e668c516f → 1.50.0-dev.3430a7cf04

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