Polish beacon chain spec and validator guide

This commit is contained in:
Mikhail Kalinin 2021-03-11 18:52:31 +06:00
parent 0dec828d89
commit ee161634b2
2 changed files with 11 additions and 12 deletions

View File

@ -66,13 +66,13 @@ order and append any additional fields to the end.
```python
class BeaconBlockBody(phase0.BeaconBlockBody):
application_payload: ApplicationPayload # User execution payload
application_payload: ApplicationPayload # [Added] application payload
```
#### `BeaconState`
*Note*: `BeaconState` fields remain unchanged other than the removal of `eth1_data_votes` and addition of `application_state_root`.
The latter stores the root hash of ethereum application state.
*Note*: `BeaconState` fields remain unchanged other than the removal of `eth1_data_votes` and addition of `application_state_root` and `application_block_hash`.
```python
class BeaconState(Container):
@ -88,11 +88,11 @@ class BeaconState(Container):
historical_roots: List[Root, HISTORICAL_ROOTS_LIMIT]
# Eth1
eth1_data: Eth1Data
# [removed] eth1_data_votes
# [Removed] eth1_data_votes
eth1_deposit_index: uint64
# [new] Hash of the root of application state
# [Added] hash of the root of application state
application_state_root: Bytes32
# [new] Hash of recent application block
# [Added] hash of recent application block
application_block_hash: Bytes32
# Registry
validators: List[Validator, VALIDATOR_REGISTRY_LIMIT]
@ -179,7 +179,7 @@ def get_recent_beacon_block_roots(state: BeaconState, qty: uint64) -> Sequence[B
```python
def get_evm_beacon_block_roots(state: BeaconState) -> Sequence[Bytes32]:
num_block_roots = min(BLOCK_ROOTS_FOR_EVM_SIZE, SLOTS_PER_HISTORICAL_ROOT)
num_block_roots = min(EVM_BLOCK_ROOTS_SIZE, SLOTS_PER_HISTORICAL_ROOT)
return get_recent_beacon_block_roots(state, num_block_roots)
```
@ -229,7 +229,7 @@ The body of the function is implementation dependant.
Let `application_state_transition(application_state: ApplicationState, beacon_chain_data: BeaconChainData, application_payload: ApplicationPayload) -> None` be the transition function of ethereum application state.
The body of the function is implementation dependant.
*Note*: `application_state_transition` must throw `AssertionError` if either transition itself or post-transition verifications has failed.
*Note*: `application_state_transition` must throw `AssertionError` if either the transition itself or one of the post-transition verifications has failed.
##### `process_application_payload`

View File

@ -1,4 +1,4 @@
# Ethereum 2.0 Phase 1 -- Honest Validator
# Ethereum 2.0 The Merge
**Notice**: This document is a work-in-progress for researchers and implementers.
@ -41,7 +41,7 @@ All validator responsibilities remain unchanged other than those noted below. Na
##### Eth1 data
The `block.body.eth1_data` field is for block proposers to publish recent Eth1 data. This recent data contains deposit root (as calculated by the get_deposit_root() method of the deposit contract) and deposit count after processing of the parent block. The fork choice verifies Eth1 data of a block, then `state.eth1_data` updates immediately allowing new deposits to be processed. Each deposit in `block.body.deposits` must verify against `state.eth1_data.deposit_root`.
The `block.body.eth1_data` field is for block proposers to publish recent Eth1 data. This recent data contains deposit root (as calculated by the `get_deposit_root()` method of the deposit contract) and deposit count after processing of the parent block. The fork choice verifies Eth1 data of a block, then `state.eth1_data` updates immediately allowing new deposits to be processed. Each deposit in `block.body.deposits` must verify against `state.eth1_data.deposit_root`.
###### `get_eth1_data`
@ -57,7 +57,7 @@ Set `block.body.eth1_data = get_eth1_data(state)`.
###### `produce_application_payload`
Let `produce_application_payload(parent_hash: Bytes32, beacon_chain_data: BeaconChainData) -> ApplicationPayload` be the function that produces new instance of application payload.
The body of this function is implementation dependant.
* Let `randao_reveal` be `block.body.randao_reveal` of the block that is being produced
* Set `block.body.application_payload = get_application_payload(state, randao_reveal)` where:
@ -74,4 +74,3 @@ def get_application_payload(state: BeaconState, randao_reveal: BLSSignature) ->
return produce_application_payload(application_parent_hash, beacon_chain_data)
```