Merge branch 'master' into JustinDrake-patch-1
This commit is contained in:
commit
f6453a7455
File diff suppressed because it is too large
Load Diff
|
@ -53,8 +53,8 @@ A `ShardBlock` object has the following fields:
|
|||
# Block signature
|
||||
'signature': ['uint384'],
|
||||
# Attestation
|
||||
'attester_bitfield': 'bytes',
|
||||
'aggregate_sig': ['uint384'],
|
||||
'participation_bitfield': 'bytes',
|
||||
'aggregate_signature': ['uint384'],
|
||||
}
|
||||
```
|
||||
|
||||
|
@ -69,9 +69,9 @@ To validate a block header on shard `shard_id`, compute as follows:
|
|||
|
||||
* Verify that `beacon_chain_ref` is the hash of a block in the beacon chain with slot less than or equal to `slot`. Verify that `beacon_chain_ref` is equal to or a descendant of the `beacon_chain_ref` specified in the `ShardBlock` pointed to by `parent_root`.
|
||||
* Let `state` be the state of the beacon chain block referred to by `beacon_chain_ref`. Let `validators` be `[validators[i] for i in state.current_persistent_committees[shard_id]]`.
|
||||
* Assert `len(attester_bitfield) == ceil_div8(len(validators))`
|
||||
* Assert `len(participation_bitfield) == ceil_div8(len(validators))`
|
||||
* Let `proposer_index = hash(state.randao_mix + bytes8(shard_id) + bytes8(slot)) % len(validators)`. Let `msg` be the block but with the `block.signature` set to `[0, 0]`. Verify that `BLSVerify(pub=validators[proposer_index].pubkey, msg=hash(msg), sig=block.signature, domain=get_domain(state, slot, SHARD_PROPOSER_DOMAIN))` passes.
|
||||
* Generate the `group_public_key` by adding the public keys of all the validators for whom the corresponding position in the bitfield is set to 1. Verify that `BLSVerify(pub=group_public_key, msg=parent_root, sig=block.aggregate_sig, domain=get_domain(state, slot, SHARD_ATTESTER_DOMAIN))` passes.
|
||||
* Generate the `group_public_key` by adding the public keys of all the validators for whom the corresponding position in the bitfield is set to 1. Verify that `BLSVerify(pub=group_public_key, msg=parent_root, sig=block.aggregate_signature, domain=get_domain(state, slot, SHARD_ATTESTER_DOMAIN))` passes.
|
||||
|
||||
### Block Merklization helper
|
||||
|
||||
|
|
|
@ -248,10 +248,10 @@ size as the integer length. (e.g. ``uint16 == 2 bytes``)
|
|||
All integers are interpreted as **big endian**.
|
||||
|
||||
```python
|
||||
assert(len(rawbytes) >= current_index + int_size)
|
||||
byte_length = int_size / 8
|
||||
new_index = current_index + int_size
|
||||
return int.from_bytes(rawbytes[current_index:current_index+int_size], 'big'), new_index
|
||||
new_index = current_index + byte_length
|
||||
assert(len(rawbytes) >= new_index)
|
||||
return int.from_bytes(rawbytes[current_index:current_index+byte_length], 'big'), new_index
|
||||
```
|
||||
|
||||
#### Bool
|
||||
|
@ -384,7 +384,7 @@ values = {}
|
|||
for field_name in get_field_names(typ):
|
||||
field_name_type = get_type_for_field_name(typ, field_name)
|
||||
values[field_name], item_index = deserialize(data, item_index, field_name_type)
|
||||
assert item_index == start + LENGTH_BYTES + length
|
||||
assert item_index == new_index
|
||||
return typ(**values), item_index
|
||||
```
|
||||
|
||||
|
@ -392,7 +392,7 @@ return typ(**values), item_index
|
|||
|
||||
The below `hash_tree_root` algorithm is defined recursively in the case of lists and containers, and it outputs a value equal to or less than 32 bytes in size. For the final output only (ie. not intermediate outputs), if the output is less than 32 bytes, right-zero-pad it to 32 bytes. The goal is collision resistance *within* each type, not between types.
|
||||
|
||||
Refer to [Appendix A](https://github.com/ethereum/eth2.0-specs/blob/master/specs/core/0_beacon-chain.md#appendix-a---hash-function) of Phase 0 of the [Eth2.0 specs](https://github.com/ethereum/eth2.0-specs) for a definition of the hash function used below, `hash(x)`.
|
||||
Refer to [the helper function `hash`](https://github.com/ethereum/eth2.0-specs/blob/master/specs/core/0_beacon-chain.md#hash) of Phase 0 of the [Eth2.0 specs](https://github.com/ethereum/eth2.0-specs) for a definition of the hash function used below, `hash(x)`.
|
||||
|
||||
#### `uint8`..`uint256`, `bool`, `address`, `hash1`..`hash32`
|
||||
|
||||
|
|
Loading…
Reference in New Issue