Skip to content

Commit

Permalink
Move compute_fork_version to fork.md
Browse files Browse the repository at this point in the history
  • Loading branch information
etan-status committed Jun 23, 2022
1 parent 0b8ab23 commit 840733f
Show file tree
Hide file tree
Showing 6 changed files with 63 additions and 48 deletions.
13 changes: 0 additions & 13 deletions specs/altair/beacon-chain.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
- [Helper functions](#helper-functions)
- [Crypto](#crypto)
- [Misc](#misc-1)
- [`compute_fork_version`](#compute_fork_version)
- [`add_flag`](#add_flag)
- [`has_flag`](#has_flag)
- [Beacon state accessors](#beacon-state-accessors)
Expand Down Expand Up @@ -227,18 +226,6 @@ the functionality described in those documents.

### Misc

#### `compute_fork_version`

```python
def compute_fork_version(epoch: Epoch) -> Version:
"""
Return the fork version at the given ``epoch``.
"""
if epoch >= ALTAIR_FORK_EPOCH:
return ALTAIR_FORK_VERSION
return GENESIS_FORK_VERSION
```

#### `add_flag`

```python
Expand Down
19 changes: 19 additions & 0 deletions specs/altair/fork.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@

- [Introduction](#introduction)
- [Configuration](#configuration)
- [Helper functions](#helper-functions)
- [Misc](#misc)
- [`compute_fork_version`](#compute_fork_version)
- [Fork to Altair](#fork-to-altair)
- [Fork trigger](#fork-trigger)
- [Upgrading the state](#upgrading-the-state)
Expand All @@ -26,6 +29,22 @@ Warning: this configuration is not definitive.
| `ALTAIR_FORK_VERSION` | `Version('0x01000000')` |
| `ALTAIR_FORK_EPOCH` | `Epoch(74240)` (Oct 27, 2021, 10:56:23am UTC) |

## Helper functions

### Misc

#### `compute_fork_version`

```python
def compute_fork_version(epoch: Epoch) -> Version:
"""
Return the fork version at the given ``epoch``.
"""
if epoch >= ALTAIR_FORK_EPOCH:
return ALTAIR_FORK_VERSION
return GENESIS_FORK_VERSION
```

## Fork to Altair

### Fork trigger
Expand Down
15 changes: 0 additions & 15 deletions specs/bellatrix/beacon-chain.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
- [`is_execution_enabled`](#is_execution_enabled)
- [Misc](#misc)
- [`compute_timestamp_at_slot`](#compute_timestamp_at_slot)
- [Modified `compute_fork_version`](#modified-compute_fork_version)
- [Beacon state accessors](#beacon-state-accessors)
- [Modified `get_inactivity_penalty_deltas`](#modified-get_inactivity_penalty_deltas)
- [Beacon state mutators](#beacon-state-mutators)
Expand Down Expand Up @@ -243,20 +242,6 @@ def compute_timestamp_at_slot(state: BeaconState, slot: Slot) -> uint64:
return uint64(state.genesis_time + slots_since_genesis * SECONDS_PER_SLOT)
```

#### Modified `compute_fork_version`

```python
def compute_fork_version(epoch: Epoch) -> Version:
"""
Return the fork version at the given ``epoch``.
"""
if epoch >= BELLATRIX_FORK_EPOCH:
return BELLATRIX_FORK_VERSION
if epoch >= ALTAIR_FORK_EPOCH:
return ALTAIR_FORK_VERSION
return GENESIS_FORK_VERSION
```

### Beacon state accessors

#### Modified `get_inactivity_penalty_deltas`
Expand Down
21 changes: 21 additions & 0 deletions specs/bellatrix/fork.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@

- [Introduction](#introduction)
- [Configuration](#configuration)
- [Helper functions](#helper-functions)
- [Misc](#misc)
- [Modified `compute_fork_version`](#modified-compute_fork_version)
- [Fork to Bellatrix](#fork-to-bellatrix)
- [Fork trigger](#fork-trigger)
- [Upgrading the state](#upgrading-the-state)
Expand All @@ -28,6 +31,24 @@ Warning: this configuration is not definitive.
| `BELLATRIX_FORK_VERSION` | `Version('0x02000000')` |
| `BELLATRIX_FORK_EPOCH` | `Epoch(18446744073709551615)` **TBD** |

## Helper functions

### Misc

#### Modified `compute_fork_version`

```python
def compute_fork_version(epoch: Epoch) -> Version:
"""
Return the fork version at the given ``epoch``.
"""
if epoch >= BELLATRIX_FORK_EPOCH:
return BELLATRIX_FORK_VERSION
if epoch >= ALTAIR_FORK_EPOCH:
return ALTAIR_FORK_VERSION
return GENESIS_FORK_VERSION
```

## Fork to Bellatrix

### Fork trigger
Expand Down
20 changes: 0 additions & 20 deletions specs/capella/beacon-chain.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@
- [`has_eth1_withdrawal_credential`](#has_eth1_withdrawal_credential)
- [`is_fully_withdrawable_validator`](#is_fully_withdrawable_validator)
- [`is_partially_withdrawable_validator`](#is_partially_withdrawable_validator)
- [Misc](#misc-1)
- [Modified `compute_fork_version`](#modified-compute_fork_version)
- [Beacon chain state transition function](#beacon-chain-state-transition-function)
- [Epoch processing](#epoch-processing)
- [Full withdrawals](#full-withdrawals)
Expand Down Expand Up @@ -320,24 +318,6 @@ def is_partially_withdrawable_validator(validator: Validator, balance: Gwei) ->
return has_eth1_withdrawal_credential(validator) and has_max_effective_balance and has_excess_balance
```

### Misc

#### Modified `compute_fork_version`

```python
def compute_fork_version(epoch: Epoch) -> Version:
"""
Return the fork version at the given ``epoch``.
"""
if epoch >= CAPELLA_FORK_EPOCH:
return CAPELLA_FORK_VERSION
if epoch >= BELLATRIX_FORK_EPOCH:
return BELLATRIX_FORK_VERSION
if epoch >= ALTAIR_FORK_EPOCH:
return ALTAIR_FORK_VERSION
return GENESIS_FORK_VERSION
```

## Beacon chain state transition function

### Epoch processing
Expand Down
23 changes: 23 additions & 0 deletions specs/capella/fork.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@

- [Introduction](#introduction)
- [Configuration](#configuration)
- [Helper functions](#helper-functions)
- [Misc](#misc)
- [Modified `compute_fork_version`](#modified-compute_fork_version)
- [Fork to Capella](#fork-to-capella)
- [Fork trigger](#fork-trigger)
- [Upgrading the state](#upgrading-the-state)
Expand All @@ -27,6 +30,26 @@ Warning: this configuration is not definitive.
| `CAPELLA_FORK_EPOCH` | `Epoch(18446744073709551615)` **TBD** |


## Helper functions

### Misc

#### Modified `compute_fork_version`

```python
def compute_fork_version(epoch: Epoch) -> Version:
"""
Return the fork version at the given ``epoch``.
"""
if epoch >= CAPELLA_FORK_EPOCH:
return CAPELLA_FORK_VERSION
if epoch >= BELLATRIX_FORK_EPOCH:
return BELLATRIX_FORK_VERSION
if epoch >= ALTAIR_FORK_EPOCH:
return ALTAIR_FORK_VERSION
return GENESIS_FORK_VERSION
```

## Fork to Capella

### Fork trigger
Expand Down

0 comments on commit 840733f

Please sign in to comment.