From 9050897cb273cf772abb4ac97bc66215b1cf9740 Mon Sep 17 00:00:00 2001 From: protolambda Date: Thu, 3 Jun 2021 19:11:47 +0200 Subject: [PATCH] fix committee work status and commitment references --- specs/sharding/beacon-chain.md | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/specs/sharding/beacon-chain.md b/specs/sharding/beacon-chain.md index 9a0117fb4..4f9f6d934 100644 --- a/specs/sharding/beacon-chain.md +++ b/specs/sharding/beacon-chain.md @@ -719,13 +719,13 @@ def process_pending_shard_confirmations(state: BeaconState) -> None: buffer_index = slot % SHARD_STATE_MEMORY_SLOTS for shard_index in range(len(state.shard_buffer[buffer_index])): committee_work = state.shard_buffer[buffer_index][shard_index] - if committee_work.selector == SHARD_WORK_PENDING: - winning_header = max(committee_work.value, key=lambda header: header.weight) + if committee_work.status.selector == SHARD_WORK_PENDING: + winning_header = max(committee_work.status.value, key=lambda header: header.weight) # TODO In Altair: set participation bit flag of voters for winning header if winning_header.commitment == DataCommitment(): - committee_work.change(selector=SHARD_WORK_UNCONFIRMED, value=None) + committee_work.status.change(selector=SHARD_WORK_UNCONFIRMED, value=None) else: - committee_work.change(selector=SHARD_WORK_CONFIRMED, value=winning_header.commitment) + committee_work.status.change(selector=SHARD_WORK_CONFIRMED, value=winning_header.commitment) ``` #### `charge_confirmed_shard_fees` @@ -745,10 +745,11 @@ def charge_confirmed_shard_fees(state: BeaconState) -> None: for shard_index in range(len(state.shard_buffer[buffer_index])): committee_work = state.shard_buffer[buffer_index][shard_index] if committee_work.status.selector == SHARD_WORK_CONFIRMED: + commitment: DataCommitment = committee_work.status.value # Charge EIP 1559 fee proposer = get_shard_proposer_index(state, slot, Shard(shard_index)) fee = ( - (state.shard_gasprice * candidate.commitment.length) + (state.shard_gasprice * commitment.length) // TARGET_SAMPLES_PER_BLOCK ) decrease_balance(state, proposer, fee) @@ -756,7 +757,7 @@ def charge_confirmed_shard_fees(state: BeaconState) -> None: # Track updated gas price new_gasprice = compute_updated_gasprice( new_gasprice, - candidate.commitment.length, + commitment.length, adjustment_quotient, ) state.shard_gasprice = new_gasprice