The Honest Validator spec here states that
Set
attestation_data.epoch_boundary_root = hash_tree_root(epoch_boundary)whereepoch_boundaryis the block at the most recent epoch boundary in the chain defined by head -- i.e. theBeaconBlockwhereblock.slot == get_epoch_start_slot(head.slot).Note: This can be looked up in the state using
get_block_root(state, get_epoch_start_slot(head.slot)).
I.e. according to the statement if an attester creates the attestation for the beacon block which slot is the first in an epoch, then the epoch_boundary_root should be the root of the atteted beacon block itself.
But:
get_block_root(state, get_epoch_start_slot(head.slot)) will fail due to assertion assert slot < state.slotepoch_boundary_root as an ancestor of the beacon block in attestation, thus it shouldn't be the root of the block itself AttestationData
.....
# Hash of root of the ancestor at the epoch boundary
'epoch_boundary_root': 'bytes32',
Can confirm this issue, I encountered it when mocking attestations.
Hey @Nashatyrev, I noticed that you’re not referencing the latest dev branch spec so I interpret the issue again. 🙂
AttestationData.epoch_boundary_rootRoot of the ancestor at the epoch boundaryV-guide (https://github.com/ethereum/eth2.0-specs/blob/f0b562054fa526322956500f3a6e19ed9007ce5d/specs/validator/0_beacon-chain-validator.md#epoch-boundary-root):
##### Epoch boundary root
Set `attestation_data.epoch_boundary_root = hash_tree_root(epoch_boundary)` where `epoch_boundary` is the block at the most recent epoch boundary in the chain defined by `head` -- i.e. the `BeaconBlock` where `block.slot == get_epoch_start_slot(slot_to_epoch(head.slot))`.
/_Note:_/ This can be looked up in the state using `get_block_root(state, get_epoch_start_slot(slot_to_epoch(head.slot)))`.
It seems when slot=64, the epoch_boundary_root would be 64, which is somehow not accurate to “Root of the ancestor at the epoch boundary”. /cc @vbuterin Am I correct that after we change the epoch boundary, it is different from the mini-spec now and it’s more like an epoch_start_root field?
get_block_root(state, slot) slot validationIt fails since both state.slot and the given slot are 64.
Fix the note by:
epoch_start_slot = get_epoch_start_slot(slot_to_epoch(head.slot))epoch_boundary_root to hash_tree_root(head) if epoch_start_slot == head.slot else get_block_root(state, epoch_start_slot)/cc @djrtwo
It seems that the spec semantically uses "ancestor" of a block to mean any block in the chain defined by the block at or before the block. See get_ancestor in the fork choice -- this function treats the meaning of "ancestor" in this way.
Unfortunately, the calling get_block_root from the state only allows access to blocks previous to the head. This _might_ change if we figure out and merge #649, but until then @hwwhww's fix looks correct, and I'll get it in the doc today.
handled in #671
Most helpful comment
It seems that the spec semantically uses "ancestor" of a
blockto mean any block in the chain defined by theblockat or before theblock. Seeget_ancestorin the fork choice -- this function treats the meaning of "ancestor" in this way.Unfortunately, the calling
get_block_rootfrom the state only allows access to blocks previous to the head. This _might_ change if we figure out and merge #649, but until then @hwwhww's fix looks correct, and I'll get it in the doc today.