Fix typing error

This commit is contained in:
Hsiao-Wei Wang 2020-05-07 14:18:29 +08:00
parent a9be3b657d
commit 779b156e28
No known key found for this signature in database
GPG Key ID: 95B070122902DEA4
5 changed files with 16 additions and 6 deletions

View File

@ -17,5 +17,4 @@ test:
. venv/bin/activate; cd src; python -m pytest .
lint:
. venv/bin/activate; flake8 --ignore=E252,W504,W503 --max-line-length=120 ./src/ \
&& mypy --follow-imports=skip --ignore-missing-imports -p src
. venv/bin/activate; flake8 --config=flake8.ini ./src && mypy --config-file mypy.ini -p src

4
flake8.ini Normal file
View File

@ -0,0 +1,4 @@
[flake8]
max-line-length= 120
exclude=
ignore=E252,W504,W503

3
mypy.ini Normal file
View File

@ -0,0 +1,3 @@
[mypy]
follow_imports = False
ignore_missing_imports = True

View File

@ -38,11 +38,11 @@ click==7.0 \
ssz==0.2.3 \
--hash=sha256:0df31a9aef80c58fc0d5c238eb8bbd2cfe4726606c3c05e173694c5404816fdf \
--hash=sha256:4c4689bd5fdd640a9095d67e54c9a629a56f0fbed1d556638fe37f6f61d0762e
# Dependencies for the above
eth-typing==2.2.1 \
--hash=sha256:2f3e1f891226148898b219bd94674a9af06c2d75d8cdd8c6722227b472cbd4d4 \
--hash=sha256:cf9e5e9fb62cfeb1027823328569315166851c65c5774604d801b6b926ff65bc
# Dependencies for the above
eth-utils==1.8.4 \
--hash=sha256:8358318685e7a7666b148b07df3c4d409435b424dce18501e79920aa52bcaba7 \
--hash=sha256:f398c649859cda5ef7c4ee2753468038d93be7d864de7631c06c3e73a7060649

View File

@ -1,4 +1,8 @@
import json
from eth_typing import (
BLSPubkey,
BLSSignature,
)
from py_ecc.bls import G2ProofOfPossession as bls
from utils.ssz import (
@ -26,10 +30,10 @@ def verify_deposit(deposit_data_dict: dict) -> bool:
Checks whether a deposit is valid based on the eth2 rules.
https://github.com/ethereum/eth2.0-specs/blob/dev/specs/phase0/beacon-chain.md#deposits
'''
pubkey = bytes.fromhex(deposit_data_dict['pubkey'])
pubkey = BLSPubkey(bytes.fromhex(deposit_data_dict['pubkey']))
withdrawal_credentials = bytes.fromhex(deposit_data_dict['withdrawal_credentials'])
amount = deposit_data_dict['amount']
signature = bytes.fromhex(deposit_data_dict['signature'])
signature = BLSSignature(bytes.fromhex(deposit_data_dict['signature']))
deposit_data_root = bytes.fromhex(deposit_data_dict['signed_deposit_data_root'])
# Verify deposit amount