Skip to content

Commit

Permalink
rebase fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
djrtwo committed Dec 5, 2019
1 parent 4bf5eb8 commit a32b010
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 38 deletions.
4 changes: 2 additions & 2 deletions scripts/build_spec.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,10 +165,10 @@ def combine_constants(old_constants: Dict[str, str], new_constants: Dict[str, st


ignored_dependencies = [
'bit', 'boolean', 'Vector', 'List', 'Container', 'Hash', 'BLSPubkey', 'BLSSignature',
'bit', 'boolean', 'Vector', 'List', 'Container', 'BLSPubkey', 'BLSSignature',
'Bytes1', 'Bytes4', 'Bytes32', 'Bytes48', 'Bytes96', 'Bitlist', 'Bitvector',
'uint8', 'uint16', 'uint32', 'uint64', 'uint128', 'uint256',
'bytes', 'byte', 'Bytes', 'BytesN' # to be removed after updating spec doc
'bytes', 'byte', 'ByteList', 'ByteVector'
]


Expand Down
60 changes: 30 additions & 30 deletions specs/core/1_beacon-chain.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ Configuration is not namespaced. Instead it is strictly an extension;
| `TARGET_SHARD_BLOCK_SIZE` | `3 * 2**16` (= 196,608) | |
| `SHARD_BLOCK_OFFSETS` | `[1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233]` | |
| `MAX_SHARD_BLOCKS_PER_ATTESTATION` | `len(SHARD_BLOCK_OFFSETS)` | |
| `EMPTY_CHUNK_ROOT` | `hash_tree_root(BytesN[SHARD_BLOCK_CHUNK_SIZE]())` | |
| `EMPTY_CHUNK_ROOT` | `hash_tree_root(ByteList[SHARD_BLOCK_CHUNK_SIZE]())` | |
| `MAX_GASPRICE` | `Gwei(2**14)` (= 16,384) | Gwei | |
| `MIN_GASPRICE` | `Gwei(2**5)` (= 32) | Gwei | |
| `GASPRICE_ADJUSTMENT_COEFFICIENT` | `2**3` (= 8) | |
Expand All @@ -62,14 +62,14 @@ class AttestationData(Container):
slot: Slot
index: CommitteeIndex
# LMD GHOST vote
beacon_block_root: Hash
beacon_block_root: Root
# FFG vote
source: Checkpoint
target: Checkpoint
# Current-slot shard block root
head_shard_root: Hash
head_shard_root: Root
# Shard transition root
shard_transition_root: Hash
shard_transition_root: Root
```

### Extended `Attestation`
Expand Down Expand Up @@ -98,7 +98,7 @@ class PendingAttestation(Container):
```python
class Validator(Container):
pubkey: BLSPubkey
withdrawal_credentials: Hash # Commitment to pubkey for withdrawals
withdrawal_credentials: Bytes32 # Commitment to pubkey for withdrawals
effective_balance: Gwei # Balance at stake
slashed: boolean
# Status epochs
Expand Down Expand Up @@ -147,8 +147,8 @@ Note that the `body` has a new `BeaconBlockBody` definition.
```python
class BeaconBlock(Container):
slot: Slot
parent_root: Hash
state_root: Hash
parent_root: Root
state_root: Root
body: BeaconBlockBody
signature: BLSSignature
```
Expand All @@ -165,9 +165,9 @@ class BeaconState(Container):
fork: Fork
# History
latest_block_header: BeaconBlockHeader
block_roots: Vector[Hash, SLOTS_PER_HISTORICAL_ROOT]
state_roots: Vector[Hash, SLOTS_PER_HISTORICAL_ROOT]
historical_roots: List[Hash, HISTORICAL_ROOTS_LIMIT]
block_roots: Vector[Root, SLOTS_PER_HISTORICAL_ROOT]
state_roots: Vector[Root, SLOTS_PER_HISTORICAL_ROOT]
historical_roots: List[Root, HISTORICAL_ROOTS_LIMIT]
# Eth1
eth1_data: Eth1Data
eth1_data_votes: List[Eth1Data, SLOTS_PER_ETH1_VOTING_PERIOD]
Expand All @@ -176,7 +176,7 @@ class BeaconState(Container):
validators: List[Validator, VALIDATOR_REGISTRY_LIMIT]
balances: List[Gwei, VALIDATOR_REGISTRY_LIMIT]
# Randomness
randao_mixes: Vector[Hash, EPOCHS_PER_HISTORICAL_VECTOR]
randao_mixes: Vector[Root, EPOCHS_PER_HISTORICAL_VECTOR]
# Slashings
slashings: Vector[Gwei, EPOCHS_PER_SLASHINGS_VECTOR] # Per-epoch sums of slashed effective balances
# Attestations
Expand All @@ -189,7 +189,7 @@ class BeaconState(Container):
finalized_checkpoint: Checkpoint
# Phase 1
shard_states: List[ShardState, MAX_SHARDS]
online_countdown: Bytes[VALIDATOR_REGISTRY_LIMIT]
online_countdown: ByteList[VALIDATOR_REGISTRY_LIMIT]
current_light_committee: CompactCommittee
next_light_committee: CompactCommittee
# Custody game
Expand All @@ -209,21 +209,21 @@ _Wrapper for being broadcasted over the network._

```python
class ShardBlockWrapper(Container):
shard_parent_root: Hash
beacon_parent_root: Hash
shard_parent_root: Root
beacon_parent_root: Root
slot: Slot
body: BytesN[MAX_SHARD_BLOCK_CHUNKS * SHARD_BLOCK_CHUNK_SIZE]
body: ByteList[MAX_SHARD_BLOCK_CHUNKS * SHARD_BLOCK_CHUNK_SIZE]
signature: BLSSignature
```

### `ShardSignableHeader`

```python
class ShardSignableHeader(Container):
shard_parent_root: Hash
beacon_parent_root: Hash
shard_parent_root: Root
beacon_parent_root: Root
slot: Slot
body_root: Hash
body_root: Root
```

### `ShardState`
Expand All @@ -232,8 +232,8 @@ class ShardSignableHeader(Container):
class ShardState(Container):
slot: Slot
gasprice: Gwei
data: Hash
latest_block_root: Hash
data: Bytes32
latest_block_root: Root
```

### `ShardTransition`
Expand All @@ -245,7 +245,7 @@ class ShardTransition(Container):
# 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]
shard_data_roots: List[List[Bytes32, MAX_SHARD_BLOCK_CHUNKS], MAX_SHARD_BLOCKS_PER_ATTESTATION]
# Intermediate shard states
shard_states: List[ShardState, MAX_SHARD_BLOCKS_PER_ATTESTATION]
# Proposer signature aggregate
Expand All @@ -272,7 +272,7 @@ class CompactCommittee(Container):

```python
class AttestationCustodyBitWrapper(Container):
attestation_data_root: Hash
attestation_data_root: Root
block_index: uint64
bit: boolean
```
Expand Down Expand Up @@ -319,8 +319,8 @@ def committee_to_compact_committee(state: BeaconState, committee: Sequence[Valid
#### `chunks_to_body_root`

```python
def chunks_to_body_root(chunks: List[Hash, MAX_SHARD_BLOCK_CHUNKS]) -> Hash:
return hash_tree_root(Vector[Hash, MAX_SHARD_BLOCK_CHUNKS](
def chunks_to_body_root(chunks: List[Bytes32, MAX_SHARD_BLOCK_CHUNKS]) -> Root:
return hash_tree_root(Vector[Bytes32, MAX_SHARD_BLOCK_CHUNKS](
chunks + [EMPTY_CHUNK_ROOT] * (MAX_SHARD_BLOCK_CHUNKS - len(chunks))
))
```
Expand Down Expand Up @@ -543,7 +543,7 @@ def validate_attestation(state: BeaconState, attestation: Attestation) -> None:
# Type 2: delayed attestations
else:
assert state.slot - compute_start_slot_at_epoch(compute_epoch_at_slot(data.slot)) < SLOTS_PER_EPOCH
assert data.shard_transition_root == Hash()
assert data.shard_transition_root == Root()
```

###### `apply_shard_transition`
Expand Down Expand Up @@ -608,7 +608,7 @@ def apply_shard_transition(state: BeaconState, shard: Shard, transition: ShardTr
def process_crosslink_for_shard(state: BeaconState,
shard: Shard,
shard_transition: ShardTransition,
attestations: Sequence[Attestation]) -> Hash:
attestations: Sequence[Attestation]) -> Root:
committee = get_beacon_committee(state, get_current_epoch(state), shard)
online_indices = get_online_validator_indices(state)

Expand Down Expand Up @@ -657,16 +657,16 @@ def process_crosslink_for_shard(state: BeaconState,

# No winning transition root, ensure empty and return empty root
assert shard_transition == ShardTransition()
return Hash()
return Root()
```

###### `process_crosslinks`

```python
def process_crosslinks(state: BeaconState,
block_body: BeaconBlockBody,
attestations: Sequence[Attestation]) -> Set[Tuple[Shard, Hash]]:
winners: Set[Tuple[Shard, Hash]] = set()
attestations: Sequence[Attestation]) -> Set[Tuple[Shard, Root]]:
winners: Set[Tuple[Shard, Root]] = set()
for shard in map(Shard, range(ACTIVE_SHARDS)):
# All attestations in the block for this shard
shard_attestations = [
Expand All @@ -675,7 +675,7 @@ def process_crosslinks(state: BeaconState,
]
shard_transition = block_body.shard_transitions[shard]
winning_root = process_crosslink_for_shard(state, shard, shard_transition, shard_attestations)
if winning_root != Hash():
if winning_root != Root():
winners.add((shard, winning_root))
return winners
```
Expand Down
2 changes: 1 addition & 1 deletion specs/core/1_custody-game.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ class CustodySlashing(Container):
whistleblower_index: ValidatorIndex
shard_transition: ShardTransition
attestation: Attestation
data: Bytes[MAX_SHARD_BLOCK_CHUNKS * SHARD_BLOCK_CHUNK_SIZE]
data: ByteList[MAX_SHARD_BLOCK_CHUNKS * SHARD_BLOCK_CHUNK_SIZE]
signature: BLSSignature
```

Expand Down
6 changes: 3 additions & 3 deletions specs/core/1_fraud-proofs.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ The proof verifies that one of the two conditions is false:
```python
def shard_state_transition(shard: Shard,
slot: Slot,
pre_state: Hash,
previous_beacon_root: Hash,
pre_state: Root,
previous_beacon_root: Root,
proposer_pubkey: BLSPubkey,
block_data: BytesN[MAX_SHARD_BLOCK_CHUNKS * SHARD_BLOCK_CHUNK_SIZE]) -> Hash:
block_data: ByteVector[MAX_SHARD_BLOCK_CHUNKS * SHARD_BLOCK_CHUNK_SIZE]) -> Root:
# We will add something more substantive in phase 2
return hash(pre_state + hash_tree_root(previous_beacon_root) + hash_tree_root(block_data))
```
Expand Down
4 changes: 2 additions & 2 deletions specs/core/1_phase1-fork.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,10 @@ def upgrade_to_phase1(pre: phase0.BeaconState) -> BeaconState:
slot=pre.slot,
gasprice=INITIAL_GASPRICE,
data=Root(),
latest_block_root=Hash(),
latest_block_root=Root(),
) for i in range(ACTIVE_SHARDS)
),
online_countdown=Bytes[VALIDATOR_REGISTRY_LIMIT](
online_countdown=ByteList[VALIDATOR_REGISTRY_LIMIT](
ONLINE_PERIOD for i in range(len(pre.validators))
),
current_light_committee=CompactCommittee(), # computed after state creation
Expand Down

0 comments on commit a32b010

Please sign in to comment.