Apply Proto's feedback of list(map(...))
This commit is contained in:
parent
4dc526fbb7
commit
cb2bfd67dc
|
@ -1173,9 +1173,9 @@ def is_genesis_trigger(deposits: List[Deposit, 2**DEPOSIT_CONTRACT_TREE_DEPTH],
|
||||||
|
|
||||||
# Process deposits
|
# Process deposits
|
||||||
state = BeaconState()
|
state = BeaconState()
|
||||||
|
leaves = list(map(lambda deposit: hash_tree_root(deposit.data), deposits))
|
||||||
for deposit_index, deposit in enumerate(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[:deposit_index + 1], 2**DEPOSIT_CONTRACT_TREE_DEPTH)
|
||||||
state.eth1_data.deposit_root = get_merkle_root(leaves, 2**DEPOSIT_CONTRACT_TREE_DEPTH)
|
|
||||||
state.eth1_deposit_index = deposit_index
|
state.eth1_deposit_index = deposit_index
|
||||||
process_deposit(state, deposit)
|
process_deposit(state, deposit)
|
||||||
|
|
||||||
|
@ -1202,9 +1202,9 @@ def get_genesis_beacon_state(deposits: Sequence[Deposit], genesis_time: int, eth
|
||||||
)
|
)
|
||||||
|
|
||||||
# Process genesis deposits
|
# Process genesis deposits
|
||||||
|
leaves = list(map(lambda deposit: hash_tree_root(deposit.data), deposits))
|
||||||
for deposit_index, deposit in enumerate(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[:deposit_index + 1], 2**DEPOSIT_CONTRACT_TREE_DEPTH)
|
||||||
state.eth1_data.deposit_root = get_merkle_root(leaves, 2**DEPOSIT_CONTRACT_TREE_DEPTH)
|
|
||||||
state.eth1_deposit_index = deposit_index
|
state.eth1_deposit_index = deposit_index
|
||||||
process_deposit(state, deposit)
|
process_deposit(state, deposit)
|
||||||
|
|
||||||
|
|
|
@ -51,8 +51,6 @@ def build_deposit(spec,
|
||||||
tree = calc_merkle_tree_from_leaves(tuple(deposit_data_leaves))
|
tree = calc_merkle_tree_from_leaves(tuple(deposit_data_leaves))
|
||||||
root = get_merkle_root((tuple(deposit_data_leaves)))
|
root = get_merkle_root((tuple(deposit_data_leaves)))
|
||||||
proof = list(get_merkle_proof(tree, item_index=index))
|
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(
|
deposit = spec.Deposit(
|
||||||
proof=list(proof),
|
proof=list(proof),
|
||||||
index=index,
|
index=index,
|
||||||
|
|
Loading…
Reference in New Issue