mirror of
https://github.com/tendermint/tendermint.git
synced 2026-01-06 13:26:23 +00:00
ADR-016: Add versions to Block and State (#2644)
* types: add Version to Header * abci: add Version to Header * state: add Version to State * node: check software and state protocol versions match * update changelog * docs/spec: update for versions * state: more tests * remove TODOs * remove empty test
This commit is contained in:
@@ -338,6 +338,7 @@ Commit are included in the header of the next block.
|
||||
### Header
|
||||
|
||||
- **Fields**:
|
||||
- `Version (Version)`: Version of the blockchain and the application
|
||||
- `ChainID (string)`: ID of the blockchain
|
||||
- `Height (int64)`: Height of the block in the chain
|
||||
- `Time (google.protobuf.Timestamp)`: Time of the block. It is the proposer's
|
||||
@@ -363,6 +364,15 @@ Commit are included in the header of the next block.
|
||||
- Provides the proposer of the current block, for use in proposer-based
|
||||
reward mechanisms.
|
||||
|
||||
### Version
|
||||
|
||||
- **Fields**:
|
||||
- `Block (uint64)`: Protocol version of the blockchain data structures.
|
||||
- `App (uint64)`: Protocol version of the application.
|
||||
- **Usage**:
|
||||
- Block version should be static in the life of a blockchain.
|
||||
- App version may be updated over time by the application.
|
||||
|
||||
### Validator
|
||||
|
||||
- **Fields**:
|
||||
|
||||
@@ -8,6 +8,7 @@ The Tendermint blockchains consists of a short list of basic data types:
|
||||
|
||||
- `Block`
|
||||
- `Header`
|
||||
- `Version`
|
||||
- `BlockID`
|
||||
- `Time`
|
||||
- `Data` (for transactions)
|
||||
@@ -38,6 +39,7 @@ the data in the current block, the previous block, and the results returned by t
|
||||
```go
|
||||
type Header struct {
|
||||
// basic block info
|
||||
Version Version
|
||||
ChainID string
|
||||
Height int64
|
||||
Time Time
|
||||
@@ -65,6 +67,19 @@ type Header struct {
|
||||
|
||||
Further details on each of these fields is described below.
|
||||
|
||||
## Version
|
||||
|
||||
The `Version` contains the protocol version for the blockchain and the
|
||||
application as two `uint64` values:
|
||||
|
||||
```go
|
||||
type Version struct {
|
||||
Block uint64
|
||||
App uint64
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
## BlockID
|
||||
|
||||
The `BlockID` contains two distinct Merkle roots of the block.
|
||||
@@ -200,6 +215,15 @@ See [here](https://github.com/tendermint/tendermint/blob/master/docs/spec/blockc
|
||||
|
||||
A Header is valid if its corresponding fields are valid.
|
||||
|
||||
### Version
|
||||
|
||||
```
|
||||
block.Version.Block == state.Version.Block
|
||||
block.Version.App == state.Version.App
|
||||
```
|
||||
|
||||
The block version must match the state version.
|
||||
|
||||
### ChainID
|
||||
|
||||
```
|
||||
|
||||
@@ -15,6 +15,7 @@ validation.
|
||||
|
||||
```go
|
||||
type State struct {
|
||||
Version Version
|
||||
LastResults []Result
|
||||
AppHash []byte
|
||||
|
||||
|
||||
Reference in New Issue
Block a user