github.com/ari-anchor/sei-tendermint@v0.0.0-20230519144642-dc826b7b56bb/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      - [SynchronyParams](#synchronyparams)
    40      - [TimeoutParams](#timeoutparams)
    41    - [Proof](#proof)
    42  
    43  ## Block
    44  
    45  A block consists of a header, transactions, votes (the commit),
    46  and a list of evidence of malfeasance (ie. signing conflicting votes).
    47  
    48  | Name   | Type              | Description                                                                                                                                                                          | Validation                                               |
    49  |--------|-------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------|
    50  | 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) |
    51  | 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).
    52  | Evidence   | [EvidenceList](#evidencelist) | Evidence contains a list of infractions committed by validators.                                                                                                                     | Can be empty, but when populated the validations rules from [evidenceList](#evidencelist) apply |
    53  | 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).  |
    54  
    55  ## Execution
    56  
    57  Once a block is validated, it can be executed against the state.
    58  
    59  The state follows this recursive equation:
    60  
    61  ```go
    62  state(initialHeight) = InitialState
    63  state(h+1) <- Execute(state(h), ABCIApp, block(h))
    64  ```
    65  
    66  where `InitialState` includes the initial consensus parameters and validator set,
    67  and `ABCIApp` is an ABCI application that can return results and changes to the validator
    68  set (TODO). Execute is defined as:
    69  
    70  ```go
    71  func Execute(s State, app ABCIApp, block Block) State {
    72   // Fuction ApplyBlock executes block of transactions against the app and returns the new root hash of the app state,
    73   // modifications to the validator set and the changes of the consensus parameters.
    74   AppHash, ValidatorChanges, ConsensusParamChanges := app.ApplyBlock(block)
    75  
    76   nextConsensusParams := UpdateConsensusParams(state.ConsensusParams, ConsensusParamChanges)
    77   return State{
    78    ChainID:         state.ChainID,
    79    InitialHeight:   state.InitialHeight,
    80    LastResults:     abciResponses.DeliverTxResults,
    81    AppHash:         AppHash,
    82    InitialHeight:   state.InitialHeight,
    83    LastValidators:  state.Validators,
    84    Validators:      state.NextValidators,
    85    NextValidators:  UpdateValidators(state.NextValidators, ValidatorChanges),
    86    ConsensusParams: nextConsensusParams,
    87    Version: {
    88     Consensus: {
    89      AppVersion: nextConsensusParams.Version.AppVersion,
    90     },
    91    },
    92   }
    93  }
    94  ```
    95  
    96  Validating a new block is first done prior to the `prevote`, `precommit` & `finalizeCommit` stages.
    97  
    98  The steps to validate a new block are:
    99  
   100  - Check the validity rules of the block and its fields.
   101  - Check the versions (Block & App) are the same as in local state.
   102  - Check the chainID's match.
   103  - Check the height is correct.
   104  - Check the `LastBlockID` corresponds to BlockID currently in state.
   105  - Check the hashes in the header match those in state.
   106  - Verify the LastCommit against state, this step is skipped for the initial height.
   107      - This is where checking the signatures correspond to the correct block will be made.
   108  - Make sure the proposer is part of the validator set.
   109  - Validate bock time.
   110      - Make sure the new blocks time is after the previous blocks time.
   111      - Calculate the medianTime and check it against the blocks time.
   112      - If the blocks height is the initial height then check if it matches the genesis time.
   113  - Validate the evidence in the block. Note: Evidence can be empty
   114  
   115  ## Header
   116  
   117  A block header contains metadata about the block and about the consensus, as well as commitments to
   118  the data in the current block, the previous block, and the results returned by the application:
   119  
   120  | Name              | Type                      | Description                                                                                                                                                                                                                                                                                                                                                                           | Validation                                                                                                                                                                                       |
   121  |-------------------|---------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
   122  | Version           | [Version](#version)       | Version defines the application and protocol version being used.                                                                                                                                                                                                                                                                                                                       | Must adhere to the validation rules of [Version](#version)                                                                                                                                       |
   123  | ChainID           | String                    | ChainID is the ID of the chain. This must be unique to your chain.                                                                                                                                                                                                                                                                                                                    | ChainID must be less than 50 bytes.                                                                                                                                                              |
   124  | Height            | uint64                     | Height is the height for this header.                                                                                                                                                                                                                                                                                                                                                 | Must be > 0, >= initialHeight, and == previous Height+1                                                                                                                                          |
   125  | 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). |
   126  | 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{}`.                                                                         |
   127  | 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                                                                                                                                                                            |
   128  | 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                                                                                                                                                                            |
   129  | 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                                                                                                                                                                            |
   130  | 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                                                                                                                                                                            |
   131  | ConsensusHash     | slice of bytes (`[]byte`) | Hash of the protobuf encoded consensus parameters.                                                                                                                                                                                                                                                                                                                                    | Must  be of length 32                                                                                                                                                                            |
   132  | 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.                                                                                                         |
   133  | 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.                                             |
   134  | EvidenceHash      | slice of bytes (`[]byte`) | MerkleRoot of the evidence of Byzantine behaviour included in this block.                                                                                                                                                                                                                                                                                                             | Must  be of length 32                                                                                                                                                                            |
   135  | 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                                                                                                                                                                            |
   136  
   137  ## Version
   138  
   139  NOTE: that this is more specifically the consensus version and doesn't include information like the
   140  P2P Version. (TODO: we should write a comprehensive document about
   141  versioning that this can refer to)
   142  
   143  | Name  | type   | Description                                                                                                     | Validation                                                                                                         |
   144  |-------|--------|-----------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------|
   145  | 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`) |
   146  | App   | uint64 | App version is decided on by the application. Read [here](../abci/abci.md#info)                                 | `block.Version.App == state.Version.Consensus.App`                                                                 |
   147  
   148  ## BlockID
   149  
   150  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))`)
   151  
   152  | Name          | Type                            | Description                                                                                                                                                      | Validation                                                             |
   153  |---------------|---------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------|
   154  | Hash          | slice of bytes (`[]byte`)       | MerkleRoot of all the fields in the header (ie. `MerkleRoot(header)`.                                                                                            | hash must be of length 32                                              |
   155  | 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) |
   156  
   157  See [MerkleRoot](./encoding.md#MerkleRoot) for details.
   158  
   159  ## PartSetHeader
   160  
   161  | Name  | Type                      | Description                       | Validation           |
   162  |-------|---------------------------|-----------------------------------|----------------------|
   163  | Total | int32                     | Total amount of parts for a block | Must be > 0          |
   164  | Hash  | slice of bytes (`[]byte`) | MerkleRoot of a serialized block  | Must be of length 32 |
   165  
   166  ## Part
   167  
   168  Part defines a part of a block. In Tendermint blocks are broken into `parts` for gossip.
   169  
   170  | Name  | Type            | Description                       | Validation           |
   171  |-------|-----------------|-----------------------------------|----------------------|
   172  | index | int32           | Total amount of parts for a block | Must be > 0          |
   173  | bytes | bytes           | MerkleRoot of a serialized block  | Must be of length 32 |
   174  | proof | [Proof](#proof) | MerkleRoot of a serialized block  | Must be of length 32 |
   175  
   176  ## Time
   177  
   178  Tendermint uses the [Google.Protobuf.Timestamp](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.Timestamp)
   179  format, which uses two integers, one 64 bit integer for Seconds and a 32 bit integer for Nanoseconds.
   180  
   181  ## Data
   182  
   183  Data is just a wrapper for a list of transactions, where transactions are arbitrary byte arrays:
   184  
   185  | Name | Type                       | Description            | Validation                                                                  |
   186  |------|----------------------------|------------------------|-----------------------------------------------------------------------------|
   187  | Txs  | Matrix of bytes ([][]byte) | Slice of transactions. | Validation does not occur on this field, this data is unknown to Tendermint |
   188  
   189  ## Commit
   190  
   191  Commit is a simple wrapper for a list of signatures, with one for each validator. It also contains the relevant BlockID, height and round:
   192  
   193  | Name       | Type                             | Description                                                          | Validation                                                                                               |
   194  |------------|----------------------------------|----------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------|
   195  | Height     | uint64                            | Height at which this commit was created.                             | Must be > 0                                                                                              |
   196  | Round      | int32                            | Round that the commit corresponds to.                                | Must be > 0                                                                                              |
   197  | BlockID    | [BlockID](#blockid)              | The blockID of the corresponding block.                              | Must adhere to the validation rules of [BlockID](#blockid).                                              |
   198  | 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) |
   199  
   200  ## CommitSig
   201  
   202  `CommitSig` represents a signature of a validator, who has voted either for nil,
   203  a particular `BlockID` or was absent. It's a part of the `Commit` and can be used
   204  to reconstruct the vote set given the validator set.
   205  
   206  | Name             | Type                        | Description                                                                                                                                                     | Validation                                                        |
   207  |------------------|-----------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------|
   208  | 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 |
   209  | ValidatorAddress | [Address](#address)         | Address of the validator                                                                                                                                        | Must be of length 20                                              |
   210  | Timestamp        | [Time](#time)               | This field will vary from `CommitSig` to `CommitSig`. It represents the timestamp of the validator.                                                             | [Time](#time)                                                     |
   211  | Signature        | [Signature](#signature)     | Signature corresponding to the validators participation in consensus.                                                                                           | The length of the signature must be > 0 and < than  64            |
   212  
   213  NOTE: `ValidatorAddress` and `Timestamp` fields may be removed in the future
   214  (see [ADR-25](https://github.com/tendermint/tendermint/blob/master/docs/architecture/adr-025-commit.md)).
   215  
   216  ## BlockIDFlag
   217  
   218  BlockIDFlag represents which BlockID the [signature](#commitsig) is for.
   219  
   220  ```go
   221  enum BlockIDFlag {
   222    BLOCK_ID_FLAG_UNKNOWN = 0;
   223    BLOCK_ID_FLAG_ABSENT  = 1; // signatures for other blocks are also considered absent
   224    BLOCK_ID_FLAG_COMMIT  = 2;
   225    BLOCK_ID_FLAG_NIL     = 3;
   226  }
   227  ```
   228  
   229  ## Vote
   230  
   231  A vote is a signed message from a validator for a particular block.
   232  The vote includes information about the validator signing it. When stored in the blockchain or propagated over the network, votes are encoded in Protobuf.
   233  The vote extension is not part of the [`CanonicalVote`](#canonicalvote).
   234  
   235  | Name               | Type                            | Description                                                                                 | Validation                                                                                           |
   236  |--------------------|---------------------------------|---------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------|
   237  | Type               | [SignedMsgType](#signedmsgtype) | Either prevote or precommit. [SignedMsgType](#signedmsgtype)                                | A Vote is valid if its corresponding fields are included in the enum [signedMsgType](#signedmsgtype) |
   238  | Height             | uint64                          | Height for which this vote was created.                                                 | Must be > 0                                                                                          |
   239  | Round              | int32                           | Round that the commit corresponds to.                                                       | Must be > 0                                                                                          |
   240  | BlockID            | [BlockID](#blockid)             | The blockID of the corresponding block.                                                     | [BlockID](#blockid)                                                                                  |
   241  | Timestamp          | [Time](#time)                   | The time at which a validator signed.                                  | [Time](#time)                                                                                        |
   242  | ValidatorAddress   | slice of bytes (`[]byte`)       | Address of the validator                                                                    | Length must be equal to 20                                                                           |
   243  | ValidatorIndex     | int32                           | Index at a specific block height that corresponds to the Index of the validator in the set. | must be > 0                                                                                          |
   244  | 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                                                             |
   245  | Extension          | slice of bytes (`[]byte`)       | The vote extension provided by the Application. Only valid for precommit messages.          | Length must be 0 if Type != `SIGNED_MSG_TYPE_PRECOMMIT`                                              |
   246  | ExtensionSignature | slice of bytes (`[]byte`)       | Signature by the validator if they participated in consensus for the associated bock.       | Length must be 0 if Type != `SIGNED_MSG_TYPE_PRECOMMIT`; else length must be > 0 and < 64            |
   247  
   248  ## CanonicalVote
   249  
   250  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
   251  the fields.
   252  
   253  ```proto
   254  message CanonicalVote {
   255    SignedMsgType             type      = 1;
   256    fixed64                   height    = 2;
   257    sfixed64                  round     = 3;
   258    CanonicalBlockID          block_id  = 4;
   259    google.protobuf.Timestamp timestamp = 5;
   260    string                    chain_id  = 6;
   261  }
   262  ```
   263  
   264  For signing, votes are represented via [`CanonicalVote`](#canonicalvote) and also encoded using protobuf via
   265  `type.SignBytes` which includes the `ChainID`, and uses a different ordering of
   266  the fields.
   267  
   268  We define a method `Verify` that returns `true` if the signature verifies against the pubkey for the `SignBytes`
   269  using the given ChainID:
   270  
   271  ```go
   272  func (vote *Vote) Verify(chainID string, pubKey crypto.PubKey) error {
   273   if !bytes.Equal(pubKey.Address(), vote.ValidatorAddress) {
   274    return ErrVoteInvalidValidatorAddress
   275   }
   276  
   277   if !pubKey.VerifyBytes(types.VoteSignBytes(chainID), vote.Signature) {
   278    return ErrVoteInvalidSignature
   279   }
   280   return nil
   281  }
   282  ```
   283  
   284  ## Proposal
   285  
   286  Proposal contains height and round for which this proposal is made, BlockID as a unique identifier
   287  of proposed block, timestamp, and POLRound (a so-called Proof-of-Lock (POL) round) that is needed for
   288  termination of the consensus. If POLRound >= 0, then BlockID corresponds to the block that
   289  is locked in POLRound. The message is signed by the validator private key.
   290  
   291  | Name      | Type                            | Description                                                                           | Validation                                              |
   292  |-----------|---------------------------------|---------------------------------------------------------------------------------------|---------------------------------------------------------|
   293  | Type      | [SignedMsgType](#signedmsgtype) | Represents a Proposal [SignedMsgType](#signedmsgtype)                                 | Must be `ProposalType`  [signedMsgType](#signedmsgtype) |
   294  | Height    | uint64                           | Height for which this vote was created for                                            | Must be > 0                                             |
   295  | Round     | int32                           | Round that the commit corresponds to.                                                 | Must be > 0                                             |
   296  | POLRound  | int64                           | Proof of lock                                                                         | Must be > 0                                             |
   297  | BlockID   | [BlockID](#blockid)             | The blockID of the corresponding block.                                               | [BlockID](#blockid)                                     |
   298  | Timestamp | [Time](#time)                   | Timestamp represents the time at which a validator signed.                            | [Time](#time)                                           |
   299  | 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                |
   300  
   301  ## SignedMsgType
   302  
   303  Signed message type represents a signed messages in consensus.
   304  
   305  ```proto
   306  enum SignedMsgType {
   307  
   308    SIGNED_MSG_TYPE_UNKNOWN = 0;
   309    // Votes
   310    SIGNED_MSG_TYPE_PREVOTE   = 1;
   311    SIGNED_MSG_TYPE_PRECOMMIT = 2;
   312  
   313    // Proposal
   314    SIGNED_MSG_TYPE_PROPOSAL = 32;
   315  }
   316  ```
   317  
   318  ## Signature
   319  
   320  Signatures in Tendermint are raw bytes representing the underlying signature.
   321  
   322  See the [signature spec](./encoding.md#key-types) for more.
   323  
   324  ## EvidenceList
   325  
   326  EvidenceList is a simple wrapper for a list of evidence:
   327  
   328  | Name     | Type                           | Description                            | Validation                                                      |
   329  |----------|--------------------------------|----------------------------------------|-----------------------------------------------------------------|
   330  | Evidence | Array of [Evidence](#evidence) | List of verified [evidence](#evidence) | Validation adheres to individual types of [Evidence](#evidence) |
   331  
   332  ## Evidence
   333  
   334  Evidence in Tendermint is used to indicate breaches in the consensus by a validator.
   335  
   336  More information on how evidence works in Tendermint can be found [here](../consensus/evidence.md)
   337  
   338  ### DuplicateVoteEvidence
   339  
   340  `DuplicateVoteEvidence` represents a validator that has voted for two different blocks
   341  in the same round of the same height. Votes are lexicographically sorted on `BlockID`.
   342  
   343  | Name             | Type          | Description                                                        | Validation                                          |
   344  |------------------|---------------|--------------------------------------------------------------------|-----------------------------------------------------|
   345  | VoteA            | [Vote](#vote) | One of the votes submitted by a validator when they equivocated    | VoteA must adhere to [Vote](#vote) validation rules |
   346  | VoteB            | [Vote](#vote) | The second vote submitted by a validator when they equivocated     | VoteB must adhere to [Vote](#vote) validation rules |
   347  | TotalVotingPower | int64         | The total power of the validator set at the height of equivocation | Must be equal to nodes own copy of the data         |
   348  | ValidatorPower   | int64         | Power of the equivocating validator at the height                  | Must be equal to the nodes own copy of the data     |
   349  | Timestamp        | [Time](#time) | Time of the block where the equivocation occurred                  | Must be equal to the nodes own copy of the data     |
   350  
   351  ### LightClientAttackEvidence
   352  
   353  `LightClientAttackEvidence` is a generalized evidence that captures all forms of known attacks on
   354  a light client such that a full node can verify, propose and commit the evidence on-chain for
   355  punishment of the malicious validators. There are three forms of attacks: Lunatic, Equivocation
   356  and Amnesia. These attacks are exhaustive. You can find a more detailed overview of this [here](../light-client/accountability#the_misbehavior_of_faulty_validators)
   357  
   358  | Name                 | Type                             | Description                                                          | Validation                                                       |
   359  |----------------------|----------------------------------|----------------------------------------------------------------------|------------------------------------------------------------------|
   360  | ConflictingBlock     | [LightBlock](#lightblock)        | Read Below                                                           | Must adhere to the validation rules of [lightBlock](#lightblock) |
   361  | CommonHeight         | int64                            | Read Below                                                           | must be > 0                                                      |
   362  | Byzantine Validators | Array of [Validator](#validator) | validators that acted maliciously                                    | Read Below                                                       |
   363  | 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                  |
   364  | Timestamp            | [Time](#time)                    | Time of the block where the infraction occurred                      | Must be equal to the nodes own copy of the data                  |
   365  
   366  ## LightBlock
   367  
   368  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)).
   369  
   370  | Name         | Type                          | Description                                                                                                                            | Validation                                                                          |
   371  |--------------|-------------------------------|----------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------|
   372  | 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) |
   373  | 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) |
   374  
   375  The `SignedHeader` and `ValidatorSet` are linked by the hash of the validator set(`SignedHeader.ValidatorsHash == ValidatorSet.Hash()`.
   376  
   377  ## SignedHeader
   378  
   379  The SignedhHeader is the [header](#header) accompanied by the commit to prove it.
   380  
   381  | Name   | Type              | Description       | Validation                                                                        |
   382  |--------|-------------------|-------------------|-----------------------------------------------------------------------------------|
   383  | Header | [Header](#header) | [Header](#header) | Header cannot be nil and must adhere to the [Header](#header) validation criteria |
   384  | Commit | [Commit](#commit) | [Commit](#commit) | Commit cannot be nil and must adhere to the [Commit](#commit) criteria            |
   385  
   386  ## ValidatorSet
   387  
   388  | Name       | Type                             | Description                                        | Validation                                                                                                        |
   389  |------------|----------------------------------|----------------------------------------------------|-------------------------------------------------------------------------------------------------------------------|
   390  | 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) |
   391  | 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)                    |
   392  
   393  ## Validator
   394  
   395  | Name             | Type                      | Description                                                                                       | Validation                                        |
   396  |------------------|---------------------------|---------------------------------------------------------------------------------------------------|---------------------------------------------------|
   397  | Address          | [Address](#address)       | Validators Address                                                                                | Length must be of size 20                         |
   398  | Pubkey           | slice of bytes (`[]byte`) | Validators Public Key                                                                             | must be a length greater than 0                   |
   399  | VotingPower      | int64                     | Validators voting power                                                                           | cannot be < 0                                     |
   400  | 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 |
   401  
   402  ## Address
   403  
   404  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.
   405  
   406  ```go
   407  const (
   408    TruncatedSize = 20
   409  )
   410  
   411  func SumTruncated(bz []byte) []byte {
   412    hash := sha256.Sum256(bz)
   413    return hash[:TruncatedSize]
   414  }
   415  ```
   416  
   417  ## ConsensusParams
   418  
   419  | Name      | Type                                | Description                                                                  | Field Number |
   420  |-----------|-------------------------------------|------------------------------------------------------------------------------|--------------|
   421  | block     | [BlockParams](#blockparams)         | Parameters limiting the size of a block and time between consecutive blocks. | 1            |
   422  | evidence  | [EvidenceParams](#evidenceparams)   | Parameters limiting the validity of evidence of byzantine behaviour.         | 2            |
   423  | validator | [ValidatorParams](#validatorparams) | Parameters limiting the types of public keys validators can use.             | 3            |
   424  | version   | [BlockParams](#blockparams)         | The ABCI application version.                                                | 4            |
   425  
   426  ### BlockParams
   427  
   428  | Name         | Type  | Description                                                                                                                                                                                                 | Field Number |
   429  |--------------|-------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------|
   430  | max_bytes    | int64 | Max size of a block, in bytes.                                                                                                                                                                              | 1            |
   431  | 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            |
   432  | recheck_tx   | bool  | Indicated whether to run `CheckTx` on all remaining transactions *after* every execution of a block | 3            |
   433  
   434  ### EvidenceParams
   435  
   436  | Name               | Type                                                                                                                               | Description                                                                                                                                                                                                                                                                    | Field Number |
   437  |--------------------|------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------|
   438  | max_age_num_blocks | int64                                                                                                                              | Max age of evidence, in blocks.                                                                                                                                                                                                                                                | 1            |
   439  | 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            |
   440  | max_bytes          | int64                                                                                                                              | maximum size in bytes of total evidence allowed to be entered into a block                                                                                                                                                                                                     | 3            |
   441  
   442  ### ValidatorParams
   443  
   444  | Name          | Type            | Description                                                           | Field Number |
   445  |---------------|-----------------|-----------------------------------------------------------------------|--------------|
   446  | pub_key_types | repeated string | List of accepted public key types. Uses same naming as `PubKey.Type`. | 1            |
   447  
   448  ### VersionParams
   449  
   450  | Name        | Type   | Description                   | Field Number |
   451  |-------------|--------|-------------------------------|--------------|
   452  | app_version | uint64 | The ABCI application version. | 1            |
   453  
   454  ### SynchronyParams
   455  
   456  | Name          | Type   | Description                   | Field Number |
   457  |---------------|--------|-------------------------------|--------------|
   458  | message_delay | [google.protobuf.Duration](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.Duration) | Bound for how long a proposal message may take to reach all validators on a newtork and still be considered valid. | 1            |
   459  | precision     | [google.protobuf.Duration](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.Duration) | Bound for how skewed a proposer's clock may be from any validator on the network while still producing valid proposals. | 2            |
   460  
   461  ### TimeoutParams
   462  
   463  | Name          | Type   | Description                   | Field Number |
   464  |---------------|--------|-------------------------------|--------------|
   465  | propose | [google.protobuf.Duration](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.Duration) | Parameter that, along with propose_delta, configures the timeout for the propose step of the consensus algorithm. | 1 |
   466  | propose_delta | [google.protobuf.Duration](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.Duration) | Parameter that, along with propose, configures the timeout for the propose step of the consensus algorithm. | 2 |
   467  | vote | [google.protobuf.Duration](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.Duration)| Parameter that, along with vote_delta, configures the timeout for the prevote and precommit step of the consensus algorithm. | 3 |
   468  | vote_delta | [google.protobuf.Duration](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.Duration)| Parameter that, along with vote, configures the timeout for the prevote and precommit step of the consensus algorithm. | 4 |
   469  | commit | [google.protobuf.Duration](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.Duration) | Parameter that configures how long Tendermint will wait after receiving a quorum of precommits before beginning consensus for the next height.| 5 |
   470  | bypass_commit_timeout | bool | Parameter that, if enabled, configures the node to proceed immediately to the next height once the node has received all precommits for a block, forgoing the commit timeout. |  6  |
   471  
   472  ## Proof
   473  
   474  | Name      | Type           | Description                                   | Field Number |
   475  |-----------|----------------|-----------------------------------------------|--------------|
   476  | total     | int64          | Total number of items.                        | 1            |
   477  | index     | int64          | Index item to prove.                          | 2            |
   478  | leaf_hash | bytes          | Hash of item value.                           | 3            |
   479  | aunts     | repeated bytes | Hashes from leaf's sibling to a root's child. | 4            |