Per #1704 discussion, remove `on_time_slot`: the given `beacon_state`
should be transitioned.
This commit is contained in:
parent
2afa315cb3
commit
a71c0a5ccc
|
@ -280,8 +280,8 @@ Suppose you are a committee member on shard `shard` at slot `current_slot` and y
|
|||
```python
|
||||
def get_shard_transition(beacon_state: BeaconState,
|
||||
shard: Shard,
|
||||
shard_blocks: Sequence[SignedShardBlock],
|
||||
on_time_slot: Slot) -> ShardTransition:
|
||||
shard_blocks: Sequence[SignedShardBlock]) -> ShardTransition:
|
||||
on_time_slot = Slot(beacon_state.slot + 1)
|
||||
offset_slots = compute_offset_slots(get_latest_slot_for_shard(beacon_state, shard), on_time_slot)
|
||||
proposals, shard_states, shard_data_roots = get_shard_state_transition_result(
|
||||
beacon_state, shard, shard_blocks, on_time_slot
|
||||
|
|
|
@ -85,7 +85,7 @@ def build_attestation_data(spec, state, slot, index, shard_transition=None, on_t
|
|||
# No shard transition -> no shard block
|
||||
shard = spec.get_shard(state, spec.Attestation(data=attestation_data))
|
||||
if on_time:
|
||||
shard_transition = spec.get_shard_transition(state, shard, shard_blocks=[], on_time_slot=slot + 1)
|
||||
shard_transition = spec.get_shard_transition(state, shard, shard_blocks=[])
|
||||
lastest_shard_data_root_index = len(shard_transition.shard_data_roots) - 1
|
||||
attestation_data.shard_head_root = shard_transition.shard_data_roots[lastest_shard_data_root_index]
|
||||
attestation_data.shard_transition_root = shard_transition.hash_tree_root()
|
||||
|
@ -318,9 +318,7 @@ def next_epoch_with_attestations(spec,
|
|||
for index in range(committees_per_slot):
|
||||
if spec.fork == PHASE1:
|
||||
shard = spec.compute_shard_from_committee_index(post_state, index, slot_to_attest)
|
||||
shard_transition = get_shard_transition_of_committee(
|
||||
spec, post_state, index, slot=slot_to_attest
|
||||
)
|
||||
shard_transition = get_shard_transition_of_committee(spec, post_state, index)
|
||||
block.body.shard_transitions[shard] = shard_transition
|
||||
else:
|
||||
shard_transition = None
|
||||
|
|
|
@ -61,7 +61,7 @@ def build_shard_transitions_till_slot(spec, parent_beacon_state, shard_blocks):
|
|||
on_time_slot,
|
||||
)
|
||||
len_offset_slots = len(offset_slots)
|
||||
shard_transition = spec.get_shard_transition(parent_beacon_state, shard, blocks, on_time_slot)
|
||||
shard_transition = spec.get_shard_transition(parent_beacon_state, shard, blocks)
|
||||
|
||||
if len(blocks) > 0:
|
||||
shard_block_root = blocks[-1].message.hash_tree_root()
|
||||
|
|
|
@ -28,13 +28,10 @@ def run_shard_transitions_processing(spec, state, shard_transitions, attestation
|
|||
yield 'post', state
|
||||
|
||||
|
||||
def get_shard_transition_of_committee(spec, state, committee_index, slot=None, shard_blocks=None):
|
||||
def get_shard_transition_of_committee(spec, state, committee_index, shard_blocks=None):
|
||||
if shard_blocks is None:
|
||||
shard_blocks = []
|
||||
|
||||
if slot is None:
|
||||
slot = state.slot
|
||||
|
||||
shard = spec.compute_shard_from_committee_index(state, committee_index, state.slot)
|
||||
shard_transition = spec.get_shard_transition(state, shard, shard_blocks=shard_blocks, on_time_slot=slot + 1)
|
||||
shard_transition = spec.get_shard_transition(state, shard, shard_blocks=shard_blocks)
|
||||
return shard_transition
|
||||
|
|
Loading…
Reference in New Issue