From eef61448a9aba2b61e77364bb920e028dd5963c1 Mon Sep 17 00:00:00 2001 From: Lion - dapplion <35266934+dapplion@users.noreply.github.com> Date: Sun, 20 Aug 2023 13:46:22 +0200 Subject: [PATCH] Whisk: don't mutate candidates during cooldown (#3483) --- specs/_features/whisk/beacon-chain.md | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/specs/_features/whisk/beacon-chain.md b/specs/_features/whisk/beacon-chain.md index 41aa3bb09..c719dabe1 100644 --- a/specs/_features/whisk/beacon-chain.md +++ b/specs/_features/whisk/beacon-chain.md @@ -324,30 +324,25 @@ def get_shuffle_indices(randao_reveal: BLSSignature) -> Sequence[uint64]: ```python def process_shuffled_trackers(state: BeaconState, body: BeaconBlockBody) -> None: - # Check the shuffle proof - shuffle_indices = get_shuffle_indices(body.randao_reveal) - pre_shuffle_trackers = [state.whisk_candidate_trackers[i] for i in shuffle_indices] - shuffle_epoch = get_current_epoch(state) % WHISK_EPOCHS_PER_SHUFFLING_PHASE if shuffle_epoch + WHISK_PROPOSER_SELECTION_GAP + 1 >= WHISK_EPOCHS_PER_SHUFFLING_PHASE: # Require trackers set to zero during cooldown assert body.whisk_post_shuffle_trackers == Vector[WhiskTracker, WHISK_VALIDATORS_PER_SHUFFLE]() assert body.whisk_shuffle_proof_M_commitment == BLSG1Point() assert body.whisk_shuffle_proof == WhiskShuffleProof() - post_shuffle_trackers = pre_shuffle_trackers else: # Require shuffled trackers during shuffle + shuffle_indices = get_shuffle_indices(body.randao_reveal) + pre_shuffle_trackers = [state.whisk_candidate_trackers[i] for i in shuffle_indices] assert IsValidWhiskShuffleProof( pre_shuffle_trackers, body.whisk_post_shuffle_trackers, body.whisk_shuffle_proof_M_commitment, body.whisk_shuffle_proof, ) - post_shuffle_trackers = body.whisk_post_shuffle_trackers - - # Shuffle candidate trackers - for i, shuffle_index in enumerate(shuffle_indices): - state.whisk_candidate_trackers[shuffle_index] = post_shuffle_trackers[i] + # Shuffle candidate trackers + for i, shuffle_index in enumerate(shuffle_indices): + state.whisk_candidate_trackers[shuffle_index] = body.whisk_post_shuffle_trackers[i] ``` ```python