-
-
Notifications
You must be signed in to change notification settings - Fork 290
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Fix multiple issues for SyncCommittee integration * Add upgradeState for altair * Simplify handling SyncDutyAndProof for multiple subnets * Multiplex BeaconBlock types everywhere * Multiplex BeaconState types everywhere but the stfn * Update multifork state transition * Run Altair from epoch 0 * Fix signature verification for altair blocks * Fix getCurrentAndNextFork * Fix altair genesis * Fix getGenesis API * Fix genesis applyDeposits * Use subnet service start/stop * Fix lodestar unit tests * Fix e2e + spec tests * Fix lint * Add sim tests with ALTAIR_FORK_EPOCH=1 * Fix validator unit tests * Impl translate_participation when upgrading beacon state from phase0 to altair * Fix upgradeState Co-authored-by: dapplion <35266934+dapplion@users.noreply.github.com> Co-authored-by: Cayman <caymannava@gmail.com>
- Loading branch information
1 parent
1229e29
commit 7b70ab6
Showing
82 changed files
with
586 additions
and
486 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
packages/beacon-state-transition/src/allForks/slot/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import {allForks} from "@chainsafe/lodestar-types"; | ||
import {CachedBeaconState} from "../util"; | ||
import {ZERO_HASH} from "../../constants"; | ||
|
||
/** | ||
* Dial state to next slot. Common for all forks | ||
*/ | ||
export function processSlot(state: CachedBeaconState<allForks.BeaconState>): void { | ||
const {config} = state; | ||
const types = config.getTypes(state.slot); | ||
|
||
// Cache state root | ||
const previousStateRoot = types.BeaconState.hashTreeRoot(state); | ||
state.stateRoots[state.slot % config.params.SLOTS_PER_HISTORICAL_ROOT] = previousStateRoot; | ||
|
||
// Cache latest block header state root | ||
if (types.Root.equals(state.latestBlockHeader.stateRoot, ZERO_HASH)) { | ||
state.latestBlockHeader.stateRoot = previousStateRoot; | ||
} | ||
|
||
// Cache block root | ||
const previousBlockRoot = types.BeaconBlockHeader.hashTreeRoot(state.latestBlockHeader); | ||
state.blockRoots[state.slot % config.params.SLOTS_PER_HISTORICAL_ROOT] = previousBlockRoot; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.