Skip to content

Commit

Permalink
Domains are bytes
Browse files Browse the repository at this point in the history
  • Loading branch information
CarlBeek committed Dec 17, 2019
1 parent 502ee29 commit 80eb721
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 11 deletions.
2 changes: 1 addition & 1 deletion scripts/build_spec.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ def objects_to_spec(functions: Dict[str, str],
functions_spec = '\n\n'.join(functions.values())
for k in list(constants.keys()):
if k.startswith('DOMAIN_'):
constants[k] = f"DomainType(({constants[k]}).to_bytes(length=4, byteorder='little'))"
constants[k] = f"DomainType(bytes.fromhex('{constants[k]}'[2:]))"
if k == "BLS12_381_Q":
constants[k] += " # noqa: E501"
constants_spec = '\n'.join(map(lambda x: '%s = %s' % (x, constants[x]), constants))
Expand Down
12 changes: 5 additions & 7 deletions specs/core/0_beacon-chain.md
Original file line number Diff line number Diff line change
Expand Up @@ -249,15 +249,13 @@ The following values are (non-configurable) constants used throughout the specif

### Domain types

The following types are defined, mapping into `DomainType` (little endian):

| Name | Value |
| - | - |
| `DOMAIN_BEACON_PROPOSER` | `0` |
| `DOMAIN_BEACON_ATTESTER` | `1` |
| `DOMAIN_RANDAO` | `2` |
| `DOMAIN_DEPOSIT` | `3` |
| `DOMAIN_VOLUNTARY_EXIT` | `4` |
| `DOMAIN_BEACON_PROPOSER` | `0x00000000` |
| `DOMAIN_BEACON_ATTESTER` | `0x01000000` |
| `DOMAIN_RANDAO` | `0x02000000` |
| `DOMAIN_DEPOSIT` | `0x03000000` |
| `DOMAIN_VOLUNTARY_EXIT` | `0x04000000` |

## Containers

Expand Down
2 changes: 1 addition & 1 deletion specs/core/1_custody-game.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ The following types are defined, mapping into `DomainType` (little endian):

| Name | Value |
| - | - |
| `DOMAIN_CUSTODY_BIT_CHALLENGE` | `6` |
| `DOMAIN_CUSTODY_BIT_CHALLENGE` | `0x05000000` |

### TODO PLACEHOLDER

Expand Down
4 changes: 2 additions & 2 deletions specs/core/1_shard-data-chains.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,8 @@ This document describes the shard transition function (data layer only) and the

| Name | Value |
| - | - |
| `DOMAIN_SHARD_PROPOSER` | `128` |
| `DOMAIN_SHARD_ATTESTER` | `129` |
| `DOMAIN_SHARD_PROPOSER` | `0x80000000` |
| `DOMAIN_SHARD_ATTESTER` | `0x81000000` |

## Containers

Expand Down

0 comments on commit 80eb721

Please sign in to comment.