Skip to content

Commit

Permalink
ensure only forward progress with eth1data voting
Browse files Browse the repository at this point in the history
  • Loading branch information
djrtwo committed May 20, 2020
1 parent aa63526 commit c4d8593
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions specs/phase0/validator.md
Original file line number Diff line number Diff line change
Expand Up @@ -289,8 +289,14 @@ def is_candidate_block(block: Eth1Block, period_start: uint64) -> bool:
def get_eth1_vote(state: BeaconState, eth1_chain: Sequence[Eth1Block]) -> Eth1Data:
period_start = voting_period_start_time(state)
# `eth1_chain` abstractly represents all blocks in the eth1 chain sorted by ascending block height
votes_to_consider = [get_eth1_data(block) for block in eth1_chain if
is_candidate_block(block, period_start)]
votes_to_consider = [
get_eth1_data(block) for block in eth1_chain
if (
is_candidate_block(block, period_start)
# Ensure only forward progress
and get_eth1_data(block).deposit_count > state.eth1data.deposit_count
)
]

# Valid votes already cast during this period
valid_votes = [vote for vote in state.eth1_data_votes if vote in votes_to_consider]
Expand Down

0 comments on commit c4d8593

Please sign in to comment.