From 75b711dbd5cbf3ed63a229046a1cf87a839eaac0 Mon Sep 17 00:00:00 2001 From: Louis Holbrook Date: Wed, 1 Sep 2021 16:54:10 +0000 Subject: [PATCH] Rehabilitate imports --- apps/cic-eth/cic_eth/eth/gas.py | 6 +++++- apps/cic-eth/cic_eth/task.py | 2 +- apps/cic-eth/cic_eth/version.py | 2 +- apps/cic-eth/doc/texinfo/configuration.texi | 23 ++++++++++++++++++--- apps/cic-eth/tests/task/test_task_gas.py | 3 +-- apps/contract-migration/requirements.txt | 6 +++--- apps/data-seeding/requirements.txt | 2 +- apps/data-seeding/verify.py | 10 +++++++++ 8 files changed, 42 insertions(+), 12 deletions(-) diff --git a/apps/cic-eth/cic_eth/eth/gas.py b/apps/cic-eth/cic_eth/eth/gas.py index 8671f3a7..40f569af 100644 --- a/apps/cic-eth/cic_eth/eth/gas.py +++ b/apps/cic-eth/cic_eth/eth/gas.py @@ -3,7 +3,10 @@ import logging # external imports import celery -from hexathon import strip_0x +from hexathon import ( + strip_0x, + add_0x, + ) #from chainlib.eth.constant import ZERO_ADDRESS from chainlib.chain import ChainSpec from chainlib.eth.address import is_checksum_address @@ -180,6 +183,7 @@ def check_gas(self, tx_hashes_hex, chain_spec_dict, txs_hex=[], address=None, ga if not is_checksum_address(address): raise ValueError('invalid address {}'.format(address)) address = tx_normalize.wallet_address(address) + address = add_0x(address) tx_hashes = [] txs = [] diff --git a/apps/cic-eth/cic_eth/task.py b/apps/cic-eth/cic_eth/task.py index 1af36b09..014565dd 100644 --- a/apps/cic-eth/cic_eth/task.py +++ b/apps/cic-eth/cic_eth/task.py @@ -13,7 +13,6 @@ from chainlib.eth.nonce import RPCNonceOracle from chainlib.eth.gas import RPCGasOracle from cic_eth_registry import CICRegistry from cic_eth_registry.error import UnknownContractError -import liveness.linux # local imports from cic_eth.error import SeppukuError @@ -48,6 +47,7 @@ class BaseTask(celery.Task): def on_failure(self, exc, task_id, args, kwargs, einfo): if isinstance(exc, SeppukuError): + import liveness.linux liveness.linux.reset(rundir=self.run_dir) logg.critical(einfo) msg = 'received critical exception {}, calling shutdown'.format(str(exc)) diff --git a/apps/cic-eth/cic_eth/version.py b/apps/cic-eth/cic_eth/version.py index 51e05dc2..9f366d63 100644 --- a/apps/cic-eth/cic_eth/version.py +++ b/apps/cic-eth/cic_eth/version.py @@ -10,7 +10,7 @@ version = ( 0, 12, 4, - 'alpha.7', + 'alpha.8', ) version_object = semver.VersionInfo( diff --git a/apps/cic-eth/doc/texinfo/configuration.texi b/apps/cic-eth/doc/texinfo/configuration.texi index 4858a057..9b4e93c2 100644 --- a/apps/cic-eth/doc/texinfo/configuration.texi +++ b/apps/cic-eth/doc/texinfo/configuration.texi @@ -1,8 +1,6 @@ @node cic-eth configuration @section Configuration -(refer to @code{cic-base} for a general overview of the config pipeline) - Configuration parameters are grouped by configuration filename. @@ -40,7 +38,26 @@ Boolean value. If set, the amount of available context for a task in the result @subsection database -See ref cic-base when ready +@table @var +@item host +Database host +@item port +Database port +@item name +Database name +@item user +Database user +@item password +Database password +@item engine +The engine part of the dsn connection string (@code{postgresql} in @code{postgresql+psycopg2}) +@item driver +The driver part of the dsn connection string (@code{psycopg2} in @code{postgresql+psycopg2}) +@item pool_size +Connection pool size for database drivers that provide connection pooling +@item debug +Output actual sql queries to logs. Potentially very verbose +@end table @subsection eth diff --git a/apps/cic-eth/tests/task/test_task_gas.py b/apps/cic-eth/tests/task/test_task_gas.py index 1a8669d8..f69a2dd2 100644 --- a/apps/cic-eth/tests/task/test_task_gas.py +++ b/apps/cic-eth/tests/task/test_task_gas.py @@ -75,7 +75,7 @@ def test_task_check_gas_ok( 'cic_eth.eth.gas.check_gas', [ [ - tx_hash_hex, + strip_0x(tx_hash_hex), ], default_chain_spec.asdict(), [], @@ -283,4 +283,3 @@ def test_task_resend_explicit( tx_after = unpack(bytes.fromhex(strip_0x(otx.signed_tx)), default_chain_spec) logg.debug('gasprices before {} after {}'.format(tx_before['gasPrice'], tx_after['gasPrice'])) assert tx_after['gasPrice'] > tx_before['gasPrice'] - diff --git a/apps/contract-migration/requirements.txt b/apps/contract-migration/requirements.txt index 48d0962b..17ffb576 100644 --- a/apps/contract-migration/requirements.txt +++ b/apps/contract-migration/requirements.txt @@ -1,6 +1,6 @@ -cic-eth[tools]==0.12.4a4 -chainlib-eth>=0.0.9a7,<0.1.0 -eth-erc20>=0.1.2a2,<0.2.0 +cic-eth[tools]==0.12.4a8 +chainlib-eth>=0.0.9a9,<0.1.0 +eth-erc20>=0.1.2a3,<0.2.0 erc20-demurrage-token>=0.0.5a2,<0.1.0 eth-accounts-index>=0.1.2a2,<0.2.0 eth-address-index>=0.2.3a4,<0.3.0 diff --git a/apps/data-seeding/requirements.txt b/apps/data-seeding/requirements.txt index 623eee78..c6931fbd 100644 --- a/apps/data-seeding/requirements.txt +++ b/apps/data-seeding/requirements.txt @@ -1,5 +1,5 @@ sarafu-faucet~=0.0.7a1 -cic-eth[tools]~=0.12.4a7 +cic-eth[tools]~=0.12.4a8 cic-types~=0.1.0a14 crypto-dev-signer>=0.4.15a1,<=0.4.15 faker==4.17.1 diff --git a/apps/data-seeding/verify.py b/apps/data-seeding/verify.py index 5f8a30cd..3db3e919 100644 --- a/apps/data-seeding/verify.py +++ b/apps/data-seeding/verify.py @@ -64,6 +64,10 @@ phone_tests = [ 'ussd_pins' ] +admin_tests = [ + 'local_key', + ] + all_tests = eth_tests + custodial_tests + metadata_tests + phone_tests argparser = argparse.ArgumentParser(description='daemon that monitors transactions in new blocks') @@ -74,6 +78,7 @@ argparser.add_argument('-i', '--chain-spec', type=str, dest='i', help='chain spe argparser.add_argument('--meta-provider', type=str, dest='meta_provider', default='http://localhost:63380', help='cic-meta url') argparser.add_argument('--ussd-provider', type=str, dest='ussd_provider', default='http://localhost:63315', help='cic-ussd url') argparser.add_argument('--skip-custodial', dest='skip_custodial', action='store_true', help='skip all custodial verifications') +argparser.add_argument('--skip-ussd', dest='skip_ussd', action='store_true', help='skip all ussd verifications') argparser.add_argument('--skip-metadata', dest='skip_metadata', action='store_true', help='skip all metadata verifications') argparser.add_argument('--exclude', action='append', type=str, default=[], help='skip specified verification') argparser.add_argument('--include', action='append', type=str, help='include specified verification') @@ -134,6 +139,11 @@ if args.skip_custodial: for t in custodial_tests: if t not in exclude: exclude.append(t) +if args.skip_ussd: + logg.info('will skip all ussd verifications ({})'.format(','.join(phone_tests))) + for t in phone_tests: + if t not in exclude: + exclude.append(t) if args.skip_metadata: logg.info('will skip all metadata verifications ({})'.format(','.join(metadata_tests))) for t in metadata_tests: