A few fixes

This commit is contained in:
vbuterin 2019-07-31 21:26:47 -04:00 committed by GitHub
parent e08c365e2f
commit b57aed2380
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 4 deletions

View File

@ -199,7 +199,7 @@ def compute_epoch_of_shard_slot(slot: ShardSlot) -> Epoch:
### `get_shard_period_start_epoch` ### `get_shard_period_start_epoch`
```python ```python
def get_shard_period_start_epoch(epoch: Epoch, lookback: uint64=0) -> Epoch: def get_shard_period_start_epoch(epoch: Epoch, lookback: int=0) -> Epoch:
return Epoch(epoch - (epoch % EPOCHS_PER_SHARD_PERIOD) - lookback * EPOCHS_PER_SHARD_PERIOD) return Epoch(epoch - (epoch % EPOCHS_PER_SHARD_PERIOD) - lookback * EPOCHS_PER_SHARD_PERIOD)
``` ```
@ -337,12 +337,12 @@ def compute_crosslink_data_root(blocks: Sequence[ShardBlock]) -> Hash:
def get_default_shard_state(beacon_state: BeaconState, shard: Shard) -> ShardState: def get_default_shard_state(beacon_state: BeaconState, shard: Shard) -> ShardState:
earlier_committee = get_period_committee( earlier_committee = get_period_committee(
beacon_state, beacon_state,
Epoch(PHASE_1_FORK_SLOT - SHARD_SLOTS_PER_BEACON_SLOT * SLOTS_PER_EPOCH * EPOCHS_PER_SHARD_PERIOD * 2), PHASE_1_FORK_EPOCH - EPOCHS_PER_SHARD_PERIOD * 2,
shard, shard,
) )
later_committee = get_period_committee( later_committee = get_period_committee(
beacon_state, beacon_state,
Epoch(PHASE_1_FORK_SLOT - SHARD_SLOTS_PER_BEACON_SLOT * SLOTS_PER_EPOCH * EPOCHS_PER_SHARD_PERIOD), PHASE_1_FORK_EPOCH - EPOCHS_PER_SHARD_PERIOD * 2,
shard, shard,
) )
return ShardState( return ShardState(
@ -519,7 +519,7 @@ def shard_block_transition(state: ShardState, beacon_state: BeaconState, block:
slot=block.core.slot, slot=block.core.slot,
beacon_chain_root=block.core.beacon_chain_root, beacon_chain_root=block.core.beacon_chain_root,
parent_root=block.core.parent_root, parent_root=block.core.parent_root,
data_root=block.core.data_root, data_root=hash_tree_root(block.core.data),
state_root=Hash(), state_root=Hash(),
total_bytes=block.core.total_bytes, total_bytes=block.core.total_bytes,
attester_bitfield=block.core.attester_bitfield, attester_bitfield=block.core.attester_bitfield,