Skip to content

Commit

Permalink
Merge pull request #738 from ethereum/JustinDrake-patch-4
Browse files Browse the repository at this point in the history
Semantic fork versions and signature domains
  • Loading branch information
djrtwo authored Mar 12, 2019
2 parents 54fae53 + a68b050 commit e843447
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions specs/core/0_beacon-chain.md
Original file line number Diff line number Diff line change
Expand Up @@ -290,9 +290,9 @@ The types are defined topologically to aid in facilitating an executable version
```python
{
# Previous fork version
'previous_version': 'uint64',
'previous_version': 'bytes4',
# Current fork version
'current_version': 'uint64',
'current_version': 'bytes4',
# Fork epoch number
'epoch': 'uint64',
}
Expand Down Expand Up @@ -1106,7 +1106,7 @@ def get_total_balance(state: BeaconState, validators: List[ValidatorIndex]) -> G

```python
def get_fork_version(fork: Fork,
epoch: Epoch) -> int:
epoch: Epoch) -> bytes:
"""
Return the fork version of the given ``epoch``.
"""
Expand All @@ -1125,8 +1125,7 @@ def get_domain(fork: Fork,
"""
Get the domain number that represents the fork meta and signature domain.
"""
fork_version = get_fork_version(fork, epoch)
return fork_version * 2**32 + domain_type
return bytes_to_int(get_fork_version(fork, epoch) + int_to_bytes4(domain_type))
```

### `get_bitfield_bit`
Expand Down Expand Up @@ -1518,8 +1517,8 @@ def get_genesis_beacon_state(genesis_validator_deposits: List[Deposit],
slot=GENESIS_SLOT,
genesis_time=genesis_time,
fork=Fork(
previous_version=GENESIS_FORK_VERSION,
current_version=GENESIS_FORK_VERSION,
previous_version=int_to_bytes4(GENESIS_FORK_VERSION),
current_version=int_to_bytes4(GENESIS_FORK_VERSION),
epoch=GENESIS_EPOCH,
),

Expand Down

0 comments on commit e843447

Please sign in to comment.