move GENESIS_SLOT/EPOCH to constants as they are not truly configurable

This commit is contained in:
Danny Ryan 2020-01-05 15:03:13 -07:00
parent 5ac0d12205
commit 8515aec7aa
No known key found for this signature in database
GPG Key ID: 2765A792E42CE07A
4 changed files with 4 additions and 7 deletions

View File

@ -63,8 +63,6 @@ EFFECTIVE_BALANCE_INCREMENT: 1000000000
# Initial values
# ---------------------------------------------------------------
# 0, GENESIS_EPOCH is derived from this constant
GENESIS_SLOT: 0
# Mainnet initial fork version, recommend altering for testnets
GENESIS_FORK_VERSION: 0x00000000
BLS_WITHDRAWAL_PREFIX: 0x00

View File

@ -63,8 +63,6 @@ EFFECTIVE_BALANCE_INCREMENT: 1000000000
# Initial values
# ---------------------------------------------------------------
# 0, GENESIS_EPOCH is derived from this constant
GENESIS_SLOT: 0
# Highest byte set to 0x01 to avoid collisions with mainnet versioning
GENESIS_FORK_VERSION: 0x00000001
BLS_WITHDRAWAL_PREFIX: 0x00

View File

@ -158,6 +158,8 @@ The following values are (non-configurable) constants used throughout the specif
| Name | Value |
| - | - |
| `GENESIS_SLOT` | `Slot(0)` |
| `GENESIS_EPOCH` | `Epoch(0)` |
| `FAR_FUTURE_EPOCH` | `Epoch(2**64 - 1)` |
| `BASE_REWARDS_PER_EPOCH` | `4` |
| `DEPOSIT_CONTRACT_TREE_DEPTH` | `2**5` (= 32) |
@ -197,8 +199,6 @@ The following values are (non-configurable) constants used throughout the specif
| Name | Value |
| - | - |
| `GENESIS_SLOT` | `Slot(0)` |
| `GENESIS_EPOCH` | `Epoch(0)` |
| `GENESIS_FORK_VERSION` | `Version('0x00000000')` |
| `BLS_WITHDRAWAL_PREFIX` | `Bytes1('0x00')` |

View File

@ -263,7 +263,8 @@ An honest block proposer sets `block.body.eth1_data = get_eth1_vote(state)` wher
```python
def voting_period_start_time(state: BeaconState) -> uint64:
eth1_voting_period_start_slot = state.slot % SLOTS_PER_ETH1_VOTING_PERIOD
return state.genesis_time + eth1_voting_period_start_slot * SECONDS_PER_SLOT
time_since_genesis = (eth1_voting_period_start_slot - GENESIS_SLOT) * SECONDS_PER_SLOT
return state.genesis_time + time_since_genesis
```
```python