Created
January 11, 2021 08:11
-
-
Save alonmuroch/e22e0f67a3230cb983e0718f5c99b1a7 to your computer and use it in GitHub Desktop.
get_attestation_deltas
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def get_attestation_deltas(state: BeaconState) -> Tuple[Sequence[Gwei], Sequence[Gwei]]: | |
""" | |
Return attestation reward/penalty deltas for each validator. | |
""" | |
source_rewards, source_penalties = get_source_deltas(state) | |
target_rewards, target_penalties = get_target_deltas(state) | |
head_rewards, head_penalties = get_head_deltas(state) | |
inclusion_delay_rewards, _ = get_inclusion_delay_deltas(state) | |
_, inactivity_penalties = get_inactivity_penalty_deltas(state) | |
rewards = [ | |
source_rewards[i] + target_rewards[i] + head_rewards[i] + inclusion_delay_rewards[i] | |
for i in range(len(state.validators)) | |
] | |
penalties = [ | |
source_penalties[i] + target_penalties[i] + head_penalties[i] + inactivity_penalties[i] | |
for i in range(len(state.validators)) | |
] | |
return rewards, penalties |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment