@lodestar/state-transition 1.42.0-dev.7df0e2c8fa → 1.42.0-dev.8300b502a6
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/index.d.ts +4 -2
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +4 -1
- package/lib/index.js.map +1 -1
- package/lib/signatureSets/executionPayloadEnvelope.d.ts.map +1 -1
- package/lib/signatureSets/executionPayloadEnvelope.js +4 -0
- package/lib/signatureSets/executionPayloadEnvelope.js.map +1 -1
- package/lib/signatureSets/voluntaryExits.d.ts +2 -2
- package/lib/signatureSets/voluntaryExits.d.ts.map +1 -1
- package/lib/signatureSets/voluntaryExits.js +4 -0
- package/lib/signatureSets/voluntaryExits.js.map +1 -1
- package/lib/stateTransition.d.ts +1 -1
- package/lib/stateTransition.d.ts.map +1 -1
- package/lib/stateTransition.js +1 -1
- package/lib/stateTransition.js.map +1 -1
- package/lib/stateView/beaconStateView.d.ts +6 -8
- package/lib/stateView/beaconStateView.d.ts.map +1 -1
- package/lib/stateView/beaconStateView.js +18 -31
- package/lib/stateView/beaconStateView.js.map +1 -1
- package/lib/stateView/index.d.ts +1 -0
- package/lib/stateView/index.d.ts.map +1 -1
- package/lib/stateView/index.js +1 -0
- package/lib/stateView/index.js.map +1 -1
- package/lib/stateView/interface.d.ts +98 -51
- package/lib/stateView/interface.d.ts.map +1 -1
- package/lib/stateView/interface.js +22 -1
- package/lib/stateView/interface.js.map +1 -1
- package/lib/stateView/stateViewFactory.d.ts +40 -0
- package/lib/stateView/stateViewFactory.d.ts.map +1 -0
- package/lib/stateView/stateViewFactory.js +46 -0
- package/lib/stateView/stateViewFactory.js.map +1 -0
- package/lib/testUtils/cache.d.ts.map +1 -1
- package/lib/testUtils/cache.js +1 -1
- package/lib/testUtils/cache.js.map +1 -1
- package/lib/testUtils/util.d.ts +13 -1
- package/lib/testUtils/util.d.ts.map +1 -1
- package/lib/testUtils/util.js +119 -19
- package/lib/testUtils/util.js.map +1 -1
- package/lib/util/gloas.d.ts +2 -1
- package/lib/util/gloas.d.ts.map +1 -1
- package/lib/util/gloas.js.map +1 -1
- package/package.json +7 -7
- package/src/index.ts +20 -2
- package/src/signatureSets/executionPayloadEnvelope.ts +5 -1
- package/src/signatureSets/voluntaryExits.ts +5 -2
- package/src/stateTransition.ts +1 -1
- package/src/stateView/beaconStateView.ts +26 -49
- package/src/stateView/index.ts +1 -0
- package/src/stateView/interface.ts +143 -73
- package/src/stateView/stateViewFactory.ts +78 -0
- package/src/testUtils/cache.ts +1 -1
- package/src/testUtils/util.ts +136 -22
- package/src/util/gloas.ts +2 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { CompactMultiProof } from "@chainsafe/persistent-merkle-tree";
|
|
2
2
|
import { BitArray, ByteViews } from "@chainsafe/ssz";
|
|
3
|
+
import { ForkName, ForkPostAltair, ForkPostBellatrix, ForkPostCapella, ForkPostDeneb, ForkPostElectra, ForkPostFulu, ForkPostGloas } from "@lodestar/params";
|
|
3
4
|
import { BeaconBlock, BeaconState, BlindedBeaconBlock, BuilderIndex, Bytes32, Epoch, ExecutionPayloadBid, ExecutionPayloadHeader, Root, RootHex, SignedBeaconBlock, SignedBlindedBeaconBlock, Slot, ValidatorIndex, altair, capella, electra, fulu, gloas, phase0, rewards } from "@lodestar/types";
|
|
4
5
|
import { Checkpoint, Fork } from "@lodestar/types/phase0";
|
|
5
6
|
import { ProcessExecutionPayloadEnvelopeOpts } from "../block/processExecutionPayloadEnvelope.js";
|
|
@@ -15,6 +16,7 @@ import { EpochShuffling } from "../util/epochShuffling.js";
|
|
|
15
16
|
* A read-only view of the BeaconState.
|
|
16
17
|
*/
|
|
17
18
|
export interface IBeaconStateView {
|
|
19
|
+
forkName: ForkName;
|
|
18
20
|
slot: Slot;
|
|
19
21
|
fork: Fork;
|
|
20
22
|
epoch: Epoch;
|
|
@@ -29,38 +31,6 @@ export interface IBeaconStateView {
|
|
|
29
31
|
getBlockRootAtEpoch(epoch: Epoch): Root;
|
|
30
32
|
getStateRootAtSlot(slot: Slot): Root;
|
|
31
33
|
getRandaoMix(epoch: Epoch): Bytes32;
|
|
32
|
-
previousEpochParticipation: Uint8Array;
|
|
33
|
-
currentEpochParticipation: Uint8Array;
|
|
34
|
-
getPreviousEpochParticipation(validatorIndex: ValidatorIndex): number;
|
|
35
|
-
getCurrentEpochParticipation(validatorIndex: ValidatorIndex): number;
|
|
36
|
-
latestExecutionPayloadHeader: ExecutionPayloadHeader;
|
|
37
|
-
/**
|
|
38
|
-
* Cross-fork accessor for the execution block hash of the most recently included payload.
|
|
39
|
-
* Pre-gloas: returns latestExecutionPayloadHeader.blockHash (bellatrix–fulu).
|
|
40
|
-
* Gloas+: returns the dedicated latestBlockHash state field (EIP-7732).
|
|
41
|
-
* Throws before bellatrix.
|
|
42
|
-
*/
|
|
43
|
-
latestBlockHash: Bytes32;
|
|
44
|
-
/**
|
|
45
|
-
* The execution block number of the most recently included payload.
|
|
46
|
-
* Named payloadBlockNumber (not latestBlockNumber) to mirror ExecutionPayloadHeader.blockNumber pre-gloas.
|
|
47
|
-
* Only available from bellatrix through fulu — not tracked on BeaconState in gloas+ (EIP-7732).
|
|
48
|
-
* Throws before bellatrix and from gloas onwards.
|
|
49
|
-
*/
|
|
50
|
-
payloadBlockNumber: number;
|
|
51
|
-
historicalSummaries: capella.HistoricalSummaries;
|
|
52
|
-
pendingDeposits: electra.PendingDeposits;
|
|
53
|
-
pendingDepositsCount: number;
|
|
54
|
-
pendingPartialWithdrawals: electra.PendingPartialWithdrawals;
|
|
55
|
-
pendingPartialWithdrawalsCount: number;
|
|
56
|
-
pendingConsolidations: electra.PendingConsolidations;
|
|
57
|
-
pendingConsolidationsCount: number;
|
|
58
|
-
proposerLookahead: fulu.ProposerLookahead;
|
|
59
|
-
executionPayloadAvailability: BitArray;
|
|
60
|
-
latestExecutionPayloadBid: ExecutionPayloadBid;
|
|
61
|
-
getBuilder(index: BuilderIndex): gloas.Builder;
|
|
62
|
-
canBuilderCoverBid(builderIndex: BuilderIndex, bidAmount: number): boolean;
|
|
63
|
-
getIndexInPayloadTimelinessCommittee(validatorIndex: ValidatorIndex, slot: Slot): number;
|
|
64
34
|
getShufflingAtEpoch(epoch: Epoch): EpochShuffling;
|
|
65
35
|
previousDecisionRoot: RootHex;
|
|
66
36
|
currentDecisionRoot: RootHex;
|
|
@@ -73,13 +43,6 @@ export interface IBeaconStateView {
|
|
|
73
43
|
currentProposers: ValidatorIndex[];
|
|
74
44
|
nextProposers: ValidatorIndex[];
|
|
75
45
|
getBeaconProposer(slot: Slot): ValidatorIndex;
|
|
76
|
-
currentSyncCommittee: altair.SyncCommittee;
|
|
77
|
-
nextSyncCommittee: altair.SyncCommittee;
|
|
78
|
-
currentSyncCommitteeIndexed: SyncCommitteeCache;
|
|
79
|
-
syncProposerReward: number;
|
|
80
|
-
getIndexedSyncCommitteeAtEpoch(epoch: Epoch): SyncCommitteeCache;
|
|
81
|
-
/** Get indexed sync committee with slot+1 offset for duty lookups */
|
|
82
|
-
getIndexedSyncCommittee(slot: Slot): SyncCommitteeCache;
|
|
83
46
|
effectiveBalanceIncrements: EffectiveBalanceIncrements;
|
|
84
47
|
getEffectiveBalanceIncrementsZeroInactive(): EffectiveBalanceIncrements;
|
|
85
48
|
getBalance(index: number): number;
|
|
@@ -89,25 +52,13 @@ export interface IBeaconStateView {
|
|
|
89
52
|
activeValidatorCount: number;
|
|
90
53
|
getAllValidators(): phase0.Validator[];
|
|
91
54
|
getAllBalances(): number[];
|
|
92
|
-
isExecutionStateType: boolean;
|
|
93
|
-
isMergeTransitionComplete: boolean;
|
|
94
|
-
isExecutionEnabled(block: BeaconBlock | BlindedBeaconBlock): boolean;
|
|
95
|
-
getExpectedWithdrawals(): {
|
|
96
|
-
expectedWithdrawals: capella.Withdrawal[];
|
|
97
|
-
processedBuilderWithdrawalsCount: number;
|
|
98
|
-
processedPartialWithdrawalsCount: number;
|
|
99
|
-
processedBuildersSweepCount: number;
|
|
100
|
-
processedValidatorSweepCount: number;
|
|
101
|
-
};
|
|
102
55
|
proposerRewards: RewardCache;
|
|
103
56
|
computeBlockRewards(block: BeaconBlock, proposerRewards?: RewardCache): Promise<rewards.BlockRewards>;
|
|
104
57
|
computeAttestationsRewards(validatorIds?: (ValidatorIndex | string)[]): Promise<rewards.AttestationsRewards>;
|
|
105
|
-
computeSyncCommitteeRewards(block: BeaconBlock, validatorIds: (ValidatorIndex | string)[]): Promise<rewards.SyncCommitteeRewards>;
|
|
106
58
|
getLatestWeakSubjectivityCheckpointEpoch(): Epoch;
|
|
107
59
|
getVoluntaryExitValidity(signedVoluntaryExit: phase0.SignedVoluntaryExit, verifySignature: boolean): VoluntaryExitValidity;
|
|
108
60
|
isValidVoluntaryExit(signedVoluntaryExit: phase0.SignedVoluntaryExit, verifySignature: boolean): boolean;
|
|
109
61
|
getFinalizedRootProof(): Uint8Array[];
|
|
110
|
-
getSyncCommitteesWitness(): SyncCommitteeWitness;
|
|
111
62
|
getSingleProof(gindex: bigint): Uint8Array[];
|
|
112
63
|
createMultiProof(descriptor: Uint8Array): CompactMultiProof;
|
|
113
64
|
computeUnrealizedCheckpoints(): {
|
|
@@ -135,6 +86,102 @@ export interface IBeaconStateView {
|
|
|
135
86
|
processSlots(slot: Slot, epochTransitionCacheOpts?: EpochTransitionCacheOpts & {
|
|
136
87
|
dontTransferCache?: boolean;
|
|
137
88
|
}, modules?: StateTransitionModules): IBeaconStateView;
|
|
89
|
+
}
|
|
90
|
+
/** Altair+ state fields — use isStatePostAltair() guard */
|
|
91
|
+
export interface IBeaconStateViewAltair extends IBeaconStateView {
|
|
92
|
+
forkName: ForkPostAltair;
|
|
93
|
+
previousEpochParticipation: Uint8Array;
|
|
94
|
+
currentEpochParticipation: Uint8Array;
|
|
95
|
+
getPreviousEpochParticipation(validatorIndex: ValidatorIndex): number;
|
|
96
|
+
getCurrentEpochParticipation(validatorIndex: ValidatorIndex): number;
|
|
97
|
+
currentSyncCommittee: altair.SyncCommittee;
|
|
98
|
+
nextSyncCommittee: altair.SyncCommittee;
|
|
99
|
+
currentSyncCommitteeIndexed: SyncCommitteeCache;
|
|
100
|
+
syncProposerReward: number;
|
|
101
|
+
getIndexedSyncCommitteeAtEpoch(epoch: Epoch): SyncCommitteeCache;
|
|
102
|
+
/** Get indexed sync committee with slot+1 offset for duty lookups */
|
|
103
|
+
getIndexedSyncCommittee(slot: Slot): SyncCommitteeCache;
|
|
104
|
+
computeSyncCommitteeRewards(block: BeaconBlock, validatorIds: (ValidatorIndex | string)[]): Promise<rewards.SyncCommitteeRewards>;
|
|
105
|
+
getSyncCommitteesWitness(): SyncCommitteeWitness;
|
|
106
|
+
}
|
|
107
|
+
/** Bellatrix+ state fields — use isStatePostBellatrix() guard */
|
|
108
|
+
export interface IBeaconStateViewBellatrix extends IBeaconStateViewAltair {
|
|
109
|
+
forkName: ForkPostBellatrix;
|
|
110
|
+
latestExecutionPayloadHeader: ExecutionPayloadHeader;
|
|
111
|
+
/**
|
|
112
|
+
* Cross-fork accessor for the execution block hash of the most recently included payload.
|
|
113
|
+
* Pre-gloas: returns latestExecutionPayloadHeader.blockHash (bellatrix–fulu).
|
|
114
|
+
* Gloas+: returns the dedicated latestBlockHash state field (EIP-7732).
|
|
115
|
+
* Throws before bellatrix.
|
|
116
|
+
*/
|
|
117
|
+
latestBlockHash: Bytes32;
|
|
118
|
+
/**
|
|
119
|
+
* The execution block number of the most recently included payload.
|
|
120
|
+
* Named payloadBlockNumber (not latestBlockNumber) to mirror ExecutionPayloadHeader.blockNumber pre-gloas.
|
|
121
|
+
* Only available from bellatrix through fulu — not tracked on BeaconState in gloas+ (EIP-7732).
|
|
122
|
+
* Throws before bellatrix and from gloas onwards.
|
|
123
|
+
*/
|
|
124
|
+
payloadBlockNumber: number;
|
|
125
|
+
isExecutionStateType: boolean;
|
|
126
|
+
isMergeTransitionComplete: boolean;
|
|
127
|
+
isExecutionEnabled(block: BeaconBlock | BlindedBeaconBlock): boolean;
|
|
128
|
+
}
|
|
129
|
+
/** Capella+ state fields — use isStatePostCapella() guard */
|
|
130
|
+
export interface IBeaconStateViewCapella extends IBeaconStateViewBellatrix {
|
|
131
|
+
forkName: ForkPostCapella;
|
|
132
|
+
historicalSummaries: capella.HistoricalSummaries;
|
|
133
|
+
getExpectedWithdrawals(): {
|
|
134
|
+
expectedWithdrawals: capella.Withdrawal[];
|
|
135
|
+
processedBuilderWithdrawalsCount: number;
|
|
136
|
+
processedPartialWithdrawalsCount: number;
|
|
137
|
+
processedBuildersSweepCount: number;
|
|
138
|
+
processedValidatorSweepCount: number;
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
/** Deneb+ state — no new state-view fields; placeholder for fork completeness and isStatePostDeneb() narrowing */
|
|
142
|
+
export interface IBeaconStateViewDeneb extends IBeaconStateViewCapella {
|
|
143
|
+
forkName: ForkPostDeneb;
|
|
144
|
+
}
|
|
145
|
+
/** Electra+ state fields — use isStatePostElectra() guard */
|
|
146
|
+
export interface IBeaconStateViewElectra extends IBeaconStateViewDeneb {
|
|
147
|
+
forkName: ForkPostElectra;
|
|
148
|
+
pendingDeposits: electra.PendingDeposits;
|
|
149
|
+
pendingDepositsCount: number;
|
|
150
|
+
pendingPartialWithdrawals: electra.PendingPartialWithdrawals;
|
|
151
|
+
pendingPartialWithdrawalsCount: number;
|
|
152
|
+
pendingConsolidations: electra.PendingConsolidations;
|
|
153
|
+
pendingConsolidationsCount: number;
|
|
154
|
+
}
|
|
155
|
+
/** Fulu+ state fields — use isStatePostFulu() guard */
|
|
156
|
+
export interface IBeaconStateViewFulu extends IBeaconStateViewElectra {
|
|
157
|
+
forkName: ForkPostFulu;
|
|
158
|
+
proposerLookahead: fulu.ProposerLookahead;
|
|
159
|
+
}
|
|
160
|
+
/** Gloas+ state fields — use isStatePostGloas() guard */
|
|
161
|
+
export interface IBeaconStateViewGloas extends IBeaconStateViewFulu {
|
|
162
|
+
forkName: ForkPostGloas;
|
|
163
|
+
executionPayloadAvailability: BitArray;
|
|
164
|
+
latestExecutionPayloadBid: ExecutionPayloadBid;
|
|
165
|
+
payloadExpectedWithdrawals: capella.Withdrawal[];
|
|
166
|
+
getBuilder(index: BuilderIndex): gloas.Builder;
|
|
167
|
+
canBuilderCoverBid(builderIndex: BuilderIndex, bidAmount: number): boolean;
|
|
168
|
+
getIndexInPayloadTimelinessCommittee(validatorIndex: ValidatorIndex, slot: Slot): number;
|
|
138
169
|
processExecutionPayloadEnvelope(signedEnvelope: gloas.SignedExecutionPayloadEnvelope, opts?: ProcessExecutionPayloadEnvelopeOpts): IBeaconStateView;
|
|
139
170
|
}
|
|
171
|
+
/**
|
|
172
|
+
* Type constraint for the concrete BeaconStateView class.
|
|
173
|
+
* Requires all fields from the latest fork interface (IBeaconStateViewGloas) but keeps
|
|
174
|
+
* forkName as ForkName since the class wraps any fork's state.
|
|
175
|
+
* Sub-interfaces retain their narrowed forkName discriminants for caller-side type guards.
|
|
176
|
+
*/
|
|
177
|
+
export type IBeaconStateViewLatestFork = Omit<IBeaconStateViewGloas, "forkName"> & {
|
|
178
|
+
forkName: ForkName;
|
|
179
|
+
};
|
|
180
|
+
export declare function isStatePostAltair(state: IBeaconStateView): state is IBeaconStateViewAltair;
|
|
181
|
+
export declare function isStatePostBellatrix(state: IBeaconStateView): state is IBeaconStateViewBellatrix;
|
|
182
|
+
export declare function isStatePostCapella(state: IBeaconStateView): state is IBeaconStateViewCapella;
|
|
183
|
+
export declare function isStatePostDeneb(state: IBeaconStateView): state is IBeaconStateViewDeneb;
|
|
184
|
+
export declare function isStatePostElectra(state: IBeaconStateView): state is IBeaconStateViewElectra;
|
|
185
|
+
export declare function isStatePostFulu(state: IBeaconStateView): state is IBeaconStateViewFulu;
|
|
186
|
+
export declare function isStatePostGloas(state: IBeaconStateView): state is IBeaconStateViewGloas;
|
|
140
187
|
//# sourceMappingURL=interface.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interface.d.ts","sourceRoot":"","s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+BAA+B,CAC7B,cAAc,EAAE,KAAK,CAAC,8BAA8B,EACpD,IAAI,CAAC,EAAE,mCAAmC,GACzC,gBAAgB,CAAC;CACrB;AAED;;;;;GAKG;AACH,MAAM,MAAM,0BAA0B,GAAG,IAAI,CAAC,qBAAqB,EAAE,UAAU,CAAC,GAAG;IAAC,QAAQ,EAAE,QAAQ,CAAA;CAAC,CAAC;AACxG,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,gBAAgB,GAAG,KAAK,IAAI,sBAAsB,CAE1F;AAED,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,gBAAgB,GAAG,KAAK,IAAI,yBAAyB,CAEhG;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,gBAAgB,GAAG,KAAK,IAAI,uBAAuB,CAE5F;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,gBAAgB,GAAG,KAAK,IAAI,qBAAqB,CAExF;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,gBAAgB,GAAG,KAAK,IAAI,uBAAuB,CAE5F;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,gBAAgB,GAAG,KAAK,IAAI,oBAAoB,CAEtF;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,gBAAgB,GAAG,KAAK,IAAI,qBAAqB,CAExF"}
|
|
@@ -1,2 +1,23 @@
|
|
|
1
|
-
|
|
1
|
+
import { isForkPostAltair, isForkPostBellatrix, isForkPostCapella, isForkPostDeneb, isForkPostElectra, isForkPostFulu, isForkPostGloas, } from "@lodestar/params";
|
|
2
|
+
export function isStatePostAltair(state) {
|
|
3
|
+
return isForkPostAltair(state.forkName);
|
|
4
|
+
}
|
|
5
|
+
export function isStatePostBellatrix(state) {
|
|
6
|
+
return isForkPostBellatrix(state.forkName);
|
|
7
|
+
}
|
|
8
|
+
export function isStatePostCapella(state) {
|
|
9
|
+
return isForkPostCapella(state.forkName);
|
|
10
|
+
}
|
|
11
|
+
export function isStatePostDeneb(state) {
|
|
12
|
+
return isForkPostDeneb(state.forkName);
|
|
13
|
+
}
|
|
14
|
+
export function isStatePostElectra(state) {
|
|
15
|
+
return isForkPostElectra(state.forkName);
|
|
16
|
+
}
|
|
17
|
+
export function isStatePostFulu(state) {
|
|
18
|
+
return isForkPostFulu(state.forkName);
|
|
19
|
+
}
|
|
20
|
+
export function isStatePostGloas(state) {
|
|
21
|
+
return isForkPostGloas(state.forkName);
|
|
22
|
+
}
|
|
2
23
|
//# sourceMappingURL=interface.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interface.js","sourceRoot":"","sources":["../../src/stateView/interface.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"interface.js","sourceRoot":"","sources":["../../src/stateView/interface.ts"],"names":[],"mappings":"AAEA,OAAO,EASL,gBAAgB,EAChB,mBAAmB,EACnB,iBAAiB,EACjB,eAAe,EACf,iBAAiB,EACjB,cAAc,EACd,eAAe,GAChB,MAAM,kBAAkB,CAAC;AAuP1B,MAAM,UAAU,iBAAiB,CAAC,KAAuB,EAAmC;IAC1F,OAAO,gBAAgB,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;AAAA,CACzC;AAED,MAAM,UAAU,oBAAoB,CAAC,KAAuB,EAAsC;IAChG,OAAO,mBAAmB,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;AAAA,CAC5C;AAED,MAAM,UAAU,kBAAkB,CAAC,KAAuB,EAAoC;IAC5F,OAAO,iBAAiB,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;AAAA,CAC1C;AAED,MAAM,UAAU,gBAAgB,CAAC,KAAuB,EAAkC;IACxF,OAAO,eAAe,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;AAAA,CACxC;AAED,MAAM,UAAU,kBAAkB,CAAC,KAAuB,EAAoC;IAC5F,OAAO,iBAAiB,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;AAAA,CAC1C;AAED,MAAM,UAAU,eAAe,CAAC,KAAuB,EAAiC;IACtF,OAAO,cAAc,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;AAAA,CACvC;AAED,MAAM,UAAU,gBAAgB,CAAC,KAAuB,EAAkC;IACxF,OAAO,eAAe,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;AAAA,CACxC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { BeaconConfig } from "@lodestar/config";
|
|
2
|
+
import { PubkeyCache } from "../cache/pubkeyCache.js";
|
|
3
|
+
import { BeaconStateAllForks } from "../cache/types.js";
|
|
4
|
+
import { IBeaconStateView } from "./interface.js";
|
|
5
|
+
type NodeJSOpts = {
|
|
6
|
+
useNative: false;
|
|
7
|
+
anchorState: BeaconStateAllForks;
|
|
8
|
+
config: BeaconConfig;
|
|
9
|
+
pubkeyCache: PubkeyCache;
|
|
10
|
+
};
|
|
11
|
+
type NativeOpts = {
|
|
12
|
+
useNative: true;
|
|
13
|
+
stateBytes: Uint8Array;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Create a BeaconStateView from a pre-deserialized state. Used at node startup.
|
|
17
|
+
*
|
|
18
|
+
* The caller is responsible for creating and populating `pubkeyCache` (it is also
|
|
19
|
+
* passed separately to BeaconNode.init, so it must live outside this factory).
|
|
20
|
+
*
|
|
21
|
+
* Set `useNative: true` to use the native (Zig) implementation once available.
|
|
22
|
+
*/
|
|
23
|
+
export declare function createBeaconStateView(opts: NodeJSOpts | NativeOpts): IBeaconStateView;
|
|
24
|
+
type RegenNodeJSOpts = {
|
|
25
|
+
useNative: false;
|
|
26
|
+
config: BeaconConfig;
|
|
27
|
+
stateBytes: Uint8Array;
|
|
28
|
+
};
|
|
29
|
+
type RegenNativeOpts = {
|
|
30
|
+
useNative: true;
|
|
31
|
+
stateBytes: Uint8Array;
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* Create a BeaconStateView from raw SSZ bytes. Used in the historical state regen worker thread.
|
|
35
|
+
*
|
|
36
|
+
* Set `useNative: true` to use the native (Zig) implementation once available.
|
|
37
|
+
*/
|
|
38
|
+
export declare function createBeaconStateViewForHistoricalRegen(opts: RegenNodeJSOpts | RegenNativeOpts): IBeaconStateView;
|
|
39
|
+
export {};
|
|
40
|
+
//# sourceMappingURL=stateViewFactory.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stateViewFactory.d.ts","sourceRoot":"","sources":["../../src/stateView/stateViewFactory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAC,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAC,WAAW,EAAoB,MAAM,yBAAyB,CAAC;AAEvE,OAAO,EAAC,mBAAmB,EAAC,MAAM,mBAAmB,CAAC;AAGtD,OAAO,EAAC,gBAAgB,EAAC,MAAM,gBAAgB,CAAC;AAIhD,KAAK,UAAU,GAAG;IAChB,SAAS,EAAE,KAAK,CAAC;IACjB,WAAW,EAAE,mBAAmB,CAAC;IACjC,MAAM,EAAE,YAAY,CAAC;IACrB,WAAW,EAAE,WAAW,CAAC;CAC1B,CAAC;AAEF,KAAK,UAAU,GAAG;IAChB,SAAS,EAAE,IAAI,CAAC;IAChB,UAAU,EAAE,UAAU,CAAC;CACxB,CAAC;AAEF;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,UAAU,GAAG,UAAU,GAAG,gBAAgB,CAOrF;AAeD,KAAK,eAAe,GAAG;IACrB,SAAS,EAAE,KAAK,CAAC;IACjB,MAAM,EAAE,YAAY,CAAC;IACrB,UAAU,EAAE,UAAU,CAAC;CACxB,CAAC;AAEF,KAAK,eAAe,GAAG;IACrB,SAAS,EAAE,IAAI,CAAC;IAChB,UAAU,EAAE,UAAU,CAAC;CACxB,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,uCAAuC,CAAC,IAAI,EAAE,eAAe,GAAG,eAAe,GAAG,gBAAgB,CASjH"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { createPubkeyCache } from "../cache/pubkeyCache.js";
|
|
2
|
+
import { createCachedBeaconState } from "../cache/stateCache.js";
|
|
3
|
+
import { getStateTypeFromBytes } from "../util/sszBytes.js";
|
|
4
|
+
import { BeaconStateView } from "./beaconStateView.js";
|
|
5
|
+
/**
|
|
6
|
+
* Create a BeaconStateView from a pre-deserialized state. Used at node startup.
|
|
7
|
+
*
|
|
8
|
+
* The caller is responsible for creating and populating `pubkeyCache` (it is also
|
|
9
|
+
* passed separately to BeaconNode.init, so it must live outside this factory).
|
|
10
|
+
*
|
|
11
|
+
* Set `useNative: true` to use the native (Zig) implementation once available.
|
|
12
|
+
*/
|
|
13
|
+
export function createBeaconStateView(opts) {
|
|
14
|
+
if (opts.useNative) {
|
|
15
|
+
throw new Error("Native (Zig) BeaconStateView not yet implemented");
|
|
16
|
+
}
|
|
17
|
+
const { anchorState, config, pubkeyCache } = opts;
|
|
18
|
+
const cachedState = createCachedBeaconState(anchorState, { config, pubkeyCache }, { skipSyncPubkeys: true });
|
|
19
|
+
return new BeaconStateView(cachedState);
|
|
20
|
+
}
|
|
21
|
+
// ---- createBeaconStateViewForHistoricalRegen (regen path) ----
|
|
22
|
+
// Reused across all historical state regen calls in the worker thread
|
|
23
|
+
const pubkeyCacheRegen = createPubkeyCache();
|
|
24
|
+
function syncPubkeyCache(state, pubkeyCache) {
|
|
25
|
+
const newCount = state.validators.length;
|
|
26
|
+
for (let i = pubkeyCache.size; i < newCount; i++) {
|
|
27
|
+
const pubkey = state.validators.getReadonly(i).pubkey;
|
|
28
|
+
pubkeyCache.set(i, pubkey);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Create a BeaconStateView from raw SSZ bytes. Used in the historical state regen worker thread.
|
|
33
|
+
*
|
|
34
|
+
* Set `useNative: true` to use the native (Zig) implementation once available.
|
|
35
|
+
*/
|
|
36
|
+
export function createBeaconStateViewForHistoricalRegen(opts) {
|
|
37
|
+
if (opts.useNative) {
|
|
38
|
+
throw new Error("Native (Zig) BeaconStateView not yet implemented");
|
|
39
|
+
}
|
|
40
|
+
const { config, stateBytes } = opts;
|
|
41
|
+
const state = getStateTypeFromBytes(config, stateBytes).deserializeToViewDU(stateBytes);
|
|
42
|
+
syncPubkeyCache(state, pubkeyCacheRegen);
|
|
43
|
+
const cachedState = createCachedBeaconState(state, { config, pubkeyCache: pubkeyCacheRegen }, { skipSyncPubkeys: true });
|
|
44
|
+
return new BeaconStateView(cachedState);
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=stateViewFactory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stateViewFactory.js","sourceRoot":"","sources":["../../src/stateView/stateViewFactory.ts"],"names":[],"mappings":"AACA,OAAO,EAAc,iBAAiB,EAAC,MAAM,yBAAyB,CAAC;AACvE,OAAO,EAAC,uBAAuB,EAAC,MAAM,wBAAwB,CAAC;AAE/D,OAAO,EAAC,qBAAqB,EAAC,MAAM,qBAAqB,CAAC;AAC1D,OAAO,EAAC,eAAe,EAAC,MAAM,sBAAsB,CAAC;AAiBrD;;;;;;;GAOG;AACH,MAAM,UAAU,qBAAqB,CAAC,IAA6B,EAAoB;IACrF,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC;QACnB,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAC;IACtE,CAAC;IACD,MAAM,EAAC,WAAW,EAAE,MAAM,EAAE,WAAW,EAAC,GAAG,IAAI,CAAC;IAChD,MAAM,WAAW,GAAG,uBAAuB,CAAC,WAAW,EAAE,EAAC,MAAM,EAAE,WAAW,EAAC,EAAE,EAAC,eAAe,EAAE,IAAI,EAAC,CAAC,CAAC;IACzG,OAAO,IAAI,eAAe,CAAC,WAAW,CAAC,CAAC;AAAA,CACzC;AAED,iEAAiE;AAEjE,sEAAsE;AACtE,MAAM,gBAAgB,GAAG,iBAAiB,EAAE,CAAC;AAE7C,SAAS,eAAe,CAAC,KAA0B,EAAE,WAAwB,EAAQ;IACnF,MAAM,QAAQ,GAAG,KAAK,CAAC,UAAU,CAAC,MAAM,CAAC;IACzC,KAAK,IAAI,CAAC,GAAG,WAAW,CAAC,IAAI,EAAE,CAAC,GAAG,QAAQ,EAAE,CAAC,EAAE,EAAE,CAAC;QACjD,MAAM,MAAM,GAAG,KAAK,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC;QACtD,WAAW,CAAC,GAAG,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC;IAC7B,CAAC;AAAA,CACF;AAaD;;;;GAIG;AACH,MAAM,UAAU,uCAAuC,CAAC,IAAuC,EAAoB;IACjH,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC;QACnB,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAC;IACtE,CAAC;IACD,MAAM,EAAC,MAAM,EAAE,UAAU,EAAC,GAAG,IAAI,CAAC;IAClC,MAAM,KAAK,GAAG,qBAAqB,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC,mBAAmB,CAAC,UAAU,CAAC,CAAC;IACxF,eAAe,CAAC,KAAK,EAAE,gBAAgB,CAAC,CAAC;IACzC,MAAM,WAAW,GAAG,uBAAuB,CAAC,KAAK,EAAE,EAAC,MAAM,EAAE,WAAW,EAAE,gBAAgB,EAAC,EAAE,EAAC,eAAe,EAAE,IAAI,EAAC,CAAC,CAAC;IACrH,OAAO,IAAI,eAAe,CAAC,WAAW,CAAC,CAAC;AAAA,CACzC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cache.d.ts","sourceRoot":"","sources":["../../src/testUtils/cache.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,aAAa,
|
|
1
|
+
{"version":3,"file":"cache.d.ts","sourceRoot":"","sources":["../../src/testUtils/cache.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,aAAa,QAA2C,CAAC"}
|
package/lib/testUtils/cache.js
CHANGED
|
@@ -3,5 +3,5 @@ import { fileURLToPath } from "node:url";
|
|
|
3
3
|
// Global variable __dirname no longer available in ES6 modules.
|
|
4
4
|
// Solutions: https://stackoverflow.com/questions/46745014/alternative-for-dirname-in-node-js-when-using-es6-modules
|
|
5
5
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
6
|
-
export const testCachePath = path.join(__dirname, "../../test
|
|
6
|
+
export const testCachePath = path.join(__dirname, "../../test-cache");
|
|
7
7
|
//# sourceMappingURL=cache.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cache.js","sourceRoot":"","sources":["../../src/testUtils/cache.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAC,aAAa,EAAC,MAAM,UAAU,CAAC;AAEvC,gEAAgE;AAChE,oHAAoH;AACpH,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AAE/D,MAAM,CAAC,MAAM,aAAa,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,
|
|
1
|
+
{"version":3,"file":"cache.js","sourceRoot":"","sources":["../../src/testUtils/cache.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAC,aAAa,EAAC,MAAM,UAAU,CAAC;AAEvC,gEAAgE;AAChE,oHAAoH;AACpH,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AAE/D,MAAM,CAAC,MAAM,aAAa,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,kBAAkB,CAAC,CAAC"}
|
package/lib/testUtils/util.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { PublicKey, SecretKey } from "@chainsafe/blst";
|
|
2
2
|
import { Slot, phase0 } from "@lodestar/types";
|
|
3
|
-
import { BeaconStateAltair, CachedBeaconStateAllForks, CachedBeaconStateAltair, CachedBeaconStatePhase0 } from "../types.js";
|
|
3
|
+
import { BeaconStateAltair, BeaconStateElectra, CachedBeaconStateAllForks, CachedBeaconStateAltair, CachedBeaconStateElectra, CachedBeaconStatePhase0 } from "../types.js";
|
|
4
4
|
/**
|
|
5
5
|
* Number of validators in prater is 210000 as of May 2021
|
|
6
6
|
*/
|
|
@@ -35,10 +35,22 @@ export declare function generatePerfTestCachedStateAltair(opts?: {
|
|
|
35
35
|
goBackOneSlot: boolean;
|
|
36
36
|
vc?: number;
|
|
37
37
|
}): CachedBeaconStateAltair;
|
|
38
|
+
/**
|
|
39
|
+
* Warning: This function has side effects on the cached state
|
|
40
|
+
* The order in which the caches are populated is important and can cause stable tests to fail.
|
|
41
|
+
*/
|
|
42
|
+
export declare function generatePerfTestCachedStateElectra(opts?: {
|
|
43
|
+
goBackOneSlot: boolean;
|
|
44
|
+
vc?: number;
|
|
45
|
+
}): CachedBeaconStateElectra;
|
|
38
46
|
/**
|
|
39
47
|
* This is generated from Medalla state 756416
|
|
40
48
|
*/
|
|
41
49
|
export declare function generatePerformanceStateAltair(pubkeysArg?: Uint8Array[]): BeaconStateAltair;
|
|
50
|
+
/**
|
|
51
|
+
* This is generated from the same performance state as Altair, upgraded to Electra fields.
|
|
52
|
+
*/
|
|
53
|
+
export declare function generatePerformanceStateElectra(pubkeysArg?: Uint8Array[]): BeaconStateElectra;
|
|
42
54
|
/**
|
|
43
55
|
* This is generated from Medalla block 756417
|
|
44
56
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../../src/testUtils/util.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAE,SAAS,EAAC,MAAM,iBAAiB,CAAC;AAcrD,OAAO,EAAc,IAAI,EAAE,MAAM,EAAM,MAAM,iBAAiB,CAAC;AAW/D,OAAO,EACL,iBAAiB,
|
|
1
|
+
{"version":3,"file":"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E,UAAU,EAAE,GAAG,iBAAiB,CAyC3F;AAED;;GAEG;AACH,wBAAgB,+BAA+B,CAAC,UAAU,CAAC,EAAE,UAAU,EAAE,GAAG,kBAAkB,CAgD7F;AAED;;GAEG;AACH,wBAAgB,8BAA8B,IAAI,MAAM,CAAC,iBAAiB,CAgBzE;AA2ED,wBAAgB,2CAA2C,CAAC,EAC1D,EAAE,EACF,IAAI,EACL,EAAE;IACD,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,IAAI,CAAC;CACZ,GAAG,yBAAyB,CAoD5B"}
|
package/lib/testUtils/util.js
CHANGED
|
@@ -16,6 +16,9 @@ let phase0SignedBlock = null;
|
|
|
16
16
|
let altairState = null;
|
|
17
17
|
let altairCachedState23637 = null;
|
|
18
18
|
let altairCachedState23638 = null;
|
|
19
|
+
let electraState = null;
|
|
20
|
+
let electraCachedState23637 = null;
|
|
21
|
+
let electraCachedState23638 = null;
|
|
19
22
|
/**
|
|
20
23
|
* Number of validators in prater is 210000 as of May 2021
|
|
21
24
|
*/
|
|
@@ -52,10 +55,10 @@ export function getSecretKeyFromIndexCached(validatorIndex) {
|
|
|
52
55
|
}
|
|
53
56
|
return sk;
|
|
54
57
|
}
|
|
55
|
-
function getPubkeyCaches({ pubkeysMod }) {
|
|
58
|
+
function getPubkeyCaches({ pubkeysMod }, vc = numValidators) {
|
|
56
59
|
// Manually sync pubkeys to prevent doing BLS opts 110_000 times
|
|
57
60
|
const pubkeyCache = createPubkeyCache();
|
|
58
|
-
for (let i = 0; i <
|
|
61
|
+
for (let i = 0; i < vc; i++) {
|
|
59
62
|
const pubkey = pubkeysMod[i % keypairsMod];
|
|
60
63
|
pubkeyCache.set(i, pubkey);
|
|
61
64
|
}
|
|
@@ -151,31 +154,83 @@ export function cachedStateAltairPopulateCaches(state) {
|
|
|
151
154
|
* The order in which the caches are populated is important and can cause stable tests to fail.
|
|
152
155
|
*/
|
|
153
156
|
export function generatePerfTestCachedStateAltair(opts) {
|
|
154
|
-
const
|
|
155
|
-
const {
|
|
157
|
+
const vc = opts?.vc ?? numValidators;
|
|
158
|
+
const { pubkeys, pubkeysMod, pubkeysModObj } = getPubkeys(vc);
|
|
159
|
+
const { pubkeyCache } = getPubkeyCaches({ pubkeys, pubkeysMod, pubkeysModObj }, vc);
|
|
156
160
|
const altairConfig = createChainForkConfig({ ALTAIR_FORK_EPOCH: 0 });
|
|
157
161
|
const origState = generatePerformanceStateAltair(pubkeys);
|
|
158
|
-
|
|
162
|
+
// For non-default vc, generate fresh without caching to avoid accumulating large states in memory
|
|
163
|
+
const isDefaultVc = vc === numValidators;
|
|
164
|
+
let cachedState23637 = isDefaultVc ? altairCachedState23637 : null;
|
|
165
|
+
if (!cachedState23637) {
|
|
159
166
|
const state = origState.clone();
|
|
160
167
|
state.slot -= 1;
|
|
161
|
-
|
|
168
|
+
cachedState23637 = createCachedBeaconState(state, {
|
|
162
169
|
config: createBeaconConfig(altairConfig, state.genesisValidatorsRoot),
|
|
163
170
|
pubkeyCache,
|
|
164
171
|
});
|
|
172
|
+
if (isDefaultVc)
|
|
173
|
+
altairCachedState23637 = cachedState23637;
|
|
174
|
+
}
|
|
175
|
+
let cachedState23638 = isDefaultVc ? altairCachedState23638 : null;
|
|
176
|
+
if (!cachedState23638) {
|
|
177
|
+
cachedState23638 = processSlots(cachedState23637, cachedState23637.slot + 1);
|
|
178
|
+
cachedState23638.slot += 1;
|
|
179
|
+
if (isDefaultVc)
|
|
180
|
+
altairCachedState23638 = cachedState23638;
|
|
181
|
+
}
|
|
182
|
+
const resultingState = opts?.goBackOneSlot ? cachedState23637 : cachedState23638;
|
|
183
|
+
return resultingState.clone();
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* Warning: This function has side effects on the cached state
|
|
187
|
+
* The order in which the caches are populated is important and can cause stable tests to fail.
|
|
188
|
+
*/
|
|
189
|
+
export function generatePerfTestCachedStateElectra(opts) {
|
|
190
|
+
const vc = opts?.vc ?? numValidators;
|
|
191
|
+
const { pubkeys, pubkeysMod, pubkeysModObj } = getPubkeys(vc);
|
|
192
|
+
const { pubkeyCache } = getPubkeyCaches({ pubkeys, pubkeysMod, pubkeysModObj }, vc);
|
|
193
|
+
const electraConfig = createChainForkConfig({
|
|
194
|
+
ALTAIR_FORK_EPOCH: 0,
|
|
195
|
+
BELLATRIX_FORK_EPOCH: 0,
|
|
196
|
+
CAPELLA_FORK_EPOCH: 0,
|
|
197
|
+
DENEB_FORK_EPOCH: 0,
|
|
198
|
+
ELECTRA_FORK_EPOCH: 0,
|
|
199
|
+
});
|
|
200
|
+
const origState = generatePerformanceStateElectra(pubkeys);
|
|
201
|
+
// For non-default vc, generate fresh without caching to avoid accumulating large states in memory
|
|
202
|
+
const isDefaultVc = vc === numValidators;
|
|
203
|
+
let cachedState23637 = isDefaultVc ? electraCachedState23637 : null;
|
|
204
|
+
if (!cachedState23637) {
|
|
205
|
+
const state = origState.clone();
|
|
206
|
+
state.slot -= 1;
|
|
207
|
+
cachedState23637 = createCachedBeaconState(state, {
|
|
208
|
+
config: createBeaconConfig(electraConfig, state.genesisValidatorsRoot),
|
|
209
|
+
pubkeyCache,
|
|
210
|
+
});
|
|
211
|
+
if (isDefaultVc)
|
|
212
|
+
electraCachedState23637 = cachedState23637;
|
|
165
213
|
}
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
214
|
+
let cachedState23638 = isDefaultVc ? electraCachedState23638 : null;
|
|
215
|
+
if (!cachedState23638) {
|
|
216
|
+
cachedState23638 = processSlots(cachedState23637, cachedState23637.slot + 1);
|
|
217
|
+
cachedState23638.slot += 1;
|
|
218
|
+
if (isDefaultVc)
|
|
219
|
+
electraCachedState23638 = cachedState23638;
|
|
169
220
|
}
|
|
170
|
-
const resultingState = opts?.goBackOneSlot ?
|
|
221
|
+
const resultingState = opts?.goBackOneSlot ? cachedState23637 : cachedState23638;
|
|
171
222
|
return resultingState.clone();
|
|
172
223
|
}
|
|
173
224
|
/**
|
|
174
225
|
* This is generated from Medalla state 756416
|
|
175
226
|
*/
|
|
176
227
|
export function generatePerformanceStateAltair(pubkeysArg) {
|
|
177
|
-
|
|
178
|
-
|
|
228
|
+
const pubkeys = pubkeysArg || getPubkeys().pubkeys;
|
|
229
|
+
const vc = pubkeys.length;
|
|
230
|
+
const isDefaultVc = vc === numValidators;
|
|
231
|
+
// Only use cached state for default vc to avoid accumulating large states in memory
|
|
232
|
+
let cached = isDefaultVc ? altairState : null;
|
|
233
|
+
if (!cached) {
|
|
179
234
|
const statePhase0 = buildPerformanceStatePhase0(pubkeys);
|
|
180
235
|
const state = statePhase0;
|
|
181
236
|
state.previousEpochParticipation = newFilledArray(pubkeys.length, 0b111);
|
|
@@ -185,19 +240,64 @@ export function generatePerformanceStateAltair(pubkeysArg) {
|
|
|
185
240
|
state.currentSyncCommittee = ssz.altair.SyncCommittee.defaultValue();
|
|
186
241
|
state.nextSyncCommittee = state.currentSyncCommittee;
|
|
187
242
|
// Now the state is fully populated to convert to ViewDU
|
|
188
|
-
|
|
243
|
+
cached = ssz.altair.BeaconState.toViewDU(state);
|
|
189
244
|
// Now set correct syncCommittees
|
|
190
245
|
const epoch = computeEpochAtSlot(state.slot);
|
|
191
|
-
const activeValidatorIndices = getActiveValidatorIndices(
|
|
192
|
-
const effectiveBalanceIncrements = getEffectiveBalanceIncrements(
|
|
193
|
-
const { syncCommittee } = getNextSyncCommittee(ForkSeq.altair,
|
|
246
|
+
const activeValidatorIndices = getActiveValidatorIndices(cached, epoch);
|
|
247
|
+
const effectiveBalanceIncrements = getEffectiveBalanceIncrements(cached);
|
|
248
|
+
const { syncCommittee } = getNextSyncCommittee(ForkSeq.altair, cached, activeValidatorIndices, effectiveBalanceIncrements);
|
|
194
249
|
state.currentSyncCommittee = syncCommittee;
|
|
195
250
|
state.nextSyncCommittee = syncCommittee;
|
|
196
|
-
|
|
251
|
+
cached = ssz.altair.BeaconState.toViewDU(state);
|
|
197
252
|
// cache roots
|
|
198
|
-
|
|
253
|
+
cached.hashTreeRoot();
|
|
254
|
+
if (isDefaultVc)
|
|
255
|
+
altairState = cached;
|
|
256
|
+
}
|
|
257
|
+
return cached.clone();
|
|
258
|
+
}
|
|
259
|
+
/**
|
|
260
|
+
* This is generated from the same performance state as Altair, upgraded to Electra fields.
|
|
261
|
+
*/
|
|
262
|
+
export function generatePerformanceStateElectra(pubkeysArg) {
|
|
263
|
+
const pubkeys = pubkeysArg || getPubkeys().pubkeys;
|
|
264
|
+
const vc = pubkeys.length;
|
|
265
|
+
const isDefaultVc = vc === numValidators;
|
|
266
|
+
// Only use cached state for default vc to avoid accumulating large states in memory
|
|
267
|
+
let cached = isDefaultVc ? electraState : null;
|
|
268
|
+
if (!cached) {
|
|
269
|
+
const electraConfig = createChainForkConfig({
|
|
270
|
+
ALTAIR_FORK_EPOCH: 0,
|
|
271
|
+
BELLATRIX_FORK_EPOCH: 0,
|
|
272
|
+
CAPELLA_FORK_EPOCH: 0,
|
|
273
|
+
DENEB_FORK_EPOCH: 0,
|
|
274
|
+
ELECTRA_FORK_EPOCH: 0,
|
|
275
|
+
});
|
|
276
|
+
const state = ssz.electra.BeaconState.defaultValue();
|
|
277
|
+
Object.assign(state, buildPerformanceStatePhase0(pubkeys));
|
|
278
|
+
state.fork.previousVersion = electraConfig.DENEB_FORK_VERSION;
|
|
279
|
+
state.fork.currentVersion = electraConfig.ELECTRA_FORK_VERSION;
|
|
280
|
+
state.fork.epoch = electraConfig.ELECTRA_FORK_EPOCH;
|
|
281
|
+
state.previousEpochParticipation = newFilledArray(pubkeys.length, 0b111);
|
|
282
|
+
state.currentEpochParticipation = state.previousEpochParticipation;
|
|
283
|
+
state.inactivityScores = Array.from({ length: pubkeys.length }, (_, i) => i % 2);
|
|
284
|
+
state.currentSyncCommittee = ssz.altair.SyncCommittee.defaultValue();
|
|
285
|
+
state.nextSyncCommittee = state.currentSyncCommittee;
|
|
286
|
+
state.latestExecutionPayloadHeader = ssz.electra.ExecutionPayloadHeader.defaultValue();
|
|
287
|
+
state.depositRequestsStartIndex = 2023n;
|
|
288
|
+
cached = ssz.electra.BeaconState.toViewDU(state);
|
|
289
|
+
const epoch = computeEpochAtSlot(state.slot);
|
|
290
|
+
const activeValidatorIndices = getActiveValidatorIndices(cached, epoch);
|
|
291
|
+
const effectiveBalanceIncrements = getEffectiveBalanceIncrements(cached);
|
|
292
|
+
const { syncCommittee } = getNextSyncCommittee(ForkSeq.electra, cached, activeValidatorIndices, effectiveBalanceIncrements);
|
|
293
|
+
state.currentSyncCommittee = syncCommittee;
|
|
294
|
+
state.nextSyncCommittee = syncCommittee;
|
|
295
|
+
cached = ssz.electra.BeaconState.toViewDU(state);
|
|
296
|
+
cached.hashTreeRoot();
|
|
297
|
+
if (isDefaultVc)
|
|
298
|
+
electraState = cached;
|
|
199
299
|
}
|
|
200
|
-
return
|
|
300
|
+
return cached.clone();
|
|
201
301
|
}
|
|
202
302
|
/**
|
|
203
303
|
* This is generated from Medalla block 756417
|