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