From 7d935bcbc3ee4c11e57318132f88a7ba31505a42 Mon Sep 17 00:00:00 2001 From: Blair Vanderlugt Date: Sun, 2 May 2021 12:32:05 -0700 Subject: [PATCH 1/8] should have dropped the user flag --- apps/contract-migration/docker/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/contract-migration/docker/Dockerfile b/apps/contract-migration/docker/Dockerfile index 1b0ef49f..1da4db8b 100644 --- a/apps/contract-migration/docker/Dockerfile +++ b/apps/contract-migration/docker/Dockerfile @@ -58,7 +58,7 @@ ARG cic_base_version=0.1.2b8 ARG cic_eth_version=0.11.0b12 ARG sarafu_token_version=0.0.1a8 ARG sarafu_faucet_version=0.0.3a2 -RUN pip install --user --index-url https://pypi.org/simple --extra-index-url $pip_extra_index_url \ +RUN pip install --index-url https://pypi.org/simple --extra-index-url $pip_extra_index_url \ cic-base[full_graph]==$cic_base_version \ cic-eth==$cic_eth_version \ sarafu-faucet==$sarafu_faucet_version \ From 6a8a356f09a9e31198bc57e7177a7741ac4a4621 Mon Sep 17 00:00:00 2001 From: Louis Holbrook Date: Wed, 5 May 2021 16:25:21 +0000 Subject: [PATCH 2/8] Add faucet filter to cic-cache --- .../runnable/daemons/filters/__init__.py | 1 + .../runnable/daemons/filters/faucet.py | 73 +++++++++++++++++++ .../cic_cache/runnable/daemons/tracker.py | 4 + apps/cic-cache/docker/Dockerfile | 2 +- apps/cic-cache/requirements.txt | 2 +- apps/cic-cache/tests/filters/test_erc20.py | 2 +- apps/cic-cache/tests/filters/test_faucet.py | 71 ++++++++++++++++++ apps/cic-eth/cic_eth/eth/account.py | 7 +- .../runnable/daemons/filters/callback.py | 2 +- .../runnable/daemons/filters/register.py | 2 +- .../cic_eth/runnable/daemons/filters/tx.py | 2 +- apps/cic-eth/cic_eth/version.py | 2 +- apps/cic-eth/docker/Dockerfile | 4 +- apps/cic-eth/requirements.txt | 8 +- .../scripts/cic_eth/import_balance.py | 2 +- .../scripts/eth/import_balance.py | 2 +- .../scripts/requirements.txt | 8 +- apps/contract-migration/scripts/verify.py | 6 +- 18 files changed, 175 insertions(+), 25 deletions(-) create mode 100644 apps/cic-cache/cic_cache/runnable/daemons/filters/faucet.py create mode 100644 apps/cic-cache/tests/filters/test_faucet.py diff --git a/apps/cic-cache/cic_cache/runnable/daemons/filters/__init__.py b/apps/cic-cache/cic_cache/runnable/daemons/filters/__init__.py index e8c9c530..af3eac98 100644 --- a/apps/cic-cache/cic_cache/runnable/daemons/filters/__init__.py +++ b/apps/cic-cache/cic_cache/runnable/daemons/filters/__init__.py @@ -1 +1,2 @@ from .erc20 import * +from .faucet import * diff --git a/apps/cic-cache/cic_cache/runnable/daemons/filters/faucet.py b/apps/cic-cache/cic_cache/runnable/daemons/filters/faucet.py new file mode 100644 index 00000000..f8fc67b7 --- /dev/null +++ b/apps/cic-cache/cic_cache/runnable/daemons/filters/faucet.py @@ -0,0 +1,73 @@ +# standard imports +import logging + +# external imports +from erc20_faucet import Faucet +from chainlib.eth.address import to_checksum_address +from chainlib.eth.constant import ZERO_ADDRESS +from chainlib.status import Status +from hexathon import strip_0x + +# local imports +import cic_cache.db as cic_cache_db +from .base import TagSyncFilter + +#logg = logging.getLogger().getChild(__name__) +logg = logging.getLogger() + + +class FaucetFilter(TagSyncFilter): + + def __init__(self, chain_spec, sender_address=ZERO_ADDRESS): + super(FaucetFilter, self).__init__('give_to', domain='faucet') + self.chain_spec = chain_spec + self.sender_address = sender_address + + + def filter(self, conn, block, tx, db_session=None): + try: + data = strip_0x(tx.payload) + except ValueError: + return False + logg.debug('data {}'.format(data)) + if Faucet.method_for(data[:8]) == None: + return False + + token_sender = tx.inputs[0] + token_recipient = data[64+8-40:] + logg.debug('token recipient {}'.format(token_recipient)) + + f = Faucet(self.chain_spec) + o = f.token(token_sender, sender_address=self.sender_address) + r = conn.do(o) + token = f.parse_token(r) + + f = Faucet(self.chain_spec) + o = f.token_amount(token_sender, sender_address=self.sender_address) + r = conn.do(o) + token_value = f.parse_token_amount(r) + + cic_cache_db.add_transaction( + db_session, + tx.hash, + block.number, + tx.index, + to_checksum_address(token_sender), + to_checksum_address(token_recipient), + token, + token, + token_value, + token_value, + tx.status == Status.SUCCESS, + block.timestamp, + ) + db_session.flush() + cic_cache_db.tag_transaction( + db_session, + tx.hash, + self.tag_name, + domain=self.tag_domain, + ) + db_session.commit() + + return True diff --git a/apps/cic-cache/cic_cache/runnable/daemons/tracker.py b/apps/cic-cache/cic_cache/runnable/daemons/tracker.py index ceac150b..279176bd 100644 --- a/apps/cic-cache/cic_cache/runnable/daemons/tracker.py +++ b/apps/cic-cache/cic_cache/runnable/daemons/tracker.py @@ -41,6 +41,7 @@ from cic_cache.db import ( ) from cic_cache.runnable.daemons.filters import ( ERC20TransferFilter, + FaucetFilter, ) script_dir = os.path.realpath(os.path.dirname(__file__)) @@ -71,6 +72,7 @@ def register_filter_tags(filters, session): session.commit() logg.info('added tag name "{}" domain "{}"'.format(tag[0], tag[1])) except sqlalchemy.exc.IntegrityError: + session.rollback() logg.debug('already have tag name "{}" domain "{}"'.format(tag[0], tag[1])) @@ -112,9 +114,11 @@ def main(): logg.info('using trusted address {}'.format(address)) erc20_transfer_filter = ERC20TransferFilter(chain_spec) + faucet_filter = FaucetFilter(chain_spec) filters = [ erc20_transfer_filter, + faucet_filter, ] session = SessionBase.create_session() diff --git a/apps/cic-cache/docker/Dockerfile b/apps/cic-cache/docker/Dockerfile index 83304027..c4c783dd 100644 --- a/apps/cic-cache/docker/Dockerfile +++ b/apps/cic-cache/docker/Dockerfile @@ -17,7 +17,7 @@ RUN apt-get update && \ # Copy shared requirements from top of mono-repo RUN echo "copying root req file ${root_requirement_file}" -RUN pip install $pip_extra_index_url_flag cic-base[full_graph]==0.1.2a76 +RUN pip install $pip_extra_index_url_flag cic-base[full_graph]==0.1.2b9 COPY cic-cache/requirements.txt ./ COPY cic-cache/setup.cfg \ diff --git a/apps/cic-cache/requirements.txt b/apps/cic-cache/requirements.txt index 9ea4ffd3..6095d479 100644 --- a/apps/cic-cache/requirements.txt +++ b/apps/cic-cache/requirements.txt @@ -1,4 +1,4 @@ -cic-base~=0.1.2b8 +cic-base~=0.1.2b9 alembic==1.4.2 confini~=0.3.6rc3 uwsgi==2.0.19.1 diff --git a/apps/cic-cache/tests/filters/test_erc20.py b/apps/cic-cache/tests/filters/test_erc20.py index d7582ed1..fb44e29a 100644 --- a/apps/cic-cache/tests/filters/test_erc20.py +++ b/apps/cic-cache/tests/filters/test_erc20.py @@ -22,7 +22,7 @@ from cic_cache.runnable.daemons.filters.erc20 import ERC20TransferFilter logg = logging.getLogger() -def test_cache( +def test_erc20_filter( eth_rpc, foo_token, init_database, diff --git a/apps/cic-cache/tests/filters/test_faucet.py b/apps/cic-cache/tests/filters/test_faucet.py new file mode 100644 index 00000000..c1f0dc10 --- /dev/null +++ b/apps/cic-cache/tests/filters/test_faucet.py @@ -0,0 +1,71 @@ +# standard imports +import logging + +# external imports +from chainlib.chain import ChainSpec +from chainlib.eth.nonce import RPCNonceOracle +from chainlib.eth.block import ( + block_by_hash, + Block, + ) +from chainlib.eth.tx import ( + receipt, + unpack, + transaction, + Tx, + ) +from hexathon import strip_0x +from erc20_faucet.faucet import SingleShotFaucet +from sqlalchemy import text + +# local imports +from cic_cache.db import add_tag +from cic_cache.runnable.daemons.filters.faucet import FaucetFilter + +logg = logging.getLogger() + + +def test_filter_faucet( + eth_rpc, + eth_signer, + foo_token, + faucet_noregistry, + init_database, + list_defaults, + contract_roles, + agent_roles, + tags, + ): + + chain_spec = ChainSpec('foo', 'bar', 42, 'baz') + + fltr = FaucetFilter(chain_spec, contract_roles['CONTRACT_DEPLOYER']) + + add_tag(init_database, fltr.tag_name, domain=fltr.tag_domain) + + nonce_oracle = RPCNonceOracle(agent_roles['ALICE'], eth_rpc) + c = SingleShotFaucet(chain_spec, signer=eth_signer, nonce_oracle=nonce_oracle) + (tx_hash_hex, o) = c.give_to(faucet_noregistry, agent_roles['ALICE'], agent_roles['ALICE']) + r = eth_rpc.do(o) + + tx_src = unpack(bytes.fromhex(strip_0x(o['params'][0])), chain_spec) + + o = receipt(r) + r = eth_rpc.do(o) + rcpt = Tx.src_normalize(r) + + assert r['status'] == 1 + + o = block_by_hash(r['block_hash']) + r = eth_rpc.do(o) + block_object = Block(r) + + tx = Tx(tx_src, block_object) + tx.apply_receipt(rcpt) + + r = fltr.filter(eth_rpc, block_object, tx, init_database) + assert r + + s = text("SELECT x.tx_hash FROM tag a INNER JOIN tag_tx_link l ON l.tag_id = a.id INNER JOIN tx x ON x.id = l.tx_id WHERE a.domain = :a AND a.value = :b") + r = init_database.execute(s, {'a': fltr.tag_domain, 'b': fltr.tag_name}).fetchone() + assert r[0] == tx.hash diff --git a/apps/cic-eth/cic_eth/eth/account.py b/apps/cic-eth/cic_eth/eth/account.py index de2e7f0b..0cf636b1 100644 --- a/apps/cic-eth/cic_eth/eth/account.py +++ b/apps/cic-eth/cic_eth/eth/account.py @@ -20,7 +20,8 @@ from chainlib.eth.tx import ( ) from chainlib.chain import ChainSpec from chainlib.error import JSONRPCException -from eth_accounts_index.registry import AccountRegistry # TODO, use interface module instead (needs gas limit method) +from eth_accounts_index.registry import AccountRegistry +from eth_accounts_index import AccountsIndex from sarafu_faucet import MinterFaucet from chainqueue.db.models.tx import TxCache @@ -127,12 +128,12 @@ def register(self, account_address, chain_spec_dict, writer_address=None): if writer_address == ZERO_ADDRESS: session.close() raise RoleMissingError('call address for resgistering {}'.format(account_address)) - account_registry_address = registry.by_name('AccountsIndex', sender_address=call_address) + account_registry_address = registry.by_name('AccountRegistry', sender_address=call_address) # Generate and sign transaction rpc_signer = RPCConnection.connect(chain_spec, 'signer') nonce_oracle = CustodialTaskNonceOracle(writer_address, self.request.root_id, session=session) #, default_nonce) - gas_oracle = self.create_gas_oracle(rpc, AccountsIndex.gas) + gas_oracle = self.create_gas_oracle(rpc, AccountRegistry.gas) account_registry = AccountsIndex(chain_spec, signer=rpc_signer, nonce_oracle=nonce_oracle, gas_oracle=gas_oracle) (tx_hash_hex, tx_signed_raw_hex) = account_registry.add(account_registry_address, writer_address, account_address, tx_format=TxFormat.RLP_SIGNED) rpc_signer.disconnect() diff --git a/apps/cic-eth/cic_eth/runnable/daemons/filters/callback.py b/apps/cic-eth/cic_eth/runnable/daemons/filters/callback.py index e47c4a65..4fb6b543 100644 --- a/apps/cic-eth/cic_eth/runnable/daemons/filters/callback.py +++ b/apps/cic-eth/cic_eth/runnable/daemons/filters/callback.py @@ -8,11 +8,11 @@ from chainlib.status import Status as TxStatus from chainlib.eth.address import to_checksum_address from chainlib.eth.error import RequestMismatchException from chainlib.eth.constant import ZERO_ADDRESS -from chainlib.eth.erc20 import ERC20 from hexathon import ( strip_0x, add_0x, ) +from eth_erc20 import ERC20 from erc20_faucet import Faucet # local imports diff --git a/apps/cic-eth/cic_eth/runnable/daemons/filters/register.py b/apps/cic-eth/cic_eth/runnable/daemons/filters/register.py index 841e7d75..dc1bd778 100644 --- a/apps/cic-eth/cic_eth/runnable/daemons/filters/register.py +++ b/apps/cic-eth/cic_eth/runnable/daemons/filters/register.py @@ -14,7 +14,7 @@ from .base import SyncFilter logg = logging.getLogger().getChild(__name__) -account_registry_add_log_hash = '0x5ed3bdd47b9af629827a8d129aa39c870b10c03f0153fe9ddb8e84b665061acd' +account_registry_add_log_hash = '0x9cc987676e7d63379f176ea50df0ae8d2d9d1141d1231d4ce15b5965f73c9430' class RegistrationFilter(SyncFilter): diff --git a/apps/cic-eth/cic_eth/runnable/daemons/filters/tx.py b/apps/cic-eth/cic_eth/runnable/daemons/filters/tx.py index 4e06e4d8..e2e4ed1f 100644 --- a/apps/cic-eth/cic_eth/runnable/daemons/filters/tx.py +++ b/apps/cic-eth/cic_eth/runnable/daemons/filters/tx.py @@ -30,7 +30,7 @@ class TxFilter(SyncFilter): if otx == None: logg.debug('tx {} not found locally, skipping'.format(tx_hash_hex)) return None - logg.info('tx filter match on {}'.format(otx.tx_hash)) + logg.debug('otx filter match on {}'.format(otx.tx_hash)) db_session.flush() SessionBase.release_session(db_session) s_final_state = celery.signature( diff --git a/apps/cic-eth/cic_eth/version.py b/apps/cic-eth/cic_eth/version.py index 1f75076e..1382b9cf 100644 --- a/apps/cic-eth/cic_eth/version.py +++ b/apps/cic-eth/cic_eth/version.py @@ -10,7 +10,7 @@ version = ( 0, 11, 0, - 'beta.12', + 'beta.13', ) version_object = semver.VersionInfo( diff --git a/apps/cic-eth/docker/Dockerfile b/apps/cic-eth/docker/Dockerfile index 163b3016..45902995 100644 --- a/apps/cic-eth/docker/Dockerfile +++ b/apps/cic-eth/docker/Dockerfile @@ -19,7 +19,7 @@ RUN apt-get update && \ apt install -y gcc gnupg libpq-dev wget make g++ gnupg bash procps git # Copy shared requirements from top of mono-repo -RUN echo "copying root req file ${root_requirement_file}" +RUN echo "copying root req file: ${root_requirement_file}" #COPY $root_requirement_file . #RUN pip install -r $root_requirement_file $pip_extra_index_url_flag RUN /usr/local/bin/python -m pip install --upgrade pip @@ -29,7 +29,7 @@ RUN /usr/local/bin/python -m pip install --upgrade pip # python merge_requirements.py | tee merged_requirements.txt #RUN cd cic-base && \ # pip install $pip_extra_index_url_flag -r ./merged_requirements.txt -RUN pip install $pip_extra_index_url_flag cic-base[full_graph]==0.1.2b8 +RUN pip install $pip_extra_index_url_flag cic-base[full_graph]==0.1.2b9 COPY cic-eth/scripts/ scripts/ COPY cic-eth/setup.cfg cic-eth/setup.py ./ diff --git a/apps/cic-eth/requirements.txt b/apps/cic-eth/requirements.txt index 7b57e8c3..fd48517d 100644 --- a/apps/cic-eth/requirements.txt +++ b/apps/cic-eth/requirements.txt @@ -1,4 +1,4 @@ -cic-base==0.1.2b8 +cic-base==0.1.2b9 celery==4.4.7 crypto-dev-signer~=0.4.14b3 confini~=0.3.6rc3 @@ -18,7 +18,7 @@ chainlib~=0.0.3a1 hexathon~=0.0.1a7 chainsyncer[sql]~=0.0.2a4 chainqueue~=0.0.2a2 -sarafu-faucet==0.0.3a1 +sarafu-faucet==0.0.3a3 +erc20-faucet==0.2.1a4 coincurve==15.0.0 -sarafu-faucet==0.0.3a2 -potaahto~=0.0.1a1 +potaahto~=0.0.1a2 diff --git a/apps/contract-migration/scripts/cic_eth/import_balance.py b/apps/contract-migration/scripts/cic_eth/import_balance.py index bad1d2bf..b3fb1112 100644 --- a/apps/contract-migration/scripts/cic_eth/import_balance.py +++ b/apps/contract-migration/scripts/cic_eth/import_balance.py @@ -27,7 +27,6 @@ from chainlib.eth.block import ( ) from chainlib.hash import keccak256_string_to_hex from chainlib.eth.address import to_checksum_address -from chainlib.eth.erc20 import ERC20 from chainlib.eth.gas import OverrideGasOracle from chainlib.eth.nonce import RPCNonceOracle from chainlib.eth.tx import TxFactory @@ -37,6 +36,7 @@ from chainlib.chain import ChainSpec from crypto_dev_signer.eth.signer import ReferenceSigner as EIP155Signer from crypto_dev_signer.keystore.dict import DictKeystore from cic_types.models.person import Person +from eth_erc20 import ERC20 logging.basicConfig(level=logging.WARNING) diff --git a/apps/contract-migration/scripts/eth/import_balance.py b/apps/contract-migration/scripts/eth/import_balance.py index bad1d2bf..b3fb1112 100644 --- a/apps/contract-migration/scripts/eth/import_balance.py +++ b/apps/contract-migration/scripts/eth/import_balance.py @@ -27,7 +27,6 @@ from chainlib.eth.block import ( ) from chainlib.hash import keccak256_string_to_hex from chainlib.eth.address import to_checksum_address -from chainlib.eth.erc20 import ERC20 from chainlib.eth.gas import OverrideGasOracle from chainlib.eth.nonce import RPCNonceOracle from chainlib.eth.tx import TxFactory @@ -37,6 +36,7 @@ from chainlib.chain import ChainSpec from crypto_dev_signer.eth.signer import ReferenceSigner as EIP155Signer from crypto_dev_signer.keystore.dict import DictKeystore from cic_types.models.person import Person +from eth_erc20 import ERC20 logging.basicConfig(level=logging.WARNING) diff --git a/apps/contract-migration/scripts/requirements.txt b/apps/contract-migration/scripts/requirements.txt index 92c179a7..f7487c3b 100644 --- a/apps/contract-migration/scripts/requirements.txt +++ b/apps/contract-migration/scripts/requirements.txt @@ -1,5 +1,5 @@ -cic-base[full_graph]==0.1.2b8 -sarafu-faucet==0.0.3a2 -cic-eth==0.11.0b12 -cic-types==0.1.0a10 +cic-base[full_graph]==0.1.2b9 +sarafu-faucet==0.0.3a3 +cic-eth==0.11.0b13 +cic-types==0.1.0a11 crypto-dev-signer==0.4.14b3 diff --git a/apps/contract-migration/scripts/verify.py b/apps/contract-migration/scripts/verify.py index 7ff0a341..5d7ffc2d 100644 --- a/apps/contract-migration/scripts/verify.py +++ b/apps/contract-migration/scripts/verify.py @@ -34,7 +34,6 @@ from chainlib.eth.block import ( ) from chainlib.hash import keccak256_string_to_hex from chainlib.eth.address import to_checksum_address -from chainlib.eth.erc20 import ERC20 from chainlib.eth.gas import ( OverrideGasOracle, balance, @@ -46,7 +45,8 @@ from cic_types.models.person import ( Person, generate_metadata_pointer, ) -from erc20_single_shot_faucet import SingleShotFaucet +from erc20_faucet import Faucet +from eth_erc20 import ERC20 logging.basicConfig(level=logging.WARNING) logg = logging.getLogger() @@ -224,7 +224,7 @@ class Verifier: self.api = cic_eth_api self.data_dir = data_dir self.exit_on_error = exit_on_error - self.faucet_tx_factory = SingleShotFaucet(chain_spec, gas_oracle=gas_oracle) + self.faucet_tx_factory = Faucet(chain_spec, gas_oracle=gas_oracle) verifymethods = [] for k in dir(self): From 0b4d8d59370cc3756a59aaa2d16859b59a2328e1 Mon Sep 17 00:00:00 2001 From: nolash Date: Wed, 5 May 2021 19:04:56 +0200 Subject: [PATCH 3/8] Add registry to cic-eth-info tool --- apps/cic-eth/cic_eth/runnable/info.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/apps/cic-eth/cic_eth/runnable/info.py b/apps/cic-eth/cic_eth/runnable/info.py index 59bfb759..69604ca0 100644 --- a/apps/cic-eth/cic_eth/runnable/info.py +++ b/apps/cic-eth/cic_eth/runnable/info.py @@ -12,7 +12,10 @@ import confini import celery # local imports -from cic_eth.api import Api +from cic_eth.api import ( + Api, + AdminApi, + ) logging.basicConfig(level=logging.WARNING) logg = logging.getLogger() @@ -53,8 +56,13 @@ celery_app = celery.Celery(broker=config.get('CELERY_BROKER_URL'), backend=confi queue = args.q api = Api(config.get('CIC_CHAIN_SPEC'), queue=queue) +admin_api = AdminApi(None) def main(): + t = admin_api.registry() + registry = t.get() + print('Registry address: {}'.format(registry)) + t = api.default_token() token_info = t.get() print('Default token symbol: {}'.format(token_info['symbol'])) From 123dc55687233962e60506967f57862ff705998e Mon Sep 17 00:00:00 2001 From: Philip Wafula Date: Tue, 11 May 2021 10:58:00 +0000 Subject: [PATCH 4/8] Philip/fix africastalking parser --- apps/cic-ussd/.config/app.ini | 2 +- apps/cic-ussd/cic_ussd/runnable/client.py | 8 ++-- .../runnable/daemons/cic_user_ussd_server.py | 46 ++++++++++++++----- apps/cic-ussd/cic_ussd/validator.py | 13 ------ apps/cic-ussd/var/lib/locale/ussd.en.yml | 2 + apps/cic-ussd/var/lib/locale/ussd.sw.yml | 2 + 6 files changed, 43 insertions(+), 30 deletions(-) diff --git a/apps/cic-ussd/.config/app.ini b/apps/cic-ussd/.config/app.ini index 9d7cd2c0..95a36052 100644 --- a/apps/cic-ussd/.config/app.ini +++ b/apps/cic-ussd/.config/app.ini @@ -4,7 +4,7 @@ LOCALE_FALLBACK=en LOCALE_PATH=/usr/src/cic-ussd/var/lib/locale/ MAX_BODY_LENGTH=1024 PASSWORD_PEPPER=QYbzKff6NhiQzY3ygl2BkiKOpER8RE/Upqs/5aZWW+I= -SERVICE_CODE=*483*46# +SERVICE_CODE=*483*46#,*483*061#,*384*96# [phone_number] REGION=KE diff --git a/apps/cic-ussd/cic_ussd/runnable/client.py b/apps/cic-ussd/cic_ussd/runnable/client.py index f6fc050b..5ea98e8e 100644 --- a/apps/cic-ussd/cic_ussd/runnable/client.py +++ b/apps/cic-ussd/cic_ussd/runnable/client.py @@ -13,7 +13,7 @@ import argparse import logging import urllib from xdg.BaseDirectory import xdg_config_home -from urllib import request +from urllib import parse, request # third-party imports from confini import Config @@ -92,9 +92,9 @@ def main(): data['text'] = user_input req = urllib.request.Request(url) - data_str = json.dumps(data) - data_bytes = data_str.encode('utf-8') - req.add_header('Content-Type', 'application/json') + urlencoded_data = parse.urlencode(data) + data_bytes = urlencoded_data.encode('utf-8') + req.add_header('Content-Type', 'application/x-www-form-urlencoded') req.data = data_bytes response = urllib.request.urlopen(req) response_data = response.read().decode('utf-8') diff --git a/apps/cic-ussd/cic_ussd/runnable/daemons/cic_user_ussd_server.py b/apps/cic-ussd/cic_ussd/runnable/daemons/cic_user_ussd_server.py index f867dffe..92c4147f 100644 --- a/apps/cic-ussd/cic_ussd/runnable/daemons/cic_user_ussd_server.py +++ b/apps/cic-ussd/cic_ussd/runnable/daemons/cic_user_ussd_server.py @@ -4,6 +4,7 @@ # standard imports import json import logging +from urllib.parse import parse_qs # third-party imports import celery @@ -33,8 +34,7 @@ from cic_ussd.requests import (get_request_endpoint, from cic_ussd.runnable.server_base import exportable_parser, logg from cic_ussd.session.ussd_session import UssdSession as InMemoryUssdSession from cic_ussd.state_machine import UssdStateMachine -from cic_ussd.validator import check_ip, check_request_content_length, check_service_code, validate_phone_number, \ - validate_presence +from cic_ussd.validator import check_ip, check_request_content_length, validate_phone_number, validate_presence args = exportable_parser.parse_args() @@ -124,6 +124,9 @@ else: raise InitializationError(f'Default token data for: {chain_str} not found.') +valid_service_codes = config.get('APP_SERVICE_CODE').split(",") + + def application(env, start_response): """Loads python code for application to be accessible over web server :param env: Object containing server and request information @@ -139,13 +142,27 @@ def application(env, start_response): if get_request_method(env=env) == 'POST' and get_request_endpoint(env=env) == '/': - # get post data - post_data = json.load(env.get('wsgi.input')) + if env.get('CONTENT_TYPE') != 'application/x-www-form-urlencoded': + start_response('405 Play by the rules', errors_headers) + return [] - service_code = post_data.get('serviceCode') - phone_number = post_data.get('phoneNumber') - external_session_id = post_data.get('sessionId') - user_input = post_data.get('text') + post_data = env.get('wsgi.input').read() + post_data = post_data.decode('utf-8') + + try: + post_data = parse_qs(post_data) + except TypeError: + start_response('400 Size matters', errors_headers) + return [] + + service_code = post_data.get('serviceCode')[0] + phone_number = post_data.get('phoneNumber')[0] + external_session_id = post_data.get('sessionId')[0] + + try: + user_input = post_data.get('text')[0] + except TypeError: + user_input = "" # add validation for phone number if phone_number: @@ -162,14 +179,14 @@ def application(env, start_response): return [] # validate service code - if not check_service_code(code=service_code, config=config): + if service_code not in valid_service_codes: response = define_multilingual_responses( key='ussd.kenya.invalid_service_code', locales=['en', 'sw'], prefix='END', - valid_service_code=config.get('APP_SERVICE_CODE')) - response_bytes, headers = define_response_with_content(headers=errors_headers, response=response) - start_response('400 Invalid service code', headers) + valid_service_code=valid_service_codes[0]) + response_bytes, headers = define_response_with_content(headers=headers, response=response) + start_response('200 OK', headers) return [response_bytes] # validate phone number @@ -192,3 +209,8 @@ def application(env, start_response): start_response('200 OK,', headers) SessionBase.session.close() return [response_bytes] + + else: + start_response('405 Play by the rules', errors_headers) + return [] + diff --git a/apps/cic-ussd/cic_ussd/validator.py b/apps/cic-ussd/cic_ussd/validator.py index 89896955..660f2783 100644 --- a/apps/cic-ussd/cic_ussd/validator.py +++ b/apps/cic-ussd/cic_ussd/validator.py @@ -45,19 +45,6 @@ def check_request_content_length(config: Config, env: dict): config.get('APP_MAX_BODY_LENGTH')) -def check_service_code(code: str, config: Config): - """Checks whether provided code matches expected service code - :param config: A dictionary object containing configuration values - :type config: Config - :param code: Service code passed over request - :type code: str - - :return: Service code validity - :rtype: boolean - """ - return code == config.get('APP_SERVICE_CODE') - - def check_known_user(phone: str): """ This method attempts to ascertain whether the user already exists and is known to the system. diff --git a/apps/cic-ussd/var/lib/locale/ussd.en.yml b/apps/cic-ussd/var/lib/locale/ussd.en.yml index e0751543..8cd16b9b 100644 --- a/apps/cic-ussd/var/lib/locale/ussd.en.yml +++ b/apps/cic-ussd/var/lib/locale/ussd.en.yml @@ -158,6 +158,8 @@ en: Your Sarafu-Network balances is: %{token_balance} 00. Back 99. Exit + invalid_service_code: |- + Please dial %{valid_service_code} to access Sarafu Network help: |- CON For assistance call %{support_phone} 00. Back diff --git a/apps/cic-ussd/var/lib/locale/ussd.sw.yml b/apps/cic-ussd/var/lib/locale/ussd.sw.yml index 123363be..7718f477 100644 --- a/apps/cic-ussd/var/lib/locale/ussd.sw.yml +++ b/apps/cic-ussd/var/lib/locale/ussd.sw.yml @@ -158,6 +158,8 @@ sw: Akaunti yako ya Sarafu-Network ina salio ifuatayo: %{token_balance} 00. Nyuma 99. Ondoka + invalid_service_code: |- + Bonyeza %{valid_service_code} kutumia mtandao wa Sarafu help: |- CON Kwa usaidizi piga simu %{support_phone} 0. Nyuma From 4667916d80ed348a25a5f402869edcdc79d45807 Mon Sep 17 00:00:00 2001 From: nolash Date: Wed, 12 May 2021 08:48:50 +0200 Subject: [PATCH 5/8] Catch bogus transfers where token address is no contract --- .../cic_eth/runnable/daemons/filters/callback.py | 12 ++++++++---- .../scripts/cic_eth/import_balance.py | 7 ++++++- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/apps/cic-eth/cic_eth/runnable/daemons/filters/callback.py b/apps/cic-eth/cic_eth/runnable/daemons/filters/callback.py index 4fb6b543..84b61671 100644 --- a/apps/cic-eth/cic_eth/runnable/daemons/filters/callback.py +++ b/apps/cic-eth/cic_eth/runnable/daemons/filters/callback.py @@ -3,7 +3,10 @@ import logging # external imports import celery -from cic_eth_registry.error import UnknownContractError +from cic_eth_registry.error import ( + UnknownContractError, + NotAContractError, + ) from chainlib.status import Status as TxStatus from chainlib.eth.address import to_checksum_address from chainlib.eth.error import RequestMismatchException @@ -124,8 +127,7 @@ class CallbackFilter(SyncFilter): (transfer_type, transfer_data) = parser(tx, conn) if transfer_type == None: continue - else: - pass + break except RequestMismatchException: continue @@ -168,7 +170,9 @@ class CallbackFilter(SyncFilter): t = self.call_back(transfer_type, result) logg.info('callback success task id {} tx {} queue {}'.format(t, tx.hash, t.queue)) except UnknownContractError: - logg.debug('callback filter {}:{} skipping "transfer" method on unknown contract {} tx {}'.format(tx.queue, tx.method, transfer_data['to'], tx.hash)) + logg.debug('callback filter {}:{} skipping "transfer" method on unknown contract {} tx {}'.format(self.queue, self.method, transfer_data['to'], tx.hash)) + except NotAContractError: + logg.debug('callback filter {}:{} skipping "transfer" on non-contract address {} tx {}'.format(self.queue, self.method, transfer_data['to'], tx.hash)) def __str__(self): diff --git a/apps/contract-migration/scripts/cic_eth/import_balance.py b/apps/contract-migration/scripts/cic_eth/import_balance.py index b3fb1112..97c75d60 100644 --- a/apps/contract-migration/scripts/cic_eth/import_balance.py +++ b/apps/contract-migration/scripts/cic_eth/import_balance.py @@ -33,6 +33,7 @@ from chainlib.eth.tx import TxFactory from chainlib.jsonrpc import jsonrpc_template from chainlib.eth.error import EthException from chainlib.chain import ChainSpec +from chainlib.eth.constant import ZERO_ADDRESS from crypto_dev_signer.eth.signer import ReferenceSigner as EIP155Signer from crypto_dev_signer.keystore.dict import DictKeystore from cic_types.models.person import Person @@ -51,7 +52,7 @@ argparser.add_argument('-c', type=str, default=config_dir, help='config root to argparser.add_argument('--old-chain-spec', type=str, dest='old_chain_spec', default='evm:oldchain:1', help='chain spec') argparser.add_argument('-i', '--chain-spec', type=str, dest='i', help='chain spec') argparser.add_argument('-r', '--registry-address', type=str, dest='r', help='CIC Registry address') -argparser.add_argument('--token-symbol', default='SRF', type=str, dest='token_symbol', help='Token symbol to use for trnsactions') +argparser.add_argument('--token-symbol', default='GFT', type=str, dest='token_symbol', help='Token symbol to use for trnsactions') argparser.add_argument('--head', action='store_true', help='start at current block height (overrides --offset)') argparser.add_argument('--env-prefix', default=os.environ.get('CONFINI_ENV_PREFIX'), dest='env_prefix', type=str, help='environment prefix for variables to overwrite configuration') argparser.add_argument('-q', type=str, default='cic-eth', help='celery queue to submit transaction tasks to') @@ -252,6 +253,10 @@ def main(): except ValueError as e: logg.critical('lookup failed for token {}: {}'.format(token_symbol, e)) sys.exit(1) + + if sarafu_token_address == ZERO_ADDRESS: + raise KeyError('token address for symbol {} is zero'.format(token_symbol)) + logg.info('found token address {}'.format(sarafu_token_address)) syncer_backend = MemBackend(chain_str, 0) From e7f48f3ce03ede0f8cdfeff350bec50849bbad44 Mon Sep 17 00:00:00 2001 From: PhilipWafula Date: Wed, 12 May 2021 12:51:55 +0300 Subject: [PATCH 6/8] Refactors to fix hard-coded token symbols. --- apps/cic-ussd/cic_ussd/conversions.py | 8 ++++---- .../cic-ussd/cic_ussd/state_machine/logic/transaction.py | 9 +++++++-- apps/cic-ussd/cic_ussd/transactions.py | 2 +- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/apps/cic-ussd/cic_ussd/conversions.py b/apps/cic-ussd/cic_ussd/conversions.py index 192c4aa4..d2de2546 100644 --- a/apps/cic-ussd/cic_ussd/conversions.py +++ b/apps/cic-ussd/cic_ussd/conversions.py @@ -24,7 +24,7 @@ def from_wei(value: int) -> float: """This function converts values in Wei to a token in the cic network. :param value: Value in Wei :type value: int - :return: SRF equivalent of value in Wei + :return: platform's default token equivalent of value in Wei :rtype: float """ value = float(value) / 1e+6 @@ -33,9 +33,9 @@ def from_wei(value: int) -> float: def to_wei(value: int) -> int: """This functions converts values from a token in the cic network to Wei. - :param value: Value in SRF + :param value: Value in platform's default token :type value: int - :return: Wei equivalent of value in SRF + :return: Wei equivalent of value in platform's default token :rtype: int """ - return int(value * 1e+6) \ No newline at end of file + return int(value * 1e+6) diff --git a/apps/cic-ussd/cic_ussd/state_machine/logic/transaction.py b/apps/cic-ussd/cic_ussd/state_machine/logic/transaction.py index eee2c7df..2c4bbf02 100644 --- a/apps/cic-ussd/cic_ussd/state_machine/logic/transaction.py +++ b/apps/cic-ussd/cic_ussd/state_machine/logic/transaction.py @@ -12,6 +12,7 @@ from cic_ussd.chain import Chain from cic_ussd.db.models.account import AccountStatus, Account from cic_ussd.operations import save_to_in_memory_ussd_session_data from cic_ussd.phone_number import get_user_by_phone_number +from cic_ussd.processor import retrieve_token_symbol from cic_ussd.redis import create_cached_data_key, get_cached_data from cic_ussd.transactions import OutgoingTransactionProcessor @@ -124,14 +125,18 @@ def process_transaction_request(state_machine_data: Tuple[str, dict, Account]): """ user_input, ussd_session, user = state_machine_data + # retrieve token symbol + chain_str = Chain.spec.__str__() + # get user from phone number recipient_phone_number = ussd_session.get('session_data').get('recipient_phone_number') recipient = get_user_by_phone_number(phone_number=recipient_phone_number) to_address = recipient.blockchain_address from_address = user.blockchain_address amount = int(ussd_session.get('session_data').get('transaction_amount')) - chain_str = Chain.spec.__str__() + token_symbol = retrieve_token_symbol(chain_str=chain_str) + outgoing_tx_processor = OutgoingTransactionProcessor(chain_str=chain_str, from_address=from_address, to_address=to_address) - outgoing_tx_processor.process_outgoing_transfer_transaction(amount=amount) + outgoing_tx_processor.process_outgoing_transfer_transaction(amount=amount, token_symbol=token_symbol) diff --git a/apps/cic-ussd/cic_ussd/transactions.py b/apps/cic-ussd/cic_ussd/transactions.py index be08d745..ab235b72 100644 --- a/apps/cic-ussd/cic_ussd/transactions.py +++ b/apps/cic-ussd/cic_ussd/transactions.py @@ -120,7 +120,7 @@ class OutgoingTransactionProcessor: self.from_address = from_address self.to_address = to_address - def process_outgoing_transfer_transaction(self, amount: int, token_symbol='SRF'): + def process_outgoing_transfer_transaction(self, amount: int, token_symbol: str): """This function initiates standard transfers between one account to another :param amount: The amount of tokens to be sent :type amount: int From 8bf1364864c1096b790a49bf574c8105d40b26bc Mon Sep 17 00:00:00 2001 From: nolash Date: Thu, 13 May 2021 18:00:59 +0200 Subject: [PATCH 7/8] Upgrade acoutns index --- apps/cic-eth/requirements.txt | 4 ++-- apps/contract-migration/docker/Dockerfile | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/apps/cic-eth/requirements.txt b/apps/cic-eth/requirements.txt index fd48517d..4ec9c34e 100644 --- a/apps/cic-eth/requirements.txt +++ b/apps/cic-eth/requirements.txt @@ -1,4 +1,4 @@ -cic-base==0.1.2b9 +cic-base~=0.1.2b11 celery==4.4.7 crypto-dev-signer~=0.4.14b3 confini~=0.3.6rc3 @@ -7,7 +7,7 @@ redis==3.5.3 alembic==1.4.2 websockets==8.1 requests~=2.24.0 -eth_accounts_index~=0.0.11a11 +eth_accounts_index~=0.0.11a12 erc20-transfer-authorization~=0.3.1a6 uWSGI==2.0.19.1 semver==2.13.0 diff --git a/apps/contract-migration/docker/Dockerfile b/apps/contract-migration/docker/Dockerfile index 1da4db8b..d91e638b 100644 --- a/apps/contract-migration/docker/Dockerfile +++ b/apps/contract-migration/docker/Dockerfile @@ -54,10 +54,10 @@ ENV PATH $NVM_DIR/versions/node//v$NODE_VERSION/bin:$PATH ARG pip_extra_args="" ARG pip_index_url=https://pypi.org/simple ARG pip_extra_index_url=https://pip.grassrootseconomics.net:8433 -ARG cic_base_version=0.1.2b8 -ARG cic_eth_version=0.11.0b12 +ARG cic_base_version=0.1.2b11 +ARG cic_eth_version=0.11.0b14 ARG sarafu_token_version=0.0.1a8 -ARG sarafu_faucet_version=0.0.3a2 +ARG sarafu_faucet_version=0.0.3a3 RUN pip install --index-url https://pypi.org/simple --extra-index-url $pip_extra_index_url \ cic-base[full_graph]==$cic_base_version \ cic-eth==$cic_eth_version \ From 06652eb30f6bc2165d38a3ef6920c1b57eed9b91 Mon Sep 17 00:00:00 2001 From: Louis Holbrook Date: Thu, 13 May 2021 16:37:44 +0000 Subject: [PATCH 8/8] cic-cache-tracker, cic-eth-tracker: Add optional and customizable history start for trackers --- .../cic_cache/runnable/daemons/tracker.py | 23 ++++++++++++---- apps/cic-cache/config/docker/eth.ini | 2 +- apps/cic-cache/config/docker/syncer.ini | 1 + apps/cic-cache/config/syncer.ini | 1 + apps/cic-cache/requirements.txt | 2 +- .../cic_eth/runnable/daemons/tracker.py | 26 ++++++++++++++----- apps/cic-eth/config/docker/syncer.ini | 1 + apps/cic-eth/config/syncer.ini | 1 + apps/cic-eth/requirements.txt | 2 +- 9 files changed, 44 insertions(+), 15 deletions(-) diff --git a/apps/cic-cache/cic_cache/runnable/daemons/tracker.py b/apps/cic-cache/cic_cache/runnable/daemons/tracker.py index 279176bd..0746df7f 100644 --- a/apps/cic-cache/cic_cache/runnable/daemons/tracker.py +++ b/apps/cic-cache/cic_cache/runnable/daemons/tracker.py @@ -46,12 +46,21 @@ from cic_cache.runnable.daemons.filters import ( script_dir = os.path.realpath(os.path.dirname(__file__)) +def add_block_args(argparser): + argparser.add_argument('--history-start', type=int, default=0, dest='history_start', help='Start block height for initial history sync') + argparser.add_argument('--no-history', action='store_true', dest='no_history', help='Skip initial history sync') + return argparser + + logg = cic_base.log.create() argparser = cic_base.argparse.create(script_dir, cic_base.argparse.full_template) -#argparser = cic_base.argparse.add(argparser, add_traffic_args, 'traffic') +argparser = cic_base.argparse.add(argparser, add_block_args, 'block') args = cic_base.argparse.parse(argparser, logg) config = cic_base.config.create(args.c, args, args.env_prefix) +config.add(args.history_start, 'SYNCER_HISTORY_START', True) +config.add(args.no_history, '_NO_HISTORY', True) + cic_base.config.log(config) dsn = dsn_from_config(config) @@ -60,7 +69,6 @@ SessionBase.connect(dsn, debug=config.true('DATABASE_DEBUG')) chain_spec = ChainSpec.from_chain_str(config.get('CIC_CHAIN_SPEC')) -#RPCConnection.register_location(config.get('ETH_PROVIDER'), chain_spec, 'default') cic_base.rpc.setup(chain_spec, config.get('ETH_PROVIDER')) @@ -84,7 +92,7 @@ def main(): r = rpc.do(o) block_offset = int(strip_0x(r), 16) + 1 - logg.debug('starting at block {}'.format(block_offset)) + logg.debug('current block height {}'.format(block_offset)) syncers = [] @@ -93,8 +101,13 @@ def main(): syncer_backends = SQLBackend.resume(chain_spec, block_offset) if len(syncer_backends) == 0: - logg.info('found no backends to resume') - syncer_backends.append(SQLBackend.initial(chain_spec, block_offset)) + initial_block_start = config.get('SYNCER_HISTORY_START') + initial_block_offset = block_offset + if config.get('_NO_HISTORY'): + initial_block_start = block_offset + initial_block_offset += 1 + syncer_backends.append(SQLBackend.initial(chain_spec, initial_block_offset, start_block_height=initial_block_start)) + logg.info('found no backends to resume, adding initial sync from history start {} end {}'.format(initial_block_start, initial_block_offset)) else: for syncer_backend in syncer_backends: logg.info('resuming sync session {}'.format(syncer_backend)) diff --git a/apps/cic-cache/config/docker/eth.ini b/apps/cic-cache/config/docker/eth.ini index d61e9647..321384f8 100644 --- a/apps/cic-cache/config/docker/eth.ini +++ b/apps/cic-cache/config/docker/eth.ini @@ -1,2 +1,2 @@ [eth] -provider = ws://localhost:63546 +provider = http://localhost:63545 diff --git a/apps/cic-cache/config/docker/syncer.ini b/apps/cic-cache/config/docker/syncer.ini index 452fb81c..c811bccc 100644 --- a/apps/cic-cache/config/docker/syncer.ini +++ b/apps/cic-cache/config/docker/syncer.ini @@ -1,2 +1,3 @@ [syncer] loop_interval = 1 +history_start = 0 diff --git a/apps/cic-cache/config/syncer.ini b/apps/cic-cache/config/syncer.ini index 42e7cd88..f26739c7 100644 --- a/apps/cic-cache/config/syncer.ini +++ b/apps/cic-cache/config/syncer.ini @@ -1,2 +1,3 @@ [syncer] loop_interval = 5 +history_start = 0 diff --git a/apps/cic-cache/requirements.txt b/apps/cic-cache/requirements.txt index 6095d479..ad1232c3 100644 --- a/apps/cic-cache/requirements.txt +++ b/apps/cic-cache/requirements.txt @@ -1,4 +1,4 @@ -cic-base~=0.1.2b9 +cic-base~=0.1.2b10 alembic==1.4.2 confini~=0.3.6rc3 uwsgi==2.0.19.1 diff --git a/apps/cic-eth/cic_eth/runnable/daemons/tracker.py b/apps/cic-eth/cic_eth/runnable/daemons/tracker.py index d20dc338..10ef5154 100644 --- a/apps/cic-eth/cic_eth/runnable/daemons/tracker.py +++ b/apps/cic-eth/cic_eth/runnable/daemons/tracker.py @@ -51,15 +51,23 @@ from cic_eth.registry import ( script_dir = os.path.realpath(os.path.dirname(__file__)) +def add_block_args(argparser): + argparser.add_argument('--history-start', type=int, default=0, dest='history_start', help='Start block height for initial history sync') + argparser.add_argument('--no-history', action='store_true', dest='no_history', help='Skip initial history sync') + return argparser + + logg = cic_base.log.create() argparser = cic_base.argparse.create(script_dir, cic_base.argparse.full_template) -#argparser = cic_base.argparse.add(argparser, add_traffic_args, 'traffic') +argparser = cic_base.argparse.add(argparser, add_block_args, 'block') args = cic_base.argparse.parse(argparser, logg) + config = cic_base.config.create(args.c, args, args.env_prefix) config.add(args.y, '_KEYSTORE_FILE', True) - config.add(args.q, '_CELERY_QUEUE', True) +config.add(args.history_start, 'SYNCER_HISTORY_START', True) +config.add(args.no_history, '_NO_HISTORY', True) cic_base.config.log(config) @@ -69,9 +77,9 @@ SessionBase.connect(dsn, pool_size=16, debug=config.true('DATABASE_DEBUG')) chain_spec = ChainSpec.from_chain_str(config.get('CIC_CHAIN_SPEC')) -#RPCConnection.register_location(config.get('ETH_PROVIDER'), chain_spec, 'default') cic_base.rpc.setup(chain_spec, config.get('ETH_PROVIDER')) + def main(): # connect to celery celery.Celery(broker=config.get('CELERY_BROKER_URL'), backend=config.get('CELERY_RESULT_URL')) @@ -89,7 +97,7 @@ def main(): stat = init_chain_stat(rpc, block_start=block_current) loop_interval = stat.block_average() - logg.debug('starting at block {}'.format(block_offset)) + logg.debug('current block height {}'.format(block_offset)) syncers = [] @@ -98,8 +106,13 @@ def main(): syncer_backends = SQLBackend.resume(chain_spec, block_offset) if len(syncer_backends) == 0: - logg.info('found no backends to resume') - syncer_backends.append(SQLBackend.initial(chain_spec, block_offset)) + initial_block_start = config.get('SYNCER_HISTORY_START') + initial_block_offset = block_offset + if config.get('_NO_HISTORY'): + initial_block_start = block_offset + initial_block_offset += 1 + syncer_backends.append(SQLBackend.initial(chain_spec, initial_block_offset, start_block_height=initial_block_start)) + logg.info('found no backends to resume, adding initial sync from history start {} end {}'.format(initial_block_start, initial_block_offset)) else: for syncer_backend in syncer_backends: logg.info('resuming sync session {}'.format(syncer_backend)) @@ -155,7 +168,6 @@ def main(): for cf in callback_filters: syncer.add_filter(cf) - #r = syncer.loop(int(config.get('SYNCER_LOOP_INTERVAL')), rpc) r = syncer.loop(int(loop_interval), rpc) sys.stderr.write("sync {} done at block {}\n".format(syncer, r)) diff --git a/apps/cic-eth/config/docker/syncer.ini b/apps/cic-eth/config/docker/syncer.ini index 9c452999..fc88c7f4 100644 --- a/apps/cic-eth/config/docker/syncer.ini +++ b/apps/cic-eth/config/docker/syncer.ini @@ -1,2 +1,3 @@ [SYNCER] loop_interval = +history_start = 0 diff --git a/apps/cic-eth/config/syncer.ini b/apps/cic-eth/config/syncer.ini index 9c452999..fc88c7f4 100644 --- a/apps/cic-eth/config/syncer.ini +++ b/apps/cic-eth/config/syncer.ini @@ -1,2 +1,3 @@ [SYNCER] loop_interval = +history_start = 0 diff --git a/apps/cic-eth/requirements.txt b/apps/cic-eth/requirements.txt index 4ec9c34e..a4fb22b6 100644 --- a/apps/cic-eth/requirements.txt +++ b/apps/cic-eth/requirements.txt @@ -14,7 +14,7 @@ semver==2.13.0 websocket-client==0.57.0 moolb~=0.1.1b2 eth-address-index~=0.1.1a11 -chainlib~=0.0.3a1 +chainlib~=0.0.3a2 hexathon~=0.0.1a7 chainsyncer[sql]~=0.0.2a4 chainqueue~=0.0.2a2