-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ADR-016: Add versions to Block and State #2644
Merged
Merged
Changes from 7 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
b7e431a
types: add Version to Header
ebuchman 37e0304
abci: add Version to Header
ebuchman b0ee932
state: add Version to State
ebuchman 2390122
node: check software and state protocol versions match
ebuchman 1709ed6
update changelog
ebuchman 5390d18
docs/spec: update for versions
ebuchman 4d306f4
state: more tests
ebuchman 2bd5996
remove TODOs
ebuchman 648c95d
remove empty test
ebuchman File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -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: | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. no need to duplicate type information imho
Suggested change
|
||||||
|
||||||
```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 | ||||||
|
||||||
``` | ||||||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,6 +15,7 @@ validation. | |
|
||
```go | ||
type State struct { | ||
Version Version | ||
LastResults []Result | ||
AppHash []byte | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Question: Does that mean a block version can only be upgraded / changed via a fork?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's the idea for now. We can probably relax it somewhat later but needs more work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I definitely think this can be relaxed #postlaunch. My intuition is that only changes to the merkle tree structure absolutely require going back to genesis files, from a block version pov. Header formats and Block Structures can be changed in a live-upgrade, but probably shouldn't be due to how it would break a ton of other things.