Slashing Module (x/slashing)
Overview
Thex/slashing module implements functionality to disincentivize validator misbehavior by penalizing (slashing) their stake and removing their ability to vote on blocks temporarily or permanently.
Purpose: Maintain network security and liveness by penalizing validators who commit protocol faults or fail to participate in consensus.
Key Concepts
Validator States
At any time, validators can be:- Bonded: Active set, signing blocks, earning rewards
- Unbonding: Leaving active set
- Unbonded: Not in active set
- Jailed: Temporarily banned from active set
- Tombstoned: Permanently banned (cannot unjail)
Penalties
Two main types of misbehavior are penalized:-
Liveness Faults: Missing too many blocks
- Slash percentage: ~0.01%
- Jail duration: Configurable (e.g., 10 minutes)
- Can unjail after period expires
- Not tombstoned
-
Byzantine Faults: Double signing
- Slash percentage: ~5%
- Permanently tombstoned
- Cannot rejoin validator set
- Consensus key permanently banned
Tombstone Caps
Validators are tombstoned on first double-sign to prevent multiple slashes for same type of fault. Prevents excessive punishment from configuration errors.State
ValidatorSigningInfo
Tracks liveness and infraction information: Storage:0x01 | ConsAddr -> ProtocolBuffer(ValidatorSigningInfo)
MissedBlocksBitArray
Tracks which blocks validator missed: Storage:0x02 | ConsAddr | LittleEndianUint64(index) -> VarInt(didMiss)
0= validator signed block1= validator missed block- Size =
SignedBlocksWindowparameter
Parameters
Storage:0x00 -> ProtocolBuffer(Params)
| Parameter | Type | Default | Description |
|---|---|---|---|
| SignedBlocksWindow | int64 | 100 | Blocks in sliding window |
| MinSignedPerWindow | Dec | 0.500000000000000000 | Minimum % blocks to sign |
| DowntimeJailDuration | Duration | 600s | Jail time for downtime |
| SlashFractionDoubleSign | Dec | 0.050000000000000000 | 5% slash for double sign |
| SlashFractionDowntime | Dec | 0.010000000000000000 | 0.01% slash for downtime |
Messages
MsgUnjail
Validator requests to unjail after downtime:- Validator must exist
- Validator must be jailed
- Validator must not be tombstoned
- Current time must be after
JailedUntil - Validator must have self-delegation
BeginBlock Liveness Tracking
At each block, the module:- Update Signing Info: Increment
IndexOffsetfor each validator - Track Missed Blocks: Update
MissedBlocksBitArraybased on votes - Check Liveness: If validator exceeded
maxMissed, slash and jail
Liveness Algorithm
Max Missed Blocks Calculation
Slashing for Double Sign
When CometBFT detects double signing:- Slash Validator: Apply
SlashFractionDoubleSignto tokens - Slash Delegations: Slash unbonding delegations and redelegations
- Jail Validator: Permanently jail
- Tombstone: Mark as tombstoned (cannot unjail)
Queries
Query Signing Info
Query Signing Infos
Query Parameters
gRPC Endpoints
SigningInfo
SigningInfos
Params
Events
MsgUnjail
| Type | Attribute Key | Attribute Value |
|---|---|---|
| message | module | slashing |
| message | sender |
Slash Event
| Type | Attribute Key | Attribute Value |
|---|---|---|
| slash | address | |
| slash | power | |
| slash | reason | |
| slash | jailed | |
| slash | burned_coins |
Liveness Event
| Type | Attribute Key | Attribute Value |
|---|---|---|
| liveness | address | |
| liveness | missed_blocks | |
| liveness | height |
Code Examples
Unjail Validator
Query Missed Blocks
Check Liveness
Slash Validator
Hooks
AfterValidatorBonded
Initialize signing info when validator bonds:CLI Commands Reference
| Command | Description |
|---|---|
simd query slashing signing-info [cons-addr] | Query signing info |
simd query slashing signing-infos | Query all signing infos |
simd query slashing params | Query slashing parameters |
simd tx slashing unjail | Unjail validator |
Integration Guide
Best Practices
- Monitor Uptime: Track validator signing percentage
- Set Alerts: Alert before reaching missed blocks threshold
- Backup Infrastructure: Maintain redundant signing nodes
- Test Unjailing: Practice unjail process on testnet
- Avoid Double Signing: Never run duplicate validators with same key
- Key Management: Secure consensus keys properly