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

Problem: (CRO-455) Byzantine validators are not slashed #495

Merged
merged 1 commit into from
Oct 21, 2019
Merged

Problem: (CRO-455) Byzantine validators are not slashed #495

merged 1 commit into from
Oct 21, 2019

Conversation

devashishdxt
Copy link
Collaborator

Solution: Add byzantine validators to slashing queue and slash them when wait time passes

Copy link
Contributor

@tomtau tomtau left a comment

Choose a reason for hiding this comment

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

looks good, just one small style improvement -- clippy already warned about it in store_valid_genesis_state, so could be good to refactor it.

  • the punishment would ideally be proportional to the number of failing validators -- if that's a bit complex to do now, we can postpone from this PR, sketch out it first in https://github.com/crypto-com/chain-docs and later fix it.

chain-abci/src/app/mod.rs Show resolved Hide resolved
chain-abci/src/app/app_init.rs Outdated Show resolved Hide resolved
chain-abci/src/app/slash_accounts.rs Show resolved Hide resolved
@tomtau
Copy link
Contributor

tomtau commented Oct 21, 2019

@devashishdxt init config is currently feature-guarded, as it's not needed in tx-validation enclave etc., so compiling enclaves fails due to this:

error[E0432]: unresolved import `crate::init::config`
614	 --> /tmp/drone-6NS9G1rMvn8mGTkF/drone/src/chain-core/src/init/coin.rs:6:18
615	  |
616	6 | use crate::init::config::SlashRatio;
617	  |                  ^^^^^^ could not find `config` in `init`
618	
619	
620	error[E0432]: unresolved import `crate::init::config`
621	 --> /tmp/drone-6NS9G1rMvn8mGTkF/drone/src/chain-core/src/state/account.rs:4:18
622	  |
623	4 | use crate::init::config::SlashRatio;
624	  |                  ^^^^^^ could not find `config` in `init`
625	
626	
627	error: aborting due to 2 previous errors
628	
629	For more information about this error, try `rustc --explain E0432`.
630	error:

SlashRatio could either be moved out to a separate module, or its uses in Coin and StakedState can be feature guarded (if it can be done -- for StakedState, it may not)

Solution: Slash byzantine validators
@codecov
Copy link

codecov bot commented Oct 21, 2019

Codecov Report

Merging #495 into master will increase coverage by 0.39%.
The diff coverage is 94.02%.

@@            Coverage Diff            @@
##           master    #495      +/-   ##
=========================================
+ Coverage   65.71%   66.1%   +0.39%     
=========================================
  Files         117     120       +3     
  Lines       13602   13794     +192     
=========================================
+ Hits         8938    9118     +180     
- Misses       4664    4676      +12
Impacted Files Coverage Δ
chain-abci/src/main.rs 2.63% <ø> (ø) ⬆️
chain-abci/src/lib.rs 100% <ø> (ø) ⬆️
chain-core/src/init/config.rs 68.65% <100%> (+0.47%) ⬆️
chain-core/src/state/account.rs 75.21% <100%> (+0.86%) ⬆️
chain-core/src/init/coin.rs 88.51% <100%> (+0.69%) ⬆️
chain-abci/src/slashing.rs 61.11% <61.11%> (ø)
chain-abci/src/punishment.rs 85.71% <85.71%> (ø)
chain-abci/src/app/app_init.rs 69.66% <87.5%> (-0.04%) ⬇️
chain-abci/src/app/mod.rs 82.45% <91.66%> (+0.26%) ⬆️
chain-abci/src/app/slash_accounts.rs 96.77% <96.77%> (ø)
... and 4 more

@devashishdxt devashishdxt requested a review from tomtau October 21, 2019 06:37
@tomtau
Copy link
Contributor

tomtau commented Oct 21, 2019

bors r+

bors bot added a commit that referenced this pull request Oct 21, 2019
495: Problem: (CRO-455) Byzantine validators are not slashed r=tomtau a=devashishdxt

Solution: Add byzantine validators to slashing queue and slash them when wait time passes

Co-authored-by: Devashish Dixit <[email protected]>
@bors
Copy link
Contributor

bors bot commented Oct 21, 2019

@bors bors bot merged commit 7716165 into crypto-com:master Oct 21, 2019
@devashishdxt devashishdxt deleted the slashing branch October 21, 2019 07:49
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants