github.com/fibonacci-chain/fbc@v0.0.0-20231124064014-c7636198c1e9/libs/cosmos-sdk/x/slashing/spec/02_state.md (about)

     1  <!--
     2  order: 2
     3  -->
     4  
     5  # State
     6  
     7  ## Signing Info (Liveness)
     8  
     9  Every block includes a set of precommits by the validators for the previous block,
    10  known as the `LastCommitInfo` provided by Tendermint. A `LastCommitInfo` is valid so
    11  long as it contains precommits from +2/3 of total voting power.
    12  
    13  Proposers are incentivized to include precommits from all validators in the `LastCommitInfo`
    14  by receiving additional fees proportional to the difference between the voting
    15  power included in the `LastCommitInfo` and +2/3 (see [TODO](https://github.com/cosmos/cosmos-sdk/issues/967)).
    16  
    17  Validators are penalized for failing to be included in the `LastCommitInfo` for some
    18  number of blocks by being automatically jailed, potentially slashed, and unbonded.
    19  
    20  Information about validator's liveness activity is tracked through `ValidatorSigningInfo`.
    21  It is indexed in the store as follows:
    22  
    23  - ValidatorSigningInfo: ` 0x01 | ConsAddress -> amino(valSigningInfo)`
    24  - MissedBlocksBitArray: ` 0x02 | ConsAddress | LittleEndianUint64(signArrayIndex) -> VarInt(didMiss)`
    25  
    26  The first mapping allows us to easily lookup the recent signing info for a
    27  validator based on the validator's consensus address. The second mapping acts
    28  as a bit-array of size `SignedBlocksWindow` that tells us if the validator missed
    29  the block for a given index in the bit-array. The index in the bit-array is given
    30  as little endian uint64.
    31  
    32  The result is a `varint` that takes on `0` or `1`, where `0` indicates the
    33  validator did not miss (did sign) the corresponding block, and `1` indicates
    34  they missed the block (did not sign).
    35  
    36  Note that the `MissedBlocksBitArray` is not explicitly initialized up-front. Keys
    37  are added as we progress through the first `SignedBlocksWindow` blocks for a newly
    38  bonded validator. The `SignedBlocksWindow` parameter defines the size
    39  (number of blocks) of the sliding window used to track validator liveness.
    40  
    41  The information stored for tracking validator liveness is as follows:
    42  
    43  ```go
    44  type ValidatorSigningInfo struct {
    45      Address             sdk.ConsAddress
    46      StartHeight         int64
    47      IndexOffset         int64
    48      JailedUntil         time.Time
    49      Tombstoned          bool
    50      MissedBlocksCounter int64
    51  }
    52  ```
    53  
    54  Where:
    55  
    56  - __Address__: The validator's consensus address.
    57  - __StartHeight__: The height that the candidate became an active validator
    58    (with non-zero voting power).
    59  - __IndexOffset__: Index which is incremented each time the validator was a bonded
    60    in a block and may have signed a precommit or not. This in conjunction with the
    61    `SignedBlocksWindow` param determines the index in the `MissedBlocksBitArray`.
    62  - __JailedUntil__: Time for which the validator is jailed until due to liveness downtime.
    63  - __Tombstoned__: Desribes if the validator is tombstoned or not. It is set once the
    64    validator commits an equivocation or for any other configured misbehiavor.
    65  - __MissedBlocksCounter__: A counter kept to avoid unnecessary array reads. Note
    66    that `Sum(MissedBlocksBitArray)` equals `MissedBlocksCounter` always.