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

Add shard field to ShardBlock #1853

Merged
merged 1 commit into from
May 28, 2020
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: 4 additions & 1 deletion specs/phase1/beacon-chain.md
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,7 @@ class ShardBlock(Container):
shard_parent_root: Root
beacon_parent_root: Root
slot: Slot
shard: Shard
proposer_index: ValidatorIndex
body: ByteList[MAX_SHARD_BLOCK_SIZE]
```
Expand All @@ -321,6 +322,7 @@ class ShardBlockHeader(Container):
shard_parent_root: Root
beacon_parent_root: Root
slot: Slot
shard: Shard
proposer_index: ValidatorIndex
body_root: Root
```
Expand Down Expand Up @@ -781,8 +783,9 @@ def apply_shard_transition(state: BeaconState, shard: Shard, transition: ShardTr
header = ShardBlockHeader(
shard_parent_root=shard_parent_root,
beacon_parent_root=get_block_root_at_slot(state, offset_slots[i]),
proposer_index=proposal_index,
slot=offset_slots[i],
shard=shard,
proposer_index=proposal_index,
body_root=transition.shard_data_roots[i]
)
shard_parent_root = hash_tree_root(header)
Expand Down
1 change: 1 addition & 0 deletions specs/phase1/shard-transition.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ def verify_shard_block_message(beacon_state: BeaconState,
shard: Shard) -> bool:
assert block.shard_parent_root == shard_state.latest_block_root
assert block.slot == slot
assert block.shard == shard
assert block.proposer_index == get_shard_proposer_index(beacon_state, slot, shard)
assert 0 < len(block.body) <= MAX_SHARD_BLOCK_SIZE
return True
Expand Down
1 change: 1 addition & 0 deletions tests/core/pyspec/eth2spec/test/helpers/shard_block.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ def build_shard_block(spec,
shard_parent_root=shard_state.latest_block_root,
beacon_parent_root=beacon_parent_root,
slot=slot,
shard=shard,
proposer_index=proposer_index,
body=body,
)
Expand Down