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