Change balances to Gwei

See discussion here https://github.com/ethereum/eth2.0-specs/issues/34
This commit is contained in:
Justin 2018-10-05 11:34:38 +01:00 committed by GitHub
parent 9ee17787d2
commit 1cbde6f3c8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 4 deletions

View File

@ -219,7 +219,7 @@ A `ValidatorRecord` has the following fields:
# RANDAO commitment # RANDAO commitment
'randao_commitment': 'hash32', 'randao_commitment': 'hash32',
# Balance # Balance
'balance': 'int128', 'balance': 'int64',
# Status code # Status code
'status': 'int8', 'status': 'int8',
# Slot when validator exited (or 0) # Slot when validator exited (or 0)
@ -448,7 +448,7 @@ def add_validator(validators, pubkey, proof_of_possession, withdrawal_shard,
withdrawal_shard=withdrawal_shard, withdrawal_shard=withdrawal_shard,
withdrawal_address=withdrawal_address, withdrawal_address=withdrawal_address,
randao_commitment=randao_commitment, randao_commitment=randao_commitment,
balance=DEPOSIT_SIZE, # in WEI balance=DEPOSIT_SIZE * 10**9, # in Gwei
status=PENDING_LOG_IN, status=PENDING_LOG_IN,
exit_slot=0 exit_slot=0
) )
@ -585,9 +585,9 @@ def change_validators(validators):
active_validators = get_active_validator_indices(validators, dynasty) active_validators = get_active_validator_indices(validators, dynasty)
# The total size of active deposits # The total size of active deposits
total_deposits = sum([v.balance for i, v in enumerate(validators) if i in active_validators]) total_deposits = sum([v.balance for i, v in enumerate(validators) if i in active_validators])
# The maximum total wei that can deposit+withdraw # The maximum total Gwei that can be deposited and withdrawn
max_allowable_change = max( max_allowable_change = max(
DEPOSIT_SIZE * 2, 2 * DEPOSIT_SIZE * 10**9,
total_deposits // MAX_VALIDATOR_CHURN_QUOTIENT total_deposits // MAX_VALIDATOR_CHURN_QUOTIENT
) )
# Go through the list start to end depositing+withdrawing as many as possible # Go through the list start to end depositing+withdrawing as many as possible