From 80eb721895339802bbe00b501ce16ea13a9c098d Mon Sep 17 00:00:00 2001 From: Carl Beekhuizen Date: Tue, 17 Dec 2019 12:20:34 +0200 Subject: [PATCH] Domains are bytes --- scripts/build_spec.py | 2 +- specs/core/0_beacon-chain.md | 12 +++++------- specs/core/1_custody-game.md | 2 +- specs/core/1_shard-data-chains.md | 4 ++-- 4 files changed, 9 insertions(+), 11 deletions(-) diff --git a/scripts/build_spec.py b/scripts/build_spec.py index ca8bbb6dd..0baa487c3 100644 --- a/scripts/build_spec.py +++ b/scripts/build_spec.py @@ -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)) diff --git a/specs/core/0_beacon-chain.md b/specs/core/0_beacon-chain.md index 71980e88c..271be3ef7 100644 --- a/specs/core/0_beacon-chain.md +++ b/specs/core/0_beacon-chain.md @@ -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 diff --git a/specs/core/1_custody-game.md b/specs/core/1_custody-game.md index 017e2a22a..4f3b26c7c 100644 --- a/specs/core/1_custody-game.md +++ b/specs/core/1_custody-game.md @@ -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 diff --git a/specs/core/1_shard-data-chains.md b/specs/core/1_shard-data-chains.md index d5964fe7d..9d537a789 100644 --- a/specs/core/1_shard-data-chains.md +++ b/specs/core/1_shard-data-chains.md @@ -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