Skip to content

Implement Slashing Protection#588

Closed
pscott wants to merge 268 commits intosigp:masterfrom
pscott:254_slashing_protection
Closed

Implement Slashing Protection#588
pscott wants to merge 268 commits intosigp:masterfrom
pscott:254_slashing_protection

Conversation

@pscott
Copy link
Copy Markdown
Contributor

@pscott pscott commented Oct 31, 2019

Issue Addressed

Closes #254
Closes #623

Proposed Changes

  • Add a slashing_protection crate in validator_client.

Additional info

Added some comments on github for things I'm unsure about.

Please see this hackmd note that explains the slashing protection implementation.

// Retrieving the corresponding ValidatorDir
let validator = match validators.get(validator_pubkey) {
Some(validator) => validator,
None => return None,
Copy link
Copy Markdown
Contributor Author

@pscott pscott Dec 4, 2019

Choose a reason for hiding this comment

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

Maybe we should log something here if it returns None, stating that the validator_pubkey doesn't appear amongst the validators?

let is_slashing_free = validator
.block_slashing_protection
.as_ref()?
.try_lock()?
Copy link
Copy Markdown
Contributor Author

@pscott pscott Dec 4, 2019

Choose a reason for hiding this comment

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

What should we do here if it fails?

let is_slashing_free = validator
.attestation_slashing_protection
.as_ref()?
.try_lock()?
Copy link
Copy Markdown
Contributor Author

@pscott pscott Dec 4, 2019

Choose a reason for hiding this comment

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

What should we do here if it fails?

@paulhauner paulhauner added this to the v0.2.0 milestone Dec 15, 2019
@paulhauner paulhauner added ready-for-review The code is ready for review and removed waiting-on-author The reviewer has suggested changes and awaits thier implementation. labels Jan 3, 2020
@paulhauner
Copy link
Copy Markdown
Member

I'm still keen to get this merged, I'm just dealing with some more immediate sync-speed issues at the moment.

Please bear with me! :)

@michaelsproul michaelsproul changed the base branch from kill-grpc to master April 21, 2020 00:17
michaelsproul pushed a commit that referenced this pull request Apr 24, 2020
Roll-up of #588 with some conflicts resolved
@michaelsproul michaelsproul mentioned this pull request May 7, 2020
4 tasks
@michaelsproul
Copy link
Copy Markdown
Member

Closing in favour of #1116, thanks @pscott for laying the groundwork! 🎉

@michaelsproul michaelsproul removed may-sec-review ready-for-review The code is ready for review labels May 7, 2020
@michaelsproul michaelsproul removed this from the v0.2.0 milestone May 7, 2020
michaelsproul added a commit that referenced this pull request May 18, 2020
* Implement slashing protection

Roll-up of #588 with some conflicts resolved

* WIP improvements

* Require slot uniqueness for blocks (rather than epochs)
* Native DB support for Slot and Epoch
* Simplify surrounding/surrounded-by queries

* Implement unified slashing protection database

A single SQL database saves on open file descriptors.

* Make slashing protection concurrency safe.

Revive tests, add parallel tests.

* Some simplifications

* Auto-registration, test clean-ups

* More tests, clean-ups, hardening

* Fix comments in BLS

* Optimise bulk validator registration

* Delete outdated tests

* Use bundled SQLite in slashing protection

* Auto-register validators in simulation

* Use real signing_root in slashing protection

* Update book for --auto-register

* Refine log messages and help flags

* Correct typo in Cargo.toml authors

* Fix merge conflicts

* Safer error handling in sqlite slot/epoch

* Address review comments

* Add attestation test mutating block root

Co-authored-by: pscott <scottpiriou@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Lock validators to a SLOTS_PER_EPOCH value Implement slash protection

4 participants