Merge PR #4629: Emit Warning Events when Validator Misses Blocks
This commit is contained in:
committed by
Alexander Bezobchuk
parent
a57915600c
commit
f9dea984c2
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user