From e4eebef3a4098e49123895532226fcabe87b768d Mon Sep 17 00:00:00 2001 From: protolambda Date: Sat, 29 Jun 2019 20:09:43 +0200 Subject: [PATCH] fix broken deposits test, now same error as others --- test_libs/pyspec/eth2spec/test/helpers/deposits.py | 9 ++------- .../phase_0/block_processing/test_process_deposit.py | 2 +- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/test_libs/pyspec/eth2spec/test/helpers/deposits.py b/test_libs/pyspec/eth2spec/test/helpers/deposits.py index 39ecbd2d7..7f5975dd4 100644 --- a/test_libs/pyspec/eth2spec/test/helpers/deposits.py +++ b/test_libs/pyspec/eth2spec/test/helpers/deposits.py @@ -3,11 +3,10 @@ from eth2spec.utils.bls import bls_sign from eth2spec.utils.merkle_minimal import calc_merkle_tree_from_leaves, get_merkle_proof from eth2spec.utils.ssz.ssz_impl import signing_root, hash_tree_root from eth2spec.utils.ssz.ssz_typing import List -from eth2spec.phase0.spec import DepositData def build_deposit_data(spec, pubkey, privkey, amount, withdrawal_credentials, state=None, signed=False): - deposit_data = DepositData( + deposit_data = spec.DepositData( pubkey=pubkey, withdrawal_credentials=withdrawal_credentials, amount=amount, @@ -43,14 +42,10 @@ def build_deposit(spec, amount, withdrawal_credentials, signed): - deposit_data = build_deposit_data( - spec, pubkey, privkey, amount, withdrawal_credentials, state=state, signed=signed, - ) - deposit_data = build_deposit_data(spec, pubkey, privkey, amount, withdrawal_credentials, state=state, signed=signed) deposit_data_list.append(deposit_data) index = len(deposit_data_list) - root = hash_tree_root(List[DepositData, 2**spec.DEPOSIT_CONTRACT_TREE_DEPTH](*deposit_data_list)) + root = hash_tree_root(List[spec.DepositData, 2**spec.DEPOSIT_CONTRACT_TREE_DEPTH](*deposit_data_list)) tree = calc_merkle_tree_from_leaves(tuple([d.hash_tree_root() for d in deposit_data_list])) proof = list(get_merkle_proof(tree, item_index=index)) + [index.to_bytes(32, 'little')] leaf = deposit_data.hash_tree_root() diff --git a/test_libs/pyspec/eth2spec/test/phase_0/block_processing/test_process_deposit.py b/test_libs/pyspec/eth2spec/test/phase_0/block_processing/test_process_deposit.py index d0a62ff6b..d596523ec 100644 --- a/test_libs/pyspec/eth2spec/test/phase_0/block_processing/test_process_deposit.py +++ b/test_libs/pyspec/eth2spec/test/phase_0/block_processing/test_process_deposit.py @@ -117,7 +117,7 @@ def test_invalid_withdrawal_credentials_top_up(spec, state): @with_all_phases @spec_state_test def test_wrong_deposit_for_deposit_count(spec, state): - deposit_data_leaves = [spec.ZERO_HASH] * len(state.validators) + deposit_data_leaves = [spec.DepositData() for _ in range(len(state.validators))] # build root for deposit_1 index_1 = len(deposit_data_leaves)