Skip to content
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 9 commits into from Oct 17, 2018
Merged

Conversation

ebuchman
Copy link
Contributor

@ebuchman ebuchman commented Oct 16, 2018

Implements part of ADR-016 - #2468.

  • Version structs to block.Header and State.
  • the change to the block.Header bumps all proto3 fields forward by one and increases the max size of blocks.
  • this does not yet include the ability for apps to signal or upgrade their protocol version.
  • does not include changes to P2P. See [WIP] p2p: node info sub-structs #2627 for first draft there
  • Updated all relevant documentation in docs
  • Updated all code comments where relevant
  • Wrote tests
  • Updated CHANGELOG_PENDING.md

@codecov-io
Copy link

codecov-io commented Oct 16, 2018

Codecov Report

Merging #2644 into develop will increase coverage by 0.13%.
The diff coverage is 61.11%.

@@             Coverage Diff             @@
##           develop    #2644      +/-   ##
===========================================
+ Coverage    61.29%   61.43%   +0.13%     
===========================================
  Files          203      203              
  Lines        16739    16757      +18     
===========================================
+ Hits         10261    10294      +33     
+ Misses        5611     5591      -20     
- Partials       867      872       +5
Impacted Files Coverage Δ
node/node.go 65.01% <0%> (-1.05%) ⬇️
state/validation.go 65.62% <100%> (+1.69%) ⬆️
state/execution.go 75.67% <100%> (+0.22%) ⬆️
state/state.go 91.57% <100%> (+0.27%) ⬆️
p2p/conn/connection.go 79.43% <0%> (-0.29%) ⬇️
libs/db/remotedb/grpcdb/server.go 0% <0%> (ø) ⬆️
consensus/reactor.go 71.87% <0%> (+0.25%) ⬆️
libs/db/remotedb/remotedb.go 41.52% <0%> (+4.68%) ⬆️

types/block.go Outdated
@@ -538,6 +543,9 @@ func (sh SignedHeader) ValidateBasic(chainID string) error {
if sh.Commit == nil {
return errors.New("SignedHeader missing commit (precommit votes).")
}

// TODO: Check Version?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will this be addressed in a followup issue?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whoops this is actually checked in the state.ValidateBlock so nothing to check here, can remove this comment

- `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.
Copy link
Contributor

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?

Copy link
Contributor Author

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.

Copy link
Contributor

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.

Copy link
Contributor

@melekes melekes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🍰 🌮 🍉

## Version

The `Version` contains the protocol version for the blockchain and the
application as two `uint64` values:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no need to duplicate type information imho

Suggested change
application as two `uint64` values:
application:

@ebuchman ebuchman merged commit 455d341 into develop Oct 17, 2018
@ebuchman ebuchman deleted the bucky/versions-adr-016 branch October 17, 2018 19:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants