Merge branch 'lash/verify-details' into lash/cic-eth-upgrade-more
This commit is contained in:
commit
77710636ee
@ -9,8 +9,8 @@ import semver
|
|||||||
version = (
|
version = (
|
||||||
0,
|
0,
|
||||||
12,
|
12,
|
||||||
2,
|
3,
|
||||||
'alpha.4',
|
'alpha.1',
|
||||||
)
|
)
|
||||||
|
|
||||||
version_object = semver.VersionInfo(
|
version_object = semver.VersionInfo(
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
celery==4.4.7
|
celery==4.4.7
|
||||||
chainlib-eth>=0.0.7a7,<0.1.0
|
chainlib-eth>=0.0.8a1,<0.1.0
|
||||||
semver==2.13.0
|
semver==2.13.0
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
crypto-dev-signer>=0.4.14b7,<=0.4.14
|
crypto-dev-signer>=0.4.14b7,<=0.4.14
|
||||||
chainqueue>=0.0.3a1,<0.1.0
|
chainqueue>=0.0.3a1,<0.1.0
|
||||||
confini>=0.3.6rc4,<0.5.0
|
confini>=0.3.6rc4,<0.5.0
|
||||||
cic-eth-registry>=0.5.8a1,<0.6.0
|
cic-eth-registry>=0.6.0a1,<0.7.0
|
||||||
redis==3.5.3
|
redis==3.5.3
|
||||||
hexathon~=0.0.1a7
|
hexathon~=0.0.1a7
|
||||||
pycryptodome==3.10.1
|
pycryptodome==3.10.1
|
||||||
|
@ -37,7 +37,8 @@ from crypto_dev_signer.eth.signer import ReferenceSigner as EIP155Signer
|
|||||||
from crypto_dev_signer.keystore.dict import DictKeystore
|
from crypto_dev_signer.keystore.dict import DictKeystore
|
||||||
from cic_types.models.person import Person
|
from cic_types.models.person import Person
|
||||||
from eth_erc20 import ERC20
|
from eth_erc20 import ERC20
|
||||||
from cic_base.eth.syncer import chain_interface
|
#from cic_base.eth.syncer import chain_interface
|
||||||
|
from cic_eth.cli.chain import chain_interface
|
||||||
from eth_accounts_index import AccountsIndex
|
from eth_accounts_index import AccountsIndex
|
||||||
from eth_contract_registry import Registry
|
from eth_contract_registry import Registry
|
||||||
from eth_token_index import TokenUniqueSymbolIndex
|
from eth_token_index import TokenUniqueSymbolIndex
|
||||||
@ -172,6 +173,7 @@ class Handler:
|
|||||||
erc20 = ERC20(self.chain_spec, signer=self.signer, gas_oracle=self.gas_oracle, nonce_oracle=self.nonce_oracle)
|
erc20 = ERC20(self.chain_spec, signer=self.signer, gas_oracle=self.gas_oracle, nonce_oracle=self.nonce_oracle)
|
||||||
o = erc20.decimals(self.token_address)
|
o = erc20.decimals(self.token_address)
|
||||||
r = conn.do(o)
|
r = conn.do(o)
|
||||||
|
logg.debug('parse dec {}'.format(r))
|
||||||
decimals = erc20.parse_decimals(r)
|
decimals = erc20.parse_decimals(r)
|
||||||
multiplier = 10 ** decimals
|
multiplier = 10 ** decimals
|
||||||
balance_full = balance * multiplier
|
balance_full = balance * multiplier
|
||||||
|
@ -205,8 +205,9 @@ def send_ussd_request(address, data_dir):
|
|||||||
|
|
||||||
class VerifierState:
|
class VerifierState:
|
||||||
|
|
||||||
def __init__(self, item_keys, active_tests=None):
|
def __init__(self, item_keys, target_count, active_tests=None):
|
||||||
self.items = {}
|
self.items = {}
|
||||||
|
self.target_count = target_count
|
||||||
for k in item_keys:
|
for k in item_keys:
|
||||||
self.items[k] = 0
|
self.items[k] = 0
|
||||||
if active_tests == None:
|
if active_tests == None:
|
||||||
@ -223,7 +224,7 @@ class VerifierState:
|
|||||||
r = ''
|
r = ''
|
||||||
for k in self.items.keys():
|
for k in self.items.keys():
|
||||||
if k in self.active_tests:
|
if k in self.active_tests:
|
||||||
r += '{}: {}\n'.format(k, self.items[k])
|
r += '{}: {}/{}\n'.format(k, self.items[k], self.target_count)
|
||||||
else:
|
else:
|
||||||
r += '{}: skipped\n'.format(k)
|
r += '{}: skipped\n'.format(k)
|
||||||
return r
|
return r
|
||||||
@ -244,7 +245,7 @@ class VerifierError(Exception):
|
|||||||
class Verifier:
|
class Verifier:
|
||||||
|
|
||||||
# TODO: what an awful function signature
|
# TODO: what an awful function signature
|
||||||
def __init__(self, conn, cic_eth_api, gas_oracle, chain_spec, index_address, token_address, faucet_address, data_dir, exit_on_error=False):
|
def __init__(self, conn, target_count, cic_eth_api, gas_oracle, chain_spec, index_address, token_address, faucet_address, data_dir, exit_on_error=False):
|
||||||
self.conn = conn
|
self.conn = conn
|
||||||
self.gas_oracle = gas_oracle
|
self.gas_oracle = gas_oracle
|
||||||
self.chain_spec = chain_spec
|
self.chain_spec = chain_spec
|
||||||
@ -268,7 +269,7 @@ class Verifier:
|
|||||||
self.faucet_amount = self.faucet_tx_factory.parse_token_amount(r)
|
self.faucet_amount = self.faucet_tx_factory.parse_token_amount(r)
|
||||||
logg.info('faucet amount set to {} at verify initialization time'.format(self.faucet_amount))
|
logg.info('faucet amount set to {} at verify initialization time'.format(self.faucet_amount))
|
||||||
|
|
||||||
self.state = VerifierState(verifymethods, active_tests=active_tests)
|
self.state = VerifierState(verifymethods, target_count, active_tests=active_tests)
|
||||||
|
|
||||||
|
|
||||||
def verify_accounts_index(self, address, balance=None):
|
def verify_accounts_index(self, address, balance=None):
|
||||||
@ -481,7 +482,7 @@ def main():
|
|||||||
|
|
||||||
f.close()
|
f.close()
|
||||||
|
|
||||||
verifier = Verifier(conn, api, gas_oracle, chain_spec, account_index_address, token_address, faucet_address, user_dir, exit_on_error)
|
verifier = Verifier(conn, i, api, gas_oracle, chain_spec, account_index_address, token_address, faucet_address, user_dir, exit_on_error)
|
||||||
|
|
||||||
user_new_dir = os.path.join(user_dir, 'new')
|
user_new_dir = os.path.join(user_dir, 'new')
|
||||||
i = 0
|
i = 0
|
||||||
@ -517,6 +518,7 @@ def main():
|
|||||||
verifier.verify(new_address, balance, debug_stem=s)
|
verifier.verify(new_address, balance, debug_stem=s)
|
||||||
i += 1
|
i += 1
|
||||||
|
|
||||||
|
print()
|
||||||
print(verifier)
|
print(verifier)
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user