@lodestar/state-transition 1.47.0-dev.a64cdf7144 → 1.47.0-dev.aa6eaee53a
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/isValidIndexedAttestation.d.ts +2 -3
- package/lib/block/isValidIndexedAttestation.d.ts.map +1 -1
- package/lib/block/isValidIndexedAttestation.js +4 -4
- package/lib/block/isValidIndexedAttestation.js.map +1 -1
- package/lib/block/isValidIndexedPayloadAttestation.d.ts.map +1 -1
- package/lib/block/isValidIndexedPayloadAttestation.js +1 -1
- package/lib/block/isValidIndexedPayloadAttestation.js.map +1 -1
- package/lib/block/processAttestationPhase0.d.ts.map +1 -1
- package/lib/block/processAttestationPhase0.js +1 -1
- package/lib/block/processAttestationPhase0.js.map +1 -1
- package/lib/block/processAttestationsAltair.js +1 -1
- package/lib/block/processAttestationsAltair.js.map +1 -1
- package/lib/block/processAttesterSlashing.d.ts +1 -2
- package/lib/block/processAttesterSlashing.d.ts.map +1 -1
- package/lib/block/processAttesterSlashing.js +3 -3
- package/lib/block/processAttesterSlashing.js.map +1 -1
- package/lib/block/processDeposit.d.ts.map +1 -1
- package/lib/block/processDeposit.js +21 -46
- package/lib/block/processDeposit.js.map +1 -1
- package/lib/block/processExecutionPayloadBid.d.ts.map +1 -1
- package/lib/block/processExecutionPayloadBid.js +2 -5
- package/lib/block/processExecutionPayloadBid.js.map +1 -1
- package/lib/block/processProposerSlashing.d.ts +1 -2
- package/lib/block/processProposerSlashing.d.ts.map +1 -1
- package/lib/block/processProposerSlashing.js +3 -3
- package/lib/block/processProposerSlashing.js.map +1 -1
- package/lib/block/processRandao.js +1 -1
- package/lib/block/processRandao.js.map +1 -1
- package/lib/block/processSyncCommittee.js +1 -1
- package/lib/block/processSyncCommittee.js.map +1 -1
- package/lib/block/processVoluntaryExit.d.ts.map +1 -1
- package/lib/block/processVoluntaryExit.js +1 -2
- package/lib/block/processVoluntaryExit.js.map +1 -1
- package/lib/cache/epochCache.d.ts +2 -2
- package/lib/cache/epochCache.d.ts.map +1 -1
- package/lib/cache/epochCache.js +5 -6
- package/lib/cache/epochCache.js.map +1 -1
- package/lib/cache/stateCache.js +1 -1
- package/lib/cache/stateCache.js.map +1 -1
- package/lib/cache/syncCommitteeCache.d.ts +2 -3
- package/lib/cache/syncCommitteeCache.d.ts.map +1 -1
- package/lib/cache/syncCommitteeCache.js.map +1 -1
- package/lib/epoch/processSyncCommitteeUpdates.js +1 -1
- package/lib/epoch/processSyncCommitteeUpdates.js.map +1 -1
- package/lib/index.d.ts +1 -2
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -2
- package/lib/index.js.map +1 -1
- package/lib/lightClient/spec/store.d.ts +1 -1
- package/lib/lightClient/spec/store.d.ts.map +1 -1
- package/lib/lightClient/spec/utils.js +1 -1
- package/lib/lightClient/spec/utils.js.map +1 -1
- package/lib/lightClient/spec/validateLightClientUpdate.js +1 -1
- package/lib/lightClient/spec/validateLightClientUpdate.js.map +1 -1
- package/lib/rewards/attestationsRewards.d.ts +1 -1
- package/lib/rewards/attestationsRewards.d.ts.map +1 -1
- package/lib/rewards/attestationsRewards.js.map +1 -1
- package/lib/rewards/syncCommitteeRewards.d.ts +1 -1
- package/lib/rewards/syncCommitteeRewards.d.ts.map +1 -1
- package/lib/rewards/syncCommitteeRewards.js +3 -1
- package/lib/rewards/syncCommitteeRewards.js.map +1 -1
- package/lib/signatureSets/blsToExecutionChange.d.ts.map +1 -1
- package/lib/signatureSets/blsToExecutionChange.js +1 -2
- package/lib/signatureSets/blsToExecutionChange.js.map +1 -1
- package/lib/signatureSets/executionPayloadEnvelope.d.ts +2 -3
- package/lib/signatureSets/executionPayloadEnvelope.d.ts.map +1 -1
- package/lib/signatureSets/executionPayloadEnvelope.js +6 -7
- package/lib/signatureSets/executionPayloadEnvelope.js.map +1 -1
- package/lib/signatureSets/proposer.d.ts +1 -2
- package/lib/signatureSets/proposer.d.ts.map +1 -1
- package/lib/signatureSets/proposer.js +2 -2
- package/lib/signatureSets/proposer.js.map +1 -1
- package/lib/signatureSets/randao.d.ts +1 -2
- package/lib/signatureSets/randao.d.ts.map +1 -1
- package/lib/signatureSets/randao.js +2 -2
- package/lib/signatureSets/randao.js.map +1 -1
- package/lib/signatureSets/voluntaryExits.d.ts +1 -2
- package/lib/signatureSets/voluntaryExits.d.ts.map +1 -1
- package/lib/signatureSets/voluntaryExits.js +3 -4
- package/lib/signatureSets/voluntaryExits.js.map +1 -1
- package/lib/stateTransition.js +1 -1
- package/lib/stateTransition.js.map +1 -1
- package/lib/stateView/stateViewFactory.d.ts +1 -1
- package/lib/stateView/stateViewFactory.d.ts.map +1 -1
- package/lib/stateView/stateViewFactory.js +2 -13
- package/lib/stateView/stateViewFactory.js.map +1 -1
- package/lib/testUtils/index.d.ts +1 -0
- package/lib/testUtils/index.d.ts.map +1 -1
- package/lib/testUtils/index.js +1 -0
- package/lib/testUtils/index.js.map +1 -1
- package/lib/testUtils/interopPubkeyCache.d.ts +7 -0
- package/lib/testUtils/interopPubkeyCache.d.ts.map +1 -0
- package/lib/testUtils/interopPubkeyCache.js +92 -0
- package/lib/testUtils/interopPubkeyCache.js.map +1 -0
- package/lib/testUtils/state.d.ts.map +1 -1
- package/lib/testUtils/state.js +5 -5
- package/lib/testUtils/state.js.map +1 -1
- package/lib/testUtils/testFileCache.d.ts.map +1 -1
- package/lib/testUtils/testFileCache.js +3 -0
- package/lib/testUtils/testFileCache.js.map +1 -1
- package/lib/testUtils/util.d.ts +1 -1
- package/lib/testUtils/util.d.ts.map +1 -1
- package/lib/testUtils/util.js +27 -35
- package/lib/testUtils/util.js.map +1 -1
- package/lib/util/gloas.d.ts.map +1 -1
- package/lib/util/gloas.js +2 -4
- package/lib/util/gloas.js.map +1 -1
- package/lib/util/interop.d.ts +1 -1
- package/lib/util/interop.d.ts.map +1 -1
- package/lib/util/interop.js +1 -1
- package/lib/util/interop.js.map +1 -1
- package/lib/util/signatureSets.d.ts +5 -13
- package/lib/util/signatureSets.d.ts.map +1 -1
- package/lib/util/signatureSets.js +30 -39
- package/lib/util/signatureSets.js.map +1 -1
- package/lib/util/syncCommittee.js +1 -1
- package/lib/util/syncCommittee.js.map +1 -1
- package/package.json +11 -12
- package/src/block/isValidIndexedAttestation.ts +2 -8
- package/src/block/isValidIndexedPayloadAttestation.ts +1 -4
- package/src/block/processAttestationPhase0.ts +0 -1
- package/src/block/processAttestationsAltair.ts +1 -1
- package/src/block/processAttesterSlashing.ts +2 -13
- package/src/block/processDeposit.ts +35 -47
- package/src/block/processExecutionPayloadBid.ts +8 -6
- package/src/block/processProposerSlashing.ts +2 -11
- package/src/block/processRandao.ts +1 -1
- package/src/block/processSyncCommittee.ts +1 -1
- package/src/block/processVoluntaryExit.ts +1 -4
- package/src/cache/epochCache.ts +6 -7
- package/src/cache/stateCache.ts +1 -1
- package/src/cache/syncCommitteeCache.ts +3 -2
- package/src/epoch/processSyncCommitteeUpdates.ts +1 -1
- package/src/index.ts +1 -6
- package/src/lightClient/spec/store.ts +1 -1
- package/src/lightClient/spec/utils.ts +1 -1
- package/src/lightClient/spec/validateLightClientUpdate.ts +1 -1
- package/src/rewards/attestationsRewards.ts +1 -1
- package/src/rewards/syncCommitteeRewards.ts +4 -2
- package/src/signatureSets/blsToExecutionChange.ts +1 -2
- package/src/signatureSets/executionPayloadEnvelope.ts +14 -15
- package/src/signatureSets/proposer.ts +1 -3
- package/src/signatureSets/randao.ts +2 -3
- package/src/signatureSets/voluntaryExits.ts +2 -5
- package/src/stateTransition.ts +1 -1
- package/src/stateView/stateViewFactory.ts +2 -14
- package/src/testUtils/index.ts +1 -0
- package/src/testUtils/interopPubkeyCache.ts +100 -0
- package/src/testUtils/state.ts +5 -11
- package/src/testUtils/testFileCache.ts +3 -0
- package/src/testUtils/util.ts +26 -38
- package/src/util/gloas.ts +2 -4
- package/src/util/interop.ts +1 -1
- package/src/util/signatureSets.ts +34 -51
- package/src/util/syncCommittee.ts +1 -1
- package/lib/cache/pubkeyCache.d.ts +0 -28
- package/lib/cache/pubkeyCache.d.ts.map +0 -1
- package/lib/cache/pubkeyCache.js +0 -49
- package/lib/cache/pubkeyCache.js.map +0 -1
- package/src/cache/pubkeyCache.ts +0 -74
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import {BeaconConfig} from "@lodestar/config";
|
|
2
2
|
import {ForkSeq} from "@lodestar/params";
|
|
3
3
|
import {AttesterSlashing, Slot} from "@lodestar/types";
|
|
4
|
-
import {PubkeyCache} from "../cache/pubkeyCache.js";
|
|
5
4
|
import {CachedBeaconStateAllForks} from "../types.js";
|
|
6
5
|
import {getAttesterSlashableIndices, isSlashableAttestationData, isSlashableValidator} from "../util/index.js";
|
|
7
6
|
import {isValidIndexedAttestationBigint} from "./isValidIndexedAttestation.js";
|
|
@@ -20,14 +19,7 @@ export function processAttesterSlashing(
|
|
|
20
19
|
verifySignatures = true
|
|
21
20
|
): void {
|
|
22
21
|
const {epochCtx} = state;
|
|
23
|
-
assertValidAttesterSlashing(
|
|
24
|
-
state.config,
|
|
25
|
-
epochCtx.pubkeyCache,
|
|
26
|
-
state.slot,
|
|
27
|
-
state.validators.length,
|
|
28
|
-
attesterSlashing,
|
|
29
|
-
verifySignatures
|
|
30
|
-
);
|
|
22
|
+
assertValidAttesterSlashing(state.config, state.slot, state.validators.length, attesterSlashing, verifySignatures);
|
|
31
23
|
|
|
32
24
|
const intersectingIndices = getAttesterSlashableIndices(attesterSlashing);
|
|
33
25
|
|
|
@@ -48,7 +40,6 @@ export function processAttesterSlashing(
|
|
|
48
40
|
|
|
49
41
|
export function assertValidAttesterSlashing(
|
|
50
42
|
config: BeaconConfig,
|
|
51
|
-
pubkeyCache: PubkeyCache,
|
|
52
43
|
stateSlot: Slot,
|
|
53
44
|
validatorsLen: number,
|
|
54
45
|
attesterSlashing: AttesterSlashing,
|
|
@@ -65,9 +56,7 @@ export function assertValidAttesterSlashing(
|
|
|
65
56
|
// be higher than the clock and the slashing would still be valid. Same applies to attestation data index, which
|
|
66
57
|
// can be any arbitrary value. Must use bigint variants to hash correctly to all possible values
|
|
67
58
|
for (const [i, attestation] of [attestation1, attestation2].entries()) {
|
|
68
|
-
if (
|
|
69
|
-
!isValidIndexedAttestationBigint(config, pubkeyCache, stateSlot, validatorsLen, attestation, verifySignatures)
|
|
70
|
-
) {
|
|
59
|
+
if (!isValidIndexedAttestationBigint(config, stateSlot, validatorsLen, attestation, verifySignatures)) {
|
|
71
60
|
throw new Error(`AttesterSlashing attestation${i} is invalid`);
|
|
72
61
|
}
|
|
73
62
|
}
|
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
BLS_VERIFIER_MAX_BATCH_SIZE,
|
|
3
|
+
BLS_VERIFIER_SET_TYPE,
|
|
4
|
+
type BlsSignatureSet,
|
|
5
|
+
verifySignatureSets,
|
|
6
|
+
} from "@chainsafe/lodestar-z/bls-verifier";
|
|
2
7
|
import {BeaconConfig} from "@lodestar/config";
|
|
3
8
|
import {
|
|
4
9
|
DEPOSIT_CONTRACT_TREE_DEPTH,
|
|
@@ -13,7 +18,14 @@ import {BLSPubkey, Bytes32, UintNum64, electra, phase0, ssz} from "@lodestar/typ
|
|
|
13
18
|
import {verifyMerkleBranch} from "@lodestar/utils";
|
|
14
19
|
import {ZERO_HASH} from "../constants/index.js";
|
|
15
20
|
import {CachedBeaconStateAllForks, CachedBeaconStateAltair, CachedBeaconStateElectra} from "../types.js";
|
|
16
|
-
import {
|
|
21
|
+
import {
|
|
22
|
+
computeDomain,
|
|
23
|
+
computeSigningRoot,
|
|
24
|
+
createSingleSignatureSetFromComponents,
|
|
25
|
+
getMaxEffectiveBalance,
|
|
26
|
+
increaseBalance,
|
|
27
|
+
verifySignatureSet,
|
|
28
|
+
} from "../util/index.js";
|
|
17
29
|
|
|
18
30
|
/**
|
|
19
31
|
* Process a Deposit operation. Potentially adds a new validator to the registry. Mutates the validators and balances
|
|
@@ -159,11 +171,7 @@ export function isValidDepositSignature(
|
|
|
159
171
|
const domain = computeDomain(DOMAIN_DEPOSIT, config.GENESIS_FORK_VERSION, ZERO_HASH);
|
|
160
172
|
const signingRoot = computeSigningRoot(ssz.phase0.DepositMessage, depositMessage, domain);
|
|
161
173
|
try {
|
|
162
|
-
|
|
163
|
-
const publicKey = PublicKey.fromBytes(pubkey, true);
|
|
164
|
-
const signature = Signature.fromBytes(depositSignature, true);
|
|
165
|
-
|
|
166
|
-
return verify(signingRoot, publicKey, signature);
|
|
174
|
+
return verifySignatureSet(createSingleSignatureSetFromComponents(pubkey, signingRoot, depositSignature));
|
|
167
175
|
} catch (_e) {
|
|
168
176
|
return false; // Catch all BLS errors: failed key validation, failed signature validation, invalid signature
|
|
169
177
|
}
|
|
@@ -184,54 +192,34 @@ export function verifyDepositSignatures(config: BeaconConfig, deposits: electra.
|
|
|
184
192
|
// fork-agnostic domain since deposits are valid across forks, matching isValidDepositSignature
|
|
185
193
|
const domain = computeDomain(DOMAIN_DEPOSIT, config.GENESIS_FORK_VERSION, ZERO_HASH);
|
|
186
194
|
|
|
187
|
-
const signatureSets:
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
195
|
+
const signatureSets: BlsSignatureSet[] = deposits.map(({pubkey, withdrawalCredentials, amount, signature}) => ({
|
|
196
|
+
type: BLS_VERIFIER_SET_TYPE.single,
|
|
197
|
+
pubkey,
|
|
198
|
+
message: computeSigningRoot(ssz.phase0.DepositMessage, {pubkey, withdrawalCredentials, amount}, domain),
|
|
199
|
+
signature,
|
|
200
|
+
}));
|
|
201
|
+
|
|
202
|
+
for (let chunkStart = 0; chunkStart < signatureSets.length; chunkStart += BLS_VERIFIER_MAX_BATCH_SIZE) {
|
|
203
|
+
const chunk = signatureSets.slice(chunkStart, chunkStart + BLS_VERIFIER_MAX_BATCH_SIZE);
|
|
204
|
+
let chunkValid: boolean;
|
|
193
205
|
try {
|
|
194
|
-
|
|
195
|
-
// batched across all sets.
|
|
196
|
-
pk = PublicKey.fromBytes(pubkey);
|
|
197
|
-
sig = Signature.fromBytes(signature);
|
|
206
|
+
chunkValid = verifySignatureSets(chunk);
|
|
198
207
|
} catch (_) {
|
|
199
|
-
|
|
200
|
-
continue;
|
|
208
|
+
chunkValid = false;
|
|
201
209
|
}
|
|
202
|
-
const msg = computeSigningRoot(ssz.phase0.DepositMessage, {pubkey, withdrawalCredentials, amount}, domain);
|
|
203
|
-
signatureSets.push({pk, msg, sig});
|
|
204
|
-
signatureSetDepositIndices.push(i);
|
|
205
|
-
}
|
|
206
210
|
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
// Deposit pubkeys and signatures are untrusted, so group + infinity checks are required.
|
|
212
|
-
// The trailing (true, true) args delegate those checks to blst, amortized across the batch.
|
|
213
|
-
let batchValid: boolean;
|
|
214
|
-
try {
|
|
215
|
-
batchValid =
|
|
216
|
-
signatureSets.length >= 2
|
|
217
|
-
? verifyMultipleAggregateSignatures(signatureSets, true, true)
|
|
218
|
-
: verify(signatureSets[0].msg, signatureSets[0].pk, signatureSets[0].sig, true, true);
|
|
219
|
-
} catch (_) {
|
|
220
|
-
batchValid = false;
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
if (batchValid) {
|
|
224
|
-
for (const depositIndex of signatureSetDepositIndices) {
|
|
225
|
-
results[depositIndex] = true;
|
|
211
|
+
if (chunkValid) {
|
|
212
|
+
results.fill(true, chunkStart, chunkStart + chunk.length);
|
|
213
|
+
continue;
|
|
226
214
|
}
|
|
227
|
-
|
|
228
|
-
for (let
|
|
215
|
+
|
|
216
|
+
for (let i = 0; i < chunk.length; i++) {
|
|
229
217
|
try {
|
|
230
|
-
if (
|
|
231
|
-
results[
|
|
218
|
+
if (verifySignatureSets([chunk[i]])) {
|
|
219
|
+
results[chunkStart + i] = true;
|
|
232
220
|
}
|
|
233
221
|
} catch (_) {
|
|
234
|
-
//
|
|
222
|
+
// Invalid point or malformed bytes leave this deposit false.
|
|
235
223
|
}
|
|
236
224
|
}
|
|
237
225
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import {PublicKey, Signature, verify} from "@chainsafe/blst";
|
|
2
1
|
import {
|
|
3
2
|
BUILDER_INDEX_SELF_BUILD,
|
|
4
3
|
ForkSeq,
|
|
@@ -12,7 +11,13 @@ import {G2_POINT_AT_INFINITY} from "../constants/constants.js";
|
|
|
12
11
|
import {getExecutionPayloadBidSigningRoot} from "../signatureSets/executionPayloadBid.js";
|
|
13
12
|
import {CachedBeaconStateGloas, CachedBeaconStateHeze} from "../types.js";
|
|
14
13
|
import {canBuilderCoverBid, isActiveBuilder} from "../util/gloas.js";
|
|
15
|
-
import {
|
|
14
|
+
import {
|
|
15
|
+
createSingleSignatureSetFromComponents,
|
|
16
|
+
getBlockRootAtSlot,
|
|
17
|
+
getCurrentEpoch,
|
|
18
|
+
getRandaoMix,
|
|
19
|
+
verifySignatureSet,
|
|
20
|
+
} from "../util/index.js";
|
|
16
21
|
|
|
17
22
|
export function processExecutionPayloadBid(
|
|
18
23
|
state: CachedBeaconStateGloas | CachedBeaconStateHeze,
|
|
@@ -123,10 +128,7 @@ function verifyExecutionPayloadBidSignature(
|
|
|
123
128
|
const signingRoot = getExecutionPayloadBidSigningRoot(state.config, signedBid.message);
|
|
124
129
|
|
|
125
130
|
try {
|
|
126
|
-
|
|
127
|
-
const signature = Signature.fromBytes(signedBid.signature, true);
|
|
128
|
-
|
|
129
|
-
return verify(signingRoot, publicKey, signature);
|
|
131
|
+
return verifySignatureSet(createSingleSignatureSetFromComponents(pubkey, signingRoot, signedBid.signature));
|
|
130
132
|
} catch (_e) {
|
|
131
133
|
return false; // Catch all BLS errors: failed key validation, failed signature validation, invalid signature
|
|
132
134
|
}
|
|
@@ -2,7 +2,6 @@ import {BeaconConfig} from "@lodestar/config";
|
|
|
2
2
|
import {ForkSeq, SLOTS_PER_EPOCH} from "@lodestar/params";
|
|
3
3
|
import {Slot, phase0, ssz} from "@lodestar/types";
|
|
4
4
|
import {Validator} from "@lodestar/types/phase0";
|
|
5
|
-
import {PubkeyCache} from "../cache/pubkeyCache.js";
|
|
6
5
|
import {getProposerSlashingSignatureSets} from "../signatureSets/index.js";
|
|
7
6
|
import {CachedBeaconStateAllForks, CachedBeaconStateGloas} from "../types.js";
|
|
8
7
|
import {computeEpochAtSlot, isSlashableValidator} from "../util/index.js";
|
|
@@ -22,14 +21,7 @@ export function processProposerSlashing(
|
|
|
22
21
|
verifySignatures = true
|
|
23
22
|
): void {
|
|
24
23
|
const proposer = state.validators.getReadonly(proposerSlashing.signedHeader1.message.proposerIndex);
|
|
25
|
-
assertValidProposerSlashing(
|
|
26
|
-
state.config,
|
|
27
|
-
state.epochCtx.pubkeyCache,
|
|
28
|
-
state.slot,
|
|
29
|
-
proposerSlashing,
|
|
30
|
-
proposer,
|
|
31
|
-
verifySignatures
|
|
32
|
-
);
|
|
24
|
+
assertValidProposerSlashing(state.config, state.slot, proposerSlashing, proposer, verifySignatures);
|
|
33
25
|
|
|
34
26
|
if (fork >= ForkSeq.gloas) {
|
|
35
27
|
// Remove the BuilderPendingPayment corresponding to this proposal if it is still in the
|
|
@@ -62,7 +54,6 @@ export function processProposerSlashing(
|
|
|
62
54
|
|
|
63
55
|
export function assertValidProposerSlashing(
|
|
64
56
|
config: BeaconConfig,
|
|
65
|
-
pubkeyCache: PubkeyCache,
|
|
66
57
|
stateSlot: Slot,
|
|
67
58
|
proposerSlashing: phase0.ProposerSlashing,
|
|
68
59
|
proposer: Validator,
|
|
@@ -99,7 +90,7 @@ export function assertValidProposerSlashing(
|
|
|
99
90
|
if (verifySignatures) {
|
|
100
91
|
const signatureSets = getProposerSlashingSignatureSets(config, stateSlot, proposerSlashing);
|
|
101
92
|
for (let i = 0; i < signatureSets.length; i++) {
|
|
102
|
-
if (!verifySignatureSet(signatureSets[i]
|
|
93
|
+
if (!verifySignatureSet(signatureSets[i])) {
|
|
103
94
|
throw new Error(`ProposerSlashing header${i + 1} signature invalid`);
|
|
104
95
|
}
|
|
105
96
|
}
|
|
@@ -17,7 +17,7 @@ export function processRandao(state: CachedBeaconStateAllForks, block: BeaconBlo
|
|
|
17
17
|
const randaoReveal = block.body.randaoReveal;
|
|
18
18
|
|
|
19
19
|
// verify RANDAO reveal
|
|
20
|
-
if (verifySignature && !verifyRandaoSignature(config,
|
|
20
|
+
if (verifySignature && !verifyRandaoSignature(config, block)) {
|
|
21
21
|
throw new Error("RANDAO reveal is an invalid signature");
|
|
22
22
|
}
|
|
23
23
|
|
|
@@ -32,7 +32,7 @@ export function processSyncAggregate(
|
|
|
32
32
|
participantIndices
|
|
33
33
|
);
|
|
34
34
|
// When there's no participation we consider the signature valid and just ignore it
|
|
35
|
-
if (signatureSet !== null && !verifySignatureSet(signatureSet
|
|
35
|
+
if (signatureSet !== null && !verifySignatureSet(signatureSet)) {
|
|
36
36
|
throw Error("Sync committee signature invalid");
|
|
37
37
|
}
|
|
38
38
|
}
|
|
@@ -93,10 +93,7 @@ function getValidatorVoluntaryExitValidity(
|
|
|
93
93
|
}
|
|
94
94
|
|
|
95
95
|
// Verify signature
|
|
96
|
-
if (
|
|
97
|
-
verifySignature &&
|
|
98
|
-
!verifyVoluntaryExitSignature(config, epochCtx.pubkeyCache, new BeaconStateView(state), signedVoluntaryExit)
|
|
99
|
-
) {
|
|
96
|
+
if (verifySignature && !verifyVoluntaryExitSignature(config, new BeaconStateView(state), signedVoluntaryExit)) {
|
|
100
97
|
return VoluntaryExitValidity.invalidSignature;
|
|
101
98
|
}
|
|
102
99
|
|
package/src/cache/epochCache.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {PublicKey} from "@chainsafe/blst";
|
|
1
|
+
import {PublicKey} from "@chainsafe/lodestar-z/blst";
|
|
2
|
+
import {type PubkeyCache, pubkeyCache as defaultPubkeyCache} from "@chainsafe/lodestar-z/pubkeys";
|
|
2
3
|
import {BeaconConfig, ChainConfig, createBeaconConfig} from "@lodestar/config";
|
|
3
4
|
import {
|
|
4
5
|
ATTESTATION_SUBNET_COUNT,
|
|
@@ -56,7 +57,6 @@ import {sumTargetUnslashedBalanceIncrements} from "../util/targetUnslashedBalanc
|
|
|
56
57
|
import {BuilderDepositSignatureCache} from "./builderDepositSignatureCache.js";
|
|
57
58
|
import {EffectiveBalanceIncrements, getEffectiveBalanceIncrementsWithLen} from "./effectiveBalanceIncrements.js";
|
|
58
59
|
import {EpochTransitionCache} from "./epochTransitionCache.js";
|
|
59
|
-
import {PubkeyCache, createPubkeyCache, syncPubkeys} from "./pubkeyCache.js";
|
|
60
60
|
import {CachedBeaconStateAllForks, CachedBeaconStateFulu, CachedBeaconStateGloas} from "./stateCache.js";
|
|
61
61
|
import {
|
|
62
62
|
SyncCommitteeCache,
|
|
@@ -341,10 +341,10 @@ export class EpochCache {
|
|
|
341
341
|
const validators = state.validators.getAllReadonlyValues();
|
|
342
342
|
const validatorCount = validators.length;
|
|
343
343
|
|
|
344
|
-
// syncPubkeys here to ensure EpochCacheImmutableData is
|
|
344
|
+
// syncPubkeys here to ensure EpochCacheImmutableData is populated before computing the rest of caches
|
|
345
345
|
// - computeSyncCommitteeCache() needs a fully populated pubkeyCache
|
|
346
346
|
if (!opts?.skipSyncPubkeys) {
|
|
347
|
-
syncPubkeys(
|
|
347
|
+
pubkeyCache.syncPubkeys(validators);
|
|
348
348
|
}
|
|
349
349
|
|
|
350
350
|
const effectiveBalanceIncrements = getEffectiveBalanceIncrementsWithLen(validatorCount);
|
|
@@ -908,7 +908,7 @@ export class EpochCache {
|
|
|
908
908
|
}
|
|
909
909
|
|
|
910
910
|
addPubkey(index: ValidatorIndex, pubkey: Uint8Array): void {
|
|
911
|
-
this.pubkeyCache.
|
|
911
|
+
this.pubkeyCache.append(index, pubkey);
|
|
912
912
|
}
|
|
913
913
|
|
|
914
914
|
getShufflingAtSlot(slot: Slot): EpochShuffling {
|
|
@@ -1123,7 +1123,6 @@ export function createEmptyEpochCacheImmutableData(
|
|
|
1123
1123
|
): EpochCacheImmutableData {
|
|
1124
1124
|
return {
|
|
1125
1125
|
config: createBeaconConfig(chainConfig, state.genesisValidatorsRoot),
|
|
1126
|
-
|
|
1127
|
-
pubkeyCache: createPubkeyCache(),
|
|
1126
|
+
pubkeyCache: defaultPubkeyCache,
|
|
1128
1127
|
};
|
|
1129
1128
|
}
|
package/src/cache/stateCache.ts
CHANGED
|
@@ -187,7 +187,7 @@ export function loadCachedBeaconState<T extends CachedBeaconStateAllForks>(
|
|
|
187
187
|
const validators = migratedState.validators;
|
|
188
188
|
for (const validatorIndex of modifiedValidators) {
|
|
189
189
|
const validator = validators.getReadonly(validatorIndex);
|
|
190
|
-
pubkeyCache.
|
|
190
|
+
pubkeyCache.append(validatorIndex, validator.pubkey);
|
|
191
191
|
}
|
|
192
192
|
|
|
193
193
|
return createCachedBeaconState(
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import {type PubkeyCache} from "@chainsafe/lodestar-z/pubkeys";
|
|
1
2
|
import {CompositeViewDU} from "@chainsafe/ssz";
|
|
2
3
|
import {ValidatorIndex, ssz} from "@lodestar/types";
|
|
3
4
|
import {toPubkeyHex} from "@lodestar/utils";
|
|
@@ -38,7 +39,7 @@ export function getSyncCommitteeCache(validatorIndices: Uint32Array): SyncCommit
|
|
|
38
39
|
|
|
39
40
|
export function computeSyncCommitteeCache(
|
|
40
41
|
syncCommittee: CompositeViewDU<typeof ssz.altair.SyncCommittee>,
|
|
41
|
-
pubkeyCache:
|
|
42
|
+
pubkeyCache: PubkeyCache
|
|
42
43
|
): SyncCommitteeCache {
|
|
43
44
|
const validatorIndices = computeSyncCommitteeValidatorIndices(syncCommittee, pubkeyCache);
|
|
44
45
|
const validatorIndexMap = computeValidatorSyncCommitteeIndexMap(validatorIndices);
|
|
@@ -78,7 +79,7 @@ export function computeValidatorSyncCommitteeIndexMap(
|
|
|
78
79
|
*/
|
|
79
80
|
function computeSyncCommitteeValidatorIndices(
|
|
80
81
|
syncCommittee: CompositeViewDU<typeof ssz.altair.SyncCommittee>,
|
|
81
|
-
pubkeyCache:
|
|
82
|
+
pubkeyCache: PubkeyCache
|
|
82
83
|
): Uint32Array {
|
|
83
84
|
const pubkeys = syncCommittee.pubkeys.getAllReadonly();
|
|
84
85
|
const validatorIndices = new Uint32Array(pubkeys.length);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {aggregateSerializedPublicKeys} from "@chainsafe/blst";
|
|
1
|
+
import {aggregateSerializedPublicKeys} from "@chainsafe/lodestar-z/blst";
|
|
2
2
|
import {EPOCHS_PER_SYNC_COMMITTEE_PERIOD, ForkSeq} from "@lodestar/params";
|
|
3
3
|
import {ssz} from "@lodestar/types";
|
|
4
4
|
import {CachedBeaconStateAltair} from "../types.js";
|
package/src/index.ts
CHANGED
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
export {
|
|
2
|
-
type BlockExternalData,
|
|
3
|
-
DataAvailabilityStatus,
|
|
4
|
-
ExecutionPayloadStatus,
|
|
5
|
-
} from "./block/externalData.js";
|
|
1
|
+
export {type BlockExternalData, DataAvailabilityStatus, ExecutionPayloadStatus} from "./block/externalData.js";
|
|
6
2
|
export {getAttestationParticipationStatus, processAttestationsAltair} from "./block/processAttestationsAltair.js";
|
|
7
3
|
export {assertValidAttesterSlashing} from "./block/processAttesterSlashing.js";
|
|
8
4
|
export {isValidBlsToExecutionChange} from "./block/processBlsToExecutionChange.js";
|
|
@@ -25,7 +21,6 @@ export {
|
|
|
25
21
|
createEmptyEpochCacheImmutableData,
|
|
26
22
|
} from "./cache/epochCache.js";
|
|
27
23
|
export {type EpochTransitionCache, beforeProcessEpoch} from "./cache/epochTransitionCache.js";
|
|
28
|
-
export {type PubkeyCache, createPubkeyCache, syncPubkeys} from "./cache/pubkeyCache.js";
|
|
29
24
|
// Main state caches
|
|
30
25
|
export {
|
|
31
26
|
type BeaconStateCache,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {PublicKey} from "@chainsafe/blst";
|
|
1
|
+
import type {PublicKey} from "@chainsafe/lodestar-z/blst";
|
|
2
2
|
import {BeaconConfig} from "@lodestar/config";
|
|
3
3
|
import {LightClientBootstrap, LightClientHeader, LightClientUpdate, SyncPeriod} from "@lodestar/types";
|
|
4
4
|
import {computeSyncPeriodAtSlot} from "../../util/epoch.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {PublicKey, Signature, fastAggregateVerify} from "@chainsafe/blst";
|
|
1
|
+
import {PublicKey, Signature, fastAggregateVerify} from "@chainsafe/lodestar-z/blst";
|
|
2
2
|
import {ChainForkConfig} from "@lodestar/config";
|
|
3
3
|
import {DOMAIN_SYNC_COMMITTEE, GENESIS_SLOT, MIN_SYNC_COMMITTEE_PARTICIPANTS} from "@lodestar/params";
|
|
4
4
|
import {LightClientUpdate, Root, ssz} from "@lodestar/types";
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import {type PubkeyCache} from "@chainsafe/lodestar-z/pubkeys";
|
|
1
2
|
import {BeaconConfig} from "@lodestar/config";
|
|
2
3
|
import {
|
|
3
4
|
EFFECTIVE_BALANCE_INCREMENT,
|
|
@@ -15,7 +16,6 @@ import {
|
|
|
15
16
|
import {ValidatorIndex, rewards} from "@lodestar/types";
|
|
16
17
|
import {fromHex} from "@lodestar/utils";
|
|
17
18
|
import {EpochTransitionCache, beforeProcessEpoch} from "../cache/epochTransitionCache.js";
|
|
18
|
-
import {PubkeyCache} from "../cache/pubkeyCache.js";
|
|
19
19
|
import {CachedBeaconStateAllForks, CachedBeaconStateAltair} from "../types.js";
|
|
20
20
|
import {
|
|
21
21
|
FLAG_ELIGIBLE_ATTESTER,
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import {type PubkeyCache} from "@chainsafe/lodestar-z/pubkeys";
|
|
1
2
|
import {BeaconConfig} from "@lodestar/config";
|
|
2
3
|
import {ForkName, SYNC_COMMITTEE_SIZE} from "@lodestar/params";
|
|
3
4
|
import {BeaconBlock, ValidatorIndex, altair, rewards} from "@lodestar/types";
|
|
4
|
-
import {
|
|
5
|
+
import {toPubkeyHex} from "@lodestar/utils";
|
|
5
6
|
import {CachedBeaconStateAllForks, CachedBeaconStateAltair} from "../cache/stateCache.js";
|
|
6
7
|
|
|
7
8
|
export async function computeSyncCommitteeRewards(
|
|
@@ -48,7 +49,8 @@ export async function computeSyncCommitteeRewards(
|
|
|
48
49
|
if (validatorIds.length) {
|
|
49
50
|
const filtersSet = new Set(validatorIds);
|
|
50
51
|
return rewards.filter((reward) => {
|
|
51
|
-
const
|
|
52
|
+
const pubkey = pubkeyCache.getPubkeyBytes(reward.validatorIndex);
|
|
53
|
+
const pubkeyHex = pubkey === undefined ? undefined : toPubkeyHex(pubkey);
|
|
52
54
|
return filtersSet.has(reward.validatorIndex) || (pubkeyHex !== undefined && filtersSet.has(pubkeyHex));
|
|
53
55
|
});
|
|
54
56
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import {PublicKey} from "@chainsafe/blst";
|
|
2
1
|
import {BeaconConfig} from "@lodestar/config";
|
|
3
2
|
import {DOMAIN_BLS_TO_EXECUTION_CHANGE, ForkName} from "@lodestar/params";
|
|
4
3
|
import {capella, ssz} from "@lodestar/types";
|
|
@@ -26,7 +25,7 @@ export function getBlsToExecutionChangeSignatureSet(
|
|
|
26
25
|
type: SignatureSetType.single,
|
|
27
26
|
// The withdrawal pubkey is the same as signedBLSToExecutionChange's fromBlsPubkey as it should
|
|
28
27
|
// be validated against the withdrawal credentials digest
|
|
29
|
-
pubkey:
|
|
28
|
+
pubkey: signedBLSToExecutionChange.message.fromBlsPubkey,
|
|
30
29
|
signingRoot: computeSigningRoot(ssz.capella.BLSToExecutionChange, signedBLSToExecutionChange.message, domain),
|
|
31
30
|
signature: signedBLSToExecutionChange.signature,
|
|
32
31
|
};
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
import {PublicKey} from "@chainsafe/blst";
|
|
2
1
|
import {BeaconConfig} from "@lodestar/config";
|
|
3
2
|
import {BUILDER_INDEX_SELF_BUILD, DOMAIN_BEACON_BUILDER} from "@lodestar/params";
|
|
4
3
|
import {ValidatorIndex, gloas, ssz} from "@lodestar/types";
|
|
5
|
-
import {PubkeyCache} from "../cache/pubkeyCache.js";
|
|
6
4
|
import {IBeaconStateView, isStatePostGloas} from "../stateView/interface.js";
|
|
7
5
|
import {computeSigningRoot} from "../util/index.js";
|
|
8
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
type ISignatureSet,
|
|
8
|
+
createIndexedSignatureSetFromComponents,
|
|
9
|
+
createSingleSignatureSetFromComponents,
|
|
10
|
+
} from "../util/signatureSets.js";
|
|
9
11
|
|
|
10
12
|
export function getExecutionPayloadEnvelopeSigningRoot(
|
|
11
13
|
config: BeaconConfig,
|
|
@@ -18,24 +20,21 @@ export function getExecutionPayloadEnvelopeSigningRoot(
|
|
|
18
20
|
|
|
19
21
|
export function getExecutionPayloadEnvelopeSignatureSet(
|
|
20
22
|
config: BeaconConfig,
|
|
21
|
-
pubkeyCache: PubkeyCache,
|
|
22
23
|
state: IBeaconStateView,
|
|
23
24
|
signedEnvelope: gloas.SignedExecutionPayloadEnvelope,
|
|
24
25
|
proposerIndex: ValidatorIndex
|
|
25
|
-
):
|
|
26
|
+
): ISignatureSet {
|
|
26
27
|
if (!isStatePostGloas(state)) {
|
|
27
28
|
throw new Error(`Expected gloas+ state for execution payload envelope signature, got fork=${state.forkName}`);
|
|
28
29
|
}
|
|
29
30
|
|
|
30
31
|
const envelope = signedEnvelope.message;
|
|
31
|
-
const
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
signedEnvelope.signature
|
|
40
|
-
);
|
|
32
|
+
const signingRoot = getExecutionPayloadEnvelopeSigningRoot(config, envelope);
|
|
33
|
+
return envelope.builderIndex === BUILDER_INDEX_SELF_BUILD
|
|
34
|
+
? createIndexedSignatureSetFromComponents(proposerIndex, signingRoot, signedEnvelope.signature)
|
|
35
|
+
: createSingleSignatureSetFromComponents(
|
|
36
|
+
state.getBuilder(envelope.builderIndex).pubkey,
|
|
37
|
+
signingRoot,
|
|
38
|
+
signedEnvelope.signature
|
|
39
|
+
);
|
|
41
40
|
}
|
|
@@ -1,17 +1,15 @@
|
|
|
1
1
|
import {BeaconConfig} from "@lodestar/config";
|
|
2
2
|
import {DOMAIN_BEACON_PROPOSER} from "@lodestar/params";
|
|
3
3
|
import {SignedBeaconBlock, SignedBlindedBeaconBlock, Slot, isBlindedBeaconBlock, phase0, ssz} from "@lodestar/types";
|
|
4
|
-
import {PubkeyCache} from "../cache/pubkeyCache.js";
|
|
5
4
|
import {computeSigningRoot} from "../util/index.js";
|
|
6
5
|
import {ISignatureSet, SignatureSetType, verifySignatureSet} from "../util/signatureSets.js";
|
|
7
6
|
|
|
8
7
|
export function verifyProposerSignature(
|
|
9
8
|
config: BeaconConfig,
|
|
10
|
-
pubkeyCache: PubkeyCache,
|
|
11
9
|
signedBlock: SignedBeaconBlock | SignedBlindedBeaconBlock
|
|
12
10
|
): boolean {
|
|
13
11
|
const signatureSet = getBlockProposerSignatureSet(config, signedBlock);
|
|
14
|
-
return verifySignatureSet(signatureSet
|
|
12
|
+
return verifySignatureSet(signatureSet);
|
|
15
13
|
}
|
|
16
14
|
|
|
17
15
|
export function getBlockProposerSignatureSet(
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import {BeaconConfig} from "@lodestar/config";
|
|
2
2
|
import {DOMAIN_RANDAO} from "@lodestar/params";
|
|
3
3
|
import {BeaconBlock, ssz} from "@lodestar/types";
|
|
4
|
-
import {PubkeyCache} from "../cache/pubkeyCache.js";
|
|
5
4
|
import {
|
|
6
5
|
ISignatureSet,
|
|
7
6
|
SignatureSetType,
|
|
@@ -10,8 +9,8 @@ import {
|
|
|
10
9
|
verifySignatureSet,
|
|
11
10
|
} from "../util/index.js";
|
|
12
11
|
|
|
13
|
-
export function verifyRandaoSignature(config: BeaconConfig,
|
|
14
|
-
return verifySignatureSet(getRandaoRevealSignatureSet(config, block)
|
|
12
|
+
export function verifyRandaoSignature(config: BeaconConfig, block: BeaconBlock): boolean {
|
|
13
|
+
return verifySignatureSet(getRandaoRevealSignatureSet(config, block));
|
|
15
14
|
}
|
|
16
15
|
|
|
17
16
|
/**
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import {PublicKey} from "@chainsafe/blst";
|
|
2
1
|
import {BeaconConfig} from "@lodestar/config";
|
|
3
2
|
import {ForkSeq} from "@lodestar/params";
|
|
4
3
|
import {SignedBeaconBlock, Slot, phase0, ssz} from "@lodestar/types";
|
|
5
|
-
import {PubkeyCache} from "../cache/pubkeyCache.js";
|
|
6
4
|
import {IBeaconStateView, IBeaconStateViewGloas, isStatePostGloas} from "../stateView/interface.js";
|
|
7
5
|
import {
|
|
8
6
|
ISignatureSet,
|
|
@@ -16,11 +14,10 @@ import {
|
|
|
16
14
|
|
|
17
15
|
export function verifyVoluntaryExitSignature(
|
|
18
16
|
config: BeaconConfig,
|
|
19
|
-
pubkeyCache: PubkeyCache,
|
|
20
17
|
state: IBeaconStateView,
|
|
21
18
|
signedVoluntaryExit: phase0.SignedVoluntaryExit
|
|
22
19
|
): boolean {
|
|
23
|
-
return verifySignatureSet(getVoluntaryExitSignatureSet(config, state, signedVoluntaryExit)
|
|
20
|
+
return verifySignatureSet(getVoluntaryExitSignatureSet(config, state, signedVoluntaryExit));
|
|
24
21
|
}
|
|
25
22
|
|
|
26
23
|
/**
|
|
@@ -81,7 +78,7 @@ export function getBuilderVoluntaryExitSignatureSet(
|
|
|
81
78
|
|
|
82
79
|
return {
|
|
83
80
|
type: SignatureSetType.single,
|
|
84
|
-
pubkey:
|
|
81
|
+
pubkey: builder.pubkey,
|
|
85
82
|
signingRoot: computeSigningRoot(ssz.phase0.VoluntaryExit, signedVoluntaryExit.message, domain),
|
|
86
83
|
signature: signedVoluntaryExit.signature,
|
|
87
84
|
};
|
package/src/stateTransition.ts
CHANGED
|
@@ -113,7 +113,7 @@ export function stateTransition(
|
|
|
113
113
|
postState = processSlotsWithTransientCache(postState, blockSlot, options, {metrics, validatorMonitor});
|
|
114
114
|
|
|
115
115
|
// Verify proposer signature only
|
|
116
|
-
if (verifyProposer && !verifyProposerSignature(postState.config,
|
|
116
|
+
if (verifyProposer && !verifyProposerSignature(postState.config, signedBlock)) {
|
|
117
117
|
throw new Error("Invalid block signature");
|
|
118
118
|
}
|
|
119
119
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import {type PubkeyCache, pubkeyCache} from "@chainsafe/lodestar-z/pubkeys";
|
|
1
2
|
import {BeaconConfig} from "@lodestar/config";
|
|
2
|
-
import {PubkeyCache, createPubkeyCache} from "../cache/pubkeyCache.js";
|
|
3
3
|
import {createCachedBeaconState} from "../cache/stateCache.js";
|
|
4
4
|
import {BeaconStateAllForks} from "../cache/types.js";
|
|
5
5
|
import {getStateTypeFromBytes} from "../util/sszBytes.js";
|
|
@@ -40,17 +40,6 @@ export function createBeaconStateView(opts: NodeJSOpts | NativeOpts): IBeaconSta
|
|
|
40
40
|
|
|
41
41
|
// ---- createBeaconStateViewForHistoricalRegen (regen path) ----
|
|
42
42
|
|
|
43
|
-
// Reused across all historical state regen calls in the worker thread
|
|
44
|
-
const pubkeyCacheRegen = createPubkeyCache();
|
|
45
|
-
|
|
46
|
-
function syncPubkeyCache(state: BeaconStateAllForks, pubkeyCache: PubkeyCache): void {
|
|
47
|
-
const newCount = state.validators.length;
|
|
48
|
-
for (let i = pubkeyCache.size; i < newCount; i++) {
|
|
49
|
-
const pubkey = state.validators.getReadonly(i).pubkey;
|
|
50
|
-
pubkeyCache.set(i, pubkey);
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
|
|
54
43
|
type RegenNodeJSOpts = {
|
|
55
44
|
useNative: false;
|
|
56
45
|
config: BeaconConfig;
|
|
@@ -74,7 +63,6 @@ export function createBeaconStateViewForHistoricalRegen(opts: RegenNodeJSOpts |
|
|
|
74
63
|
}
|
|
75
64
|
const {config, stateBytes} = opts;
|
|
76
65
|
const state = getStateTypeFromBytes(config, stateBytes).deserializeToViewDU(stateBytes);
|
|
77
|
-
|
|
78
|
-
const cachedState = createCachedBeaconState(state, {config, pubkeyCache: pubkeyCacheRegen}, {skipSyncPubkeys: true});
|
|
66
|
+
const cachedState = createCachedBeaconState(state, {config, pubkeyCache}, {skipSyncPubkeys: true});
|
|
79
67
|
return new BeaconStateView(cachedState);
|
|
80
68
|
}
|