From c8efdc743133d0af1a34159ad5a47e1178293c3e Mon Sep 17 00:00:00 2001 From: Justin Date: Fri, 21 Dec 2018 15:26:13 +0000 Subject: [PATCH] Add placeholder array in state for VDFs Added `latest_vdf_outputs` in `state` initialised to an array of `ZERO_HASH` of length `LATEST_RANDAO_MIXES_LENGTH // EPOCH_LENGTH`. (There's one VDF output per epoch. The VDF input is the RANDAO mix at the epoch boundary.) Further changes to activate VDFs (in a future phase): * Add a new beacon "VDF output and proof" transaction, e.g. with `MAX_VDF_OUTPUT_AND_PROOF := 1`. * Adjust the `MAX_SEED_LOOKAHEAD` constant, e.g. to `2**4 * EPOCH_LENGTH`. (The `2**4` parameter is essentially `A_max`.) * Add a `process_vdf_output_and_proof` helper function in the per-block processing: * Verify the VDF input hasn't already been processed (check the corresponding `state.latest_vdf_outputs` entry is not `ZERO_HASH`.) * Verify the proof is correct, i.e. matches the VDF input and output * Save the VDF output to `state.latest_vdf_outputs` * In the per-epoch processing set the corresponding entry in `state.latest_vdf_outputs` to `ZERO_HASH`. * Use a VDF output for the shuffling seed. --- specs/core/0_beacon-chain.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/specs/core/0_beacon-chain.md b/specs/core/0_beacon-chain.md index 91c1aecf8..d805d3934 100644 --- a/specs/core/0_beacon-chain.md +++ b/specs/core/0_beacon-chain.md @@ -461,6 +461,7 @@ Unless otherwise indicated, code appearing in `this style` is to be interpreted # Randomness and committees 'latest_randao_mixes': ['hash32'], + 'latest_vdf_outputs': ['hash32'], 'shard_committees_at_slots': [[ShardCommittee]], 'persistent_committees': [['uint24']], 'persistent_committee_reassignments': [ShardReassignmentRecord], @@ -1146,6 +1147,7 @@ def get_initial_beacon_state(initial_validator_deposits: List[Deposit], # Randomness and committees latest_randao_mixes=[ZERO_HASH for _ in range(LATEST_RANDAO_MIXES_LENGTH)], + latest_vdf_outputs=[ZERO_HASH for _ in range(LATEST_RANDAO_MIXES_LENGTH // EPOCH_LENGTH)], shard_committees_at_slots=[], persistent_committees=[], persistent_committee_reassignments=[],