From 6b84dae09e38808f95eb299c97f945be991535bb Mon Sep 17 00:00:00 2001 From: Hsiao-Wei Wang Date: Fri, 28 Dec 2018 02:11:38 +0800 Subject: [PATCH] Fix #361: pass `poc_commitment` to `validate_proof_of_possession` (#364) * Fix #361 --- specs/core/0_beacon-chain.md | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/specs/core/0_beacon-chain.md b/specs/core/0_beacon-chain.md index 613981595..045a914b0 100644 --- a/specs/core/0_beacon-chain.md +++ b/specs/core/0_beacon-chain.md @@ -1214,6 +1214,7 @@ def get_initial_beacon_state(initial_validator_deposits: List[Deposit], proof_of_possession=deposit.deposit_data.deposit_input.proof_of_possession, 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, ) if get_effective_balance(state, validator_index) == MAX_DEPOSIT * GWEI_PER_ETH: update_validator_status(state, validator_index, ACTIVE) @@ -1248,11 +1249,13 @@ def validate_proof_of_possession(state: BeaconState, pubkey: int, proof_of_possession: bytes, withdrawal_credentials: Hash32, - randao_commitment: Hash32) -> bool: + randao_commitment: Hash32, + poc_commitment: Hash32) -> bool: proof_of_possession_data = DepositInput( pubkey=pubkey, withdrawal_credentials=withdrawal_credentials, randao_commitment=randao_commitment, + poc_commitment=poc_commitment, proof_of_possession=EMPTY_SIGNATURE, ) @@ -1276,8 +1279,8 @@ def process_deposit(state: BeaconState, deposit: int, proof_of_possession: bytes, withdrawal_credentials: Hash32, - poc_commitment: Hash32, - randao_commitment: Hash32) -> int: + randao_commitment: Hash32, + poc_commitment: Hash32) -> int: """ Process a deposit from Ethereum 1.0. Note that this function mutates ``state``. @@ -1289,6 +1292,7 @@ def process_deposit(state: BeaconState, proof_of_possession, withdrawal_credentials, randao_commitment, + poc_commitment, ) validator_pubkeys = [v.pubkey for v in state.validator_registry] @@ -1557,8 +1561,8 @@ process_deposit( deposit=deposit.deposit_data.value, proof_of_possession=deposit.deposit_data.deposit_input.proof_of_possession, withdrawal_credentials=deposit.deposit_data.deposit_input.withdrawal_credentials, - poc_commitment=deposit.deposit_data.deposit_input.poc_commitment, randao_commitment=deposit.deposit_data.deposit_input.randao_commitment, + poc_commitment=deposit.deposit_data.deposit_input.poc_commitment, ) ```