mirror of
https://github.com/status-im/eth2.0-specs.git
synced 2025-01-20 15:38:55 +00:00
Rename get_ancestor_at_epoch_boundary to get_checkpoint_block
This commit is contained in:
parent
fdf2dc7f10
commit
334114d9d3
@ -170,7 +170,7 @@ def on_block(store: Store, signed_block: SignedBeaconBlock) -> None:
|
||||
finalized_slot = compute_start_slot_at_epoch(store.finalized_checkpoint.epoch)
|
||||
assert block.slot > finalized_slot
|
||||
# Check block is a descendant of the finalized block at the checkpoint finalized slot
|
||||
assert store.finalized_checkpoint.root == get_ancestor_at_epoch_boundary(
|
||||
assert store.finalized_checkpoint.root == get_checkpoint_block(
|
||||
store,
|
||||
block.parent_root,
|
||||
store.finalized_checkpoint.epoch,
|
||||
|
@ -82,7 +82,7 @@ def on_block(store: Store, signed_block: SignedBeaconBlock) -> None:
|
||||
finalized_slot = compute_start_slot_at_epoch(store.finalized_checkpoint.epoch)
|
||||
assert block.slot > finalized_slot
|
||||
# Check block is a descendant of the finalized block at the checkpoint finalized slot
|
||||
assert store.finalized_checkpoint.root == get_ancestor_at_epoch_boundary(
|
||||
assert store.finalized_checkpoint.root == get_checkpoint_block(
|
||||
store,
|
||||
block.parent_root,
|
||||
store.finalized_checkpoint.epoch,
|
||||
|
@ -18,7 +18,7 @@
|
||||
- [`get_current_slot`](#get_current_slot)
|
||||
- [`compute_slots_since_epoch_start`](#compute_slots_since_epoch_start)
|
||||
- [`get_ancestor`](#get_ancestor)
|
||||
- [`get_ancestor_at_epoch_boundary`](#get_ancestor_at_epoch_boundary)
|
||||
- [`get_checkpoint_block`](#get_checkpoint_block)
|
||||
- [`get_weight`](#get_weight)
|
||||
- [`get_voting_source`](#get_voting_source)
|
||||
- [`filter_block_tree`](#filter_block_tree)
|
||||
@ -193,10 +193,10 @@ def get_ancestor(store: Store, root: Root, slot: Slot) -> Root:
|
||||
return root
|
||||
```
|
||||
|
||||
#### `get_ancestor_at_epoch_boundary`
|
||||
#### `get_checkpoint_block`
|
||||
|
||||
```python
|
||||
def get_ancestor_at_epoch_boundary(store: Store, root: Root, epoch: Epoch) -> Root:
|
||||
def get_checkpoint_block(store: Store, root: Root, epoch: Epoch) -> Root:
|
||||
"""
|
||||
Compute the epoch boundary block for epoch ``epoch`` in the chain of block ``root``
|
||||
"""
|
||||
@ -292,7 +292,7 @@ def filter_block_tree(store: Store, block_root: Root, blocks: Dict[Root, BeaconB
|
||||
|
||||
correct_finalized = (
|
||||
store.finalized_checkpoint.epoch == GENESIS_EPOCH
|
||||
or store.finalized_checkpoint.root == get_ancestor_at_epoch_boundary(
|
||||
or store.finalized_checkpoint.root == get_checkpoint_block(
|
||||
store,
|
||||
block_root,
|
||||
store.finalized_checkpoint.epoch,
|
||||
@ -457,7 +457,7 @@ def validate_on_attestation(store: Store, attestation: Attestation, is_from_bloc
|
||||
assert store.blocks[attestation.data.beacon_block_root].slot <= attestation.data.slot
|
||||
|
||||
# LMD vote must be consistent with FFG vote target
|
||||
assert target.root == get_ancestor_at_epoch_boundary(store, attestation.data.beacon_block_root, target.epoch)
|
||||
assert target.root == get_checkpoint_block(store, attestation.data.beacon_block_root, target.epoch)
|
||||
|
||||
# Attestations can only affect the fork choice of subsequent slots.
|
||||
# Delay consideration in the fork choice until their slot is in the past.
|
||||
@ -520,7 +520,7 @@ def on_block(store: Store, signed_block: SignedBeaconBlock) -> None:
|
||||
finalized_slot = compute_start_slot_at_epoch(store.finalized_checkpoint.epoch)
|
||||
assert block.slot > finalized_slot
|
||||
# Check block is a descendant of the finalized block at the checkpoint finalized slot
|
||||
assert store.finalized_checkpoint.root == get_ancestor_at_epoch_boundary(
|
||||
assert store.finalized_checkpoint.root == get_checkpoint_block(
|
||||
store,
|
||||
block.parent_root,
|
||||
store.finalized_checkpoint.epoch,
|
||||
|
@ -317,7 +317,7 @@ The following validations MUST pass before forwarding the `signed_beacon_block`
|
||||
- _[REJECT]_ The block's parent (defined by `block.parent_root`) passes validation.
|
||||
- _[REJECT]_ The block is from a higher slot than its parent.
|
||||
- _[REJECT]_ The current `finalized_checkpoint` is an ancestor of `block` -- i.e.
|
||||
`get_ancestor_at_epoch_boundary(store, block.parent_root, store.finalized_checkpoint.epoch)
|
||||
`get_checkpoint_block(store, block.parent_root, store.finalized_checkpoint.epoch)
|
||||
== store.finalized_checkpoint.root`
|
||||
- _[REJECT]_ The block is proposed by the expected `proposer_index` for the block's slot
|
||||
in the context of the current shuffling (defined by `parent_root`/`slot`).
|
||||
@ -356,7 +356,7 @@ The following validations MUST pass before forwarding the `signed_aggregate_and_
|
||||
(a client MAY queue aggregates for processing once block is retrieved).
|
||||
- _[REJECT]_ The block being voted for (`aggregate.data.beacon_block_root`) passes validation.
|
||||
- _[IGNORE]_ The current `finalized_checkpoint` is an ancestor of the `block` defined by `aggregate.data.beacon_block_root` -- i.e.
|
||||
`get_ancestor_at_epoch_boundary(store, aggregate.data.beacon_block_root, finalized_checkpoint.epoch)
|
||||
`get_checkpoint_block(store, aggregate.data.beacon_block_root, finalized_checkpoint.epoch)
|
||||
== store.finalized_checkpoint.root`
|
||||
|
||||
|
||||
@ -425,9 +425,9 @@ The following validations MUST pass before forwarding the `attestation` on the s
|
||||
(a client MAY queue attestations for processing once block is retrieved).
|
||||
- _[REJECT]_ The block being voted for (`attestation.data.beacon_block_root`) passes validation.
|
||||
- _[REJECT]_ The attestation's target block is an ancestor of the block named in the LMD vote -- i.e.
|
||||
`get_ancestor_at_epoch_boundary(store, attestation.data.beacon_block_root, attestation.data.target.epoch) == attestation.data.target.root`
|
||||
`get_checkpoint_block(store, attestation.data.beacon_block_root, attestation.data.target.epoch) == attestation.data.target.root`
|
||||
- _[IGNORE]_ The current `finalized_checkpoint` is an ancestor of the `block` defined by `attestation.data.beacon_block_root` -- i.e.
|
||||
`get_ancestor_at_epoch_boundary(store, attestation.data.beacon_block_root, store.finalized_checkpoint.epoch)
|
||||
`get_checkpoint_block(store, attestation.data.beacon_block_root, store.finalized_checkpoint.epoch)
|
||||
== store.finalized_checkpoint.root`
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user