From 1124bd2d267ac640896169afe5ba5c18564a5909 Mon Sep 17 00:00:00 2001 From: nolash Date: Wed, 24 Feb 2021 09:36:42 +0100 Subject: [PATCH] Upgrade chainsyncer --- apps/cic-eth/cic_eth/runnable/daemons/dispatcher.py | 4 +++- apps/cic-eth/cic_eth/runnable/view.py | 7 ++++--- apps/cic-eth/cic_eth/sync/mined.py | 2 +- apps/cic-eth/requirements.txt | 2 +- apps/contract-migration/docker/Dockerfile | 2 +- apps/contract-migration/scripts/requirements.txt | 2 +- apps/requirements.txt | 2 +- docker-compose.yml | 4 ++-- 8 files changed, 14 insertions(+), 11 deletions(-) diff --git a/apps/cic-eth/cic_eth/runnable/daemons/dispatcher.py b/apps/cic-eth/cic_eth/runnable/daemons/dispatcher.py index 9837585d..c5954977 100644 --- a/apps/cic-eth/cic_eth/runnable/daemons/dispatcher.py +++ b/apps/cic-eth/cic_eth/runnable/daemons/dispatcher.py @@ -21,6 +21,7 @@ import cic_eth from cic_eth.eth import RpcClient from cic_eth.db import SessionBase from cic_eth.db.enum import StatusEnum +from cic_eth.db.enum import StatusBits from cic_eth.db.enum import LockEnum from cic_eth.db import dsn_from_config from cic_eth.queue.tx import get_upcoming_tx @@ -129,12 +130,13 @@ class DispatchSyncer: ) s_check.link(s_send) t = s_check.apply_async() + logg.info('processed {}'.format(k)) def loop(self, w3, interval): while run: txs = {} - typ = StatusEnum.READYSEND + typ = StatusBits.QUEUED utxs = get_upcoming_tx(typ, chain_id=self.chain_id) for k in utxs.keys(): txs[k] = utxs[k] diff --git a/apps/cic-eth/cic_eth/runnable/view.py b/apps/cic-eth/cic_eth/runnable/view.py index 12de34eb..3402ece5 100644 --- a/apps/cic-eth/cic_eth/runnable/view.py +++ b/apps/cic-eth/cic_eth/runnable/view.py @@ -36,8 +36,8 @@ default_abi_dir = '/usr/share/local/cic/solidity/abi' default_config_dir = os.path.join('/usr/local/etc/cic-eth') argparser = argparse.ArgumentParser() -argparser.add_argument('-p', '--provider', dest='p', default='http://localhost:8545', type=str, help='Web3 provider url (http only)') -argparser.add_argument('-r', '--registry-address', type=str, help='CIC registry address') +argparser.add_argument('-p', '--provider', dest='p', type=str, help='Web3 provider url (http only)') +argparser.add_argument('-r', '--registry-address', dest='r', type=str, help='CIC registry address') argparser.add_argument('-f', '--format', dest='f', default='terminal', type=str, help='Output format') argparser.add_argument('-c', type=str, default=default_config_dir, help='config root to use') argparser.add_argument('-i', '--chain-spec', dest='i', type=str, help='chain spec') @@ -61,8 +61,10 @@ config.process() args_override = { 'ETH_PROVIDER': getattr(args, 'p'), 'CIC_CHAIN_SPEC': getattr(args, 'i'), + 'CIC_REGISTRY_ADDRESS': getattr(args, 'r'), } # override args +config.dict_override(args_override, 'cli args') config.censor('PASSWORD', 'DATABASE') config.censor('PASSWORD', 'SSL') logg.debug('config loaded from {}:\n{}'.format(config_dir, config)) @@ -148,7 +150,6 @@ def render_lock(o, **kwargs): # TODO: move each command to submodule def main(): - logg.debug('len {}'.format(len(args.query))) txs = [] renderer = render_tx if len(args.query) > 66: diff --git a/apps/cic-eth/cic_eth/sync/mined.py b/apps/cic-eth/cic_eth/sync/mined.py index 62b55674..362b223d 100644 --- a/apps/cic-eth/cic_eth/sync/mined.py +++ b/apps/cic-eth/cic_eth/sync/mined.py @@ -100,7 +100,7 @@ class MinedSyncer(Syncer): logg.debug('got blocks {}'.format(e)) for block in e: block_number = self.process(c.w3, block.hex()) - logg.info('processed block {} {}'.format(block_number, block.hex())) + logg.debug('processed block {} {}'.format(block_number, block.hex())) self.bc_cache.disconnect() if len(e) > 0: time.sleep(self.yield_delay) diff --git a/apps/cic-eth/requirements.txt b/apps/cic-eth/requirements.txt index be5c2da2..f1f08a00 100644 --- a/apps/cic-eth/requirements.txt +++ b/apps/cic-eth/requirements.txt @@ -20,5 +20,5 @@ moolb~=0.1.1b2 eth-address-index~=0.1.0a8 chainlib~=0.0.1a17 hexathon~=0.0.1a3 -chainsyncer~=0.0.1a16 +chainsyncer~=0.0.1a17 cic-base==0.1.1a3 diff --git a/apps/contract-migration/docker/Dockerfile b/apps/contract-migration/docker/Dockerfile index b979a714..d05f546d 100644 --- a/apps/contract-migration/docker/Dockerfile +++ b/apps/contract-migration/docker/Dockerfile @@ -107,7 +107,7 @@ RUN cd cic-bancor/python && \ RUN apt-get install -y cargo -ARG cic_base_version=0.1.1a3 +ARG cic_base_version=0.1.1a4 RUN pip install --extra-index-url $pip_extra_index_url cic-base[full_graph]==$cic_base_version ARG cic_registry_version=0.5.3a21 diff --git a/apps/contract-migration/scripts/requirements.txt b/apps/contract-migration/scripts/requirements.txt index 1fcf5405..fb18e5dc 100644 --- a/apps/contract-migration/scripts/requirements.txt +++ b/apps/contract-migration/scripts/requirements.txt @@ -1,2 +1,2 @@ -cic-base[full]==0.1.1a1 +cic-base[full]==0.1.1a4 cic-eth==0.10.0a31 diff --git a/apps/requirements.txt b/apps/requirements.txt index 6bc31411..4208c093 100644 --- a/apps/requirements.txt +++ b/apps/requirements.txt @@ -43,5 +43,5 @@ cryptocurrency-cli-tools==0.0.4 giftable-erc20-token==0.0.7b12 hexathon==0.0.1a3 chainlib==0.0.1a17 -chainsyncer==0.0.1a15 +chainsyncer==0.0.1a17 cic-registry==0.5.3.a21 diff --git a/docker-compose.yml b/docker-compose.yml index 526ffd21..93cb6f5b 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -298,7 +298,7 @@ services: CELERY_BROKER_URL: ${CELERY_BROKER_URL:-redis://redis} CELERY_RESULT_URL: ${CELERY_RESULT_URL:-redis://redis} TASKS_TRANSFER_CALLBACKS: $TASKS_TRANSFER_CALLBACKS - DATABASE_DEBUG: ${DATABASE_DEBUG:-true} + DATABASE_DEBUG: ${DATABASE_DEBUG:-false} depends_on: - eth @@ -314,7 +314,7 @@ services: - -c - | if [[ -f /tmp/cic/config/.env ]]; then source /tmp/cic/config/.env; fi - ./start_dispatcher.sh -q cic-eth -v + ./start_dispatcher.sh -q cic-eth -vv # command: "/root/start_dispatcher.sh -q cic-eth -vv"