The state contains information whose cryptographic digest is included in block headers, and thus is necessary for validating new blocks. For instance, the validators set and the results of transactions are never included in blocks, but their Merkle roots are - the state keeps track of them.
Note that the
State object itself is an implementation detail, since it is never
included in a block or gossiped over the network, and we never compute
its hash. Thus we do not include here details of how the
State object is
persisted or queried. That said, the types it contains are part of the specification, since
their Merkle roots are included in blocks and their values are used in
The chain ID and initial height are taken from the genesis file, and not changed again. The
initial height will be
1 in the typical case,
0 is an invalid value.
Note there is a hard-coded limit of 10000 validators. This is inherited from the limit on the number of votes in a commit.
State gets updated at the end of executing a block. Of specific interest is
ValidatorUpdates are used to add and remove validators to the current set as well as update
validator power. Setting validator power to 0 in
ValidatorUpdate will cause the validator to be
ConsensusParams are safely copied across (i.e. if a field is nil it gets ignored) and the
Data from the
ResponseCommit is used as the
Consensus contains the protocol version for the blockchain and the
The total size of a block is limited in bytes by the
Proposed blocks must be less than this size, and will be considered invalid
Blocks should additionally be limited by the amount of "gas" consumed by the transactions in the block, though this is not yet implemented.
For evidence in a block to be valid, it must satisfy:
A block must not contain more than
ConsensusParams.Evidence.MaxBytes of evidence. This is
implemented to mitigate spam attacks.
Validators from genesis file and
ResponseEndBlock must have pubkeys of type ∈