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

Implement state block version 2 #2899

Draft
wants to merge 21 commits into
base: develop
Choose a base branch
from

Conversation

wezrule
Copy link
Contributor

@wezrule wezrule commented Aug 28, 2020

This adds 5 new fields to the state block:

  1. Height - The height of the block
  2. Signer - Who signed the block? Either account owner or epoch currently.
  3. Link interpretation - How should the link field be interpreted? either send, receive or noop (change/epoch)
  4. Upgrade - Whether this block is upgrading an account, always set for open blocks
  5. Version - The version of the block
  • Changes to existing blocks updated with refresh() now update the block signature and changed function to rebuild()
  • Encapsulate block::account/block::height with using the sideband too, rather than checking block followed by checking sideband if it doesn't exist.
  • Epoch upgrades not required to be sequential anymore
  • A new function simple_block_validation () is used in various places which can do some rudimentary checks on state v2 blocks, anything which doesn't require ledger processing (of previous/source blocks for instance).
  • Ledger - epoch_link has a bit of a different meaning now. Self-signed epoch blocks are allowed, and epoch links were, but now the epoch link can be an account (for self-signed epochs), so passing the whole block in to a new function has_epoch_link which can determine if the link field belongs to an epoch link or a self-signed epoch.
  • Updated flatbuffer definitions and block builder to support state v2 blocks.
  • RPC - block_create, if "type" == "state2" the only required field is "link_interpretation" (being either "send", "receive" or "noop"). The rest of the fields can be implicitly determined assuming the previous block is in the ledger, if using a pruned node this will only work for frontier blocks. Also "version" has been changed to "work_version".

(Bug) - The public key used when verifying a send to an epoch link is the epoch account, so it will always fail signature validation currently

TSAN run was clean.

I have made a diagram of the core test ledger.state_blocks_v2 here:
State v2 (1)

@wezrule wezrule added documentation This item indicates the need for or supplies updated or expanded documentation major This item indicates the need for or supplies a major or notable change rpc Changes related to Remote Procedure Calls semantic Change to node APIs (separate label) which impacts interpretation of data, integrations impacted. labels Aug 28, 2020
@wezrule wezrule added this to the V22.0 milestone Aug 28, 2020
@wezrule wezrule self-assigned this Aug 28, 2020
nano/secure/ledger.cpp Outdated Show resolved Hide resolved
api/flatbuffers/nanoapi.fbs Outdated Show resolved Hide resolved
@guilhermelawless guilhermelawless removed their request for review January 17, 2021 18:43
@wezrule wezrule removed this from the V22.0 milestone Mar 1, 2021
@wezrule wezrule added this to the V23.0 milestone Mar 1, 2021
@rotilho
Copy link

rotilho commented Mar 16, 2021

What's the plan for this change? Will it be included in v22 or v23?

@wezrule
Copy link
Contributor Author

wezrule commented Mar 18, 2021

What's the plan for this change? Will it be included in v22 or v23?

It won't be in v22, on the right it states the milestone as v23 but it's possible to change.

@rotilho
Copy link

rotilho commented Mar 19, 2021

Crossing my fingers to be included in v23, this is one of the most positive additions IMO. I can see sooo many optimization after this change is deployed in the live net

Great job guys and @wezrule

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation This item indicates the need for or supplies updated or expanded documentation major This item indicates the need for or supplies a major or notable change rpc Changes related to Remote Procedure Calls semantic Change to node APIs (separate label) which impacts interpretation of data, integrations impacted.
Projects
Status: Research for Future
Development

Successfully merging this pull request may close these issues.

4 participants