divide new and old containers out in phase 1

This commit is contained in:
Danny Ryan 2019-11-22 15:45:55 -07:00
parent 72a9dfc430
commit ddd7cd2964
No known key found for this signature in database
GPG Key ID: 2765A792E42CE07A
1 changed files with 88 additions and 82 deletions

View File

@ -51,45 +51,14 @@ Configuration is not namespaced. Instead it is strictly an extension;
| `DOMAIN_SHARD_COMMITTEE` | `192` | | | `DOMAIN_SHARD_COMMITTEE` | `192` | |
| `DOMAIN_SHARD_PROPOSAL` | `193` | | | `DOMAIN_SHARD_PROPOSAL` | `193` | |
## Containers ## Updated containers
### `ShardBlockWrapper` The following containers have updated definitions in Phase 1.
_Wrapper for being broadcasted over the network._ ### Extended `AttestationData`
```python ```python
class ShardBlockWrapper(Container): class AttestationData(Container):
shard_parent_root: Hash
beacon_parent_root: Hash
slot: Slot
body: BytesN[MAX_SHARD_BLOCK_CHUNKS * SHARD_BLOCK_CHUNK_SIZE]
signature: BLSSignature
```
### `ShardSignableHeader`
```python
class ShardSignableHeader(Container):
shard_parent_root: Hash
beacon_parent_root: Hash
slot: Slot
body_root: Hash
```
### `ShardState`
```python
class ShardState(Container):
slot: Slot
gasprice: Gwei
data: Hash
latest_block_root: Hash
```
### New `AttestationData`
```python
class AttestationData(phase0.AttestationData):
slot: Slot slot: Slot
index: CommitteeIndex index: CommitteeIndex
# LMD GHOST vote # LMD GHOST vote
@ -103,23 +72,7 @@ class AttestationData(phase0.AttestationData):
shard_transition_root: Hash shard_transition_root: Hash
``` ```
### `ShardTransition` ### Extended `Attestation`
```python
class ShardTransition(Container):
# Starting from slot
start_slot: Slot
# Shard block lengths
shard_block_lengths: List[uint64, MAX_SHARD_BLOCKS_PER_ATTESTATION]
# Shard data roots
shard_data_roots: List[List[Hash, MAX_SHARD_BLOCK_CHUNKS], MAX_SHARD_BLOCKS_PER_ATTESTATION]
# Intermediate shard states
shard_states: List[ShardState, MAX_SHARD_BLOCKS_PER_ATTESTATION]
# Proposer signature aggregate
proposer_signature_aggregate: BLSSignature
```
### New `Attestation`
```python ```python
class Attestation(Container): class Attestation(Container):
@ -129,32 +82,7 @@ class Attestation(Container):
signature: BLSSignature signature: BLSSignature
``` ```
### `AttestationAndCommittee` ### Extended `PendingAttestation`
```python
class AttestationAndCommittee(Container):
committee: List[ValidatorIndex, MAX_VALIDATORS_PER_COMMITTEE]
attestation: Attestation
```
### `CompactCommittee`
```python
class CompactCommittee(Container):
pubkeys: List[BLSPubkey, MAX_VALIDATORS_PER_COMMITTEE]
compact_validators: List[uint64, MAX_VALIDATORS_PER_COMMITTEE]
```
### `AttestationCustodyBitWrapper`
```python
class AttestationCustodyBitWrapper(Container):
attestation_root: Hash
block_index: uint64
bit: boolean
```
### New extended `PendingAttestation`
```python ```python
class PendingAttestation(Container): class PendingAttestation(Container):
@ -165,7 +93,7 @@ class PendingAttestation(Container):
crosslink_success: boolean crosslink_success: boolean
``` ```
### New extended `Validator` ### Extended `Validator`
```python ```python
class Validator(Container): class Validator(Container):
@ -186,7 +114,7 @@ class Validator(Container):
max_reveal_lateness: Epoch max_reveal_lateness: Epoch
``` ```
### New extended `BeaconBlockBody` ### Extended `BeaconBlockBody`
```python ```python
class BeaconBlockBody(Container): class BeaconBlockBody(Container):
@ -212,7 +140,7 @@ class BeaconBlockBody(Container):
light_client_signature: BLSSignature light_client_signature: BLSSignature
``` ```
### New extended `BeaconBlock` ### Extended `BeaconBlock`
Note that the `body` has a new `BeaconBlockBody` definition. Note that the `body` has a new `BeaconBlockBody` definition.
@ -225,7 +153,7 @@ class BeaconBlock(Container):
signature: BLSSignature signature: BLSSignature
``` ```
### New extended `BeaconState` ### Extended `BeaconState`
Note that aside from the new additions, `Validator` and `PendingAttestation` have new definitions. Note that aside from the new additions, `Validator` and `PendingAttestation` have new definitions.
@ -271,6 +199,84 @@ class BeaconState(Container):
EARLY_DERIVED_SECRET_PENALTY_MAX_FUTURE_EPOCHS] EARLY_DERIVED_SECRET_PENALTY_MAX_FUTURE_EPOCHS]
``` ```
## New containers
The following containers are new in Phase 1.
### `ShardBlockWrapper`
_Wrapper for being broadcasted over the network._
```python
class ShardBlockWrapper(Container):
shard_parent_root: Hash
beacon_parent_root: Hash
slot: Slot
body: BytesN[MAX_SHARD_BLOCK_CHUNKS * SHARD_BLOCK_CHUNK_SIZE]
signature: BLSSignature
```
### `ShardSignableHeader`
```python
class ShardSignableHeader(Container):
shard_parent_root: Hash
beacon_parent_root: Hash
slot: Slot
body_root: Hash
```
### `ShardState`
```python
class ShardState(Container):
slot: Slot
gasprice: Gwei
data: Hash
latest_block_root: Hash
```
### `ShardTransition`
```python
class ShardTransition(Container):
# Starting from slot
start_slot: Slot
# Shard block lengths
shard_block_lengths: List[uint64, MAX_SHARD_BLOCKS_PER_ATTESTATION]
# Shard data roots
shard_data_roots: List[List[Hash, MAX_SHARD_BLOCK_CHUNKS], MAX_SHARD_BLOCKS_PER_ATTESTATION]
# Intermediate shard states
shard_states: List[ShardState, MAX_SHARD_BLOCKS_PER_ATTESTATION]
# Proposer signature aggregate
proposer_signature_aggregate: BLSSignature
```
### `AttestationAndCommittee`
```python
class AttestationAndCommittee(Container):
committee: List[ValidatorIndex, MAX_VALIDATORS_PER_COMMITTEE]
attestation: Attestation
```
### `CompactCommittee`
```python
class CompactCommittee(Container):
pubkeys: List[BLSPubkey, MAX_VALIDATORS_PER_COMMITTEE]
compact_validators: List[uint64, MAX_VALIDATORS_PER_COMMITTEE]
```
### `AttestationCustodyBitWrapper`
```python
class AttestationCustodyBitWrapper(Container):
attestation_root: Hash
block_index: uint64
bit: boolean
```
## Helper functions ## Helper functions
### Crypto ### Crypto