More renaming
This commit is contained in:
parent
f4db9ebae0
commit
ea60fb632c
|
@ -287,7 +287,7 @@ The types are defined topologically to aid in facilitating an executable version
|
|||
# Epoch number
|
||||
'epoch': 'uint64',
|
||||
# Root of the previous crosslink
|
||||
'parent_crosslink_root': 'bytes32',
|
||||
'parent_root': 'bytes32',
|
||||
# Root of the crosslinked shard data since the previous crosslink
|
||||
'data_root': 'bytes32',
|
||||
}
|
||||
|
@ -369,7 +369,7 @@ The types are defined topologically to aid in facilitating an executable version
|
|||
```python
|
||||
{
|
||||
'slot': 'uint64',
|
||||
'parent_block_root': 'bytes32',
|
||||
'parent_root': 'bytes32',
|
||||
'state_root': 'bytes32',
|
||||
'block_body_root': 'bytes32',
|
||||
'signature': 'bytes96',
|
||||
|
@ -536,7 +536,7 @@ The types are defined topologically to aid in facilitating an executable version
|
|||
{
|
||||
# Header
|
||||
'slot': 'uint64',
|
||||
'parent_block_root': 'bytes32',
|
||||
'parent_root': 'bytes32',
|
||||
'state_root': 'bytes32',
|
||||
'body': BeaconBlockBody,
|
||||
'signature': 'bytes96',
|
||||
|
@ -1306,7 +1306,7 @@ def get_attesting_balance(state: BeaconState, attestations: List[PendingAttestat
|
|||
def get_winning_crosslink_and_attesting_indices(state: BeaconState, epoch: Epoch, shard: Shard) -> Tuple[Crosslink, List[ValidatorIndex]]:
|
||||
attestations = [a for a in get_matching_source_attestations(state, epoch) if a.data.crosslink.shard == shard]
|
||||
crosslinks = list(filter(
|
||||
lambda c: hash_tree_root(state.current_crosslinks[shard]) in (c.parent_crosslink_root, hash_tree_root(c)),
|
||||
lambda c: hash_tree_root(state.current_crosslinks[shard]) in (c.parent_root, hash_tree_root(c)),
|
||||
[a.data.crosslink for a in attestations]
|
||||
))
|
||||
# Winning crosslink has the crosslink data root with the most balance voting for it (ties broken lexicographically)
|
||||
|
@ -1586,11 +1586,11 @@ def process_block_header(state: BeaconState, block: BeaconBlock) -> None:
|
|||
# Verify that the slots match
|
||||
assert block.slot == state.slot
|
||||
# Verify that the parent matches
|
||||
assert block.parent_block_root == signing_root(state.latest_block_header)
|
||||
assert block.parent_root == signing_root(state.latest_block_header)
|
||||
# Save current block as the new latest block
|
||||
state.latest_block_header = BeaconBlockHeader(
|
||||
slot=block.slot,
|
||||
parent_block_root=block.parent_block_root,
|
||||
parent_root=block.parent_root,
|
||||
block_body_root=hash_tree_root(block.body),
|
||||
)
|
||||
# Verify proposer is not slashed
|
||||
|
@ -1717,7 +1717,7 @@ def process_attestation(state: BeaconState, attestation: Attestation) -> None:
|
|||
# Check FFG data, crosslink data, and signature
|
||||
assert ffg_data == (data.source_epoch, data.source_root, data.target_epoch)
|
||||
assert data.crosslink.epoch == min(data.target_epoch, parent_crosslink.epoch + MAX_EPOCHS_PER_CROSSLINK)
|
||||
assert data.crosslink.parent_crosslink_root == hash_tree_root(parent_crosslink)
|
||||
assert data.crosslink.parent_root == hash_tree_root(parent_crosslink)
|
||||
assert data.crosslink.data_root == ZERO_HASH # [to be removed in phase 1]
|
||||
assert verify_indexed_attestation(state, convert_to_indexed(state, attestation))
|
||||
```
|
||||
|
|
|
@ -38,7 +38,7 @@ All terminology, constants, functions, and protocol mechanics defined in the [Ph
|
|||
|
||||
Processing the beacon chain is similar to processing the Ethereum 1.0 chain. Clients download and process blocks and maintain a view of what is the current "canonical chain", terminating at the current "head". For a beacon block, `block`, to be processed by a node, the following conditions must be met:
|
||||
|
||||
* The parent block with root `block.parent_block_root` has been processed and accepted.
|
||||
* The parent block with root `block.parent_root` has been processed and accepted.
|
||||
* An Ethereum 1.0 block pointed to by the `state.latest_eth1_data.block_hash` has been processed and accepted.
|
||||
* The node's Unix time is greater than or equal to `state.genesis_time + block.slot * SECONDS_PER_SLOT`.
|
||||
|
||||
|
|
|
@ -78,7 +78,7 @@ This document describes the shard data layer and the shard fork choice rule in P
|
|||
'slot': Slot,
|
||||
'shard': Shard,
|
||||
'beacon_chain_root': Hash,
|
||||
'parent_block_root': Hash,
|
||||
'parent_root': Hash,
|
||||
'data': ShardBlockBody,
|
||||
'state_root': Hash,
|
||||
'attestations': [ShardAttestation],
|
||||
|
@ -93,7 +93,7 @@ This document describes the shard data layer and the shard fork choice rule in P
|
|||
'slot': Slot,
|
||||
'shard': Shard,
|
||||
'beacon_chain_root': Hash,
|
||||
'parent_block_root': Hash,
|
||||
'parent_root': Hash,
|
||||
'body_root': Hash,
|
||||
'state_root': Hash,
|
||||
'attestations': [ShardAttestation],
|
||||
|
@ -201,7 +201,7 @@ def get_shard_header(block: ShardBlock) -> ShardBlockHeader:
|
|||
slot: block.slot,
|
||||
shard: block.shard,
|
||||
beacon_chain_root: block.beacon_chain_root,
|
||||
parent_block_root: block.parent_block_root,
|
||||
parent_root: block.parent_root,
|
||||
body_root: hash_tree_root(block.body),
|
||||
state_root: block.state_root,
|
||||
attestations: block.attestations,
|
||||
|
@ -296,11 +296,11 @@ def is_valid_shard_block(beacon_blocks: List[BeaconBlock],
|
|||
|
||||
# Check parent block
|
||||
if block.slot == PHASE_1_GENESIS_SLOT:
|
||||
assert candidate.parent_block_root == ZERO_HASH
|
||||
assert candidate.parent_root == ZERO_HASH
|
||||
else:
|
||||
parent_block = next(
|
||||
block for block in valid_shard_blocks if
|
||||
signing_root(block) == candidate.parent_block_root
|
||||
signing_root(block) == candidate.parent_root
|
||||
, None)
|
||||
assert parent_block != None
|
||||
assert parent_block.shard == block.shard
|
||||
|
|
|
@ -152,7 +152,7 @@ Set `block.slot = slot` where `slot` is the current slot at which the validator
|
|||
|
||||
##### Parent root
|
||||
|
||||
Set `block.parent_block_root = signing_root(parent)`.
|
||||
Set `block.parent_root = signing_root(parent)`.
|
||||
|
||||
##### State root
|
||||
|
||||
|
@ -275,7 +275,7 @@ Set `attestation_data.crosslink.shard = shard` where `shard` is the shard associ
|
|||
|
||||
##### Previous crosslink root
|
||||
|
||||
Set `attestation_data.parent_crosslink_root = hash_tree_root(head_state.current_crosslinks[shard])`.
|
||||
Set `attestation_data.parent_root = hash_tree_root(head_state.current_crosslinks[shard])`.
|
||||
|
||||
##### Crosslink data root
|
||||
|
||||
|
|
|
@ -55,7 +55,7 @@ def test_invalid_slot(state):
|
|||
|
||||
def test_invalid_parent_block_root(state):
|
||||
block = build_empty_block_for_next_slot(state)
|
||||
block.parent_block_root = b'\12' * 32 # invalid prev root
|
||||
block.parent_root = b'\12' * 32 # invalid prev root
|
||||
|
||||
pre_state, post_state = run_block_header_processing(state, block, valid=False)
|
||||
return pre_state, block, None
|
||||
|
|
|
@ -128,7 +128,7 @@ def build_empty_block_for_next_slot(state):
|
|||
previous_block_header = deepcopy(state.latest_block_header)
|
||||
if previous_block_header.state_root == spec.ZERO_HASH:
|
||||
previous_block_header.state_root = state.hash_tree_root()
|
||||
empty_block.parent_block_root = signing_root(previous_block_header)
|
||||
empty_block.parent_root = signing_root(previous_block_header)
|
||||
return empty_block
|
||||
|
||||
|
||||
|
@ -155,7 +155,7 @@ def build_attestation_data(state, slot, shard):
|
|||
assert state.slot >= slot
|
||||
|
||||
if slot == state.slot:
|
||||
block_root = build_empty_block_for_next_slot(state).parent_block_root
|
||||
block_root = build_empty_block_for_next_slot(state).parent_root
|
||||
else:
|
||||
block_root = get_block_root_at_slot(state, slot)
|
||||
|
||||
|
@ -185,7 +185,7 @@ def build_attestation_data(state, slot, shard):
|
|||
shard=shard,
|
||||
epoch=min(slot_to_epoch(slot), crosslinks[shard].epoch + MAX_EPOCHS_PER_CROSSLINK),
|
||||
data_root=spec.ZERO_HASH,
|
||||
parent_crosslink_root=hash_tree_root(crosslinks[shard]),
|
||||
parent_root=hash_tree_root(crosslinks[shard]),
|
||||
),
|
||||
)
|
||||
|
||||
|
@ -240,12 +240,12 @@ def get_valid_proposer_slashing(state):
|
|||
|
||||
header_1 = BeaconBlockHeader(
|
||||
slot=slot,
|
||||
parent_block_root=ZERO_HASH,
|
||||
parent_root=ZERO_HASH,
|
||||
state_root=ZERO_HASH,
|
||||
block_body_root=ZERO_HASH,
|
||||
body_root=ZERO_HASH,
|
||||
)
|
||||
header_2 = deepcopy(header_1)
|
||||
header_2.parent_block_root = b'\x02' * 32
|
||||
header_2.parent_root = b'\x02' * 32
|
||||
header_2.slot = slot + 1
|
||||
|
||||
domain = get_domain(
|
||||
|
|
|
@ -68,7 +68,7 @@ def test_empty_block_transition(state):
|
|||
state_transition(test_state, block)
|
||||
|
||||
assert len(test_state.eth1_data_votes) == len(state.eth1_data_votes) + 1
|
||||
assert get_block_root_at_slot(test_state, state.slot) == block.parent_block_root
|
||||
assert get_block_root_at_slot(test_state, state.slot) == block.parent_root
|
||||
|
||||
return state, [block], test_state
|
||||
|
||||
|
@ -82,7 +82,7 @@ def test_skipped_slots(state):
|
|||
|
||||
assert test_state.slot == block.slot
|
||||
for slot in range(state.slot, test_state.slot):
|
||||
assert get_block_root_at_slot(test_state, slot) == block.parent_block_root
|
||||
assert get_block_root_at_slot(test_state, slot) == block.parent_root
|
||||
|
||||
return state, [block], test_state
|
||||
|
||||
|
@ -96,7 +96,7 @@ def test_empty_epoch_transition(state):
|
|||
|
||||
assert test_state.slot == block.slot
|
||||
for slot in range(state.slot, test_state.slot):
|
||||
assert get_block_root_at_slot(test_state, slot) == block.parent_block_root
|
||||
assert get_block_root_at_slot(test_state, slot) == block.parent_root
|
||||
|
||||
return state, [block], test_state
|
||||
|
||||
|
|
Loading…
Reference in New Issue