@lodestar/state-transition 1.44.0-dev.1f0e8b5a5f → 1.44.0-dev.2e279005cc
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/processDepositRequest.d.ts.map +1 -1
- package/lib/block/processDepositRequest.js +2 -1
- package/lib/block/processDepositRequest.js.map +1 -1
- package/lib/block/processOperations.d.ts.map +1 -1
- package/lib/block/processOperations.js +3 -2
- package/lib/block/processOperations.js.map +1 -1
- package/lib/epoch/processPendingDeposits.d.ts.map +1 -1
- package/lib/epoch/processPendingDeposits.js +4 -3
- package/lib/epoch/processPendingDeposits.js.map +1 -1
- package/lib/epoch/processProposerLookahead.d.ts.map +1 -1
- package/lib/epoch/processProposerLookahead.js +7 -2
- package/lib/epoch/processProposerLookahead.js.map +1 -1
- package/lib/slot/upgradeStateToGloas.js +1 -1
- package/lib/slot/upgradeStateToGloas.js.map +1 -1
- package/lib/stateView/beaconStateView.d.ts +3 -1
- package/lib/stateView/beaconStateView.d.ts.map +1 -1
- package/lib/stateView/beaconStateView.js +6 -0
- package/lib/stateView/beaconStateView.js.map +1 -1
- package/lib/stateView/interface.d.ts +28 -1
- package/lib/stateView/interface.d.ts.map +1 -1
- package/lib/stateView/interface.js.map +1 -1
- package/lib/stateView/nativeBeaconStateView.d.ts +230 -0
- package/lib/stateView/nativeBeaconStateView.d.ts.map +1 -0
- package/lib/stateView/nativeBeaconStateView.js +717 -0
- package/lib/stateView/nativeBeaconStateView.js.map +1 -0
- package/lib/stateView/stateViewFactory.d.ts.map +1 -1
- package/lib/stateView/stateViewFactory.js +2 -0
- package/lib/stateView/stateViewFactory.js.map +1 -1
- package/lib/util/epochShuffling.js +1 -1
- package/lib/util/epochShuffling.js.map +1 -1
- package/lib/util/shuffling.d.ts +2 -2
- package/lib/util/shuffling.d.ts.map +1 -1
- package/lib/util/shuffling.js +4 -3
- package/lib/util/shuffling.js.map +1 -1
- package/package.json +7 -8
- package/src/block/processDepositRequest.ts +2 -1
- package/src/block/processOperations.ts +3 -2
- package/src/epoch/processPendingDeposits.ts +2 -0
- package/src/epoch/processProposerLookahead.ts +8 -1
- package/src/slot/upgradeStateToGloas.ts +1 -1
- package/src/stateView/beaconStateView.ts +9 -0
- package/src/stateView/interface.ts +32 -0
- package/src/stateView/nativeBeaconStateView.ts +915 -0
- package/src/stateView/stateViewFactory.ts +2 -0
- package/src/util/epochShuffling.ts +1 -1
- package/src/util/shuffling.ts +4 -3
|
@@ -31,6 +31,7 @@ type NativeOpts = {
|
|
|
31
31
|
export function createBeaconStateView(opts: NodeJSOpts | NativeOpts): IBeaconStateView {
|
|
32
32
|
if (opts.useNative) {
|
|
33
33
|
throw new Error("Native (Zig) BeaconStateView not yet implemented");
|
|
34
|
+
// TODO: return a new instance of NativeBeaconStateView
|
|
34
35
|
}
|
|
35
36
|
const {anchorState, config, pubkeyCache} = opts;
|
|
36
37
|
const cachedState = createCachedBeaconState(anchorState, {config, pubkeyCache}, {skipSyncPubkeys: true});
|
|
@@ -69,6 +70,7 @@ type RegenNativeOpts = {
|
|
|
69
70
|
export function createBeaconStateViewForHistoricalRegen(opts: RegenNodeJSOpts | RegenNativeOpts): IBeaconStateView {
|
|
70
71
|
if (opts.useNative) {
|
|
71
72
|
throw new Error("Native (Zig) BeaconStateView not yet implemented");
|
|
73
|
+
// TODO: return a new instance of NativeBeaconStateView
|
|
72
74
|
}
|
|
73
75
|
const {config, stateBytes} = opts;
|
|
74
76
|
const state = getStateTypeFromBytes(config, stateBytes).deserializeToViewDU(stateBytes);
|
|
@@ -124,7 +124,7 @@ export async function computeEpochShufflingAsync(
|
|
|
124
124
|
}
|
|
125
125
|
|
|
126
126
|
export function calculateDecisionRoot(state: BeaconStateAllForks, epoch: Epoch): RootHex {
|
|
127
|
-
const pivotSlot = computeStartSlotAtEpoch(epoch - 1) - 1;
|
|
127
|
+
const pivotSlot = Math.max(GENESIS_SLOT, computeStartSlotAtEpoch(epoch - 1) - 1);
|
|
128
128
|
return toRootHex(getBlockRootAtSlot(state, pivotSlot));
|
|
129
129
|
}
|
|
130
130
|
|
package/src/util/shuffling.ts
CHANGED
|
@@ -21,8 +21,8 @@ import {EpochShuffling} from "./epochShuffling.js";
|
|
|
21
21
|
* Computed for the requested epoch, not `state.epoch`, so it is correct when `state` is one
|
|
22
22
|
* epoch off the requested epoch (e.g. serving next-epoch duties from the current state).
|
|
23
23
|
*
|
|
24
|
-
* Returns `null` when the
|
|
25
|
-
*
|
|
24
|
+
* Returns `null` when the decision block is not in the state's past (the genesis block decides
|
|
25
|
+
* its own shuffling, or it has not been produced yet); caller supplies the fallback.
|
|
26
26
|
*/
|
|
27
27
|
export function proposerShufflingDecisionRoot(
|
|
28
28
|
fork: ForkName,
|
|
@@ -30,7 +30,8 @@ export function proposerShufflingDecisionRoot(
|
|
|
30
30
|
proposalEpoch: Epoch
|
|
31
31
|
): Root | null {
|
|
32
32
|
const decisionSlot = proposerShufflingDecisionSlot(fork, proposalEpoch);
|
|
33
|
-
|
|
33
|
+
// Return null when the decision block is not in the state's past or the getBlockRootAtSlot() api will throw
|
|
34
|
+
if (decisionSlot >= state.slot) {
|
|
34
35
|
return null;
|
|
35
36
|
}
|
|
36
37
|
return state.getBlockRootAtSlot(decisionSlot);
|