mirror of
https://github.com/status-im/eth2.0-specs.git
synced 2025-02-22 15:28:11 +00:00
phase0: enable a tunable genesis time
This commit is contained in:
parent
bdf9f0226d
commit
34412130c5
@ -218,7 +218,7 @@ The following values are (non-configurable) constants used throughout the specif
|
|||||||
|
|
||||||
| Name | Value | Unit | Duration |
|
| Name | Value | Unit | Duration |
|
||||||
| - | - | :-: | :-: |
|
| - | - | :-: | :-: |
|
||||||
| `MIN_GENESIS_DELAY` | `86400` | seconds | 1 day |
|
| `GENESIS_DELAY` | `172800` | seconds | 2 days |
|
||||||
| `SECONDS_PER_SLOT` | `12` | seconds | 12 seconds |
|
| `SECONDS_PER_SLOT` | `12` | seconds | 12 seconds |
|
||||||
| `SECONDS_PER_ETH1_BLOCK` | `14` | seconds | 14 seconds |
|
| `SECONDS_PER_ETH1_BLOCK` | `14` | seconds | 14 seconds |
|
||||||
| `MIN_ATTESTATION_INCLUSION_DELAY` | `2**0` (= 1) | slots | 12 seconds |
|
| `MIN_ATTESTATION_INCLUSION_DELAY` | `2**0` (= 1) | slots | 12 seconds |
|
||||||
@ -1137,7 +1137,7 @@ Before the Ethereum 2.0 genesis has been triggered, and for every Ethereum 1.0 b
|
|||||||
- `eth1_timestamp` is the Unix timestamp corresponding to `eth1_block_hash`
|
- `eth1_timestamp` is the Unix timestamp corresponding to `eth1_block_hash`
|
||||||
- `deposits` is the sequence of all deposits, ordered chronologically, up to (and including) the block with hash `eth1_block_hash`
|
- `deposits` is the sequence of all deposits, ordered chronologically, up to (and including) the block with hash `eth1_block_hash`
|
||||||
|
|
||||||
Eth1 blocks must only be considered once they are at least `SECONDS_PER_ETH1_BLOCK * ETH1_FOLLOW_DISTANCE` seconds old (i.e. `eth1_timestamp + SECONDS_PER_ETH1_BLOCK * ETH1_FOLLOW_DISTANCE <= current_unix_time`). Due to this constraint, if `MIN_GENESIS_DELAY < SECONDS_PER_ETH1_BLOCK * ETH1_FOLLOW_DISTANCE`, then the `genesis_time` can happen before the time/state is first known. Values should be configured to avoid this case.
|
Eth1 blocks must only be considered once they are at least `SECONDS_PER_ETH1_BLOCK * ETH1_FOLLOW_DISTANCE` seconds old (i.e. `eth1_timestamp + SECONDS_PER_ETH1_BLOCK * ETH1_FOLLOW_DISTANCE <= current_unix_time`). Due to this constraint, if `GENESIS_DELAY < SECONDS_PER_ETH1_BLOCK * ETH1_FOLLOW_DISTANCE`, then the `genesis_time` can happen before the time/state is first known. Values should be configured to avoid this case.
|
||||||
|
|
||||||
```python
|
```python
|
||||||
def initialize_beacon_state_from_eth1(eth1_block_hash: Bytes32,
|
def initialize_beacon_state_from_eth1(eth1_block_hash: Bytes32,
|
||||||
@ -1149,7 +1149,7 @@ def initialize_beacon_state_from_eth1(eth1_block_hash: Bytes32,
|
|||||||
epoch=GENESIS_EPOCH,
|
epoch=GENESIS_EPOCH,
|
||||||
)
|
)
|
||||||
state = BeaconState(
|
state = BeaconState(
|
||||||
genesis_time=eth1_timestamp - eth1_timestamp % MIN_GENESIS_DELAY + 2 * MIN_GENESIS_DELAY,
|
genesis_time=eth1_timestamp + GENESIS_DELAY,
|
||||||
fork=fork,
|
fork=fork,
|
||||||
eth1_data=Eth1Data(block_hash=eth1_block_hash, deposit_count=len(deposits)),
|
eth1_data=Eth1Data(block_hash=eth1_block_hash, deposit_count=len(deposits)),
|
||||||
latest_block_header=BeaconBlockHeader(body_root=hash_tree_root(BeaconBlockBody())),
|
latest_block_header=BeaconBlockHeader(body_root=hash_tree_root(BeaconBlockBody())),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user