Fix and add `EIP7732_FORK_EPOCH` and `EIP7594_FORK_VERSION`

This commit is contained in:
Hsiao-Wei Wang 2024-07-03 20:49:56 +08:00 committed by Potuz
parent b230a42584
commit b2d6e68e62
4 changed files with 17 additions and 11 deletions

View File

@ -59,6 +59,9 @@ EIP7594_FORK_EPOCH: 18446744073709551615
# WHISK
WHISK_FORK_VERSION: 0x08000000 # temporary stub
WHISK_FORK_EPOCH: 18446744073709551615
# EIP7732
EIP7732_FORK_VERSION: 0x09000000 # temporary stub
EIP7732_FORK_EPOCH: 18446744073709551615
# Time parameters
# ---------------------------------------------------------------

View File

@ -58,6 +58,9 @@ EIP7594_FORK_EPOCH: 18446744073709551615
# WHISK
WHISK_FORK_VERSION: 0x08000001
WHISK_FORK_EPOCH: 18446744073709551615
# EIP7732
EIP7732_FORK_VERSION: 0x09000001
EIP7732_FORK_EPOCH: 18446744073709551615
# Time parameters
# ---------------------------------------------------------------

View File

@ -28,8 +28,8 @@ Warning: this configuration is not definitive.
| Name | Value |
|---------------------| - |
| `EPBS_FORK_VERSION` | `Version('0x06000000')` |
| `EPBS_FORK_EPOCH` | `Epoch(18446744073709551615)` **TBD** |
| `EIP7732_FORK_VERSION` | `Version('0x09000000')` |
| `EIP7732_FORK_EPOCH` | `Epoch(18446744073709551615)` **TBD** |
## Helper functions
@ -42,8 +42,8 @@ def compute_fork_version(epoch: Epoch) -> Version:
"""
Return the fork version at the given ``epoch``.
"""
if epoch >= EPBS_FORK_EPOCH:
return EPBS_FORK_VERSION
if epoch >= EIP7732_FORK_EPOCH:
return EIP7732_FORK_VERSION
if epoch >= ELECTRA_FORK_EPOCH:
return ELECTRA_FORK_VERSION
if epoch >= DENEB_FORK_EPOCH:
@ -63,11 +63,11 @@ def compute_fork_version(epoch: Epoch) -> Version:
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 `EPBS_FORK_EPOCH`.
For now, we assume the condition will be triggered at epoch `EIP7732_FORK_EPOCH`.
### Upgrading the state
If `state.slot % SLOTS_PER_EPOCH == 0` and `compute_epoch_at_slot(state.slot) == EPBS_FORK_EPOCH`,
If `state.slot % SLOTS_PER_EPOCH == 0` and `compute_epoch_at_slot(state.slot) == EIP7732_FORK_EPOCH`,
an irregular state change is made to upgrade to ePBS.
```python
@ -81,7 +81,7 @@ def upgrade_to_epbs(pre: electra.BeaconState) -> BeaconState:
slot=pre.slot,
fork=Fork(
previous_version=pre.fork.current_version,
current_version=EPBS_FORK_EPOCH, # [Modified in ePBS]
current_version=EIP7732_FORK_EPOCH, # [Modified in ePBS]
epoch=epoch,
),
# History

View File

@ -184,7 +184,7 @@ The following validations MUST pass before forwarding the `signed_execution_payl
| `BELLATRIX_FORK_VERSION` | `bellatrix.SignedBeaconBlock` |
| `CAPELLA_FORK_VERSION` | `capella.SignedBeaconBlock` |
| `DENEB_FORK_VERSION` | `deneb.SignedBeaconBlock` |
| `EPBS_FORK_VERSION` | `epbs.SignedBeaconBlock` |
| `EIP7732_FORK_VERSION` | `epbs.SignedBeaconBlock` |
##### BeaconBlocksByRoot v3
@ -201,7 +201,7 @@ Per `context = compute_fork_digest(fork_version, genesis_validators_root)`:
| `BELLATRIX_FORK_VERSION` | `bellatrix.SignedBeaconBlock` |
| `CAPELLA_FORK_VERSION` | `capella.SignedBeaconBlock` |
| `DENEB_FORK_VERSION` | `deneb.SignedBeaconBlock` |
| `EPBS_FORK_VERSION` | `epbs.SignedBeaconBlock` |
| `EIP7732_FORK_VERSION` | `epbs.SignedBeaconBlock` |
##### BlobSidecarsByRoot v2
@ -213,7 +213,7 @@ Per `context = compute_fork_digest(fork_version, genesis_validators_root)`:
| `fork_version` | Chunk SSZ type |
|--------------------------|-------------------------------|
| `DENEB_FORK_VERSION` | `deneb.BlobSidecar` |
| `EPBS_FORK_VERSION` | `epbs.BlobSidecar` |
| `EIP7732_FORK_VERSION` | `epbs.BlobSidecar` |
##### ExecutionPayloadEnvelopeByRoot v1
@ -226,7 +226,7 @@ The `<context-bytes>` field is calculated as `context = compute_fork_digest(fork
| `fork_version` | Chunk SSZ type |
|---------------------|---------------------------------------|
| `EPBS_FORK_VERSION` | `epbs.SignedExecutionPayloadEnvelope` |
| `EIP7732_FORK_VERSION` | `epbs.SignedExecutionPayloadEnvelope` |
Request Content: