Merge PR #4629: Emit Warning Events when Validator Misses Blocks

This commit is contained in:
Aditya
2019-06-28 13:53:30 -04:00
committed by Alexander Bezobchuk
parent a57915600c
commit f9dea984c2
6 changed files with 40 additions and 7 deletions
+15 -1
View File
@@ -84,7 +84,9 @@ single slashing period is capped as described in [overview.md](overview.md) unde
## Uptime tracking
At the beginning of each block, we update the signing info for each validator and check if they've dipped below the liveness threshold over the tracked window. If so, they will be slashed by `LivenessSlashAmount` and will be Jailed for `LivenessJailPeriod`. Liveness slashes do NOT lead to a tombstombing.
At the beginning of each block, we update the signing info for each validator and check if they've dipped below the liveness threshold over the tracked window. If so, they will be slashed by `LivenessSlashAmount` and will be Jailed for `LivenessJailPeriod`. Liveness slashes do NOT lead to a tombstombing.
If a validator misses a block, a warning event will get emitted.
```
height := block.Height
@@ -108,6 +110,18 @@ for val in block.Validators:
signInfo.MissedBlocksCounter--
// else previous == val not in block.AbsentValidators, no change
// Emit warning events if Validator misses block
if val in block.AbsentValidators {
ctx.EventManager().EmitEvent(
NewEvent(
EventTypeLiveness,
NewAttribute(AttributeKeyAddress, consAddr),
NewAttribute(AttributeKeyMissedBlocks, signInfo.MissedBlocksCounter),
NewAttribute(AttributeKeyHeight, ctx.BlockHeight())
),
)
}
// validator must be active for at least SIGNED_BLOCKS_WINDOW
// before they can be automatically unbonded for failing to be
// included in 50% of the recent LastCommits
+6
View File
@@ -13,6 +13,12 @@ The slashing module emits the following events/tags:
- [0] Only included if the validator is jailed.
| Type | Attribute Key | Attribute Value |
|----------|---------------|-----------------------------|
| liveness | address | {validatorConsensusAddress} |
| liveness | missed_blocks | {missedBlocksCounter} |
| liveness | height | {blockHeight} |
## Handlers
### MsgUnjail