Merge pull request #1248 from ethereum/fix-effective-balance

Fix genesis effective balance
This commit is contained in:
Diederik Loerakker 2019-07-01 01:03:51 +02:00 committed by GitHub
commit c79f93fe99
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1140,7 +1140,9 @@ def initialize_beacon_state_from_eth1(eth1_block_hash: Hash,
# Process activations
for index, validator in enumerate(state.validators):
if state.balances[index] >= MAX_EFFECTIVE_BALANCE:
balance = state.balances[index]
validator.effective_balance = min(balance - balance % EFFECTIVE_BALANCE_INCREMENT, MAX_EFFECTIVE_BALANCE)
if validator.effective_balance == MAX_EFFECTIVE_BALANCE:
validator.activation_eligibility_epoch = GENESIS_EPOCH
validator.activation_epoch = GENESIS_EPOCH
@ -1690,7 +1692,7 @@ def process_deposit(state: BeaconState, deposit: Deposit) -> None:
activation_epoch=FAR_FUTURE_EPOCH,
exit_epoch=FAR_FUTURE_EPOCH,
withdrawable_epoch=FAR_FUTURE_EPOCH,
effective_balance=min(amount - amount % EFFECTIVE_BALANCE_INCREMENT, MAX_EFFECTIVE_BALANCE)
effective_balance=min(amount - amount % EFFECTIVE_BALANCE_INCREMENT, MAX_EFFECTIVE_BALANCE),
))
state.balances.append(amount)
else: