Small fixes for the genesis state

This commit is contained in:
Michael Sproul
2026-02-25 10:15:31 +11:00
parent 863d05f16e
commit 5f3faced1a
2 changed files with 6 additions and 3 deletions

View File

@@ -665,8 +665,11 @@ impl HierarchyModuli {
payload_status: StatePayloadStatus,
) -> Result<StorageStrategy, Error> {
// Store all Full states by replaying from their respective Pending state at the same slot.
// Make an exception for the genesis state, which "counts as" Full by virtue of having 0x0
// in both `latest_block_hash` and `latest_execution_payload_bid.block_hash`.
if let StatePayloadStatus::Full = payload_status
&& slot >= start_slot
&& slot != 0
{
return Ok(StorageStrategy::ReplayFrom(slot));
}

View File

@@ -4199,11 +4199,11 @@ impl HotStateSummary {
OptionalDiffBaseState::Snapshot(0)
};
let previous_state_root = if state.slot() == 0
&& let StatePayloadStatus::Pending = payload_status
{
let previous_state_root = if state.slot() == 0 {
// Set to 0x0 for genesis state to prevent any sort of circular reference.
Hash256::zero()
} else if let StatePayloadStatus::Full = payload_status {
get_state_root(state.slot())?
} else {
get_state_root(state.slot().safe_sub(1_u64)?)?
};