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

Commit

Permalink
Merge pull request #12 from LazyLedger/adlerjohn-refactor_header_roots
Browse files Browse the repository at this point in the history
Refactor header roots
  • Loading branch information
liamsi authored Apr 7, 2020
2 parents 326c739 + 7c85201 commit f556626
Show file tree
Hide file tree
Showing 3 changed files with 97 additions and 115 deletions.
70 changes: 34 additions & 36 deletions specs/data_structures.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ Data Structures
- [Header](#header)
- [AvailableDataHeader](#availabledataheader)
- [AvailableData](#availabledata)
- [EvidenceData](#evidencedata)
- [Commit](#commit)
- [Time](#time)
- [BlockID](#blockid)
- [HashDigest](#hashdigest)
- [Address](#address)
- [Evidence](#evidence)
- [EvidenceData](#evidencedata)
- [CommitSig](#commitsig)
- [Evidence](#evidence)
- [PublicKey](#publickey)
- [Vote](#vote)
- [Signature](#signature)
Expand Down Expand Up @@ -44,27 +44,24 @@ Blocks are the top-level data structure of the LazyLedger blockchain.
| `header` | [Header](#header) | Block header. Contains primarily identification info and commitments. |
| `availableDataHeader` | [AvailableDataHeader](#availabledataheader) | Header of available data. Contains commitments to erasure-coded data. |
| `availableData` | [AvailableData](#availabledata) | Data that is erasure-coded for availability. |
| `evidence` | [EvidenceData](#evidencedata) | Evidence used for slashing conditions (e.g. equivocation). |
| `lastCommit` | [Commit](#commit) | Previous block's Tendermint commit. |

## Header

Block header, which is fully downloaded by both full clients and light clients.

| name | type | description |
| -------------------- | ------------------------- | ------------------------------------------------------------------ |
| `version` | `uint64` | Version of the LazyLedger chain. |
| `chainID` | `uint64` | Chain ID. Each fork assigns itself a (unique) ID. |
| `height` | `uint64` | Block height. The genesis block is at height `1`. |
| `time` | [Time](#time) | Timestamp of this block. |
| `lastBlockID` | [BlockID](#blockid) | Previous block's ID. |
| `lastCommitRoot` | [HashDigest](#hashdigest) | Previous block's Tendermint commit root. |
| `validatorsRoot` | [HashDigest](#hashdigest) | Validator set root for this block. |
| `nextValidatorsRoot` | [HashDigest](#hashdigest) | Root of the next block's validator set. |
| `consensusHash` | [HashDigest](#hashdigest) | Consensus parameters for this block. |
| `evidenceRoot` | [HashDigest](#hashdigest) | Evidence data root. |
| `availableDataRoot` | [HashDigest](#hashdigest) | Root of [commitments to erasure-coded data](#availabledataheader). |
| `proposerAddress` | [Address](#address) | Address of this block's proposer. |
| name | type | description |
| ------------------- | ------------------------- | -------------------------------------------------------------------------------------------- |
| `version` | `uint64` | Version of the LazyLedger chain. |
| `chainID` | `uint64` | Chain ID. Each fork assigns itself a (unique) ID. |
| `height` | `uint64` | Block height. The genesis block is at height `1`. |
| `time` | [Time](#time) | Timestamp of this block. |
| `lastBlockID` | [BlockID](#blockid) | Previous block's ID. |
| `lastCommitRoot` | [HashDigest](#hashdigest) | Previous block's Tendermint commit root. |
| `consensusHash` | [HashDigest](#hashdigest) | Consensus parameters for this block. |
| `stateCommitment` | [HashDigest](#hashdigest) | Commitment to state root and validator set root after this block's transactions are applied. |
| `availableDataRoot` | [HashDigest](#hashdigest) | Root of [commitments to erasure-coded data](#availabledataheader). |
| `proposerAddress` | [Address](#address) | Address of this block's proposer. |

## AvailableDataHeader

Expand All @@ -76,19 +73,12 @@ Block header, which is fully downloaded by both full clients and light clients.

Data that is [erasure-coded](#erasure-coding) for [data availability checks](https://arxiv.org/abs/1809.09044).

| name | type | description |
| ------------------------ | ----------------------------------- | ----------------------------------------------- |
| `transactionData` | [TransactionData](#transactiondata) | Transaction data. |
| `intermediateStateRoots` | [HashDigest](#hashdigest) | Intermediate state roots used for fraud proofs. |
| `messageData` | [MessageData](#messagedata) | Message data. |

## EvidenceData

Wrapper for evidence data.

| name | type | description |
| ---------- | ------------------------- | ---------------------------------------------- |
| `evidence` | [Evidence](#evidence)`[]` | List of evidence used for slashing conditions. |
| name | type | description |
| ------------------------ | ----------------------------------- | ---------------------------------------------------------- |
| `transactionData` | [TransactionData](#transactiondata) | Transaction data. |
| `intermediateStateRoots` | [HashDigest](#hashdigest) | Intermediate state roots used for fraud proofs. |
| `evidenceData` | [EvidenceData](#evidencedata) | Evidence used for slashing conditions (e.g. equivocation). |
| `messageData` | [MessageData](#messagedata) | Message data. |

## Commit

Expand Down Expand Up @@ -127,13 +117,13 @@ Output of the [hashing](#hashing) function. Exactly 256 bits (32 bytes) long.

Addresses are the last `20` bytes of the [hash](#hashing) [digest](#hashdigest) of the [public key](#publickey).

## Evidence
## EvidenceData

| name | type | description |
| -------- | ----------------------- | ----------- |
| `pubKey` | [PublicKey](#publickey) | |
| `voteA` | [Vote](#vote) | |
| `voteB` | [Vote](#vote) | |
Wrapper for evidence data.

| name | type | description |
| ----------- | ------------------------- | ---------------------------------------------- |
| `evidences` | [Evidence](#evidence)`[]` | List of evidence used for slashing conditions. |

## CommitSig

Expand All @@ -152,6 +142,14 @@ enum BlockIDFlag : uint8_t {
| `timestamp` | [Time](#time) | |
| `signature` | [Signature](#signature) | |

## Evidence

| name | type | description |
| -------- | ----------------------- | ----------- |
| `pubKey` | [PublicKey](#publickey) | |
| `voteA` | [Vote](#vote) | |
| `voteB` | [Vote](#vote) | |

## PublicKey

| name | type | description |
Expand Down
14 changes: 4 additions & 10 deletions specs/figures/block_data_structures.dot
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,12 @@ digraph G {

subgraph cluster_lastcommit {
label = "lastCommit";
struct5 [label = "{lastCommit}"];
}

subgraph cluster_evidence {
label = "evidence";
struct4 [label = "{evidence}"];
struct4 [label = "{lastCommit}"];
}

subgraph cluster_body {
label = "availableData";
struct3 [label = "{<f0> transactionData | <f1> messageData}"];
struct3 [label = "{ | { transactionData | intermediateStateRoots | evidenceData | messageData } }"];
}

subgraph cluster_availableheader {
Expand All @@ -27,15 +22,14 @@ digraph G {

subgraph cluster_header {
label = "header";
struct1 [label = "version | chainID | height | time | lastBlockID | lastCommitRoot | validatorsRoot | nextValidatorsRoot | consensusHash | evidenceRoot | <f10> availableDataRoot | proposerAddress"];
struct1 [label = "version | chainID | height | time | lastBlockID | lastCommitRoot | consensusHash | stateCommitment | <f8> availableDataRoot | proposerAddress"];
}
}

struct1:f10 -> struct2;
struct1:f8 -> struct2;
struct2:f0 -> struct3;

edge [style = invis];
struct1 -> struct3;
struct1 -> struct4;
struct1 -> struct5;
}
Loading

0 comments on commit f556626

Please sign in to comment.