Evidence Module (x/evidence)
Overview
Thex/evidence module allows for the submission and handling of arbitrary evidence of misbehavior, such as equivocation (double signing) and counterfactual signing. It differs from standard evidence handling by allowing clients and foreign chains to submit complex evidence directly.
Purpose: Provide a flexible framework for detecting, submitting, and handling various types of validator misbehavior beyond what the consensus engine automatically detects.
Key Concepts
Evidence Types
Two primary types of evidence are handled:- DuplicateVoteEvidence: Validator signed two conflicting votes at same height/round
- LightClientAttackEvidence: Validator participated in light client attack
Evidence Interface
All evidence must implement:ValidatorEvidence Interface
Extended interface for validator-specific evidence:Evidence Router
Routes evidence to appropriate handler:Evidence Handler
Executes business logic for evidence:State
Evidence Storage
Evidence is stored once validated: Storage:0x00 | Hash -> ProtocolBuffer(Evidence)
Genesis State
Messages
MsgSubmitEvidence
Submit evidence of misbehavior:- Evidence must not already exist
- Evidence must have registered handler
- Evidence must pass
ValidateBasic() - Evidence must be within evidence age limit
BeginBlock Evidence Handling
CometBFT forwards evidence inBeginBlock:
Equivocation Handling
When equivocation is detected:Evidence Age Validation
Evidence.Timestamp: Block time at infraction heightblock.Timestamp: Current block timeMaxEvidenceAge: From x/slashing parameters
Queries
Query Evidence
Get evidence by hash:Query All Evidence
gRPC Endpoints
Evidence
AllEvidence
Events
MsgSubmitEvidence
| Type | Attribute Key | Attribute Value |
|---|---|---|
| submit_evidence | evidence_hash | |
| message | module | evidence |
| message | sender | |
| message | action | submit_evidence |
Code Examples
Submit Evidence
Query Evidence
Custom Evidence Type
Iterate Evidence
REST Endpoints
Evidence
All Evidence
CLI Commands Reference
| Command | Description |
|---|---|
simd query evidence evidence [hash] | Query evidence by hash |
simd query evidence list | Query all evidence |
simd tx evidence submit [evidence-json] | Submit evidence |
Integration Guide
Security Considerations
- Evidence Validation: Always validate evidence thoroughly
- Age Limits: Enforce evidence age limits to prevent old attacks
- Duplicate Detection: Check for duplicate evidence submission
- Handler Registration: Only register trusted evidence handlers
- Slashing Coordination: Ensure proper coordination with slashing module
Best Practices
- Monitor Evidence: Set up alerts for evidence submission
- Rapid Response: Handle evidence quickly to maintain security
- Document Handlers: Clearly document custom evidence types
- Test Thoroughly: Test evidence handling on testnets
- Backup Nodes: Run monitoring nodes to detect misbehavior