Apply Proto's feedback of list(map(...))

This commit is contained in:
Hsiao-Wei Wang 2019-06-29 02:27:48 +08:00
parent 4dc526fbb7
commit cb2bfd67dc
No known key found for this signature in database
GPG Key ID: 95B070122902DEA4
2 changed files with 4 additions and 6 deletions

View File

@ -1173,9 +1173,9 @@ def is_genesis_trigger(deposits: List[Deposit, 2**DEPOSIT_CONTRACT_TREE_DEPTH],
# Process deposits
state = BeaconState()
leaves = list(map(lambda deposit: hash_tree_root(deposit.data), deposits))
for deposit_index, deposit in enumerate(deposits):
leaves = [hash_tree_root(d.data) for d in deposits[:deposit_index + 1]]
state.eth1_data.deposit_root = get_merkle_root(leaves, 2**DEPOSIT_CONTRACT_TREE_DEPTH)
state.eth1_data.deposit_root = get_merkle_root(leaves[:deposit_index + 1], 2**DEPOSIT_CONTRACT_TREE_DEPTH)
state.eth1_deposit_index = deposit_index
process_deposit(state, deposit)
@ -1202,9 +1202,9 @@ def get_genesis_beacon_state(deposits: Sequence[Deposit], genesis_time: int, eth
)
# Process genesis deposits
leaves = list(map(lambda deposit: hash_tree_root(deposit.data), deposits))
for deposit_index, deposit in enumerate(deposits):
leaves = [hash_tree_root(d.data) for d in deposits[:deposit_index + 1]]
state.eth1_data.deposit_root = get_merkle_root(leaves, 2**DEPOSIT_CONTRACT_TREE_DEPTH)
state.eth1_data.deposit_root = get_merkle_root(leaves[:deposit_index + 1], 2**DEPOSIT_CONTRACT_TREE_DEPTH)
state.eth1_deposit_index = deposit_index
process_deposit(state, deposit)

View File

@ -51,8 +51,6 @@ def build_deposit(spec,
tree = calc_merkle_tree_from_leaves(tuple(deposit_data_leaves))
root = get_merkle_root((tuple(deposit_data_leaves)))
proof = list(get_merkle_proof(tree, item_index=index))
assert spec.verify_merkle_branch(item, proof, spec.DEPOSIT_CONTRACT_TREE_DEPTH, index, root)
deposit = spec.Deposit(
proof=list(proof),
index=index,