beacon-chain-java icon indicating copy to clipboard operation
beacon-chain-java copied to clipboard

Clarify calculation of epoch_boundary_block_root

Open ericsson49 opened this issue 6 years ago • 0 comments

There seems to be an edge case in https://github.com/ethereum/eth2.0-specs/blob/dev/specs/validator/0_beacon-chain-validator.md, regarding calculation of epoch_boundary_block_root.

The spec says:

'epoch_boundary_block_root' is the root of block at the most recent epoch boundary

And later proposes how to look up for it:

Let start_slot = compute_start_slot_of_epoch(get_current_epoch(head_state)). Let epoch_boundary_block_root = signing_root(head_block) if start_slot == head_state.slot else get_block_root(state, start_slot)

Obviously, if the head_state.slot is the start of an epoch, then there is no appropriate block_root in the state. If the head_block.slot == head_state.slot, then everything is fine.

But what if the head_block is stale? If it's younger than the previous epoch, then it seems reasonable too. But what if it's older then the previous epoch? Then get_block_root(state, compute_start_slot_of_epoch(get_previous_epoch(head_state))) looks like a better match to "the root of block at the most recent epoch boundary". Actually, it's also not quite clear whether it's a possible situation. E.g. LMD GHOST rule may rule it out.

ericsson49 avatar Sep 12 '19 16:09 ericsson49