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

Implement process_attester_slashings #299

Merged
merged 6 commits into from
Feb 28, 2019

Conversation

hwwhww
Copy link
Contributor

@hwwhww hwwhww commented Feb 20, 2019

What was wrong?

How was it fixed?

  1. Implement process_attester_slashings

  2. Implement validate_attester_slashing for validating each AttesterSlashing

  3. Add validate_attester_slashing tests in tests/eth2/beacon/state_machines/forks/test_serenity_block_attester_slashing_validation.py

  4. Address verify_slashable_attestation with custody bits all 0 OR all 1 consensus-specs#651

TODO:

  • Add test for process_attester_slashing

Cute Animal Picture

nature-animal-wildlife-wild-zoo-fur-red-brown-mammal-fauna-kangaroo-close-up-australia-furry-vertebrate-marsupial-outback-macropodidae-macropus-macropod-horse-like-mammal-587557

Copy link
Contributor

@djrtwo djrtwo left a comment

Choose a reason for hiding this comment

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

Haven't done a deep review, but the general spec portion looks good other than the bug noted below

attester_slashing.slashable_attestation_2.validator_indices and
state.validator_registry[index].slashed_epoch > current_epoch
)
)
Copy link
Contributor

Choose a reason for hiding this comment

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

Need to validate that len(slashable_indices) > 0 here.
"Verify that len(slashable_indices) >= 1" in the spec

assert (
new_state.validator_balances[attester_index] < state.validator_balances[attester_index]
)
# else:
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 fill some failure cases in before merge?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh thanks! That was some leftover. Added a light test!

Copy link
Member

@ralexstokes ralexstokes left a comment

Choose a reason for hiding this comment

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

overall looks great -- had a few comments/questions and i think there is a typo that should be fixed (see comment about double assignment)

i wouldn't hate having more tests a la danny's comment but would lean towards being light on tests as we move to implement the full state transition as quickly as possible :)

batched_block_roots=updated_batched_block_roots,
)
return state
return process_slot_transition(state, self.config, previous_block_root)
Copy link
Member

Choose a reason for hiding this comment

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

👍 i like the symmetry here to move this logic to its own file (and match the structure of the operation processing)

(and also in general prefer many small files over few big files :D)

eth2/beacon/tools/builder/validator.py Show resolved Hide resolved
@ralexstokes ralexstokes requested review from djrtwo and ralexstokes and removed request for ralexstokes and djrtwo February 26, 2019 02:51
@ralexstokes ralexstokes mentioned this pull request Feb 27, 2019
1. Add test of `is_surround_vote` case
2. Enable `process_attester_slashings`
1. Add test for `process_attester_slashings`
2. Fix the missing `validate_slashable_indices` (thanks to djrtwo)
3. Fix `create_mock_slashable_attestation` - should have used the same
attester to mock slashable_attestation
@hwwhww hwwhww merged commit decba6e into ethereum:master Feb 28, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants