Merge pull request #738 from ethereum/JustinDrake-patch-4
Semantic fork versions and signature domains
This commit is contained in:
commit
e8434478c4
|
@ -290,9 +290,9 @@ The types are defined topologically to aid in facilitating an executable version
|
||||||
```python
|
```python
|
||||||
{
|
{
|
||||||
# Previous fork version
|
# Previous fork version
|
||||||
'previous_version': 'uint64',
|
'previous_version': 'bytes4',
|
||||||
# Current fork version
|
# Current fork version
|
||||||
'current_version': 'uint64',
|
'current_version': 'bytes4',
|
||||||
# Fork epoch number
|
# Fork epoch number
|
||||||
'epoch': 'uint64',
|
'epoch': 'uint64',
|
||||||
}
|
}
|
||||||
|
@ -1106,7 +1106,7 @@ def get_total_balance(state: BeaconState, validators: List[ValidatorIndex]) -> G
|
||||||
|
|
||||||
```python
|
```python
|
||||||
def get_fork_version(fork: Fork,
|
def get_fork_version(fork: Fork,
|
||||||
epoch: Epoch) -> int:
|
epoch: Epoch) -> bytes:
|
||||||
"""
|
"""
|
||||||
Return the fork version of the given ``epoch``.
|
Return the fork version of the given ``epoch``.
|
||||||
"""
|
"""
|
||||||
|
@ -1125,8 +1125,7 @@ def get_domain(fork: Fork,
|
||||||
"""
|
"""
|
||||||
Get the domain number that represents the fork meta and signature domain.
|
Get the domain number that represents the fork meta and signature domain.
|
||||||
"""
|
"""
|
||||||
fork_version = get_fork_version(fork, epoch)
|
return bytes_to_int(get_fork_version(fork, epoch) + int_to_bytes4(domain_type))
|
||||||
return fork_version * 2**32 + domain_type
|
|
||||||
```
|
```
|
||||||
|
|
||||||
### `get_bitfield_bit`
|
### `get_bitfield_bit`
|
||||||
|
@ -1518,8 +1517,8 @@ def get_genesis_beacon_state(genesis_validator_deposits: List[Deposit],
|
||||||
slot=GENESIS_SLOT,
|
slot=GENESIS_SLOT,
|
||||||
genesis_time=genesis_time,
|
genesis_time=genesis_time,
|
||||||
fork=Fork(
|
fork=Fork(
|
||||||
previous_version=GENESIS_FORK_VERSION,
|
previous_version=int_to_bytes4(GENESIS_FORK_VERSION),
|
||||||
current_version=GENESIS_FORK_VERSION,
|
current_version=int_to_bytes4(GENESIS_FORK_VERSION),
|
||||||
epoch=GENESIS_EPOCH,
|
epoch=GENESIS_EPOCH,
|
||||||
),
|
),
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue