Skip to content
This repository has been archived by the owner on Jul 1, 2021. It is now read-only.

Add process_slashings #362

Merged
merged 2 commits into from
Mar 7, 2019
Merged

Add process_slashings #362

merged 2 commits into from
Mar 7, 2019

Conversation

hwwhww
Copy link
Contributor

@hwwhww hwwhww commented Mar 4, 2019

What was wrong?

Fix #322

How was it fixed?

Implement as the spec.

Cute Animal Picture

puma-4029263_640

@hwwhww hwwhww requested a review from NIC619 March 4, 2019 10:53
@hwwhww hwwhww added the eth2.0 label Mar 4, 2019
Copy link
Contributor

@NIC619 NIC619 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work!

)
validator_index = 0
total_penalties = 10 ** 9 # 1 ETH
penalty = penalty = _compute_individual_penalty(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
penalty = penalty = _compute_individual_penalty(
penalty = _compute_individual_penalty(

slot=get_epoch_start_slot(current_epoch, slots_per_epoch),
)
validator_index = 0
total_penalties = 10 ** 9 # 1 ETH
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Redefined total_penalties

)
state = state.update_validator_balance(
validator_index=validator_index,
balance=state.validator_balances[validator_index] - penalty,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we prevent balance underflow here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, logically, they would be ejected before it's under the risk of underflow.
Raise a question in the spec repo: ethereum/consensus-specs#727

)
state = state.update_validator_registry(validator_index, validator)

slashing_validator_index = 0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

slashing_validator_index seems to be a duplicate of validator_index

@hwwhww hwwhww force-pushed the process_slashings branch from 3643146 to ae3f54a Compare March 7, 2019 05:03
@hwwhww hwwhww merged commit 2e239ef into ethereum:master Mar 7, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement beacon chain state transition process_slashings
2 participants