Skip to content
This repository has been archived by the owner on Mar 24, 2023. It is now read-only.

Refactor header roots #12

Merged
merged 5 commits into from
Apr 7, 2020
Merged

Refactor header roots #12

merged 5 commits into from
Apr 7, 2020

Conversation

adlerjohn
Copy link
Member

@adlerjohn adlerjohn commented Apr 1, 2020

  • evidence root
  • validators/state roots

@adlerjohn adlerjohn added documentation Improvements or additions to documentation enhancement New feature or request labels Apr 1, 2020
@adlerjohn adlerjohn added this to the Pre-implementation draft milestone Apr 1, 2020
@adlerjohn adlerjohn self-assigned this Apr 1, 2020
@adlerjohn adlerjohn mentioned this pull request Apr 1, 2020
3 tasks
@adlerjohn
Copy link
Member Author

@liamsi Refactored the header to remove validator roots (both), and added a stateCommitment field, which is computed as hash(stateRoot, validatorRoot). Does this seem reasonable and in line with previous discussion? If yes, I'll update the data structures figure and flag this for review.

@liamsi
Copy link
Member

liamsi commented Apr 6, 2020

Still need to go through the tendermint changes required for this (celestiaorg/celestia-core#3) but independent of that this seems reasonable.

Question: Is hash in hash(stateRoot, validatorRoot) the same hash function as used for the sparse merkle tree that yields, e.g. stateRoot

@adlerjohn
Copy link
Member Author

Is hash in hash(stateRoot, validatorRoot) the same hash function as used for the sparse merkle tree that yields, e.g. stateRoot

Yes, my understanding is that only a single hash function is used everywhere (keccak-256).

@liamsi
Copy link
Member

liamsi commented Apr 6, 2020

Do we need to prefix the stateRoot and the validatorRoot with the tree's inner node prefix?

@adlerjohn
Copy link
Member Author

I don't think we need to prefix it with anything, since it's a fixed operation. But it wouldn't hurt to just prefix it, that way it might be easier to parse, as it can be interpreted as the parent node of two potentially-asymmetric subtrees.

@adlerjohn adlerjohn marked this pull request as ready for review April 7, 2020 00:53
@liamsi
Copy link
Member

liamsi commented Apr 7, 2020

From https://github.com/LazyLedger/lazyledger-specs/blob/adlerjohn-refactor_header_roots/specs/architecture.md

Transactions are signed and must be processed by clients to determine the validator set, while messages are un-signed data blobs that will usually represent an app's block data.

Didn't we settle on including messages inside of Tx?

@adlerjohn
Copy link
Member Author

Didn't we settle on including messages inside of Tx?

I don't think so? Txs that pay fees for a message to be included (not all txs do this, some just e.g. change the validator set) shouldn't include the binary data as part of the tx itself, otherwise some client profiles would have to fully download messages even if they don't care about them. For example, if I only care about the LazyLedger validator set, I can just ignore the entire message namespace. Txs should only include a commitment to a message.

@liamsi
Copy link
Member

liamsi commented Apr 7, 2020

I misunderstood the outcome of this discussion then: #2 (comment)

I thought it might be simple if we have a single Tx type type Tx {msg: Msg} and that model could also be used for validator set changes and everything.

This is kinda orthogonal to this PR. We can continue the discussion in a separate issue. If I want to include a Msg, what do I do / what happens (and if sending Tx{commitToMsg} and Message, is two operations couldn't I spam the network with unsigned messages that do not have a corresponding Tx)?

@adlerjohn
Copy link
Member Author

Transactions can certainly be sent around the network as Tx {amount, recipient, witness[, msgBytes]}, then encoded in the block as Tx{amount, recipient, witness[, msgID]} and Msg{msgBytes} (where msgID = hash(msgbytes), and can be computed before relaying the transaction).

The point of splitting up txs and msgs inside the block is that there can be users that want to ensure the integrity of the LazyLedger coin and make sure that the message data is available, but they don't care what the message data actually is.

@liamsi
Copy link
Member

liamsi commented Apr 7, 2020

Makes perfect sense inside the block! I was looking from an encoded on / decoded from the wire perspective I guess.

Copy link
Member

@liamsi liamsi left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@liamsi liamsi merged commit f556626 into master Apr 7, 2020
@liamsi liamsi deleted the adlerjohn-refactor_header_roots branch April 7, 2020 19:04
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
documentation Improvements or additions to documentation enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants