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.
This commit is contained in:
Justin 2018-12-21 15:26:13 +00:00 committed by GitHub
parent e639f365a6
commit c8efdc7431
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 0 deletions

View File

@ -461,6 +461,7 @@ Unless otherwise indicated, code appearing in `this style` is to be interpreted
# Randomness and committees # Randomness and committees
'latest_randao_mixes': ['hash32'], 'latest_randao_mixes': ['hash32'],
'latest_vdf_outputs': ['hash32'],
'shard_committees_at_slots': [[ShardCommittee]], 'shard_committees_at_slots': [[ShardCommittee]],
'persistent_committees': [['uint24']], 'persistent_committees': [['uint24']],
'persistent_committee_reassignments': [ShardReassignmentRecord], 'persistent_committee_reassignments': [ShardReassignmentRecord],
@ -1146,6 +1147,7 @@ def get_initial_beacon_state(initial_validator_deposits: List[Deposit],
# Randomness and committees # Randomness and committees
latest_randao_mixes=[ZERO_HASH for _ in range(LATEST_RANDAO_MIXES_LENGTH)], 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=[], shard_committees_at_slots=[],
persistent_committees=[], persistent_committees=[],
persistent_committee_reassignments=[], persistent_committee_reassignments=[],