From aca3e4cd5cef9a660d0c4e07db0e5b82bf6e9084 Mon Sep 17 00:00:00 2001 From: tersec Date: Sun, 14 Feb 2021 19:31:01 +0000 Subject: [PATCH] per HF1, split process_final_updates() (#2319) --- beacon_chain/spec/state_transition_epoch.nim | 39 +++++++++++++++++--- 1 file changed, 33 insertions(+), 6 deletions(-) diff --git a/beacon_chain/spec/state_transition_epoch.nim b/beacon_chain/spec/state_transition_epoch.nim index a06061cb7..0a91f46e0 100644 --- a/beacon_chain/spec/state_transition_epoch.nim +++ b/beacon_chain/spec/state_transition_epoch.nim @@ -1,5 +1,5 @@ # beacon_chain -# Copyright (c) 2018-2020 Status Research & Development GmbH +# Copyright (c) 2018-2021 Status Research & Development GmbH # Licensed and distributed under either of # * MIT license (license terms in the root directory or at https://opensource.org/licenses/MIT). # * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0). @@ -544,16 +544,16 @@ func process_slashings*(state: var BeaconState, total_balance: Gwei) {.nbench.}= let penalty = penalty_numerator div total_balance * increment decrease_balance(state, index.ValidatorIndex, penalty) -# https://github.com/ethereum/eth2.0-specs/blob/v1.0.0/specs/phase0/beacon-chain.md#final-updates -func process_final_updates*(state: var BeaconState) {.nbench.}= - let - current_epoch = get_current_epoch(state) - next_epoch = current_epoch + 1 +# https://github.com/ethereum/eth2.0-specs/blob/dev/specs/phase0/beacon-chain.md#eth1-data-votes-updates +func process_eth1_data_reset(state: var BeaconState) {.nbench.} = + let next_epoch = get_current_epoch(state) + 1 # Reset eth1 data votes if next_epoch mod EPOCHS_PER_ETH1_VOTING_PERIOD == 0: state.eth1_data_votes = default(type state.eth1_data_votes) +# https://github.com/ethereum/eth2.0-specs/blob/dev/specs/phase0/beacon-chain.md#effective-balances-updates +func process_effective_balance_updates(state: var BeaconState) {.nbench.} = # Update effective balances with hysteresis for index in 0..