EIP6110 meta update
This commit is contained in:
parent
d2c69fe3cf
commit
9c4e1db821
|
@ -26,10 +26,10 @@ Features are researched and developed in parallel, and then consolidated into se
|
|||
### In-development Specifications
|
||||
| Code Name or Topic | Specs | Notes |
|
||||
| - | - | - |
|
||||
| Electra | <ul><li>Core</li><ul><li>[Beacon Chain changes](specs/electra/beacon-chain.md)</li><li>[EIP-6110 fork](specs/electra/fork.md)</li></ul><li>Additions</li><ul><li>[Honest validator guide changes](specs/electra/validator.md)</li></ul></ul> |
|
||||
| Sharding (outdated) | <ul><li>Core</li><ul><li>[Beacon Chain changes](specs/_features/sharding/beacon-chain.md)</li></ul><li>Additions</li><ul><li>[P2P networking](specs/_features/sharding/p2p-interface.md)</li></ul></ul> |
|
||||
| Custody Game (outdated) | <ul><li>Core</li><ul><li>[Beacon Chain changes](specs/_features/custody_game/beacon-chain.md)</li></ul><li>Additions</li><ul><li>[Honest validator guide changes](specs/_features/custody_game/validator.md)</li></ul></ul> | Dependent on sharding |
|
||||
| Data Availability Sampling (outdated) | <ul><li>Core</li><ul><li>[Core types and functions](specs/_features/das/das-core.md)</li><li>[Fork choice changes](specs/_features/das/fork-choice.md)</li></ul><li>Additions</li><ul><li>[P2P Networking](specs/_features/das/p2p-interface.md)</li><li>[Sampling process](specs/_features/das/sampling.md)</li></ul></ul> | <ul><li> Dependent on sharding</li><li>[Technical explainer](https://hackmd.io/@HWeNw8hNRimMm2m2GH56Cw/B1YJPGkpD)</li></ul> |
|
||||
| EIP-6110 | <ul><li>Core</li><ul><li>[Beacon Chain changes](specs/_features/electra//beacon-chain.md)</li><li>[EIP-6110 fork](specs/_features/electra/fork.md)</li></ul><li>Additions</li><ul><li>[Honest validator guide changes](specs/_features/electra/validator.md)</li></ul></ul> |
|
||||
|
||||
### Accompanying documents can be found in [specs](specs) and include:
|
||||
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
# EIP-6110 -- The Beacon Chain
|
||||
# Electra -- The Beacon Chain
|
||||
|
||||
**Notice**: This document is a work-in-progress for researchers and implementers.
|
||||
|
||||
## Table of contents
|
||||
|
||||
|
@ -30,10 +32,8 @@
|
|||
|
||||
## Introduction
|
||||
|
||||
This is the beacon chain specification of in-protocol deposits processing mechanism.
|
||||
This mechanism relies on the changes proposed by [EIP-6110](http://eips.ethereum.org/EIPS/eip-6110).
|
||||
|
||||
*Note:* This specification is built upon [Deneb](../../deneb/beacon-chain.md) and is under active development.
|
||||
Electra is a consensus-layer upgrade containing a number of features. Including:
|
||||
* [EIP-6110](https://eips.ethereum.org/EIPS/eip-6110): Supply validator deposits on chain
|
||||
|
||||
## Constants
|
||||
|
||||
|
@ -41,9 +41,9 @@ The following values are (non-configurable) constants used throughout the specif
|
|||
|
||||
### Misc
|
||||
|
||||
| Name | Value |
|
||||
| - | - |
|
||||
| `UNSET_DEPOSIT_RECEIPTS_START_INDEX` | `uint64(2**64 - 1)` |
|
||||
| Name | Value | Description |
|
||||
| - | - | - |
|
||||
| `UNSET_DEPOSIT_RECEIPTS_START_INDEX` | `uint64(2**64 - 1)` | *[New in Electra:EIP6110]* |
|
||||
|
||||
## Preset
|
||||
|
||||
|
@ -51,7 +51,7 @@ The following values are (non-configurable) constants used throughout the specif
|
|||
|
||||
| Name | Value | Description |
|
||||
| - | - | - |
|
||||
| `MAX_DEPOSIT_RECEIPTS_PER_PAYLOAD` | `uint64(2**13)` (= 8,192) | Maximum number of deposit receipts allowed in each payload |
|
||||
| `MAX_DEPOSIT_RECEIPTS_PER_PAYLOAD` | `uint64(2**13)` (= 8,192) | *[New in Electra:EIP6110]* Maximum number of deposit receipts allowed in each payload |
|
||||
|
||||
## Containers
|
||||
|
||||
|
@ -59,6 +59,8 @@ The following values are (non-configurable) constants used throughout the specif
|
|||
|
||||
#### `DepositReceipt`
|
||||
|
||||
*Note*: The container is new in EIP6110.
|
||||
|
||||
```python
|
||||
class DepositReceipt(Container):
|
||||
pubkey: BLSPubkey
|
||||
|
@ -93,7 +95,7 @@ class ExecutionPayload(Container):
|
|||
withdrawals: List[Withdrawal, MAX_WITHDRAWALS_PER_PAYLOAD]
|
||||
blob_gas_used: uint64
|
||||
excess_blob_gas: uint64
|
||||
deposit_receipts: List[DepositReceipt, MAX_DEPOSIT_RECEIPTS_PER_PAYLOAD] # [New in EIP6110]
|
||||
deposit_receipts: List[DepositReceipt, MAX_DEPOSIT_RECEIPTS_PER_PAYLOAD] # [New in Electra:EIP6110]
|
||||
```
|
||||
|
||||
#### `ExecutionPayloadHeader`
|
||||
|
@ -119,7 +121,7 @@ class ExecutionPayloadHeader(Container):
|
|||
withdrawals_root: Root
|
||||
blob_gas_used: uint64
|
||||
excess_blob_gas: uint64
|
||||
deposit_receipts_root: Root # [New in EIP6110]
|
||||
deposit_receipts_root: Root # [New in Electra:EIP6110]
|
||||
```
|
||||
|
||||
#### `BeaconState`
|
||||
|
@ -161,13 +163,13 @@ class BeaconState(Container):
|
|||
current_sync_committee: SyncCommittee
|
||||
next_sync_committee: SyncCommittee
|
||||
# Execution
|
||||
latest_execution_payload_header: ExecutionPayloadHeader # [Modified in EIP6110]
|
||||
latest_execution_payload_header: ExecutionPayloadHeader # [Modified in Electra:EIP6110]
|
||||
# Withdrawals
|
||||
next_withdrawal_index: WithdrawalIndex
|
||||
next_withdrawal_validator_index: ValidatorIndex
|
||||
# Deep history valid from Capella onwards
|
||||
historical_summaries: List[HistoricalSummary, HISTORICAL_ROOTS_LIMIT]
|
||||
# [New in EIP6110]
|
||||
# [New in Electra:EIP6110]
|
||||
deposit_receipts_start_index: uint64
|
||||
```
|
||||
|
||||
|
@ -179,10 +181,10 @@ class BeaconState(Container):
|
|||
def process_block(state: BeaconState, block: BeaconBlock) -> None:
|
||||
process_block_header(state, block)
|
||||
process_withdrawals(state, block.body.execution_payload)
|
||||
process_execution_payload(state, block.body, EXECUTION_ENGINE) # [Modified in EIP6110]
|
||||
process_execution_payload(state, block.body, EXECUTION_ENGINE) # [Modified in Electra:EIP6110]
|
||||
process_randao(state, block.body)
|
||||
process_eth1_data(state, block.body)
|
||||
process_operations(state, block.body) # [Modified in EIP6110]
|
||||
process_operations(state, block.body) # [Modified in Electra:EIP6110]
|
||||
process_sync_aggregate(state, block.body.sync_aggregate)
|
||||
```
|
||||
|
||||
|
@ -192,7 +194,7 @@ def process_block(state: BeaconState, block: BeaconBlock) -> None:
|
|||
|
||||
```python
|
||||
def process_operations(state: BeaconState, body: BeaconBlockBody) -> None:
|
||||
# [Modified in EIP6110]
|
||||
# [Modified in Electra:EIP6110]
|
||||
# Disable former deposit mechanism once all prior deposits are processed
|
||||
eth1_deposit_index_limit = min(state.eth1_data.deposit_count, state.deposit_receipts_start_index)
|
||||
if state.eth1_deposit_index < eth1_deposit_index_limit:
|
||||
|
@ -217,6 +219,8 @@ def process_operations(state: BeaconState, body: BeaconBlockBody) -> None:
|
|||
|
||||
#### New `process_deposit_receipt`
|
||||
|
||||
*Note*: This function is new in Electra:EIP6110.
|
||||
|
||||
```python
|
||||
def process_deposit_receipt(state: BeaconState, deposit_receipt: DepositReceipt) -> None:
|
||||
# Set deposit receipt start index
|
||||
|
@ -276,17 +280,17 @@ def process_execution_payload(state: BeaconState, body: BeaconBlockBody, executi
|
|||
withdrawals_root=hash_tree_root(payload.withdrawals),
|
||||
blob_gas_used=payload.blob_gas_used,
|
||||
excess_blob_gas=payload.excess_blob_gas,
|
||||
deposit_receipts_root=hash_tree_root(payload.deposit_receipts), # [New in EIP6110]
|
||||
deposit_receipts_root=hash_tree_root(payload.deposit_receipts), # [New in Electra:EIP6110]
|
||||
)
|
||||
```
|
||||
|
||||
## Testing
|
||||
|
||||
*Note*: The function `initialize_beacon_state_from_eth1` is modified for pure EIP-6110 testing only.
|
||||
*Note*: The function `initialize_beacon_state_from_eth1` is modified for pure Electra testing only.
|
||||
Modifications include:
|
||||
1. Use `ELECTRA_FORK_VERSION` as the previous and current fork version.
|
||||
2. Utilize the EIP-6110 `BeaconBlockBody` when constructing the initial `latest_block_header`.
|
||||
3. Add `deposit_receipts_start_index` variable to the genesis state initialization.
|
||||
2. Utilize the Electra `BeaconBlockBody` when constructing the initial `latest_block_header`.
|
||||
3. *[New in Electra:EIP6110]* Add `deposit_receipts_start_index` variable to the genesis state initialization.
|
||||
|
||||
```python
|
||||
def initialize_beacon_state_from_eth1(eth1_block_hash: Hash32,
|
||||
|
@ -295,8 +299,8 @@ def initialize_beacon_state_from_eth1(eth1_block_hash: Hash32,
|
|||
execution_payload_header: ExecutionPayloadHeader=ExecutionPayloadHeader()
|
||||
) -> BeaconState:
|
||||
fork = Fork(
|
||||
previous_version=ELECTRA_FORK_VERSION, # [Modified in EIP6110] for testing only
|
||||
current_version=ELECTRA_FORK_VERSION, # [Modified in EIP6110]
|
||||
previous_version=ELECTRA_FORK_VERSION, # [Modified in Electra:EIP6110] for testing only
|
||||
current_version=ELECTRA_FORK_VERSION, # [Modified in Electra:EIP6110]
|
||||
epoch=GENESIS_EPOCH,
|
||||
)
|
||||
state = BeaconState(
|
||||
|
@ -305,7 +309,7 @@ def initialize_beacon_state_from_eth1(eth1_block_hash: Hash32,
|
|||
eth1_data=Eth1Data(block_hash=eth1_block_hash, deposit_count=uint64(len(deposits))),
|
||||
latest_block_header=BeaconBlockHeader(body_root=hash_tree_root(BeaconBlockBody())),
|
||||
randao_mixes=[eth1_block_hash] * EPOCHS_PER_HISTORICAL_VECTOR, # Seed RANDAO with Eth1 entropy
|
||||
deposit_receipts_start_index=UNSET_DEPOSIT_RECEIPTS_START_INDEX, # [New in EIP6110]
|
||||
deposit_receipts_start_index=UNSET_DEPOSIT_RECEIPTS_START_INDEX, # [New in Electra:EIP6110]
|
||||
)
|
||||
|
||||
# Process deposits
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# EIP-6110 -- Fork Logic
|
||||
# Electra -- Fork Logic
|
||||
|
||||
**Notice**: This document is a work-in-progress for researchers and implementers.
|
||||
|
||||
|
@ -12,7 +12,7 @@
|
|||
- [Helper functions](#helper-functions)
|
||||
- [Misc](#misc)
|
||||
- [Modified `compute_fork_version`](#modified-compute_fork_version)
|
||||
- [Fork to EIP-6110](#fork-to-eip-6110)
|
||||
- [Fork to Electra](#fork-to-electra)
|
||||
- [Fork trigger](#fork-trigger)
|
||||
- [Upgrading the state](#upgrading-the-state)
|
||||
|
||||
|
@ -55,19 +55,19 @@ def compute_fork_version(epoch: Epoch) -> Version:
|
|||
return GENESIS_FORK_VERSION
|
||||
```
|
||||
|
||||
## Fork to EIP-6110
|
||||
## Fork to Electra
|
||||
|
||||
### Fork trigger
|
||||
|
||||
TBD. This fork is defined for testing purposes, the EIP may be combined with other consensus-layer upgrade.
|
||||
For now, we assume the condition will be triggered at epoch `ELECTRA_FORK_EPOCH`.
|
||||
|
||||
Note that for the pure EIP-6110 networks, we don't apply `upgrade_to_electra` since it starts with EIP-6110 version logic.
|
||||
Note that for the pure Electra networks, we don't apply `upgrade_to_electra` since it starts with Electra version logic.
|
||||
|
||||
### Upgrading the state
|
||||
|
||||
If `state.slot % SLOTS_PER_EPOCH == 0` and `compute_epoch_at_slot(state.slot) == ELECTRA_FORK_EPOCH`,
|
||||
an irregular state change is made to upgrade to EIP-6110.
|
||||
an irregular state change is made to upgrade to Electra.
|
||||
|
||||
```python
|
||||
def upgrade_to_electra(pre: deneb.BeaconState) -> BeaconState:
|
||||
|
@ -90,7 +90,7 @@ def upgrade_to_electra(pre: deneb.BeaconState) -> BeaconState:
|
|||
withdrawals_root=pre.latest_execution_payload_header.withdrawals_root,
|
||||
blob_gas_used=uint64(0),
|
||||
excess_blob_gas=uint64(0),
|
||||
deposit_receipts_root=Root(), # [New in EIP-6110]
|
||||
deposit_receipts_root=Root(), # [New in Electra:EIP6110]
|
||||
)
|
||||
post = BeaconState(
|
||||
# Versioning
|
||||
|
@ -99,7 +99,7 @@ def upgrade_to_electra(pre: deneb.BeaconState) -> BeaconState:
|
|||
slot=pre.slot,
|
||||
fork=Fork(
|
||||
previous_version=pre.fork.current_version,
|
||||
current_version=ELECTRA_FORK_VERSION, # [Modified in EIP-6110]
|
||||
current_version=ELECTRA_FORK_VERSION, # [Modified in Electra:EIP6110]
|
||||
epoch=epoch,
|
||||
),
|
||||
# History
|
||||
|
@ -132,14 +132,14 @@ def upgrade_to_electra(pre: deneb.BeaconState) -> BeaconState:
|
|||
current_sync_committee=pre.current_sync_committee,
|
||||
next_sync_committee=pre.next_sync_committee,
|
||||
# Execution-layer
|
||||
latest_execution_payload_header=latest_execution_payload_header, # [Modified in EIP-6110]
|
||||
latest_execution_payload_header=latest_execution_payload_header, # [Modified in Electra:EIP6110]
|
||||
# Withdrawals
|
||||
next_withdrawal_index=pre.next_withdrawal_index,
|
||||
next_withdrawal_validator_index=pre.next_withdrawal_validator_index,
|
||||
# Deep history valid from Capella onwards
|
||||
historical_summaries=pre.historical_summaries,
|
||||
# EIP-6110
|
||||
deposit_receipts_start_index=UNSET_DEPOSIT_RECEIPTS_START_INDEX, # [New in EIP-6110]
|
||||
# EIP6110
|
||||
deposit_receipts_start_index=UNSET_DEPOSIT_RECEIPTS_START_INDEX, # [New in Electra:EIP6110]
|
||||
)
|
||||
|
||||
return post
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# EIP-6110 -- Honest Validator
|
||||
# Electra -- Honest Validator
|
||||
|
||||
## Table of contents
|
||||
|
||||
|
@ -16,21 +16,21 @@
|
|||
|
||||
## Introduction
|
||||
|
||||
This document represents the changes to be made in the code of an "honest validator" to implement EIP-6110.
|
||||
This document represents the changes to be made in the code of an "honest validator" to implement Electra.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
This document is an extension of the [Deneb -- Honest Validator](../../deneb/validator.md) guide.
|
||||
All behaviors and definitions defined in this document, and documents it extends, carry over unless explicitly noted or overridden.
|
||||
|
||||
All terminology, constants, functions, and protocol mechanics defined in the updated Beacon Chain doc of [EIP-6110](./beacon-chain.md) are requisite for this document and used throughout.
|
||||
All terminology, constants, functions, and protocol mechanics defined in the updated Beacon Chain doc of [Electra](./beacon-chain.md) are requisite for this document and used throughout.
|
||||
Please see related Beacon Chain doc before continuing and use them as a reference throughout.
|
||||
|
||||
## Block proposal
|
||||
|
||||
### Deposits
|
||||
|
||||
The expected number of deposits MUST be changed from `min(MAX_DEPOSITS, eth1_data.deposit_count - state.eth1_deposit_index)` to the result of the following function:
|
||||
*[New in Electra:EIP6110* The expected number of deposits MUST be changed from `min(MAX_DEPOSITS, eth1_data.deposit_count - state.eth1_deposit_index)` to the result of the following function:
|
||||
|
||||
```python
|
||||
def get_eth1_pending_deposit_count(state: BeaconState) -> uint64:
|
||||
|
|
Loading…
Reference in New Issue