* update slashing docs * x/slashing docs general audit & cleanup * Update x/slashing/spec/02_state.md Co-authored-by: Amaury <amaury.martiny@protonmail.com> * Update x/slashing/spec/05_hooks.md Co-authored-by: Alessio Treglia <alessio@tendermint.com> * use code insertion widget * review update * Update x/slashing/spec/05_hooks.md Co-authored-by: Alessio Treglia <alessio@tendermint.com> * update link and location for fee distribution spec Co-authored-by: Amaury <amaury.martiny@protonmail.com> Co-authored-by: Alessio Treglia <alessio@tendermint.com>
1.3 KiB
1.3 KiB
Hooks
This section contains a description of the module's hooks. Hooks are operations that are executed automatically when events are raised.
Staking hooks
The slashing module implements the StakingHooks defined in x/staking and are used as record-keeping of validators information. During the app initialization, these hooks should be registered in the staking module struct.
The following hooks impact the slashing state:
AfterValidatorBondedcreates aValidatorSigningInfoinstance as described in the following section.AfterValidatorCreatedstores a validator's consensus key.AfterValidatorRemovedremoves a validator's consensus key.
Validator Bonded
Upon successful first-time bonding of a new validator, we create a new ValidatorSigningInfo structure for the
now-bonded validator, which StartHeight of the current block.
onValidatorBonded(address sdk.ValAddress)
signingInfo, found = GetValidatorSigningInfo(address)
if !found {
signingInfo = ValidatorSigningInfo {
StartHeight : CurrentHeight,
IndexOffset : 0,
JailedUntil : time.Unix(0, 0),
Tombstone : false,
MissedBloskCounter : 0
}
setValidatorSigningInfo(signingInfo)
}
return