@lodestar/state-transition 1.51.0-dev.312812503e → 1.51.0-dev.36022cc5cb
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 +1 -1
- package/lib/block/index.d.ts.map +1 -1
- package/lib/block/index.js +2 -2
- package/lib/block/index.js.map +1 -1
- package/lib/block/processDeposit.d.ts.map +1 -1
- package/lib/block/processDeposit.js +1 -1
- package/lib/block/processDeposit.js.map +1 -1
- package/lib/block/processOperations.d.ts +1 -1
- package/lib/block/processOperations.d.ts.map +1 -1
- package/lib/block/processOperations.js +1 -1
- package/lib/block/processOperations.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 +1 -1
- package/lib/cache/epochCache.js.map +1 -1
- package/lib/cache/syncCommitteeCache.d.ts +1 -1
- package/lib/cache/syncCommitteeCache.d.ts.map +1 -1
- package/lib/epoch/index.d.ts +2 -2
- package/lib/epoch/index.d.ts.map +1 -1
- package/lib/epoch/index.js +2 -2
- package/lib/epoch/index.js.map +1 -1
- package/lib/epoch/processSyncCommitteeUpdates.js +1 -1
- package/lib/epoch/processSyncCommitteeUpdates.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.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.d.ts.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/syncCommitteeRewards.d.ts +1 -1
- package/lib/rewards/syncCommitteeRewards.d.ts.map +1 -1
- package/lib/stateView/beaconStateView.d.ts +1 -0
- package/lib/stateView/beaconStateView.d.ts.map +1 -1
- package/lib/stateView/beaconStateView.js +5 -1
- package/lib/stateView/beaconStateView.js.map +1 -1
- package/lib/stateView/interface.d.ts +1 -1
- package/lib/stateView/interface.d.ts.map +1 -1
- package/lib/stateView/interface.js.map +1 -1
- package/lib/stateView/nativeBeaconStateView.d.ts +1 -1
- package/lib/stateView/nativeBeaconStateView.d.ts.map +1 -1
- package/lib/stateView/nativeBeaconStateView.js +3 -13
- package/lib/stateView/nativeBeaconStateView.js.map +1 -1
- package/lib/stateView/stateViewFactory.d.ts.map +1 -1
- package/lib/stateView/stateViewFactory.js +2 -2
- package/lib/stateView/stateViewFactory.js.map +1 -1
- package/lib/testUtils/interopPubkeyCache.js +1 -1
- package/lib/testUtils/interopPubkeyCache.js.map +1 -1
- package/lib/testUtils/state.d.ts.map +1 -1
- package/lib/testUtils/state.js +1 -1
- package/lib/testUtils/state.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 +2 -2
- package/lib/testUtils/util.js.map +1 -1
- package/lib/util/blindedBlock.d.ts.map +1 -1
- package/lib/util/blindedBlock.js +4 -12
- package/lib/util/blindedBlock.js.map +1 -1
- package/lib/util/epochShuffling.d.ts.map +1 -1
- package/lib/util/epochShuffling.js +1 -1
- package/lib/util/epochShuffling.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/seed.js +1 -1
- package/lib/util/seed.js.map +1 -1
- package/lib/util/signatureSets.d.ts +1 -1
- package/lib/util/signatureSets.d.ts.map +1 -1
- package/lib/util/signatureSets.js +1 -1
- package/lib/util/signatureSets.js.map +1 -1
- package/lib/util/syncCommittee.d.ts.map +1 -1
- package/lib/util/syncCommittee.js +1 -1
- package/lib/util/syncCommittee.js.map +1 -1
- package/package.json +8 -8
- package/src/block/index.ts +11 -12
- package/src/block/processDeposit.ts +2 -2
- package/src/block/processOperations.ts +5 -5
- package/src/cache/epochCache.ts +2 -2
- package/src/cache/syncCommitteeCache.ts +1 -1
- package/src/epoch/index.ts +14 -15
- package/src/epoch/processSyncCommitteeUpdates.ts +1 -1
- 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 +1 -1
- package/src/stateView/beaconStateView.ts +5 -1
- package/src/stateView/interface.ts +0 -2
- package/src/stateView/nativeBeaconStateView.ts +3 -16
- package/src/stateView/stateViewFactory.ts +2 -2
- package/src/testUtils/interopPubkeyCache.ts +1 -1
- package/src/testUtils/state.ts +1 -1
- package/src/testUtils/util.ts +2 -2
- package/src/util/blindedBlock.ts +4 -12
- package/src/util/epochShuffling.ts +1 -1
- package/src/util/interop.ts +1 -1
- package/src/util/seed.ts +1 -1
- package/src/util/signatureSets.ts +1 -1
- package/src/util/syncCommittee.ts +1 -1
|
@@ -84,6 +84,7 @@ export class BeaconStateView implements IBeaconStateViewLatestFork {
|
|
|
84
84
|
// phase0
|
|
85
85
|
private cachedFork: Fork | null = null;
|
|
86
86
|
private cachedLatestBlockHeader: phase0.BeaconBlockHeader | null = null;
|
|
87
|
+
private cachedEffectiveBalanceIncrementsZeroInactive: EffectiveBalanceIncrements | null = null;
|
|
87
88
|
// altair
|
|
88
89
|
private cachedCurrentSyncCommittee: SyncCommittee | null = null;
|
|
89
90
|
private cachedNextSyncCommittee: SyncCommittee | null = null;
|
|
@@ -638,7 +639,10 @@ export class BeaconStateView implements IBeaconStateViewLatestFork {
|
|
|
638
639
|
}
|
|
639
640
|
|
|
640
641
|
getEffectiveBalanceIncrementsZeroInactive(): EffectiveBalanceIncrements {
|
|
641
|
-
|
|
642
|
+
if (this.cachedEffectiveBalanceIncrementsZeroInactive === null) {
|
|
643
|
+
this.cachedEffectiveBalanceIncrementsZeroInactive = getEffectiveBalanceIncrementsZeroInactive(this.cachedState);
|
|
644
|
+
}
|
|
645
|
+
return this.cachedEffectiveBalanceIncrementsZeroInactive;
|
|
642
646
|
}
|
|
643
647
|
|
|
644
648
|
getBalance(index: number): number {
|
|
@@ -348,8 +348,6 @@ export type IBeaconStateViewNative = Omit<
|
|
|
348
348
|
| "pendingConsolidations"
|
|
349
349
|
| "pendingDeposits"
|
|
350
350
|
| "pendingPartialWithdrawals"
|
|
351
|
-
| "preVerifyBuilderDepositsPreGloas"
|
|
352
|
-
| "clearPreGloasBuilderDepositCache"
|
|
353
351
|
| "processSlots"
|
|
354
352
|
| "proposerLookahead"
|
|
355
353
|
| "stateTransition"
|
|
@@ -908,25 +908,12 @@ export class NativeBeaconStateView implements IBeaconStateViewLatestFork {
|
|
|
908
908
|
return this.cachedProposerLookahead;
|
|
909
909
|
}
|
|
910
910
|
|
|
911
|
-
preVerifyBuilderDepositsPreGloas(
|
|
912
|
-
|
|
913
|
-
_maxDurationMs: number
|
|
914
|
-
): PreVerifyBuilderDepositsResult {
|
|
915
|
-
// The native fork upgrade verifies directly; it does not maintain a warm-up cache.
|
|
916
|
-
return {
|
|
917
|
-
validBuilderSignaturesCount: 0,
|
|
918
|
-
invalidBuilderSignaturesCount: 0,
|
|
919
|
-
validValidatorSignaturesCount: 0,
|
|
920
|
-
invalidValidatorSignaturesCount: 0,
|
|
921
|
-
scannedPendingDeposits: 0,
|
|
922
|
-
totalCachedDeposits: 0,
|
|
923
|
-
totalBuilderPubkeys: 0,
|
|
924
|
-
pendingDepositsCount: this.pendingDepositsCount,
|
|
925
|
-
};
|
|
911
|
+
preVerifyBuilderDepositsPreGloas(maxBuilderDeposits: number, maxDurationMs: number): PreVerifyBuilderDepositsResult {
|
|
912
|
+
return this.binding.preVerifyBuilderDepositsPreGloas(maxBuilderDeposits, maxDurationMs);
|
|
926
913
|
}
|
|
927
914
|
|
|
928
915
|
clearPreGloasBuilderDepositCache(): void {
|
|
929
|
-
|
|
916
|
+
this.binding.clearPreGloasBuilderDepositCache();
|
|
930
917
|
}
|
|
931
918
|
|
|
932
919
|
// ─── gloas ───────────────────────────────────────────────────────────────
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import bindings from "@chainsafe/lodestar-z";
|
|
2
|
-
import {pubkeyCache} from "@chainsafe/lodestar-z/pubkeys";
|
|
3
1
|
import {BeaconConfig} from "@lodestar/config";
|
|
2
|
+
import bindings from "@lodestar/native";
|
|
3
|
+
import {pubkeyCache} from "@lodestar/native/pubkeys";
|
|
4
4
|
import {createCachedBeaconState} from "../cache/stateCache.js";
|
|
5
5
|
import {getStateSlotFromBytes, getStateTypeFromBytes} from "../util/sszBytes.js";
|
|
6
6
|
import {BeaconStateView} from "./beaconStateView.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import fs from "node:fs";
|
|
2
2
|
import path from "node:path";
|
|
3
|
-
import {pubkeyCache} from "@
|
|
3
|
+
import {pubkeyCache} from "@lodestar/native/pubkeys";
|
|
4
4
|
import {interopSecretKey} from "../util/interop.js";
|
|
5
5
|
import {testCachePath} from "./cache.js";
|
|
6
6
|
|
package/src/testUtils/state.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {pubkeyCache} from "@chainsafe/lodestar-z/pubkeys";
|
|
2
1
|
import {ChainForkConfig, createBeaconConfig} from "@lodestar/config";
|
|
3
2
|
import {config, config as minimalConfig} from "@lodestar/config/default";
|
|
3
|
+
import {pubkeyCache} from "@lodestar/native/pubkeys";
|
|
4
4
|
import {
|
|
5
5
|
EPOCHS_PER_HISTORICAL_VECTOR,
|
|
6
6
|
EPOCHS_PER_SLASHINGS_VECTOR,
|
package/src/testUtils/util.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {PublicKey, SecretKey} from "@chainsafe/lodestar-z/blst";
|
|
2
|
-
import {pubkeyCache} from "@chainsafe/lodestar-z/pubkeys";
|
|
3
1
|
import {BitArray, fromHexString} from "@chainsafe/ssz";
|
|
4
2
|
import {BeaconConfig, createBeaconConfig, createChainForkConfig} from "@lodestar/config";
|
|
5
3
|
import {config} from "@lodestar/config/default";
|
|
4
|
+
import {PublicKey, SecretKey} from "@lodestar/native/blst";
|
|
5
|
+
import {pubkeyCache} from "@lodestar/native/pubkeys";
|
|
6
6
|
import {
|
|
7
7
|
BUILDER_WITHDRAWAL_PREFIX,
|
|
8
8
|
DOMAIN_DEPOSIT,
|
package/src/util/blindedBlock.ts
CHANGED
|
@@ -33,13 +33,9 @@ export function blindedOrFullBlockHashTreeRoot(
|
|
|
33
33
|
): Root {
|
|
34
34
|
return isBlindedBeaconBlock(blindedOrFull)
|
|
35
35
|
? // Blinded
|
|
36
|
-
config
|
|
37
|
-
.getPostBellatrixForkTypes(blindedOrFull.slot)
|
|
38
|
-
.BlindedBeaconBlock.hashTreeRoot(blindedOrFull)
|
|
36
|
+
config.getPostBellatrixForkTypes(blindedOrFull.slot).BlindedBeaconBlock.hashTreeRoot(blindedOrFull)
|
|
39
37
|
: // Full
|
|
40
|
-
config
|
|
41
|
-
.getForkTypes(blindedOrFull.slot)
|
|
42
|
-
.BeaconBlock.hashTreeRoot(blindedOrFull);
|
|
38
|
+
config.getForkTypes(blindedOrFull.slot).BeaconBlock.hashTreeRoot(blindedOrFull);
|
|
43
39
|
}
|
|
44
40
|
|
|
45
41
|
export function blindedOrFullBlockToHeader(
|
|
@@ -48,13 +44,9 @@ export function blindedOrFullBlockToHeader(
|
|
|
48
44
|
): BeaconBlockHeader {
|
|
49
45
|
const bodyRoot = isBlindedBeaconBlock(blindedOrFull)
|
|
50
46
|
? // Blinded
|
|
51
|
-
config
|
|
52
|
-
.getPostBellatrixForkTypes(blindedOrFull.slot)
|
|
53
|
-
.BlindedBeaconBlockBody.hashTreeRoot(blindedOrFull.body)
|
|
47
|
+
config.getPostBellatrixForkTypes(blindedOrFull.slot).BlindedBeaconBlockBody.hashTreeRoot(blindedOrFull.body)
|
|
54
48
|
: // Full
|
|
55
|
-
config
|
|
56
|
-
.getForkTypes(blindedOrFull.slot)
|
|
57
|
-
.BeaconBlockBody.hashTreeRoot(blindedOrFull.body);
|
|
49
|
+
config.getForkTypes(blindedOrFull.slot).BeaconBlockBody.hashTreeRoot(blindedOrFull.body);
|
|
58
50
|
|
|
59
51
|
return {
|
|
60
52
|
slot: blindedOrFull.slot,
|
package/src/util/interop.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {toBufferBE} from "@vekexasia/bigint-buffer2";
|
|
2
2
|
import {digest} from "@chainsafe/as-sha256";
|
|
3
|
-
import {SecretKey} from "@
|
|
3
|
+
import {SecretKey} from "@lodestar/native/blst";
|
|
4
4
|
import {bytesToBigInt, intToBytes} from "@lodestar/utils";
|
|
5
5
|
|
|
6
6
|
let curveOrder: bigint;
|
package/src/util/seed.ts
CHANGED
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
computePtcIndicesForEpoch,
|
|
4
4
|
computeProposerIndex as nativeComputeProposerIndex,
|
|
5
5
|
computeSyncCommitteeIndices as nativeComputeSyncCommitteeIndices,
|
|
6
|
-
} from "@
|
|
6
|
+
} from "@lodestar/native/shuffle";
|
|
7
7
|
import {
|
|
8
8
|
DOMAIN_BEACON_PROPOSER,
|
|
9
9
|
DOMAIN_PTC_ATTESTER,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {BLS_VERIFIER_SET_TYPE, type BlsSignatureSet, verifySignatureSets} from "@
|
|
1
|
+
import {BLS_VERIFIER_SET_TYPE, type BlsSignatureSet, verifySignatureSets} from "@lodestar/native/bls-verifier";
|
|
2
2
|
import {Root} from "@lodestar/types";
|
|
3
3
|
|
|
4
4
|
export enum SignatureSetType {
|