Fixed deposit inclusion and positioning of state variables

This commit is contained in:
vbuterin 2018-12-21 11:26:40 -05:00 committed by GitHub
parent 1d1db908e2
commit 5fc8f6cfca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 15 additions and 10 deletions

View File

@ -378,6 +378,8 @@ Unless otherwise indicated, code appearing in `this style` is to be interpreted
'withdrawal_credentials': 'hash32', 'withdrawal_credentials': 'hash32',
# Initial RANDAO commitment # Initial RANDAO commitment
'randao_commitment': 'hash32', 'randao_commitment': 'hash32',
# Initial proof of custody commitment
'poc_commitment': 'hash32',
# a BLS signature of this ``DepositInput`` # a BLS signature of this ``DepositInput``
'proof_of_possession': ['uint384'], 'proof_of_possession': ['uint384'],
} }
@ -475,11 +477,6 @@ Unless otherwise indicated, code appearing in `this style` is to be interpreted
# Placeholders for now; ProofOfCustodyChallenge is defined in phase 1, implementers can # Placeholders for now; ProofOfCustodyChallenge is defined in phase 1, implementers can
# put a dummy class in for now, as the list will remain empty throughout phase 0 # put a dummy class in for now, as the list will remain empty throughout phase 0
'poc_challenges': [ProofOfCustodyChallenge], 'poc_challenges': [ProofOfCustodyChallenge],
# Proof of custody commitment
'poc_commitment': 'hash32',
# Slot the proof of custody seed was last changed
'last_poc_change_slot': 'uint64',
'second_last_poc_change_slot': 'uint64',
# Finality # Finality
'previous_justified_slot': 'uint64', 'previous_justified_slot': 'uint64',
@ -518,6 +515,11 @@ Unless otherwise indicated, code appearing in `this style` is to be interpreted
'latest_status_change_slot': 'uint64', 'latest_status_change_slot': 'uint64',
# Exit counter when validator exited (or 0) # Exit counter when validator exited (or 0)
'exit_count': 'uint64', 'exit_count': 'uint64',
# Proof of custody commitment
'poc_commitment': 'hash32',
# Slot the proof of custody seed was last changed
'last_poc_change_slot': 'uint64',
'second_last_poc_change_slot': 'uint64',
} }
``` ```
@ -1171,9 +1173,6 @@ def get_initial_beacon_state(initial_validator_deposits: List[Deposit],
# Proof of custody # Proof of custody
poc_challenges=[], poc_challenges=[],
poc_commitment=ZERO_HASH,
last_poc_change_slot=0,
second_last_poc_change_slot=0,
# Finality # Finality
previous_justified_slot=INITIAL_SLOT_NUMBER, previous_justified_slot=INITIAL_SLOT_NUMBER,
@ -1264,6 +1263,7 @@ def process_deposit(state: BeaconState,
deposit: int, deposit: int,
proof_of_possession: bytes, proof_of_possession: bytes,
withdrawal_credentials: Hash32, withdrawal_credentials: Hash32,
poc_commitment: Hash32,
randao_commitment: Hash32) -> int: randao_commitment: Hash32) -> int:
""" """
Process a deposit from Ethereum 1.0. Process a deposit from Ethereum 1.0.
@ -1289,7 +1289,10 @@ def process_deposit(state: BeaconState,
randao_layers=0, randao_layers=0,
status=PENDING_ACTIVATION, status=PENDING_ACTIVATION,
latest_status_change_slot=state.slot, latest_status_change_slot=state.slot,
exit_count=0 exit_count=0,
poc_commitment=poc_commitment,
last_poc_change_slot=0,
second_last_poc_change_slot=0,
) )
index = min_empty_validator_index(state.validator_registry, state.validator_balances, state.slot) index = min_empty_validator_index(state.validator_registry, state.validator_balances, state.slot)
@ -1541,7 +1544,9 @@ process_deposit(
deposit=deposit.deposit_data.value, deposit=deposit.deposit_data.value,
proof_of_possession=deposit.deposit_data.deposit_input.proof_of_possession, proof_of_possession=deposit.deposit_data.deposit_input.proof_of_possession,
withdrawal_credentials=deposit.deposit_data.deposit_input.withdrawal_credentials, withdrawal_credentials=deposit.deposit_data.deposit_input.withdrawal_credentials,
randao_commitment=deposit.deposit_data.deposit_input.randao_commitment poc_commitment=deposit.deposit_data.deposit_input.poc_commitment,
randao_commitment=deposit.deposit_data.deposit_input.randao_commitment,
) )
``` ```