From 3f0e58a8ed52253d84af70a1e041d64648dbe19b Mon Sep 17 00:00:00 2001 From: Danny Ryan Date: Tue, 19 May 2020 07:50:05 -0600 Subject: [PATCH] add chunk challenge and response to block and operations --- configs/mainnet.yaml | 2 ++ configs/minimal.yaml | 2 ++ specs/phase1/beacon-chain.md | 4 +++- specs/phase1/custody-game.md | 7 +++---- 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/configs/mainnet.yaml b/configs/mainnet.yaml index f5f38de5e..6475d491e 100644 --- a/configs/mainnet.yaml +++ b/configs/mainnet.yaml @@ -214,6 +214,8 @@ MAX_REVEAL_LATENESS_DECREMENT: 128 # 2**8 (= 256) MAX_CUSTODY_KEY_REVEALS: 256 MAX_EARLY_DERIVED_SECRET_REVEALS: 1 +MAX_CUSTODY_CHUNK_CHALLENGES: 4 +MAX_CUSTODY_CHUNK_CHALLENGE_RESP: 16 MAX_CUSTODY_SLASHINGS: 1 # Reward and penalty quotients diff --git a/configs/minimal.yaml b/configs/minimal.yaml index 1b5aac5f6..89e2a7eae 100644 --- a/configs/minimal.yaml +++ b/configs/minimal.yaml @@ -215,6 +215,8 @@ CUSTODY_PERIOD_TO_RANDAO_PADDING: 8 # 2**8 (= 256) MAX_CUSTODY_KEY_REVEALS: 256 MAX_EARLY_DERIVED_SECRET_REVEALS: 1 +MAX_CUSTODY_CHUNK_CHALLENGES: 2 +MAX_CUSTODY_CHUNK_CHALLENGE_RESP: 8 MAX_CUSTODY_SLASHINGS: 1 # Reward and penalty quotients diff --git a/specs/phase1/beacon-chain.md b/specs/phase1/beacon-chain.md index 27a9229dd..e48c99c4a 100644 --- a/specs/phase1/beacon-chain.md +++ b/specs/phase1/beacon-chain.md @@ -215,9 +215,11 @@ class BeaconBlockBody(Container): deposits: List[Deposit, MAX_DEPOSITS] voluntary_exits: List[SignedVoluntaryExit, MAX_VOLUNTARY_EXITS] # Custody game - custody_slashings: List[SignedCustodySlashing, MAX_CUSTODY_SLASHINGS] + chunk_challenges: List[CustodyChunkResponse, MAX_CUSTODY_CHUNK_CHALLENGES] + chunk_challenge_responses: List[CustodyChunkResponse, MAX_CUSTODY_CHUNK_CHALLENGE_RESPONSES] custody_key_reveals: List[CustodyKeyReveal, MAX_CUSTODY_KEY_REVEALS] early_derived_secret_reveals: List[EarlyDerivedSecretReveal, MAX_EARLY_DERIVED_SECRET_REVEALS] + custody_slashings: List[SignedCustodySlashing, MAX_CUSTODY_SLASHINGS] # Shards shard_transitions: Vector[ShardTransition, MAX_SHARDS] # Light clients diff --git a/specs/phase1/custody-game.md b/specs/phase1/custody-game.md index 96a7f5616..08893ef53 100644 --- a/specs/phase1/custody-game.md +++ b/specs/phase1/custody-game.md @@ -81,6 +81,7 @@ This document details the beacon chain additions and changes in Phase 1 of Ether | `MAX_CUSTODY_KEY_REVEALS` | `2**8` (= 256) | | `MAX_EARLY_DERIVED_SECRET_REVEALS` | `1` | | `MAX_CUSTODY_CHUNK_CHALLENGES` | `2**2` (= 4) | +| `MAX_CUSTODY_CHUNK_CHALLENGE_RESPONSES` | `2**4` (= 16) | | `MAX_CUSTODY_SLASHINGS` | `1` | ### Reward and penalty quotients @@ -297,6 +298,8 @@ def process_custody_game_operations(state: BeaconState, body: BeaconBlockBody) - for operation in operations: fn(state, operation) + for_ops(body.chunk_challenges, process_chunk_challenge) + for_ops(body.chunk_challenge_responses, process_chunk_challenge) for_ops(body.custody_key_reveals, process_custody_key_reveal) for_ops(body.early_derived_secret_reveals, process_early_derived_secret_reveal) for_ops(body.custody_slashings, process_custody_slashing) @@ -304,10 +307,6 @@ def process_custody_game_operations(state: BeaconState, body: BeaconBlockBody) - #### Chunk challenges -Verify that `len(block.body.custody_chunk_challenges) <= MAX_CUSTODY_CHUNK_CHALLENGES`. - -For each `challenge` in `block.body.custody_chunk_challenges`, run the following function: - ```python def process_chunk_challenge(state: BeaconState, challenge: CustodyChunkChallenge) -> None: # Verify the attestation