From e83500cef8ec9a936dd566f797af2f746358032b Mon Sep 17 00:00:00 2001 From: Ivan Martinez Date: Wed, 5 Jun 2019 14:52:09 +0900 Subject: [PATCH 1/4] Reorganize data structures to mirror beacon state order --- specs/core/0_beacon-chain.md | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/specs/core/0_beacon-chain.md b/specs/core/0_beacon-chain.md index 4940d35f4..6d18d18e6 100644 --- a/specs/core/0_beacon-chain.md +++ b/specs/core/0_beacon-chain.md @@ -23,16 +23,15 @@ - [Data structures](#data-structures) - [Misc dependencies](#misc-dependencies) - [`Fork`](#fork) - - [`Crosslink`](#crosslink) - - [`Eth1Data`](#eth1data) + - [`Validator`](#validator) - [`AttestationData`](#attestationdata) - [`AttestationDataAndCustodyBit`](#attestationdataandcustodybit) - [`IndexedAttestation`](#indexedattestation) - - [`DepositData`](#depositdata) - - [`BeaconBlockHeader`](#beaconblockheader) - - [`Validator`](#validator) - [`PendingAttestation`](#pendingattestation) + - [`Crosslink`](#crosslink) + - [`Eth1Data`](#eth1data) - [`HistoricalBatch`](#historicalbatch) + - [`DepositData`](#depositdata) - [Beacon operations](#beacon-operations) - [`ProposerSlashing`](#proposerslashing) - [`AttesterSlashing`](#attesterslashing) From 65d2a502191f4a70edc3d0906f9cb4d5ae6c953f Mon Sep 17 00:00:00 2001 From: Ivan Martinez Date: Wed, 5 Jun 2019 14:57:54 +0900 Subject: [PATCH 2/4] Change data structure to match beacon state order --- specs/core/0_beacon-chain.md | 118 +++++++++++++++++------------------ 1 file changed, 59 insertions(+), 59 deletions(-) diff --git a/specs/core/0_beacon-chain.md b/specs/core/0_beacon-chain.md index 6d18d18e6..e24176c49 100644 --- a/specs/core/0_beacon-chain.md +++ b/specs/core/0_beacon-chain.md @@ -274,31 +274,26 @@ class Fork(Container): epoch: uint64 ``` -#### `Crosslink` +#### `Validator` ```python -class Crosslink(Container): - # Shard number - shard: uint64 - # Crosslinking data from epochs [start....end-1] - start_epoch: uint64 - end_epoch: uint64 - # Root of the previous crosslink - parent_root: Bytes32 - # Root of the crosslinked shard data since the previous crosslink - data_root: Bytes32 -``` - -#### `Eth1Data` - -```python -class Eth1Data(Container): - # Root of the deposit tree - deposit_root: Bytes32 - # Total number of deposits - deposit_count: uint64 - # Block hash - block_hash: Bytes32 +class Validator(Container): + # BLS public key + pubkey: Bytes48 + # Withdrawal credentials + withdrawal_credentials: Bytes32 + # Epoch when became eligible for activation + activation_eligibility_epoch: uint64 + # Epoch when validator activated + activation_epoch: uint64 + # Epoch when validator exited + exit_epoch: uint64 + # Epoch when validator is eligible to withdraw + withdrawable_epoch: uint64 + # Was the validator slashed + slashed: bool + # Effective balance + effective_balance: uint64 ``` #### `AttestationData` @@ -341,20 +336,6 @@ class IndexedAttestation(Container): signature: Bytes96 ``` -#### `DepositData` - -```python -class DepositData(Container): - # BLS pubkey - pubkey: Bytes48 - # Withdrawal credentials - withdrawal_credentials: Bytes32 - # Amount in Gwei - amount: uint64 - # Container self-signature - signature: Bytes96 -``` - #### `BeaconBlockHeader` ```python @@ -366,28 +347,6 @@ class BeaconBlockHeader(Container): signature: Bytes96 ``` -#### `Validator` - -```python -class Validator(Container): - # BLS public key - pubkey: Bytes48 - # Withdrawal credentials - withdrawal_credentials: Bytes32 - # Epoch when became eligible for activation - activation_eligibility_epoch: uint64 - # Epoch when validator activated - activation_epoch: uint64 - # Epoch when validator exited - exit_epoch: uint64 - # Epoch when validator is eligible to withdraw - withdrawable_epoch: uint64 - # Was the validator slashed - slashed: bool - # Effective balance - effective_balance: uint64 -``` - #### `PendingAttestation` ```python @@ -402,6 +361,33 @@ class PendingAttestation(Container): proposer_index: uint64 ``` +#### `Crosslink` + +```python +class Crosslink(Container): + # Shard number + shard: uint64 + # Crosslinking data from epochs [start....end-1] + start_epoch: uint64 + end_epoch: uint64 + # Root of the previous crosslink + parent_root: Bytes32 + # Root of the crosslinked shard data since the previous crosslink + data_root: Bytes32 +``` + +#### `Eth1Data` + +```python +class Eth1Data(Container): + # Root of the deposit tree + deposit_root: Bytes32 + # Total number of deposits + deposit_count: uint64 + # Block hash + block_hash: Bytes32 +``` + #### `HistoricalBatch` ```python @@ -412,6 +398,20 @@ class HistoricalBatch(Container): state_roots: Vector[Bytes32, SLOTS_PER_HISTORICAL_ROOT] ``` +#### `DepositData` + +```python +class DepositData(Container): + # BLS pubkey + pubkey: Bytes48 + # Withdrawal credentials + withdrawal_credentials: Bytes32 + # Amount in Gwei + amount: uint64 + # Container self-signature + signature: Bytes96 +``` + ### Beacon operations #### `ProposerSlashing` From c250296d8ae2176ddf6297a47a2d86fffc62ba38 Mon Sep 17 00:00:00 2001 From: Ivan Martinez Date: Wed, 5 Jun 2019 15:07:50 +0900 Subject: [PATCH 3/4] Move crosslink above attestation data --- specs/core/0_beacon-chain.md | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/specs/core/0_beacon-chain.md b/specs/core/0_beacon-chain.md index e24176c49..58bfc8bf4 100644 --- a/specs/core/0_beacon-chain.md +++ b/specs/core/0_beacon-chain.md @@ -24,11 +24,11 @@ - [Misc dependencies](#misc-dependencies) - [`Fork`](#fork) - [`Validator`](#validator) + - [`Crosslink`](#crosslink) - [`AttestationData`](#attestationdata) - [`AttestationDataAndCustodyBit`](#attestationdataandcustodybit) - [`IndexedAttestation`](#indexedattestation) - [`PendingAttestation`](#pendingattestation) - - [`Crosslink`](#crosslink) - [`Eth1Data`](#eth1data) - [`HistoricalBatch`](#historicalbatch) - [`DepositData`](#depositdata) @@ -296,6 +296,21 @@ class Validator(Container): effective_balance: uint64 ``` +#### `Crosslink` + +```python +class Crosslink(Container): + # Shard number + shard: uint64 + # Crosslinking data from epochs [start....end-1] + start_epoch: uint64 + end_epoch: uint64 + # Root of the previous crosslink + parent_root: Bytes32 + # Root of the crosslinked shard data since the previous crosslink + data_root: Bytes32 +``` + #### `AttestationData` ```python @@ -361,21 +376,6 @@ class PendingAttestation(Container): proposer_index: uint64 ``` -#### `Crosslink` - -```python -class Crosslink(Container): - # Shard number - shard: uint64 - # Crosslinking data from epochs [start....end-1] - start_epoch: uint64 - end_epoch: uint64 - # Root of the previous crosslink - parent_root: Bytes32 - # Root of the crosslinked shard data since the previous crosslink - data_root: Bytes32 -``` - #### `Eth1Data` ```python From 853c34eb60a707ede5339597af666f380f1218e4 Mon Sep 17 00:00:00 2001 From: Danny Ryan Date: Wed, 5 Jun 2019 09:50:15 -0600 Subject: [PATCH 4/4] add beaconblockheader back to toc --- specs/core/0_beacon-chain.md | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/specs/core/0_beacon-chain.md b/specs/core/0_beacon-chain.md index 58bfc8bf4..f5fc0c98e 100644 --- a/specs/core/0_beacon-chain.md +++ b/specs/core/0_beacon-chain.md @@ -32,6 +32,7 @@ - [`Eth1Data`](#eth1data) - [`HistoricalBatch`](#historicalbatch) - [`DepositData`](#depositdata) + - [`BeaconBlockHeader`](#beaconblockheader) - [Beacon operations](#beacon-operations) - [`ProposerSlashing`](#proposerslashing) - [`AttesterSlashing`](#attesterslashing) @@ -351,17 +352,6 @@ class IndexedAttestation(Container): signature: Bytes96 ``` -#### `BeaconBlockHeader` - -```python -class BeaconBlockHeader(Container): - slot: uint64 - parent_root: Bytes32 - state_root: Bytes32 - body_root: Bytes32 - signature: Bytes96 -``` - #### `PendingAttestation` ```python @@ -412,6 +402,17 @@ class DepositData(Container): signature: Bytes96 ``` +#### `BeaconBlockHeader` + +```python +class BeaconBlockHeader(Container): + slot: uint64 + parent_root: Bytes32 + state_root: Bytes32 + body_root: Bytes32 + signature: Bytes96 +``` + ### Beacon operations #### `ProposerSlashing`