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