mirror of
https://github.com/status-im/eth2.0-specs.git
synced 2025-03-01 18:50:35 +00:00
commit
d8cbca76b2
@ -75,8 +75,6 @@ def on_block(store: Store, signed_block: SignedBeaconBlock) -> None:
|
|||||||
block = signed_block.message
|
block = signed_block.message
|
||||||
# Parent block must be known
|
# Parent block must be known
|
||||||
assert block.parent_root in store.block_states
|
assert block.parent_root in store.block_states
|
||||||
# Make a copy of the state to avoid mutability issues
|
|
||||||
pre_state = copy(store.block_states[block.parent_root])
|
|
||||||
# Blocks cannot be in the future. If they are, their consideration must be delayed until they are in the past.
|
# Blocks cannot be in the future. If they are, their consideration must be delayed until they are in the past.
|
||||||
assert get_current_slot(store) >= block.slot
|
assert get_current_slot(store) >= block.slot
|
||||||
|
|
||||||
@ -92,7 +90,8 @@ def on_block(store: Store, signed_block: SignedBeaconBlock) -> None:
|
|||||||
assert store.finalized_checkpoint.root == finalized_checkpoint_block
|
assert store.finalized_checkpoint.root == finalized_checkpoint_block
|
||||||
|
|
||||||
# Check the block is valid and compute the post-state
|
# Check the block is valid and compute the post-state
|
||||||
state = pre_state.copy()
|
# Make a copy of the state to avoid mutability issues
|
||||||
|
state = copy(store.block_states[block.parent_root])
|
||||||
block_root = hash_tree_root(block)
|
block_root = hash_tree_root(block)
|
||||||
state_transition(state, signed_block, True)
|
state_transition(state, signed_block, True)
|
||||||
|
|
||||||
|
@ -74,8 +74,6 @@ def on_block(store: Store, signed_block: SignedBeaconBlock) -> None:
|
|||||||
block = signed_block.message
|
block = signed_block.message
|
||||||
# Parent block must be known
|
# Parent block must be known
|
||||||
assert block.parent_root in store.block_states
|
assert block.parent_root in store.block_states
|
||||||
# Make a copy of the state to avoid mutability issues
|
|
||||||
pre_state = copy(store.block_states[block.parent_root])
|
|
||||||
# Blocks cannot be in the future. If they are, their consideration must be delayed until they are in the past.
|
# Blocks cannot be in the future. If they are, their consideration must be delayed until they are in the past.
|
||||||
assert get_current_slot(store) >= block.slot
|
assert get_current_slot(store) >= block.slot
|
||||||
|
|
||||||
@ -98,7 +96,8 @@ def on_block(store: Store, signed_block: SignedBeaconBlock) -> None:
|
|||||||
assert is_data_available(hash_tree_root(block), block.body.blob_kzg_commitments)
|
assert is_data_available(hash_tree_root(block), block.body.blob_kzg_commitments)
|
||||||
|
|
||||||
# Check the block is valid and compute the post-state
|
# Check the block is valid and compute the post-state
|
||||||
state = pre_state.copy()
|
# Make a copy of the state to avoid mutability issues
|
||||||
|
state = copy(store.block_states[block.parent_root])
|
||||||
block_root = hash_tree_root(block)
|
block_root = hash_tree_root(block)
|
||||||
state_transition(state, signed_block, True)
|
state_transition(state, signed_block, True)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user