Merge pull request #655 from ethereum/JustinDrake-patch-4

Reduce GENESIS_SLOT to 2**32
This commit is contained in:
Danny Ryan 2019-02-21 14:51:12 -07:00 committed by GitHub
commit 830ae3be9a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 6 deletions

View File

@ -212,7 +212,7 @@ Code snippets appearing in `this style` are to be interpreted as Python code.
| Name | Value | | Name | Value |
| - | - | | - | - |
| `GENESIS_FORK_VERSION` | `0` | | `GENESIS_FORK_VERSION` | `0` |
| `GENESIS_SLOT` | `2**63` | | `GENESIS_SLOT` | `2**32` |
| `GENESIS_EPOCH` | `slot_to_epoch(GENESIS_SLOT)` | | `GENESIS_EPOCH` | `slot_to_epoch(GENESIS_SLOT)` |
| `GENESIS_START_SHARD` | `0` | | `GENESIS_START_SHARD` | `0` |
| `FAR_FUTURE_EPOCH` | `2**64 - 1` | | `FAR_FUTURE_EPOCH` | `2**64 - 1` |
@ -688,12 +688,8 @@ def slot_to_epoch(slot: Slot) -> Epoch:
def get_previous_epoch(state: BeaconState) -> Epoch: def get_previous_epoch(state: BeaconState) -> Epoch:
"""` """`
Return the previous epoch of the given ``state``. Return the previous epoch of the given ``state``.
If the current epoch is ``GENESIS_EPOCH``, return ``GENESIS_EPOCH``.
""" """
current_epoch = get_current_epoch(state) return get_current_epoch(state) - 1
if current_epoch == GENESIS_EPOCH:
return GENESIS_EPOCH
return current_epoch - 1
``` ```
### `get_current_epoch` ### `get_current_epoch`