This repository was archived by the owner on Nov 15, 2023. It is now read-only.
  
  
  - 
                Notifications
    
You must be signed in to change notification settings  - Fork 2.7k
 
Offences reporting and slashing #3322
          
     Merged
      
      
    
                
     Merged
            
            
          Conversation
  
    
      This file contains hidden or 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
    
  
  
    
    …to retreat-slashing
…or slash calculations
Co-Authored-By: joe petrowski <[email protected]>
Co-Authored-By: joe petrowski <[email protected]>
              
                    lsaether
  
              
              reviewed
              
                  
                    Aug 14, 2019 
                  
              
              
            
            
Co-Authored-By: Logan Saether <[email protected]>
              
                    rphmeier
  
              
              reviewed
              
                  
                    Aug 15, 2019 
                  
              
              
            
            
| // because: | ||
| // Y = X * (1 - prev) | ||
| // Z = Y * (1 - x) | ||
| // Z = X * (1 - new) | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Our main concern was whether PerBill can handle it.
To keep the decimal representation from going out of control, we could always round the slash_fraction to the nearest 1000th or 10,000th.
We will then incur some rounding error but are at much lower risk of overflow.
* only slash in current era * prune journal for last era * comment own_slash * emit an event when old slashing events are discarded
              
                    tomusdrw
  
              
              commented
              
                  
                    Aug 16, 2019 
                  
              
              
            
            
# Conflicts: # node/cli/src/chain_spec.rs # node/runtime/src/lib.rs # srml/aura/Cargo.toml # srml/babe/Cargo.toml # srml/babe/src/lib.rs # srml/session/src/lib.rs
# Conflicts: # node/runtime/src/lib.rs # srml/babe/src/lib.rs
              
                    rphmeier
  
              
              approved these changes
              
                  
                    Aug 16, 2019 
                  
              
              
            
            
              
                    gavofyork
  
              
              approved these changes
              
                  
                    Aug 16, 2019 
                  
              
              
            
            
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lgtm
  
      Sign up for free
      to subscribe to this conversation on GitHub.
      Already have an account?
      Sign in.
  
      
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
The spec is available here.
This PR introduces infrastructure for tracking offences and enacting them, i.e. slashing. Actual reporting is implemented only for unresponsivness; detection, validation and filing the reports is out of scope for this PR and should be implemented in #3314. There are some differences from the spec, namely: