@lodestar/state-transition 1.44.0-dev.edb7c53fbc → 1.44.0-dev.f328dc3369
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/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/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/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/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);
|
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);
|