Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove redundant copy() #3877

Merged
merged 1 commit into from
Aug 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions specs/capella/fork-choice.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,6 @@ def on_block(store: Store, signed_block: SignedBeaconBlock) -> None:
block = signed_block.message
# Parent block must be known
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.
assert get_current_slot(store) >= block.slot

Expand All @@ -92,7 +90,8 @@ def on_block(store: Store, signed_block: SignedBeaconBlock) -> None:
assert store.finalized_checkpoint.root == finalized_checkpoint_block

# 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)
state_transition(state, signed_block, True)

Expand Down
5 changes: 2 additions & 3 deletions specs/deneb/fork-choice.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,6 @@ def on_block(store: Store, signed_block: SignedBeaconBlock) -> None:
block = signed_block.message
# Parent block must be known
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.
assert get_current_slot(store) >= block.slot

Expand All @@ -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)

# 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)
state_transition(state, signed_block, True)

Expand Down