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

Initial consensus rules #89

Merged
merged 52 commits into from
Nov 27, 2020
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
e8ab530
Organize consensus constants alphabetically.
adlerjohn Oct 27, 2020
b9cb328
Rename lastCommitRoot -> lastCommitHash.
adlerjohn Oct 27, 2020
96d7173
Add basic rules for header validity.
adlerjohn Oct 28, 2020
fc1adaa
Clarify serialization with deterministic protobuf.
adlerjohn Nov 3, 2020
09645e1
Add some info on parsing checks.
adlerjohn Nov 4, 2020
530e254
Split up logic around available data acquisition.
adlerjohn Nov 4, 2020
e1b4399
Clean up headings and notation.
adlerjohn Nov 4, 2020
5cd25ed
Add rules for available data header.
adlerjohn Nov 5, 2020
d48d262
Clarify available data header rules.
adlerjohn Nov 5, 2020
19fc54b
Add rules for last commit.
adlerjohn Nov 10, 2020
56ca555
Clean up, add initial available data setup.
adlerjohn Nov 10, 2020
f8c51f2
Fix bad links.
adlerjohn Nov 10, 2020
777cc69
Add rule for available data.
adlerjohn Nov 10, 2020
08a61d7
Merge branch 'master' into adlerjohn-initial_consensus_rules
adlerjohn Nov 10, 2020
0adcc79
Refactor available data original size field.
adlerjohn Nov 11, 2020
5a75720
Minor cleanup for data structures figure.
adlerjohn Nov 11, 2020
b566ec0
Add rule for lengths available data lists.
adlerjohn Nov 11, 2020
e2d3866
Clean up.
adlerjohn Nov 11, 2020
6ef8083
Clean up.
adlerjohn Nov 11, 2020
4d49b4a
Add minor introduction for state transitions.
adlerjohn Nov 11, 2020
de21ed0
Clarify how available data is parsed.
adlerjohn Nov 11, 2020
3e28226
Fix available data header rows and cols roots.
adlerjohn Nov 11, 2020
355553c
Add rules for basic validation of transaction data.
adlerjohn Nov 15, 2020
f3e1864
Reorganize headers.
adlerjohn Nov 15, 2020
8e01879
Add skeleton for processing transactions.
adlerjohn Nov 15, 2020
49fa3b3
Minor wording fix.
adlerjohn Nov 15, 2020
974b5fb
Fix bad link.
adlerjohn Nov 16, 2020
4f4971b
Add state access shorthand for use with state transitions.
adlerjohn Nov 17, 2020
c90a5d9
Add some partial rules for txs.
adlerjohn Nov 18, 2020
d0b9b86
Remove pay for padding tx.
adlerjohn Nov 18, 2020
343a3f7
Make padding shares deterministic.
adlerjohn Nov 18, 2020
68303b9
Extend rule to handle padding between txs and messages.
adlerjohn Nov 18, 2020
8154a60
Clarify rules around padding in data structures doc.
adlerjohn Nov 18, 2020
bf76dbc
Add consensus check for tx message namespace ID.
adlerjohn Nov 18, 2020
b33ce2b
Fix typo.
adlerjohn Nov 18, 2020
9073da8
Add rule for tx create validator.
adlerjohn Nov 18, 2020
d47e3f9
Add todo for end block.
adlerjohn Nov 18, 2020
3b0a96b
Add some rules for unbond tx.
adlerjohn Nov 18, 2020
2d63069
Rearrange.
adlerjohn Nov 18, 2020
92b311c
Add check for is validator when creating validator.
adlerjohn Nov 18, 2020
8c4c90f
Logic to handle unbonding validator with no delegations.
adlerjohn Nov 18, 2020
f9dba6e
Add delegation creation.
adlerjohn Nov 18, 2020
403aab7
Add rules for delegations. Handle balance transfers for rest of txs.
adlerjohn Nov 18, 2020
07a85db
Clean up todos.
adlerjohn Nov 18, 2020
1e2df94
Remove some todos based on issues filed.
adlerjohn Nov 18, 2020
37d31ca
Clean up wording around evidence.
adlerjohn Nov 24, 2020
0ebc93f
Fix indentation.
adlerjohn Nov 24, 2020
6d9648a
Revert changes to inter-message padding shares.
adlerjohn Nov 24, 2020
c5cf93c
Add pay for padding tx state transition rule.
adlerjohn Nov 25, 2020
1522239
Update specs/consensus.md
adlerjohn Nov 26, 2020
9a31d32
Fix max namespace id reserved.
adlerjohn Nov 26, 2020
074cd26
Fix missed graffiti bytes constant renaming.
adlerjohn Nov 27, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 16 additions & 11 deletions specs/consensus.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ Consensus Rules
- [`block.lastCommit`](#blocklastcommit)
- [`block.availableData`](#blockavailabledata)
- [State Transitions](#state-transitions)
- [`block.availableData.evidenceData`](#blockavailabledataevidencedata)
- [`block.availableData.transactionData`](#blockavailabledatatransactiondata)
- [Validators and Delegations](#validators-and-delegations)
- [Formatting](#formatting)
- [Availability](#availability)

## System Parameters

Expand Down Expand Up @@ -48,7 +48,6 @@ Consensus Rules
| `UNBONDING_DURATION` | `uint32` | | `block` | Duration, in blocks, for unbonding a validator or delegation. |
| `VERSION` | `uint64` | `1` | | Version of the LazyLedger chain. Breaking changes (hard forks) must update this parameter. |


### Reserved Namespace IDs

| name | type | value | description |
Expand All @@ -67,7 +66,6 @@ Consensus Rules
| `ACTIVE_VALIDATORS_SUBTREE_ID` | `StateSubtreeID` | `0x02` |
| `INACTIVE_VALIDATORS_SUBTREE_ID` | `StateSubtreeID` | `0x03` |


### Rewards and Penalties

| name | type | value | unit | description |
Expand All @@ -77,8 +75,12 @@ Consensus Rules

## Leader Selection

TODO

## Fork Choice

TODO

## Block Validity

This section specifies the entirety of the validity rules for a newly-seen block, `block`.
Expand Down Expand Up @@ -140,10 +142,19 @@ TODO define fraud proof for invalid block here

Once parsed, the following checks must be `true`:

1. The commitments of the [erasure-coded extended](./data_structures.md#2d-reed-solomon-encoding-scheme) `availableData` must match those in `header.availableDataHeader`.
1. The commitments of the [erasure-coded extended](./data_structures.md#2d-reed-solomon-encoding-scheme) `availableData` must match those in `header.availableDataHeader`. Implicitly, this means that both rows and columns must be ordered lexicographically by namespace ID since they are committed to in a [Namespace Merkle Tree](data_structures.md#namespace-merkle-tree).
1. Length of `availableData.intermediateStateRootData` == length of `availableData.transactionData` + length of `availableData.evidenceData`.
adlerjohn marked this conversation as resolved.
Show resolved Hide resolved

### State Transitions

#### `block.availableData.evidenceData`



#### `block.availableData.transactionData`



#### Validators and Delegations

A transaction `tx` that requests a new validator initializes a new [Validator](data_structures.md#validator) leaf in the inactive validators subtree for that account as follows:
Expand Down Expand Up @@ -216,9 +227,3 @@ then updates the target validator's voting power:
validator.delegatedCount -= 1
validator.votingPower -= delegation.votingPower
```

### Formatting

Leaves in the message [Namespace Merkle Tree](data_structures.md#namespace-merkle-tree) must be ordered lexicographically by namespace ID.

### Availability
4 changes: 2 additions & 2 deletions specs/figures/block_data_structures.dot
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ digraph G {

subgraph cluster_header {
label = "header";
struct1 [label = "height | timestamp | lastBlockID | <f3> lastCommitHash | consensusRoot | stateCommitment | availableDataOriginalSharesUsed | <f6> availableDataRoot | proposerAddress"];
struct1 [label = "height | timestamp | lastBlockID | <f3> lastCommitHash | consensusRoot | stateCommitment | availableDataOriginalSharesUsed | <f7> availableDataRoot | proposerAddress"];
}
}

struct1:f3 -> struct2;
struct1:f6 -> struct4 [label = "Merkle root of"];
struct1:f7 -> struct4 [label = "Merkle root of"];
struct4:f0 -> struct3 [label = "NMT roots to\nerasure-coded data"];

edge [style = invis];
Expand Down
2 changes: 1 addition & 1 deletion specs/figures/block_data_structures.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.