Skip to content

Commit

Permalink
reorder ssz types to match ethereum/consensus-specs#731
Browse files Browse the repository at this point in the history
  • Loading branch information
djrtwo committed Mar 7, 2019
1 parent b37b981 commit 3f9f8a6
Showing 1 changed file with 116 additions and 130 deletions.
246 changes: 116 additions & 130 deletions spec_pythonizer/spec.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,35 +21,30 @@
- [Max transactions per block](#max-transactions-per-block)
- [Signature domains](#signature-domains)
- [Data structures](#data-structures)
- [Misc dependencies](#misc-dependencies)
- [`Fork`](#fork)
- [`Crosslink`](#crosslink)
- [`Eth1Data`](#eth1data)
- [`Eth1DataVote`](#eth1datavote)
- [Beacon chain transactions](#beacon-chain-transactions)
- [Attestations](#attestations)
- [`AttestationData`](#attestationdata)
- [`AttestationDataAndCustodyBit`](#attestationdataandcustodybit)
- [`Attestation`](#attestation)
- [Deposits](#deposits)
- [`DepositInput`](#depositinput)
- [`DepositData`](#depositdata)
- [`Deposit`](#deposit)
- [Voluntary exits](#voluntary-exits)
- [`VoluntaryExit`](#voluntaryexit)
- [Transfers](#transfers)
- [`Transfer`](#transfer)
- [Beacon chain blocks](#beacon-chain-blocks)
- [`AttestationData`](#attestationdata)
- [`AttestationDataAndCustodyBit`](#attestationdataandcustodybit)
- [`SlashableAttestation`](#slashableattestation)
- [`DepositInput`](#depositinput)
- [`DepositData`](#depositdata)
- [`BeaconBlockHeader`](#beaconblockheader)
- [Proposer slashings](#proposer-slashings)
- [`ProposerSlashing`](#proposerslashing)
- [Attester slashings](#attester-slashings)
- [`SlashableAttestation`](#slashableattestation)
- [`AttesterSlashing`](#attesterslashing)
- [`BeaconBlockBody`](#beaconblockbody)
- [`BeaconBlock`](#beaconblock)
- [Beacon chain state](#beacon-chain-state)
- [`Validator`](#validator)
- [`PendingAttestation`](#pendingattestation)
- [Beacon transactions](#beacon-transactions)
- [`ProposerSlashing`](#proposerslashing)
- [`AttesterSlashing`](#attesterslashing)
- [`Attestation`](#attestation)
- [`Deposit`](#deposit)
- [`VoluntaryExit`](#voluntaryexit)
- [`Transfer`](#transfer)
- [Beacon blocks](#beacon-blocks)
- [`BeaconBlockBody`](#beaconblockbody)
- [`BeaconBlock`](#beaconblock)
- [Beacon state](#beacon-state)
- [`BeaconState`](#beaconstate)
- [Custom Types](#custom-types)
- [Helper functions](#helper-functions)
Expand Down Expand Up @@ -284,6 +279,10 @@ Code snippets appearing in `this style` are to be interpreted as Python code.

The following data structures are defined as [SimpleSerialize (SSZ)](https://github.com/ethereum/eth2.0-specs/blob/master/specs/simple-serialize.md) objects.

The types are defined topologically to aid in facilitating an executable version of the spec.

### Misc dependencies

#### `Fork`

```python
Expand Down Expand Up @@ -330,11 +329,7 @@ The following data structures are defined as [SimpleSerialize (SSZ)](https://git
}
```

### Beacon chain transactions

#### Attestations

##### `AttestationData`
#### `AttestationData`

```python
{
Expand All @@ -357,7 +352,7 @@ The following data structures are defined as [SimpleSerialize (SSZ)](https://git
}
```

##### `AttestationDataAndCustodyBit`
#### `AttestationDataAndCustodyBit`

```python
{
Expand All @@ -368,24 +363,22 @@ The following data structures are defined as [SimpleSerialize (SSZ)](https://git
}
```

##### `Attestation`
#### `SlashableAttestation`

```python
{
# Attester aggregation bitfield
'aggregation_bitfield': 'bytes',
# Validator indices
'validator_indices': ['uint64'],
# Attestation data
'data': AttestationData,
# Custody bitfield
'custody_bitfield': 'bytes',
# BLS aggregate signature
# Aggregate signature
'aggregate_signature': 'bytes96',
}
```

#### Deposits

##### `DepositInput`
#### `DepositInput`

```python
{
Expand All @@ -398,7 +391,7 @@ The following data structures are defined as [SimpleSerialize (SSZ)](https://git
}
```

##### `DepositData`
#### `DepositData`

```python
{
Expand All @@ -411,74 +404,57 @@ The following data structures are defined as [SimpleSerialize (SSZ)](https://git
}
```

##### `Deposit`

```python
{
# Branch in the deposit tree
'proof': ['bytes32', DEPOSIT_CONTRACT_TREE_DEPTH],
# Index in the deposit tree
'index': 'uint64',
# Data
'deposit_data': DepositData,
}
```

#### Voluntary exits

##### `VoluntaryExit`
#### `BeaconBlockHeader`

```python
{
# Minimum epoch for processing exit
'epoch': 'uint64',
# Index of the exiting validator
'validator_index': 'uint64',
# Validator signature
'slot': 'uint64',
'previous_block_root': 'bytes32',
'state_root': 'bytes32',
'block_body_root': 'bytes32',
'signature': 'bytes96',
}
```

#### Transfers

##### `Transfer`
#### `Validator`

```python
{
# Sender index
'sender': 'uint64',
# Recipient index
'recipient': 'uint64',
# Amount in Gwei
'amount': 'uint64',
# Fee in Gwei for block proposer
'fee': 'uint64',
# Inclusion slot
'slot': 'uint64',
# Sender withdrawal pubkey
# BLS public key
'pubkey': 'bytes48',
# Sender signature
'signature': 'bytes96',
# Withdrawal credentials
'withdrawal_credentials': 'bytes32',
# Epoch when validator activated
'activation_epoch': 'uint64',
# Epoch when validator exited
'exit_epoch': 'uint64',
# Epoch when validator is eligible to withdraw
'withdrawable_epoch': 'uint64',
# Did the validator initiate an exit
'initiated_exit': 'bool',
# Was the validator slashed
'slashed': 'bool',
}
```

### Beacon chain blocks

#### `BeaconBlockHeader`
#### `PendingAttestation`

```python
{
'slot': 'uint64',
'previous_block_root': 'bytes32',
'state_root': 'bytes32',
'block_body_root': 'bytes32',
'signature': 'bytes96',
# Attester aggregation bitfield
'aggregation_bitfield': 'bytes',
# Attestation data
'data': AttestationData,
# Custody bitfield
'custody_bitfield': 'bytes',
# Inclusion slot
'inclusion_slot': 'uint64',
}
```

#### Proposer slashings
### Beacon transactions

##### `ProposerSlashing`
#### `ProposerSlashing`

```python
{
Expand All @@ -491,34 +467,80 @@ The following data structures are defined as [SimpleSerialize (SSZ)](https://git
}
```

#### Attester slashings
#### `AttesterSlashing`

##### `SlashableAttestation`
```python
{
# First slashable attestation
'slashable_attestation_1': SlashableAttestation,
# Second slashable attestation
'slashable_attestation_2': SlashableAttestation,
}
```

#### `Attestation`

```python
{
# Validator indices
'validator_indices': ['uint64'],
# Attester aggregation bitfield
'aggregation_bitfield': 'bytes',
# Attestation data
'data': AttestationData,
# Custody bitfield
'custody_bitfield': 'bytes',
# Aggregate signature
# BLS aggregate signature
'aggregate_signature': 'bytes96',
}
```

##### `AttesterSlashing`
#### `Deposit`

```python
{
# First slashable attestation
'slashable_attestation_1': SlashableAttestation,
# Second slashable attestation
'slashable_attestation_2': SlashableAttestation,
# Branch in the deposit tree
'proof': ['bytes32', DEPOSIT_CONTRACT_TREE_DEPTH],
# Index in the deposit tree
'index': 'uint64',
# Data
'deposit_data': DepositData,
}
```

#### `VoluntaryExit`

```python
{
# Minimum epoch for processing exit
'epoch': 'uint64',
# Index of the exiting validator
'validator_index': 'uint64',
# Validator signature
'signature': 'bytes96',
}
```

#### `Transfer`

```python
{
# Sender index
'sender': 'uint64',
# Recipient index
'recipient': 'uint64',
# Amount in Gwei
'amount': 'uint64',
# Fee in Gwei for block proposer
'fee': 'uint64',
# Inclusion slot
'slot': 'uint64',
# Sender withdrawal pubkey
'pubkey': 'bytes48',
# Sender signature
'signature': 'bytes96',
}
```

### Beacon blocks

#### `BeaconBlockBody`

Expand Down Expand Up @@ -548,43 +570,7 @@ The following data structures are defined as [SimpleSerialize (SSZ)](https://git
}
```

### Beacon chain state

#### `Validator`

```python
{
# BLS public key
'pubkey': 'bytes48',
# Withdrawal credentials
'withdrawal_credentials': 'bytes32',
# Epoch when validator activated
'activation_epoch': 'uint64',
# Epoch when validator exited
'exit_epoch': 'uint64',
# Epoch when validator is eligible to withdraw
'withdrawable_epoch': 'uint64',
# Did the validator initiate an exit
'initiated_exit': 'bool',
# Was the validator slashed
'slashed': 'bool',
}
```

#### `PendingAttestation`

```python
{
# Attester aggregation bitfield
'aggregation_bitfield': 'bytes',
# Attestation data
'data': AttestationData,
# Custody bitfield
'custody_bitfield': 'bytes',
# Inclusion slot
'inclusion_slot': 'uint64',
}
```
### Beacon state

#### `BeaconState`

Expand Down

0 comments on commit 3f9f8a6

Please sign in to comment.