mirror of
https://github.com/ethereum/consensus-specs.git
synced 2026-02-02 05:05:00 -05:00
Merge pull request #1920 from terencechain/patch-104
Fix usages of shard in `process_crosslink_for_shard`
This commit is contained in:
@@ -876,6 +876,7 @@ def process_crosslink_for_shard(state: BeaconState,
|
||||
on_time_attestation_slot = compute_previous_slot(state.slot)
|
||||
committee = get_beacon_committee(state, on_time_attestation_slot, committee_index)
|
||||
online_indices = get_online_validator_indices(state)
|
||||
shard = compute_shard_from_committee_index(state, committee_index, on_time_attestation_slot)
|
||||
|
||||
# Loop over all shard transition roots
|
||||
shard_transition_roots = set([a.data.shard_transition_root for a in attestations])
|
||||
@@ -901,7 +902,7 @@ def process_crosslink_for_shard(state: BeaconState,
|
||||
assert shard_transition_root == hash_tree_root(shard_transition)
|
||||
|
||||
# Apply transition
|
||||
apply_shard_transition(state, attestation.data.shard, shard_transition)
|
||||
apply_shard_transition(state, shard, shard_transition)
|
||||
# Apply proposer reward and cost
|
||||
beacon_proposer_index = get_beacon_proposer_index(state)
|
||||
estimated_attester_reward = sum([get_base_reward(state, attester) for attester in transition_participants])
|
||||
@@ -909,11 +910,11 @@ def process_crosslink_for_shard(state: BeaconState,
|
||||
increase_balance(state, beacon_proposer_index, proposer_reward)
|
||||
states_slots_lengths = zip(
|
||||
shard_transition.shard_states,
|
||||
get_offset_slots(state, attestation.data.shard),
|
||||
get_offset_slots(state, shard),
|
||||
shard_transition.shard_block_lengths
|
||||
)
|
||||
for shard_state, slot, length in states_slots_lengths:
|
||||
proposer_index = get_shard_proposer_index(state, slot, attestation.data.shard)
|
||||
proposer_index = get_shard_proposer_index(state, slot, shard)
|
||||
decrease_balance(state, proposer_index, shard_state.gasprice * length)
|
||||
|
||||
# Return winning transition root
|
||||
|
||||
Reference in New Issue
Block a user