remove 'slot_hash_block'
This commit is contained in:
parent
464ad63464
commit
5e058a15b8
|
@ -872,12 +872,12 @@ def get_beacon_proposer_index(state: BeaconState,
|
|||
#### `get_updated_ancestor_hashes`
|
||||
|
||||
```python
|
||||
def get_updated_ancestor_hashes(parent: BeaconBlock,
|
||||
parent_hash: Hash32) -> List[Hash32]:
|
||||
new_ancestor_hashes = copy.deepcopy(parent.ancestor_hashes)
|
||||
def get_updated_ancestor_hashes(latest_block: BeaconBlock,
|
||||
latest_hash: Hash32) -> List[Hash32]:
|
||||
new_ancestor_hashes = copy.deepcopy(latest_block.ancestor_hashes)
|
||||
for i in range(32):
|
||||
if parent.slot % 2**i == 0:
|
||||
new_ancestor_hashes[i] = parent_hash
|
||||
if latest_block.slot % 2**i == 0:
|
||||
new_ancestor_hashes[i] = latest_hash
|
||||
return new_ancestor_hashes
|
||||
```
|
||||
|
||||
|
@ -1205,31 +1205,28 @@ def exit_validator(index: int,
|
|||
|
||||
Below are the processing steps that happen at every slot.
|
||||
|
||||
* Let `parent_hash` be the hash of the latest beacon block that was processed in the chain.
|
||||
* Let `parent` be the `BeaconBlock` with the hash `parent_hash`.
|
||||
* Let `latest_hash` be the hash of the latest beacon block that was processed in the chain.
|
||||
* Let `latest_block` be the `BeaconBlock` with the hash `latest_hash`.
|
||||
* Set `state.slot += 1`
|
||||
* Set `state.latest_block_hashes = state.latest_block_hashes + [parent_hash]`. (The output of `get_block_hash` should not change, except that it will no longer throw for `state.slot - 1`).
|
||||
* Set `state.latest_block_hashes = state.latest_block_hashes + [latest_hash]`. (The output of `get_block_hash` should not change, except that it will no longer throw for `state.slot - 1`).
|
||||
|
||||
If there is a block from the proposer for `state.slot`, we process that incoming block:
|
||||
* Let `slot_has_block = True`
|
||||
* Let `block` be that associated incoming block.
|
||||
* Verify that `block.ancestor_hashes` equals `get_updated_ancestor_hashes(parent, parent_hash)`.
|
||||
* Verify that `block.slot == state.slot`
|
||||
* Verify that `block.ancestor_hashes` equals `get_updated_ancestor_hashes(latest_block, latest_hash)`.
|
||||
|
||||
If there is not a block from the proposer for `state.slot`, the slot is processed without a block:
|
||||
* Let `slot_has_block = False`
|
||||
* Let `state.validator_registry[get_beacon_proposer_index(state, state.slot)].randao_skips += 1`.
|
||||
* Skip all other per-slot processing. Move directly to [per-epoch processing](#per-epoch-processing).
|
||||
|
||||
### Proposer signature
|
||||
|
||||
If `slot_has_block`:
|
||||
|
||||
* Let `block_hash_without_sig` be the hash of `block` where `proposer_signature` is set to `[0, 0]`.
|
||||
* Let `proposal_hash = hash(ProposalSignedData(state.slot, BEACON_CHAIN_SHARD_NUMBER, block_hash_without_sig))`.
|
||||
* Verify that `BLSVerify(pubkey=state.validator_registry[get_beacon_proposer_index(state, state.slot)].pubkey, data=proposal_hash, sig=block.proposer_signature, domain=get_domain(state.fork_data, state.slot, DOMAIN_PROPOSAL))`.
|
||||
|
||||
### Attestations
|
||||
|
||||
*If not `slot_has_block`, do not process attestations. Move to next section.*
|
||||
|
||||
* Verify that `len(block.attestations) <= MAX_ATTESTATIONS_PER_BLOCK`.
|
||||
|
||||
For each `attestation` in `block.attestations`:
|
||||
|
@ -1248,8 +1245,6 @@ For each `attestation` in `block.attestations`:
|
|||
|
||||
### RANDAO
|
||||
|
||||
If `slot_has_block`:
|
||||
|
||||
* Let `repeat_hash(x, n) = x if n == 0 else repeat_hash(hash(x), n-1)`.
|
||||
* Let `proposer = state.validator_registry[get_beacon_proposer_index(state, state.slot)]`.
|
||||
* Verify that `repeat_hash(block.randao_reveal, proposer.randao_skips + 1) == proposer.randao_commitment`.
|
||||
|
@ -1257,23 +1252,13 @@ If `slot_has_block`:
|
|||
* Set `proposer.randao_commitment = block.randao_reveal`.
|
||||
* Set `proposer.randao_skips = 0`.
|
||||
|
||||
|
||||
If not `slot_has_block`:
|
||||
|
||||
* Let `state.validator_registry[get_beacon_proposer_index(state, state.slot)].randao_skips += 1`.
|
||||
|
||||
### PoW receipt root
|
||||
|
||||
*If not `slot_has_block`, do not process PoW receipt root. Move to next section.*
|
||||
|
||||
|
||||
* If `block.candidate_pow_receipt_root` is `x.candidate_pow_receipt_root` for some `x` in `state.candidate_pow_receipt_roots`, set `x.votes += 1`.
|
||||
* Otherwise, append to `state.candidate_pow_receipt_roots` a new `CandidatePoWReceiptRootRecord(candidate_pow_receipt_root=block.candidate_pow_receipt_root, votes=1)`.
|
||||
|
||||
### Special objects
|
||||
|
||||
*If not `slot_has_block`, do not process special objects. Move to next section.*
|
||||
|
||||
* Verify that the quantity of each type of object in `block.specials` is less than or equal to its maximum (see table at the top).
|
||||
* Verify that objects are sorted in order of `kind`. That is, `block.specials[i+1].kind >= block.specials[i].kind` for `0 <= i < len(block.specials-1)`.
|
||||
|
||||
|
@ -1607,9 +1592,8 @@ while len(state.persistent_committee_reassignments) > 0 and state.persistent_com
|
|||
|
||||
## State root processing
|
||||
|
||||
*If not `slot_has_block`, do not process state root. Move to next section.*
|
||||
|
||||
Verify `block.state_root == hash(state)`
|
||||
If there exists a `block` for the slot being processed:
|
||||
* Verify `block.state_root == hash(state)`
|
||||
|
||||
# Appendix
|
||||
## Appendix A - Hash function
|
||||
|
|
Loading…
Reference in New Issue