github.com/vipernet-xyz/tm@v0.34.24/spec/core/data_structures.md (about)

     1  # Data Structures
     2  
     3  Here we describe the data structures in the Tendermint blockchain and the rules for validating them.
     4  
     5  The Tendermint blockchains consists of a short list of data types:
     6  
     7  - [Data Structures](#data-structures)
     8    - [Block](#block)
     9    - [Execution](#execution)
    10    - [Header](#header)
    11    - [Version](#version)
    12    - [BlockID](#blockid)
    13    - [PartSetHeader](#partsetheader)
    14    - [Part](#part)
    15    - [Time](#time)
    16    - [Data](#data)
    17    - [Commit](#commit)
    18    - [CommitSig](#commitsig)
    19    - [BlockIDFlag](#blockidflag)
    20    - [Vote](#vote)
    21    - [CanonicalVote](#canonicalvote)
    22    - [Proposal](#proposal)
    23    - [SignedMsgType](#signedmsgtype)
    24    - [Signature](#signature)
    25    - [EvidenceList](#evidencelist)
    26    - [Evidence](#evidence)
    27      - [DuplicateVoteEvidence](#duplicatevoteevidence)
    28      - [LightClientAttackEvidence](#lightclientattackevidence)
    29    - [LightBlock](#lightblock)
    30    - [SignedHeader](#signedheader)
    31    - [ValidatorSet](#validatorset)
    32    - [Validator](#validator)
    33    - [Address](#address)
    34    - [ConsensusParams](#consensusparams)
    35      - [BlockParams](#blockparams)
    36      - [EvidenceParams](#evidenceparams)
    37      - [ValidatorParams](#validatorparams)
    38      - [VersionParams](#versionparams)
    39    - [Proof](#proof)
    40  
    41  
    42  ## Block
    43  
    44  A block consists of a header, transactions, votes (the commit),
    45  and a list of evidence of malfeasance (ie. signing conflicting votes).
    46  
    47  | Name   | Type              | Description                                                                                                                                                                          | Validation                                               |
    48  |--------|-------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------|
    49  | Header | [Header](#header) | Header corresponding to the block. This field contains information used throughout consensus and other areas of the protocol. To find out what it contains, visit [header](#header) | Must adhere to the validation rules of [header](#header) |
    50  | Data       | [Data](#data)                  | Data contains a list of transactions. The contents of the transaction is unknown to Tendermint.                                                                                      | This field can be empty or populated, but no validation is performed. Applications can perform validation on individual transactions prior to block creation using [checkTx](../abci/abci.md#checktx).
    51  | Evidence   | [EvidenceList](#evidence_list) | Evidence contains a list of infractions committed by validators.                                                                                                                     | Can be empty, but when populated the validations rules from [evidenceList](#evidence_list) apply |
    52  | LastCommit | [Commit](#commit)              | `LastCommit` includes one vote for every validator.  All votes must either be for the previous block, nil or absent. If a vote is for the previous block it must have a valid signature from the corresponding validator. The sum of the voting power of the validators that voted must be greater than 2/3 of the total voting power of the complete validator set. The number of votes in a commit is limited to 10000 (see `types.MaxVotesCount`).                                                                                             | Must be empty for the initial height and must adhere to the validation rules of [commit](#commit).  |
    53  
    54  ## Execution
    55  
    56  Once a block is validated, it can be executed against the state.
    57  
    58  The state follows this recursive equation:
    59  
    60  ```go
    61  state(initialHeight) = InitialState
    62  state(h+1) <- Execute(state(h), ABCIApp, block(h))
    63  ```
    64  
    65  where `InitialState` includes the initial consensus parameters and validator set,
    66  and `ABCIApp` is an ABCI application that can return results and changes to the validator
    67  set (TODO). Execute is defined as:
    68  
    69  ```go
    70  func Execute(s State, app ABCIApp, block Block) State {
    71   // Fuction ApplyBlock executes block of transactions against the app and returns the new root hash of the app state,
    72   // modifications to the validator set and the changes of the consensus parameters.
    73   AppHash, ValidatorChanges, ConsensusParamChanges := app.ApplyBlock(block)
    74  
    75   nextConsensusParams := UpdateConsensusParams(state.ConsensusParams, ConsensusParamChanges)
    76   return State{
    77    ChainID:         state.ChainID,
    78    InitialHeight:   state.InitialHeight,
    79    LastResults:     abciResponses.DeliverTxResults,
    80    AppHash:         AppHash,
    81    InitialHeight:   state.InitialHeight,
    82    LastValidators:  state.Validators,
    83    Validators:      state.NextValidators,
    84    NextValidators:  UpdateValidators(state.NextValidators, ValidatorChanges),
    85    ConsensusParams: nextConsensusParams,
    86    Version: {
    87     Consensus: {
    88      AppVersion: nextConsensusParams.Version.AppVersion,
    89     },
    90    },
    91   }
    92  }
    93  ```
    94  
    95  Validating a new block is first done prior to the `prevote`, `precommit` & `finalizeCommit` stages.
    96  
    97  The steps to validate a new block are:
    98  
    99  - Check the validity rules of the block and its fields.
   100  - Check the versions (Block & App) are the same as in local state.
   101  - Check the chainID's match.
   102  - Check the height is correct.
   103  - Check the `LastBlockID` corresponds to BlockID currently in state.
   104  - Check the hashes in the header match those in state.
   105  - Verify the LastCommit against state, this step is skipped for the initial height.
   106      - This is where checking the signatures correspond to the correct block will be made.
   107  - Make sure the proposer is part of the validator set.
   108  - Validate bock time.
   109      - Make sure the new blocks time is after the previous blocks time.
   110      - Calculate the medianTime and check it against the blocks time.
   111      - If the blocks height is the initial height then check if it matches the genesis time.
   112  - Validate the evidence in the block. Note: Evidence can be empty
   113  
   114  ## Header
   115  
   116  A block header contains metadata about the block and about the consensus, as well as commitments to
   117  the data in the current block, the previous block, and the results returned by the application:
   118  
   119  | Name              | Type                      | Description                                                                                                                                                                                                                                                                                                                                                                           | Validation                                                                                                                                                                                       |
   120  |-------------------|---------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
   121  | Version           | [Version](#version)       | Version defines the application and protocol version being used.                                                                                                                                                                                                                                                                                                                       | Must adhere to the validation rules of [Version](#version)                                                                                                                                       |
   122  | ChainID           | String                    | ChainID is the ID of the chain. This must be unique to your chain.                                                                                                                                                                                                                                                                                                                    | ChainID must be less than 50 bytes.                                                                                                                                                              |
   123  | Height            | uint64                     | Height is the height for this header.                                                                                                                                                                                                                                                                                                                                                 | Must be > 0, >= initialHeight, and == previous Height+1                                                                                                                                          |
   124  | Time              | [Time](#time)             | The timestamp is equal to the weighted median of validators present in the last commit. Read more on time in the [BFT-time section](../consensus/bft-time.md). Note: the timestamp of a vote must be greater by at least one millisecond than that of the block being voted on.                                                                                                       | Time must be >= previous header timestamp + consensus parameters TimeIotaMs.  The timestamp of the first block must be equal to the genesis time (since there's no votes to compute the median). |
   125  | LastBlockID       | [BlockID](#blockid)       | BlockID of the previous block.                                                                                                                                                                                                                                                                                                                                                        | Must adhere to the validation rules of [blockID](#blockid). The first block has `block.Header.LastBlockID == BlockID{}`.                                                                         |
   126  | LastCommitHash    | slice of bytes (`[]byte`) | MerkleRoot of the lastCommit's signatures. The signatures represent the validators that committed to the last block. The first block has an empty slices of bytes for the hash.                                                                                                                                                                                                       | Must  be of length 32                                                                                                                                                                            |
   127  | DataHash          | slice of bytes (`[]byte`) | MerkleRoot of the hash of transactions. **Note**: The transactions are hashed before being included in the merkle tree, the leaves of the Merkle tree are the hashes, not the transactions themselves.                                                                                                                                                                                | Must  be of length 32                                                                                                                                                                            |
   128  | ValidatorHash     | slice of bytes (`[]byte`) | MerkleRoot of the current validator set. The validators are first sorted by voting power (descending), then by address (ascending) prior to computing the MerkleRoot.                                                                                                                                                                                                                 | Must  be of length 32                                                                                                                                                                            |
   129  | NextValidatorHash | slice of bytes (`[]byte`) | MerkleRoot of the next validator set. The validators are first sorted by voting power (descending), then by address (ascending) prior to computing the MerkleRoot.                                                                                                                                                                                                                    | Must  be of length 32                                                                                                                                                                            |
   130  | ConsensusHash     | slice of bytes (`[]byte`) | Hash of the protobuf encoded consensus parameters.                                                                                                                                                                                                                                                                                                                                    | Must  be of length 32                                                                                                                                                                            |
   131  | AppHash           | slice of bytes (`[]byte`) | Arbitrary byte array returned by the application after executing and commiting the previous block. It serves as the basis for validating any merkle proofs that comes from the ABCI application and represents the state of the actual application rather than the state of the blockchain itself. The first block's `block.Header.AppHash` is given by `ResponseInitChain.app_hash`. | This hash is determined by the application, Tendermint can not perform validation on it.                                                                                                         |
   132  | LastResultHash    | slice of bytes (`[]byte`) | `LastResultsHash` is the root hash of a Merkle tree built from `ResponseDeliverTx` responses (`Log`,`Info`, `Codespace` and `Events` fields are ignored).                                                                                                                                                                                                                             | Must  be of length 32. The first block has `block.Header.ResultsHash == MerkleRoot(nil)`, i.e. the hash of an empty input, for RFC-6962 conformance.                                             |
   133  | EvidenceHash      | slice of bytes (`[]byte`) | MerkleRoot of the evidence of Byzantine behaviour included in this block.                                                                                                                                                                                                                                                                                                             | Must  be of length 32                                                                                                                                                                            |
   134  | ProposerAddress   | slice of bytes (`[]byte`) | Address of the original proposer of the block. Validator must be in the current validatorSet.                                                                                                                                                                                                                                                                                         | Must  be of length 20                                                                                                                                                                            |
   135  
   136  ## Version
   137  
   138  NOTE: that this is more specifically the consensus version and doesn't include information like the
   139  P2P Version. (TODO: we should write a comprehensive document about
   140  versioning that this can refer to)
   141  
   142  | Name  | type   | Description                                                                                                     | Validation                                                                                                         |
   143  |-------|--------|-----------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------|
   144  | Block | uint64 | This number represents the version of the block protocol and must be the same throughout an operational network | Must be equal to protocol version being used in a network (`block.Version.Block == state.Version.Consensus.Block`) |
   145  | App   | uint64 | App version is decided on by the application. Read [here](../abci/abci.md#info)                                 | `block.Version.App == state.Version.Consensus.App`                                                                 |
   146  
   147  ## BlockID
   148  
   149  The `BlockID` contains two distinct Merkle roots of the block. The `BlockID` includes these two hashes, as well as the number of parts (ie. `len(MakeParts(block))`)
   150  
   151  | Name          | Type                            | Description                                                                                                                                                      | Validation                                                             |
   152  |---------------|---------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------|
   153  | Hash          | slice of bytes (`[]byte`)       | MerkleRoot of all the fields in the header (ie. `MerkleRoot(header)`.                                                                                            | hash must be of length 32                                              |
   154  | PartSetHeader | [PartSetHeader](#PartSetHeader) | Used for secure gossiping of the block during consensus, is the MerkleRoot of the complete serialized block cut into parts (ie. `MerkleRoot(MakeParts(block))`). | Must adhere to the validation rules of [PartSetHeader](#PartSetHeader) |
   155  
   156  See [MerkleRoot](./encoding.md#MerkleRoot) for details.
   157  
   158  ## PartSetHeader
   159  
   160  | Name  | Type                      | Description                       | Validation           |
   161  |-------|---------------------------|-----------------------------------|----------------------|
   162  | Total | int32                     | Total amount of parts for a block | Must be > 0          |
   163  | Hash  | slice of bytes (`[]byte`) | MerkleRoot of a serialized block  | Must be of length 32 |
   164  
   165  ## Part
   166  
   167  Part defines a part of a block. In Tendermint blocks are broken into `parts` for gossip.
   168  
   169  | Name  | Type            | Description                       | Validation           |
   170  |-------|-----------------|-----------------------------------|----------------------|
   171  | index | int32           | Total amount of parts for a block | Must be > 0          |
   172  | bytes | bytes           | MerkleRoot of a serialized block  | Must be of length 32 |
   173  | proof | [Proof](#proof) | MerkleRoot of a serialized block  | Must be of length 32 |
   174  
   175  ## Time
   176  
   177  Tendermint uses the [Google.Protobuf.Timestamp](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.Timestamp)
   178  format, which uses two integers, one 64 bit integer for Seconds and a 32 bit integer for Nanoseconds.
   179  
   180  ## Data
   181  
   182  Data is just a wrapper for a list of transactions, where transactions are arbitrary byte arrays:
   183  
   184  | Name | Type                       | Description            | Validation                                                                  |
   185  |------|----------------------------|------------------------|-----------------------------------------------------------------------------|
   186  | Txs  | Matrix of bytes ([][]byte) | Slice of transactions. | Validation does not occur on this field, this data is unknown to Tendermint |
   187  
   188  ## Commit
   189  
   190  Commit is a simple wrapper for a list of signatures, with one for each validator. It also contains the relevant BlockID, height and round:
   191  
   192  | Name       | Type                             | Description                                                          | Validation                                                                                               |
   193  |------------|----------------------------------|----------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------|
   194  | Height     | uint64                            | Height at which this commit was created.                             | Must be > 0                                                                                              |
   195  | Round      | int32                            | Round that the commit corresponds to.                                | Must be > 0                                                                                              |
   196  | BlockID    | [BlockID](#blockid)              | The blockID of the corresponding block.                              | Must adhere to the validation rules of [BlockID](#blockid).                                              |
   197  | Signatures | Array of [CommitSig](#commitsig) | Array of commit signatures that correspond to current validator set. | Length of signatures must be > 0 and adhere to the validation of each individual [Commitsig](#commitsig) |
   198  
   199  ## CommitSig
   200  
   201  `CommitSig` represents a signature of a validator, who has voted either for nil,
   202  a particular `BlockID` or was absent. It's a part of the `Commit` and can be used
   203  to reconstruct the vote set given the validator set.
   204  
   205  | Name             | Type                        | Description                                                                                                                                                     | Validation                                                        |
   206  |------------------|-----------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------|
   207  | BlockIDFlag      | [BlockIDFlag](#blockidflag) | Represents the validators participation in consensus: Either voted for the block that received the majority, voted for another block, voted nil or did not vote | Must be one of the fields in the [BlockIDFlag](#blockidflag) enum |
   208  | ValidatorAddress | [Address](#address)         | Address of the validator                                                                                                                                        | Must be of length 20                                              |
   209  | Timestamp        | [Time](#time)               | This field will vary from `CommitSig` to `CommitSig`. It represents the timestamp of the validator.                                                             | [Time](#time)                                                     |
   210  | Signature        | [Signature](#signature)     | Signature corresponding to the validators participation in consensus.                                                                                           | The length of the signature must be > 0 and < than  64            |
   211  
   212  NOTE: `ValidatorAddress` and `Timestamp` fields may be removed in the future
   213  (see [ADR-25](https://github.com/vipernet-xyz/tm/blob/main/docs/architecture/adr-025-commit.md)).
   214  
   215  ## BlockIDFlag
   216  
   217  BlockIDFlag represents which BlockID the [signature](#commitsig) is for.
   218  
   219  ```go
   220  enum BlockIDFlag {
   221    BLOCK_ID_FLAG_UNKNOWN = 0;
   222    BLOCK_ID_FLAG_ABSENT  = 1; // signatures for other blocks are also considered absent
   223    BLOCK_ID_FLAG_COMMIT  = 2;
   224    BLOCK_ID_FLAG_NIL     = 3;
   225  }
   226  ```
   227  
   228  ## Vote
   229  
   230  A vote is a signed message from a validator for a particular block.
   231  The vote includes information about the validator signing it. When stored in the blockchain or propagated over the network, votes are encoded in Protobuf.
   232  
   233  | Name             | Type                            | Description                                                                                 | Validation                                                                                           |
   234  |------------------|---------------------------------|---------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------|
   235  | Type             | [SignedMsgType](#signedmsgtype) | Either prevote or precommit. [SignedMsgType](#signedmsgtype)                                | A Vote is valid if its corresponding fields are included in the enum [signedMsgType](#signedmsgtype) |
   236  | Height           | uint64                           | Height for which this vote was created for                                                  | Must be > 0                                                                                          |
   237  | Round            | int32                           | Round that the commit corresponds to.                                                       | Must be > 0                                                                                          |
   238  | BlockID          | [BlockID](#blockid)             | The blockID of the corresponding block.                                                     | [BlockID](#blockid)                                                                                  |
   239  | Timestamp        | [Time](#Time)                   | Timestamp represents the time at which a validator signed.                                  | [Time](#time)                                                                                        |
   240  | ValidatorAddress | slice of bytes (`[]byte`)       | Address of the validator                                                                    | Length must be equal to 20                                                                           |
   241  | ValidatorIndex   | int32                           | Index at a specific block height that corresponds to the Index of the validator in the set. | must be > 0                                                                                          |
   242  | Signature        | slice of bytes (`[]byte`)       | Signature by the validator if they participated in consensus for the associated bock.       | Length of signature must be > 0 and < 64                                                             |
   243  
   244  ## CanonicalVote
   245  
   246  CanonicalVote is for validator signing. This type will not be present in a block. Votes are represented via `CanonicalVote` and also encoded using protobuf via `type.SignBytes` which includes the `ChainID`, and uses a different ordering of
   247  the fields.
   248  
   249  ```proto
   250  message CanonicalVote {
   251    SignedMsgType             type      = 1;
   252    fixed64                  height    = 2;
   253    sfixed64                  round     = 3;
   254    CanonicalBlockID          block_id  = 4;
   255    google.protobuf.Timestamp timestamp = 5;
   256    string                    chain_id  = 6;
   257  }
   258  ```
   259  
   260  For signing, votes are represented via [`CanonicalVote`](#canonicalvote) and also encoded using protobuf via
   261  `type.SignBytes` which includes the `ChainID`, and uses a different ordering of
   262  the fields.
   263  
   264  We define a method `Verify` that returns `true` if the signature verifies against the pubkey for the `SignBytes`
   265  using the given ChainID:
   266  
   267  ```go
   268  func (vote *Vote) Verify(chainID string, pubKey crypto.PubKey) error {
   269   if !bytes.Equal(pubKey.Address(), vote.ValidatorAddress) {
   270    return ErrVoteInvalidValidatorAddress
   271   }
   272   v := vote.ToProto()
   273   if !pubKey.VerifyBytes(types.VoteSignBytes(chainID, v), vote.Signature) {
   274    return ErrVoteInvalidSignature
   275   }
   276   return nil
   277  }
   278  ```
   279  
   280  ## Proposal
   281  
   282  Proposal contains height and round for which this proposal is made, BlockID as a unique identifier
   283  of proposed block, timestamp, and POLRound (a so-called Proof-of-Lock (POL) round) that is needed for
   284  termination of the consensus. If POLRound >= 0, then BlockID corresponds to the block that
   285  is locked in POLRound. The message is signed by the validator private key.
   286  
   287  | Name      | Type                            | Description                                                                           | Validation                                              |
   288  |-----------|---------------------------------|---------------------------------------------------------------------------------------|---------------------------------------------------------|
   289  | Type      | [SignedMsgType](#signedmsgtype) | Represents a Proposal [SignedMsgType](#signedmsgtype)                                 | Must be `ProposalType`  [signedMsgType](#signedmsgtype) |
   290  | Height    | uint64                           | Height for which this vote was created for                                            | Must be > 0                                             |
   291  | Round     | int32                           | Round that the commit corresponds to.                                                 | Must be > 0                                             |
   292  | POLRound  | int64                           | Proof of lock                                                                         | Must be > 0                                             |
   293  | BlockID   | [BlockID](#blockid)             | The blockID of the corresponding block.                                               | [BlockID](#blockid)                                     |
   294  | Timestamp | [Time](#Time)                   | Timestamp represents the time at which a validator signed.                            | [Time](#time)                                           |
   295  | Signature | slice of bytes (`[]byte`)       | Signature by the validator if they participated in consensus for the associated bock. | Length of signature must be > 0 and < 64                |
   296  
   297  ## SignedMsgType
   298  
   299  Signed message type represents a signed messages in consensus.
   300  
   301  ```proto
   302  enum SignedMsgType {
   303  
   304    SIGNED_MSG_TYPE_UNKNOWN = 0;
   305    // Votes
   306    SIGNED_MSG_TYPE_PREVOTE   = 1;
   307    SIGNED_MSG_TYPE_PRECOMMIT = 2;
   308  
   309    // Proposal
   310    SIGNED_MSG_TYPE_PROPOSAL = 32;
   311  }
   312  ```
   313  
   314  ## Signature
   315  
   316  Signatures in Tendermint are raw bytes representing the underlying signature.
   317  
   318  See the [signature spec](./encoding.md#key-types) for more.
   319  
   320  ## EvidenceList
   321  
   322  EvidenceList is a simple wrapper for a list of evidence:
   323  
   324  | Name     | Type                           | Description                            | Validation                                                      |
   325  |----------|--------------------------------|----------------------------------------|-----------------------------------------------------------------|
   326  | Evidence | Array of [Evidence](#evidence) | List of verified [evidence](#evidence) | Validation adheres to individual types of [Evidence](#evidence) |
   327  
   328  ## Evidence
   329  
   330  Evidence in Tendermint is used to indicate breaches in the consensus by a validator.
   331  
   332  More information on how evidence works in Tendermint can be found [here](../consensus/evidence.md)
   333  
   334  ### DuplicateVoteEvidence
   335  
   336  `DuplicateVoteEvidence` represents a validator that has voted for two different blocks
   337  in the same round of the same height. Votes are lexicographically sorted on `BlockID`.
   338  
   339  | Name             | Type          | Description                                                        | Validation                                          |
   340  |------------------|---------------|--------------------------------------------------------------------|-----------------------------------------------------|
   341  | VoteA            | [Vote](#vote) | One of the votes submitted by a validator when they equivocated    | VoteA must adhere to [Vote](#vote) validation rules |
   342  | VoteB            | [Vote](#vote) | The second vote submitted by a validator when they equivocated     | VoteB must adhere to [Vote](#vote) validation rules |
   343  | TotalVotingPower | int64         | The total power of the validator set at the height of equivocation | Must be equal to nodes own copy of the data         |
   344  | ValidatorPower   | int64         | Power of the equivocating validator at the height                  | Must be equal to the nodes own copy of the data     |
   345  | Timestamp        | [Time](#Time) | Time of the block where the equivocation occurred                  | Must be equal to the nodes own copy of the data     |
   346  
   347  ### LightClientAttackEvidence
   348  
   349  `LightClientAttackEvidence` is a generalized evidence that captures all forms of known attacks on
   350  a light client such that a full node can verify, propose and commit the evidence on-chain for
   351  punishment of the malicious validators. There are three forms of attacks: Lunatic, Equivocation
   352  and Amnesia. These attacks are exhaustive. You can find a more detailed overview of this [here](../light-client/accountability#the_misbehavior_of_faulty_validators)
   353  
   354  | Name                 | Type                               | Description                                                          | Validation                                                       |
   355  |----------------------|------------------------------------|----------------------------------------------------------------------|------------------------------------------------------------------|
   356  | ConflictingBlock     | [LightBlock](#LightBlock)          | Read Below                                                           | Must adhere to the validation rules of [lightBlock](#lightblock) |
   357  | CommonHeight         | int64                              | Read Below                                                           | must be > 0                                                      |
   358  | Byzantine Validators | Array of [Validators](#Validators) | validators that acted maliciously                                    | Read Below                                                       |
   359  | TotalVotingPower     | int64                              | The total power of the validator set at the height of the infraction | Must be equal to the nodes own copy of the data                  |
   360  | Timestamp            | [Time](#Time)                      | Time of the block where the infraction occurred                      | Must be equal to the nodes own copy of the data                  |
   361  
   362  ## LightBlock
   363  
   364  LightBlock is the core data structure of the [light client](../light-client/README.md). It combines two data structures needed for verification ([signedHeader](#signedheader) & [validatorSet](#validatorset)).
   365  
   366  | Name         | Type                          | Description                                                                                                                            | Validation                                                                          |
   367  |--------------|-------------------------------|----------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------|
   368  | SignedHeader | [SignedHeader](#signedheader) | The header and commit, these are used for verification purposes. To find out more visit [light client docs](../light-client/README.md) | Must not be nil and adhere to the validation rules of [signedHeader](#signedheader) |
   369  | ValidatorSet | [ValidatorSet](#validatorset) | The validatorSet is used to help with verify that the validators in that committed the infraction were truly in the validator set.     | Must not be nil and adhere to the validation rules of [validatorSet](#validatorset) |
   370  
   371  The `SignedHeader` and `ValidatorSet` are linked by the hash of the validator set(`SignedHeader.ValidatorsHash == ValidatorSet.Hash()`.
   372  
   373  ## SignedHeader
   374  
   375  The SignedhHeader is the [header](#header) accompanied by the commit to prove it.
   376  
   377  | Name   | Type              | Description       | Validation                                                                        |
   378  |--------|-------------------|-------------------|-----------------------------------------------------------------------------------|
   379  | Header | [Header](#Header) | [Header](#header) | Header cannot be nil and must adhere to the [Header](#Header) validation criteria |
   380  | Commit | [Commit](#commit) | [Commit](#commit) | Commit cannot be nil and must adhere to the [Commit](#commit) criteria            |
   381  
   382  ## ValidatorSet
   383  
   384  | Name       | Type                             | Description                                        | Validation                                                                                                        |
   385  |------------|----------------------------------|----------------------------------------------------|-------------------------------------------------------------------------------------------------------------------|
   386  | Validators | Array of [validator](#validator) | List of the active validators at a specific height | The list of validators can not be empty or nil and must adhere to the validation rules of [validator](#validator) |
   387  | Proposer   | [validator](#validator)          | The block proposer for the corresponding block     | The proposer cannot be nil and must adhere to the validation rules of  [validator](#validator)                    |
   388  
   389  ## Validator
   390  
   391  | Name             | Type                      | Description                                                                                       | Validation                                        |
   392  |------------------|---------------------------|---------------------------------------------------------------------------------------------------|---------------------------------------------------|
   393  | Address          | [Address](#address)       | Validators Address                                                                                | Length must be of size 20                         |
   394  | Pubkey           | slice of bytes (`[]byte`) | Validators Public Key                                                                             | must be a length greater than 0                   |
   395  | VotingPower      | int64                     | Validators voting power                                                                           | cannot be < 0                                     |
   396  | ProposerPriority | int64                     | Validators proposer priority. This is used to gauge when a validator is up next to propose blocks | No validation, value can be negative and positive |
   397  
   398  ## Address
   399  
   400  Address is a type alias of a slice of bytes. The address is calculated by hashing the public key using sha256 and truncating it to only use the first 20 bytes of the slice.
   401  
   402  ```go
   403  const (
   404    TruncatedSize = 20
   405  )
   406  
   407  func SumTruncated(bz []byte) []byte {
   408    hash := sha256.Sum256(bz)
   409    return hash[:TruncatedSize]
   410  }
   411  ```
   412  
   413  ## ConsensusParams
   414  
   415  | Name      | Type                                | Description                                                                  | Field Number |
   416  |-----------|-------------------------------------|------------------------------------------------------------------------------|--------------|
   417  | block     | [BlockParams](#blockparams)         | Parameters limiting the size of a block and time between consecutive blocks. | 1            |
   418  | evidence  | [EvidenceParams](#evidenceparams)   | Parameters limiting the validity of evidence of byzantine behaviour.         | 2            |
   419  | validator | [ValidatorParams](#validatorparams) | Parameters limiting the types of public keys validators can use.             | 3            |
   420  | version   | [BlockParams](#blockparams)         | The ABCI application version.                                                | 4            |
   421  
   422  ### BlockParams
   423  
   424  | Name         | Type  | Description                                                                                                                                                                                                 | Field Number |
   425  |--------------|-------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------|
   426  | max_bytes    | int64 | Max size of a block, in bytes.                                                                                                                                                                              | 1            |
   427  | max_gas      | int64 | Max sum of `GasWanted` in a proposed block. NOTE: blocks that violate this may be committed if there are Byzantine proposers. It's the application's responsibility to handle this when processing a block! | 2            |
   428  
   429  ### EvidenceParams
   430  
   431  | Name               | Type                                                                                                                               | Description                                                                                                                                                                                                                                                                    | Field Number |
   432  |--------------------|------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------|
   433  | max_age_num_blocks | int64                                                                                                                              | Max age of evidence, in blocks.                                                                                                                                                                                                                                                | 1            |
   434  | max_age_duration   | [google.protobuf.Duration](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.Duration) | Max age of evidence, in time. It should correspond with an app's "unbonding period" or other similar mechanism for handling [Nothing-At-Stake attacks](https://github.com/ethereum/wiki/wiki/Proof-of-Stake-FAQ#what-is-the-nothing-at-stake-problem-and-how-can-it-be-fixed). | 2            |
   435  | max_bytes          | int64                                                                                                                              | maximum size in bytes of total evidence allowed to be entered into a block                                                                                                                                                                                                     | 3            |
   436  
   437  ### ValidatorParams
   438  
   439  | Name          | Type            | Description                                                           | Field Number |
   440  |---------------|-----------------|-----------------------------------------------------------------------|--------------|
   441  | pub_key_types | repeated string | List of accepted public key types. Uses same naming as `PubKey.Type`. | 1            |
   442  
   443  ### VersionParams
   444  
   445  | Name        | Type   | Description                   | Field Number |
   446  |-------------|--------|-------------------------------|--------------|
   447  | app_version | uint64 | The ABCI application version. | 1            |
   448  
   449  ## Proof
   450  
   451  | Name      | Type           | Description                                   | Field Number |
   452  |-----------|----------------|-----------------------------------------------|--------------|
   453  | total     | int64          | Total number of items.                        | 1            |
   454  | index     | int64          | Index item to prove.                          | 2            |
   455  | leaf_hash | bytes          | Hash of item value.                           | 3            |
   456  | aunts     | repeated bytes | Hashes from leaf's sibling to a root's child. | 4            |