PR feedback from Danny

This commit is contained in:
Hsiao-Wei Wang 2020-06-30 00:11:43 +08:00
parent d3f2344e45
commit 2c0595da01
No known key found for this signature in database
GPG Key ID: 95B070122902DEA4
3 changed files with 7 additions and 4 deletions

View File

@ -226,7 +226,7 @@ get_attesting_indices = cache_this(
PHASE1_SUNDRY_FUNCTIONS = '''
def get_block_data_merkle_root(data: ByteList) -> Root:
# To get the Merkle root of the block data, we need the Merkle root without the length Mixing
# To get the Merkle root of the block data, we need the Merkle root without the length mix-in
# The below implements this in the Remerkleable framework
return data.get_backing().get_left().merkle_root()

View File

@ -25,6 +25,7 @@
- [`CustodyKeyReveal`](#custodykeyreveal)
- [`EarlyDerivedSecretReveal`](#earlyderivedsecretreveal)
- [Helpers](#helpers)
- [`get_block_data_merkle_root`](#get_block_data_merkle_root)
- [`replace_empty_or_append`](#replace_empty_or_append)
- [`legendre_bit`](#legendre_bit)
- [`get_custody_atoms`](#get_custody_atoms)
@ -182,6 +183,10 @@ class EarlyDerivedSecretReveal(Container):
## Helpers
### `get_block_data_merkle_root`
`get_block_data_merkle_root(data: ByteList) -> Root` is the function that returns the Merkle root of the block data without the length mix-in.
### `replace_empty_or_append`
```python
@ -515,7 +520,7 @@ def process_custody_slashing(state: BeaconState, signed_custody_slashing: Signed
assert hash_tree_root(shard_transition) == attestation.data.shard_transition_root
# Verify that the provided data matches the shard-transition
assert (
custody_slashing.data.get_backing().get_left().merkle_root()
get_block_data_merkle_root(custody_slashing.data)
== shard_transition.shard_data_roots[custody_slashing.data_index]
)
assert len(custody_slashing.data) == shard_transition.shard_block_lengths[custody_slashing.data_index]

View File

@ -275,8 +275,6 @@ Set `attestation_data.shard_head_root = hash_tree_root(shard_head_block)`.
Set `shard_transition` to the value returned by `get_shard_transition(head_state, shard, shard_blocks)`.
`get_block_data_merkle_root(data: ByteList) -> Root` is the function that returns the Merkle root of the block data without the length mixing.
```python
def get_shard_transition_fields(
beacon_state: BeaconState,