From 05479a6576339659c819d89f4f7d99e37c8d1d54 Mon Sep 17 00:00:00 2001 From: nolash Date: Sun, 7 Mar 2021 10:33:11 +0100 Subject: [PATCH] WIP remove lower layer deps in ussd, correct create account api task graph --- apps/cic-eth/cic_eth/api/api_task.py | 6 ++-- apps/cic-eth/cic_eth/eth/gas.py | 1 + apps/cic-eth/cic_eth/eth/tx.py | 2 ++ apps/cic-eth/cic_eth/runnable/create.py | 1 + apps/cic-eth/cic_eth/runnable/ctrl.py | 2 +- apps/cic-eth/cic_eth/runnable/resend.py | 2 +- apps/cic-eth/cic_eth/runnable/view.py | 2 +- apps/cic-eth/cic_eth/version.py | 2 +- apps/cic-eth/requirements.txt | 2 +- apps/cic-notify/setup.cfg | 2 +- apps/cic-ussd/cic_ussd/runnable/client.py | 4 +-- apps/cic-ussd/cic_ussd/version.py | 2 +- apps/cic-ussd/requirements.txt | 32 ++----------------- .../scripts/import_users.py | 6 ++-- apps/contract-migration/seed_cic_eth.sh | 2 +- docker-compose.yml | 2 +- 16 files changed, 23 insertions(+), 47 deletions(-) diff --git a/apps/cic-eth/cic_eth/api/api_task.py b/apps/cic-eth/cic_eth/api/api_task.py index f6e8704d..1ec624d3 100644 --- a/apps/cic-eth/cic_eth/api/api_task.py +++ b/apps/cic-eth/cic_eth/api/api_task.py @@ -352,8 +352,7 @@ class Api: ], queue=self.queue, ) - s_nonce.link(s_account) - s_check.link(s_nonce) + s_check.link(s_account) if self.callback_param != None: s_account.link(self.callback_success) @@ -365,7 +364,8 @@ class Api: ], queue=self.queue, ) - s_account.link(s_register) + s_nonce.link(s_register) + s_account.link(s_nonce) t = s_check.apply_async(queue=self.queue) return t diff --git a/apps/cic-eth/cic_eth/eth/gas.py b/apps/cic-eth/cic_eth/eth/gas.py index 8cf99055..34a2ff1a 100644 --- a/apps/cic-eth/cic_eth/eth/gas.py +++ b/apps/cic-eth/cic_eth/eth/gas.py @@ -54,6 +54,7 @@ class GasOracle(): """ session = SessionBase.create_session() a = AccountRole.get_address('GAS_GIFTER', session) + logg.debug('gasgifter {}'.format(a)) session.close() return a diff --git a/apps/cic-eth/cic_eth/eth/tx.py b/apps/cic-eth/cic_eth/eth/tx.py index 2e43f5f6..789ee3bf 100644 --- a/apps/cic-eth/cic_eth/eth/tx.py +++ b/apps/cic-eth/cic_eth/eth/tx.py @@ -593,6 +593,8 @@ def reserve_nonce(self, chained_input, address=None): if address == None: address = chained_input + if not web3.Web3.isChecksumAddress(address): + raise ValueError('invalid address {}'.format(address)) root_id = self.request.root_id nonce = NonceReservation.next(address, root_id) diff --git a/apps/cic-eth/cic_eth/runnable/create.py b/apps/cic-eth/cic_eth/runnable/create.py index 8371b0eb..532878b4 100644 --- a/apps/cic-eth/cic_eth/runnable/create.py +++ b/apps/cic-eth/cic_eth/runnable/create.py @@ -5,6 +5,7 @@ import os import logging import uuid import json +from xdg.BaseDirectory import xdg_config_home import celery from cic_eth.api import Api diff --git a/apps/cic-eth/cic_eth/runnable/ctrl.py b/apps/cic-eth/cic_eth/runnable/ctrl.py index 2aae7be5..b73f3bd6 100644 --- a/apps/cic-eth/cic_eth/runnable/ctrl.py +++ b/apps/cic-eth/cic_eth/runnable/ctrl.py @@ -25,7 +25,7 @@ logging.getLogger('urllib3').setLevel(logging.WARNING) default_abi_dir = '/usr/share/local/cic/solidity/abi' -default_config_dir = os.path.join('/usr/local/etc/cic-eth') +default_config_dir = os.environ.get('CONFINI_DIR', '/usr/local/etc/cic') argparser = argparse.ArgumentParser() argparser.add_argument('-p', '--provider', dest='p', default='http://localhost:8545', type=str, help='Web3 provider url (http only)') diff --git a/apps/cic-eth/cic_eth/runnable/resend.py b/apps/cic-eth/cic_eth/runnable/resend.py index b455b772..77faf95a 100644 --- a/apps/cic-eth/cic_eth/runnable/resend.py +++ b/apps/cic-eth/cic_eth/runnable/resend.py @@ -22,7 +22,7 @@ logg = logging.getLogger() logging.getLogger('web3').setLevel(logging.WARNING) logging.getLogger('urllib3').setLevel(logging.WARNING) -default_config_dir = os.path.join('/usr/local/etc/cic-eth') +default_config_dir = os.environ.get('CONFINI_DIR', '/usr/local/etc/cic') argparser = argparse.ArgumentParser() diff --git a/apps/cic-eth/cic_eth/runnable/view.py b/apps/cic-eth/cic_eth/runnable/view.py index 144f0940..0cd6f8d2 100644 --- a/apps/cic-eth/cic_eth/runnable/view.py +++ b/apps/cic-eth/cic_eth/runnable/view.py @@ -37,7 +37,7 @@ logging.getLogger('urllib3').setLevel(logging.WARNING) default_abi_dir = '/usr/share/local/cic/solidity/abi' -default_config_dir = os.path.join('/usr/local/etc/cic-eth') +default_config_dir = os.environ.get('CONFINI_DIR', '/usr/local/etc/cic') argparser = argparse.ArgumentParser() argparser.add_argument('-p', '--provider', dest='p', type=str, help='Web3 provider url (http only)') diff --git a/apps/cic-eth/cic_eth/version.py b/apps/cic-eth/cic_eth/version.py index 66a1f091..102c1cce 100644 --- a/apps/cic-eth/cic_eth/version.py +++ b/apps/cic-eth/cic_eth/version.py @@ -10,7 +10,7 @@ version = ( 0, 10, 0, - 'alpha.39', + 'alpha.40', ) version_object = semver.VersionInfo( diff --git a/apps/cic-eth/requirements.txt b/apps/cic-eth/requirements.txt index 96b4c93e..93585123 100644 --- a/apps/cic-eth/requirements.txt +++ b/apps/cic-eth/requirements.txt @@ -1,4 +1,4 @@ -cic-base~=0.1.1a10 +cic-base~=0.1.1a17 web3==5.12.2 celery==4.4.7 crypto-dev-signer~=0.4.13rc4 diff --git a/apps/cic-notify/setup.cfg b/apps/cic-notify/setup.cfg index d421d373..4ef87f2c 100644 --- a/apps/cic-notify/setup.cfg +++ b/apps/cic-notify/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = cic-notify -version= attr: cic_notify.version.__version_string__ +version= 0.4.0a2 description = CIC notifications service author = Louis Holbrook author_email = dev@holbrook.no diff --git a/apps/cic-ussd/cic_ussd/runnable/client.py b/apps/cic-ussd/cic_ussd/runnable/client.py index 3278a9e9..f6fc050b 100644 --- a/apps/cic-ussd/cic_ussd/runnable/client.py +++ b/apps/cic-ussd/cic_ussd/runnable/client.py @@ -21,10 +21,10 @@ from confini import Config logging.basicConfig(level=logging.WARNING) logg = logging.getLogger() -config_dir = os.path.join(xdg_config_home, 'cli-ussd') +default_config_dir = os.environ.get('CONFINI_DIR', '/usr/local/etc/cic') argparser = argparse.ArgumentParser(description='CLI tool to interface a Sempo USSD session') -argparser.add_argument('-c', type=str, default=config_dir, help='config root to use') +argparser.add_argument('-c', type=str, default=default_config_dir, help='config root to use') #argparser.add_argument('-d', type=str, default='local', help='deployment name to interface (config root subdirectory)') argparser.add_argument('--host', type=str, default='localhost') argparser.add_argument('--port', type=int, default=9000) diff --git a/apps/cic-ussd/cic_ussd/version.py b/apps/cic-ussd/cic_ussd/version.py index 866d952b..d0d95f19 100644 --- a/apps/cic-ussd/cic_ussd/version.py +++ b/apps/cic-ussd/cic_ussd/version.py @@ -1,7 +1,7 @@ # standard imports import semver -version = (0, 3, 0, 'alpha.2') +version = (0, 3, 0, 'alpha.4') version_object = semver.VersionInfo( major=version[0], diff --git a/apps/cic-ussd/requirements.txt b/apps/cic-ussd/requirements.txt index f451f650..e8fd5152 100644 --- a/apps/cic-ussd/requirements.txt +++ b/apps/cic-ussd/requirements.txt @@ -1,49 +1,21 @@ +cic_base[full-graph]~=0.1.1a17 alembic==1.4.2 -amqp==2.6.1 -attrs==20.2.0 bcrypt==3.2.0 -betterpath==0.2.2 -billiard==3.6.3.0 celery==4.4.7 -cffi==1.14.3 -chainlib~=0.0.1a15 +chainlib~=0.0.1a20 cic-eth==0.10.0a39 cic-notify~=0.4.0a2 cic-types==0.1.0a8 -click==7.1.2 confini~=0.3.6rc3 cryptography==3.2.1 faker==4.17.1 -iniconfig==1.1.1 -kombu==4.6.11 -Mako==1.1.3 -MarkupSafe==1.1.1 -mirakuru==2.3.0 -more-itertools==8.5.0 -packaging==20.4 phonenumbers==8.12.12 -pluggy==0.13.1 -port-for==0.4 -psutil==5.7.3 psycopg2==2.8.6 -py==1.9.0 -pycparser==2.20 -pyparsing==2.4.7 -python-dateutil==2.8.1 -python-editor==1.0.4 python-gnupg==0.4.6 python-i18n==0.3.9 -pytz==2020.1 -PyYAML==5.3.1 redis==3.5.3 -requests==2.24.0 semver==2.13.0 -six==1.15.0 SQLAlchemy==1.3.20 tinydb==4.2.0 -toml==0.10.1 transitions==0.8.4 uWSGI==2.0.19.1 -vcversioner==2.16.0.0 -vine==1.3.0 -zope.interface==5.1.2 diff --git a/apps/contract-migration/scripts/import_users.py b/apps/contract-migration/scripts/import_users.py index cb2d1d7d..2acede2f 100644 --- a/apps/contract-migration/scripts/import_users.py +++ b/apps/contract-migration/scripts/import_users.py @@ -112,11 +112,11 @@ def register_eth(i, u): r = json.loads(m['data']) address = r['result'] break - except TypeError as e: + except Exception as e: if m == None: - logg.critical('empty response from redis callback (did the service crash?)') + logg.critical('empty response from redis callback (did the service crash?) {}'.format(e)) else: - logg.critical('unexpected response from redis callback: {}'.format(m)) + logg.critical('unexpected response from redis callback: {} {}'.format(m, e)) sys.exit(1) logg.debug('[{}] register eth {} {}'.format(i, u, address)) diff --git a/apps/contract-migration/seed_cic_eth.sh b/apps/contract-migration/seed_cic_eth.sh index dda61b9e..9c737f90 100644 --- a/apps/contract-migration/seed_cic_eth.sh +++ b/apps/contract-migration/seed_cic_eth.sh @@ -31,7 +31,7 @@ set -e set -a # We need to not install these here... -pip install --extra-index-url $DEV_PIP_EXTRA_INDEX_URL cic-eth==0.10.0a38 chainlib==0.0.1a19 cic-contracts==0.0.2a2 +pip install --extra-index-url $DEV_PIP_EXTRA_INDEX_URL cic-eth==0.10.0a39 chainlib==0.0.1a19 cic-contracts==0.0.2a2 pip install --extra-index-url $DEV_PIP_EXTRA_INDEX_URL --force-reinstall erc20-transfer-authorization==0.3.0a10 >&2 echo "create account for gas gifter" diff --git a/docker-compose.yml b/docker-compose.yml index 65430535..7bd962bf 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -238,7 +238,7 @@ services: - -c - | if [[ -f /tmp/cic/config/.env ]]; then source /tmp/cic/config/.env; fi - ./start_tasker.sh -q cic-eth + ./start_tasker.sh -q cic-eth -vv # command: [/bin/sh, "./start_tasker.sh", -q, cic-eth, -vv ] cic-eth-tracker: