diff --git a/apps/cic-cache/cic_cache/cli/arg.py b/apps/cic-cache/cic_cache/cli/arg.py index 2d4e6e8a..43126eb2 100644 --- a/apps/cic-cache/cic_cache/cli/arg.py +++ b/apps/cic-cache/cic_cache/cli/arg.py @@ -14,7 +14,7 @@ class ArgumentParser(BaseArgumentParser): if local_arg_flags & CICFlag.CELERY: self.add_argument('-q', '--celery-queue', dest='celery_queue', type=str, default='cic-cache', help='Task queue') if local_arg_flags & CICFlag.SYNCER: - self.add_argument('--offset', type=int, default=0, help='Start block height for initial history sync') + self.add_argument('--offset', type=int, help='Start block height for initial history sync') self.add_argument('--no-history', action='store_true', dest='no_history', help='Skip initial history sync') if local_arg_flags & CICFlag.CHAIN: self.add_argument('-r', '--registry-address', type=str, dest='registry_address', help='CIC registry contract address') diff --git a/apps/cic-cache/cic_cache/runnable/daemons/tracker.py b/apps/cic-cache/cic_cache/runnable/daemons/tracker.py index 16ed1f4b..d5646ea9 100644 --- a/apps/cic-cache/cic_cache/runnable/daemons/tracker.py +++ b/apps/cic-cache/cic_cache/runnable/daemons/tracker.py @@ -95,10 +95,10 @@ def main(): syncer_backends = SQLBackend.resume(chain_spec, block_offset) if len(syncer_backends) == 0: - initial_block_start = config.get('SYNCER_OFFSET') - initial_block_offset = block_offset + initial_block_start = int(config.get('SYNCER_OFFSET')) + initial_block_offset = int(block_offset) if config.get('SYNCER_NO_HISTORY'): - initial_block_start = block_offset + initial_block_start = initial_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)) diff --git a/apps/cic-eth/cic_eth/cli/arg.py b/apps/cic-eth/cic_eth/cli/arg.py index 91fcc071..7604b72b 100644 --- a/apps/cic-eth/cic_eth/cli/arg.py +++ b/apps/cic-eth/cic_eth/cli/arg.py @@ -22,7 +22,7 @@ class ArgumentParser(BaseArgumentParser): if local_arg_flags & CICFlag.CELERY: self.add_argument('-q', '--celery-queue', dest='celery_queue', type=str, default='cic-eth', help='Task queue') if local_arg_flags & CICFlag.SYNCER: - self.add_argument('--offset', type=int, default=0, help='Start block height for initial history sync') + self.add_argument('--offset', type=int, help='Start block height for initial history sync') self.add_argument('--no-history', action='store_true', dest='no_history', help='Skip initial history sync') if local_arg_flags & CICFlag.CHAIN: self.add_argument('-r', '--registry-address', type=str, dest='registry_address', help='CIC registry contract address') diff --git a/apps/cic-eth/cic_eth/data/config/eth.ini b/apps/cic-eth/cic_eth/data/config/eth.ini index fd58e918..6252960b 100644 --- a/apps/cic-eth/cic_eth/data/config/eth.ini +++ b/apps/cic-eth/cic_eth/data/config/eth.ini @@ -1,2 +1,3 @@ [eth] gas_gifter_minimum_balance = 10000000000000000000000 +min_fee_price = 1 diff --git a/apps/cic-eth/cic_eth/runnable/daemons/tasker.py b/apps/cic-eth/cic_eth/runnable/daemons/tasker.py index 7e3a22a8..4826d410 100644 --- a/apps/cic-eth/cic_eth/runnable/daemons/tasker.py +++ b/apps/cic-eth/cic_eth/runnable/daemons/tasker.py @@ -76,18 +76,18 @@ arg_flags = cic_eth.cli.argflag_std_read local_arg_flags = cic_eth.cli.argflag_local_task argparser = cic_eth.cli.ArgumentParser(arg_flags) argparser.process_local_flags(local_arg_flags) -#argparser.add_argument('--default-token-symbol', dest='default_token_symbol', type=str, help='Symbol of default token to use') argparser.add_argument('--trace-queue-status', default=None, dest='trace_queue_status', action='store_true', help='set to perist all queue entry status changes to storage') argparser.add_argument('--aux-all', action='store_true', help='include tasks from all submodules from the aux module path') +argparser.add_argument('--min-fee-price', dest='min_fee_price', type=int, help='set minimum fee price for transactions, in wei') argparser.add_argument('--aux', action='append', type=str, default=[], help='add single submodule from the aux module path') args = argparser.parse_args() # process config extra_args = { -# 'default_token_symbol': 'CIC_DEFAULT_TOKEN_SYMBOL', 'aux_all': None, 'aux': None, 'trace_queue_status': 'TASKS_TRACE_QUEUE_STATUS', + 'min_fee_price': 'ETH_MIN_FEE_PRICE', } config = cic_eth.cli.Config.from_args(args, arg_flags, local_arg_flags) @@ -215,6 +215,8 @@ def main(): argv.append('-n') argv.append(config.get('CELERY_QUEUE')) + if config.get('ETH_MIN_FEE_PRICE'): + BaseTask.min_fee_price = int(config.get('ETH_MIN_FEE_PRICE')) BaseTask.default_token_symbol = default_token_symbol BaseTask.default_token_address = default_token_address default_token = ERC20Token(chain_spec, conn, add_0x(BaseTask.default_token_address)) diff --git a/apps/cic-eth/cic_eth/runnable/daemons/tracker.py b/apps/cic-eth/cic_eth/runnable/daemons/tracker.py index 5117537c..a173119d 100644 --- a/apps/cic-eth/cic_eth/runnable/daemons/tracker.py +++ b/apps/cic-eth/cic_eth/runnable/daemons/tracker.py @@ -99,10 +99,10 @@ def main(): syncer_backends = SQLBackend.resume(chain_spec, block_offset) if len(syncer_backends) == 0: - initial_block_start = config.get('SYNCER_OFFSET') - initial_block_offset = block_offset + initial_block_start = int(config.get('SYNCER_OFFSET')) + initial_block_offset = int(block_offset) if config.true('SYNCER_NO_HISTORY'): - initial_block_start = block_offset + initial_block_start = initial_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)) diff --git a/apps/cic-eth/cic_eth/task.py b/apps/cic-eth/cic_eth/task.py index 149e1800..0eaae980 100644 --- a/apps/cic-eth/cic_eth/task.py +++ b/apps/cic-eth/cic_eth/task.py @@ -29,14 +29,19 @@ class BaseTask(celery.Task): session_func = SessionBase.create_session call_address = ZERO_ADDRESS trusted_addresses = [] + min_fee_price = 1 create_nonce_oracle = RPCNonceOracle - create_gas_oracle = RPCGasOracle default_token_address = None default_token_symbol = None default_token_name = None default_token_decimals = None run_dir = '/run' + + def create_gas_oracle(self, conn, code_callback=None, id_generator=None): + return RPCGasOracle(conn, code_callback=code_callback, min_price=self.min_fee_price, id_generator=id_generator) + + def create_session(self): return BaseTask.session_func() diff --git a/docker-compose.yml b/docker-compose.yml index 9ee5eef8..4a37d68c 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -9,7 +9,7 @@ volumes: services: evm: - image: ${DEV_DOCKER_REGISTRY:-registry.gitlab.com/grassrootseconomics/cic-internal-integration}/bloxberg-node:${TAG:-latest} + image: ${DEV_DOCKER_REGISTRY:-registry.gitlab.com/grassrootseconomics/cic-base-images}/bloxberg-node:${TAG:-latest} build: context: apps/bloxbergValidatorSetup restart: unless-stopped @@ -41,12 +41,12 @@ services: bootstrap: - image: ${DEV_DOCKER_REGISTRY:-registry.gitlab.com/grassrootseconomics/cic-internal-integration}/contract-migration:${TAG:-latest} + image: ${DEV_DOCKER_REGISTRY:-registry.gitlab.com/grassrootseconomics/cic-base-images}/contract-migration:${TAG:-latest} build: context: apps/contract-migration dockerfile: docker/Dockerfile args: - DOCKER_REGISTRY: ${DEV_DOCKER_REGISTRY:-registry.gitlab.com/grassrootseconomics/cic-internal-integration} + DOCKER_REGISTRY: ${DEV_DOCKER_REGISTRY:-registry.gitlab.com/grassrootseconomics/cic-base-images} PIP_INDEX_URL: ${PIP_INDEX_URL:-https://pypi.org/simple} EXTRA_PIP_INDEX_URL: ${EXTRA_PIP_INDEX_URL:-https://pip.grassrootseconomics.net:8433} EXTRA_PIP_ARGS: $EXTRA_PIP_ARGS @@ -90,12 +90,12 @@ services: cic-signer: - image: ${DEV_DOCKER_REGISTRY:-registry.gitlab.com/grassrootseconomics/cic-internal-integration}/funga-eth:${TAG:-latest} + image: ${DEV_DOCKER_REGISTRY:-registry.gitlab.com/grassrootseconomics/cic-base-images}/funga-eth:${TAG:-latest} build: context: apps/cic-signer dockerfile: Dockerfile args: - DOCKER_REGISTRY: ${DEV_DOCKER_REGISTRY:-registry.gitlab.com/grassrootseconomics} + DOCKER_REGISTRY: ${DEV_DOCKER_REGISTRY:-registry.gitlab.com/grassrootseconomics/cic-base-images} PIP_INDEX_URL: ${PIP_INDEX_URL:-https://pypi.org/simple} EXTRA_PIP_INDEX_URL: ${EXTRA_PIP_INDEX_URL:-https://pip.grassrootseconomics.net:8433} EXTRA_PIP_ARGS: $EXTRA_PIP_ARGS @@ -120,12 +120,12 @@ services: # queue handling for outgoing transactions and incoming transactions cic-eth-tasker: - image: ${DEV_DOCKER_REGISTRY:-registry.gitlab.com/grassrootseconomics/cic-internal-integration}/cic-eth:${TAG:-latest} + image: ${DEV_DOCKER_REGISTRY:-registry.gitlab.com/grassrootseconomics/cic-base-images}/cic-eth:${TAG:-latest} build: context: apps/cic-eth dockerfile: docker/Dockerfile args: - DOCKER_REGISTRY: ${DEV_DOCKER_REGISTRY:-registry.gitlab.com/grassrootseconomics} + DOCKER_REGISTRY: ${DEV_DOCKER_REGISTRY:-registry.gitlab.com/grassrootseconomics/cic-base-images} PIP_INDEX_URL: ${PIP_INDEX_URL:-https://pypi.org/simple} EXTRA_PIP_INDEX_URL: ${EXTRA_PIP_INDEX_URL:-https://pip.grassrootseconomics.net:8433} EXTRA_PIP_ARGS: $EXTRA_PIP_ARGS @@ -150,6 +150,7 @@ services: SIGNER_PROVIDER: ${SIGNER_PROVIDER:-http://cic-signer:8000} SIGNER_SECRET: ${SIGNER_SECRET:-deadbeef} TASKS_TRACE_QUEUE_STATUS: ${TASKS_TRACE_QUEUE_STATUS:-1} + ETH_MIN_FEE_PRICE: $ETH_MIN_FEE_PRICE restart: unless-stopped depends_on: - evm @@ -170,12 +171,12 @@ services: cic-eth-tracker: - image: ${DEV_DOCKER_REGISTRY:-registry.gitlab.com/grassrootseconomics/cic-internal-integration}/cic-eth:${TAG:-latest} + image: ${DEV_DOCKER_REGISTRY:-registry.gitlab.com/grassrootseconomics/cic-base-images}/cic-eth:${TAG:-latest} build: context: apps/cic-eth dockerfile: docker/Dockerfile args: - DOCKER_REGISTRY: ${DEV_DOCKER_REGISTRY:-registry.gitlab.com/grassrootseconomics} + DOCKER_REGISTRY: ${DEV_DOCKER_REGISTRY:-registry.gitlab.com/grassrootseconomics/cic-base-images} PIP_INDEX_URL: ${PIP_INDEX_URL:-https://pypi.org/simple} EXTRA_PIP_INDEX_URL: ${EXTRA_PIP_INDEX_URL:-https://pip.grassrootseconomics.net:8433} EXTRA_PIP_ARGS: $EXTRA_PIP_ARGS @@ -218,12 +219,12 @@ services: cic-eth-dispatcher: - image: ${DEV_DOCKER_REGISTRY:-registry.gitlab.com/grassrootseconomics/cic-internal-integration}/cic-eth:${TAG:-latest} + image: ${DEV_DOCKER_REGISTRY:-registry.gitlab.com/grassrootseconomics/cic-base-images}/cic-eth:${TAG:-latest} build: context: apps/cic-eth dockerfile: docker/Dockerfile args: - DOCKER_REGISTRY: ${DEV_DOCKER_REGISTRY:-registry.gitlab.com/grassrootseconomics} + DOCKER_REGISTRY: ${DEV_DOCKER_REGISTRY:-registry.gitlab.com/grassrootseconomics/cic-base-images} PIP_INDEX_URL: ${PIP_INDEX_URL:-https://pypi.org/simple} EXTRA_PIP_INDEX_URL: ${EXTRA_PIP_INDEX_URL:-https://pip.grassrootseconomics.net:8433} EXTRA_PIP_ARGS: $EXTRA_PIP_ARGS @@ -262,12 +263,12 @@ services: cic-eth-retrier: - image: ${DEV_DOCKER_REGISTRY:-registry.gitlab.com/grassrootseconomics/cic-internal-integration}/cic-eth:${TAG:-latest} + image: ${DEV_DOCKER_REGISTRY:-registry.gitlab.com/grassrootseconomics/cic-base-images}/cic-eth:${TAG:-latest} build: context: apps/cic-eth dockerfile: docker/Dockerfile args: - DOCKER_REGISTRY: ${DEV_DOCKER_REGISTRY:-registry.gitlab.com/grassrootseconomics} + DOCKER_REGISTRY: ${DEV_DOCKER_REGISTRY:-registry.gitlab.com/grassrootseconomics/cic-base-images} PIP_INDEX_URL: ${PIP_INDEX_URL:-https://pypi.org/simple} EXTRA_PIP_INDEX_URL: ${EXTRA_PIP_INDEX_URL:-https://pip.grassrootseconomics.net:8433} EXTRA_PIP_ARGS: $EXTRA_PIP_ARGS @@ -309,12 +310,12 @@ services: cic-cache-tracker: - image: ${DEV_DOCKER_REGISTRY:-registry.gitlab.com/grassrootseconomics/cic-internal-integration}/cic-cache:${TAG:-latest} + image: ${DEV_DOCKER_REGISTRY:-registry.gitlab.com/grassrootseconomics/cic-base-images}/cic-cache:${TAG:-latest} build: context: apps/cic-cache dockerfile: docker/Dockerfile args: - DOCKER_REGISTRY: ${DEV_DOCKER_REGISTRY:-registry.gitlab.com/grassrootseconomics} + DOCKER_REGISTRY: ${DEV_DOCKER_REGISTRY:-registry.gitlab.com/grassrootseconomics/cic-base-images} PIP_INDEX_URL: ${PIP_INDEX_URL:-https://pypi.org/simple} EXTRA_PIP_INDEX_URL: ${EXTRA_PIP_INDEX_URL:-https://pip.grassrootseconomics.net:8433} EXTRA_PIP_ARGS: $EXTRA_PIP_ARGS @@ -357,12 +358,12 @@ services: cic-cache-tasker: - image: ${DEV_DOCKER_REGISTRY:-registry.gitlab.com/grassrootseconomics/cic-internal-integration}/cic-cache:${TAG:-latest} + image: ${DEV_DOCKER_REGISTRY:-registry.gitlab.com/grassrootseconomics/cic-base-images}/cic-cache:${TAG:-latest} build: context: apps/cic-cache dockerfile: docker/Dockerfile args: - DOCKER_REGISTRY: ${DEV_DOCKER_REGISTRY:-registry.gitlab.com/grassrootseconomics} + DOCKER_REGISTRY: ${DEV_DOCKER_REGISTRY:-registry.gitlab.com/grassrootseconomics/cic-base-images} PIP_INDEX_URL: ${PIP_INDEX_URL:-https://pypi.org/simple} EXTRA_PIP_INDEX_URL: ${EXTRA_PIP_INDEX_URL:-https://pip.grassrootseconomics.net:8433} EXTRA_PIP_ARGS: $EXTRA_PIP_ARGS @@ -405,12 +406,12 @@ services: cic-cache-server: - image: ${DEV_DOCKER_REGISTRY:-registry.gitlab.com/grassrootseconomics/cic-internal-integration}/cic-cache:${TAG:-latest} + image: ${DEV_DOCKER_REGISTRY:-registry.gitlab.com/grassrootseconomics/cic-base-images}/cic-cache:${TAG:-latest} build: context: apps/cic-cache dockerfile: docker/Dockerfile args: - DOCKER_REGISTRY: ${DEV_DOCKER_REGISTRY:-registry.gitlab.com/grassrootseconomics} + DOCKER_REGISTRY: ${DEV_DOCKER_REGISTRY:-registry.gitlab.com/grassrootseconomics/cic-base-images} PIP_INDEX_URL: ${PIP_INDEX_URL:-https://pypi.org/simple} EXTRA_PIP_INDEX_URL: ${EXTRA_PIP_INDEX_URL:-https://pip.grassrootseconomics.net:8433} EXTRA_PIP_ARGS: $EXTRA_PIP_ARGS @@ -449,13 +450,13 @@ services: # metadata replacement server for swarm cic-meta-server: - image: ${DEV_DOCKER_REGISTRY:-registry.gitlab.com/grassrootseconomics/cic-internal-integration}/cic-meta:${TAG:-latest} + image: ${DEV_DOCKER_REGISTRY:-registry.gitlab.com/grassrootseconomics/cic-base-images}/cic-meta:${TAG:-latest} hostname: meta build: context: apps/cic-meta dockerfile: docker/Dockerfile args: - DOCKER_REGISTRY: ${DEV_DOCKER_REGISTRY:-registry.gitlab.com/grassrootseconomics} + DOCKER_REGISTRY: ${DEV_DOCKER_REGISTRY:-registry.gitlab.com/grassrootseconomics/cic-base-images} NPM_REPOSITORY: ${DEV_NPM_REPOSITORY:-https://registry.npmjs.org} environment: DATABASE_HOST: ${DATABASE_HOST:-postgres} @@ -487,12 +488,12 @@ services: cic-user-tasker: - image: ${DEV_DOCKER_REGISTRY:-registry.gitlab.com/grassrootseconomics/cic-internal-integration}/cic-user:${TAG:-latest} + image: ${DEV_DOCKER_REGISTRY:-registry.gitlab.com/grassrootseconomics/cic-base-images}/cic-user:${TAG:-latest} build: context: apps/cic-ussd dockerfile: docker/Dockerfile args: - DOCKER_REGISTRY: ${DEV_DOCKER_REGISTRY:-registry.gitlab.com/grassrootseconomics} + DOCKER_REGISTRY: ${DEV_DOCKER_REGISTRY:-registry.gitlab.com/grassrootseconomics/cic-base-images} PIP_INDEX_URL: ${PIP_INDEX_URL:-https://pypi.org/simple} EXTRA_PIP_INDEX_URL: ${EXTRA_PIP_INDEX_URL:-https://pip.grassrootseconomics.net:8433} EXTRA_PIP_ARGS: $EXTRA_PIP_ARGS @@ -526,12 +527,12 @@ services: cic-user-server: - image: ${DEV_DOCKER_REGISTRY:-registry.gitlab.com/grassrootseconomics/cic-internal-integration}/cic-user:${TAG:-latest} + image: ${DEV_DOCKER_REGISTRY:-registry.gitlab.com/grassrootseconomics/cic-base-images}/cic-user:${TAG:-latest} build: context: apps/cic-ussd dockerfile: docker/Dockerfile args: - DOCKER_REGISTRY: ${DEV_DOCKER_REGISTRY:-registry.gitlab.com/grassrootseconomics} + DOCKER_REGISTRY: ${DEV_DOCKER_REGISTRY:-registry.gitlab.com/grassrootseconomics/cic-base-images} PIP_INDEX_URL: ${PIP_INDEX_URL:-https://pypi.org/simple} EXTRA_PIP_INDEX_URL: ${EXTRA_PIP_INDEX_URL:-https://pip.grassrootseconomics.net:8433} EXTRA_PIP_ARGS: $EXTRA_PIP_ARGS @@ -555,12 +556,12 @@ services: cic-user-ussd-server: - image: ${DEV_DOCKER_REGISTRY:-registry.gitlab.com/grassrootseconomics/cic-internal-integration}/cic-user:${TAG:-latest} + image: ${DEV_DOCKER_REGISTRY:-registry.gitlab.com/grassrootseconomics/cic-base-images}/cic-user:${TAG:-latest} build: context: apps/cic-ussd dockerfile: docker/Dockerfile args: - DOCKER_REGISTRY: ${DEV_DOCKER_REGISTRY:-registry.gitlab.com/grassrootseconomics} + DOCKER_REGISTRY: ${DEV_DOCKER_REGISTRY:-registry.gitlab.com/grassrootseconomics/cic-base-images} PIP_INDEX_URL: ${PIP_INDEX_URL:-https://pypi.org/simple} EXTRA_PIP_INDEX_URL: ${EXTRA_PIP_INDEX_URL:-https://pip.grassrootseconomics.net:8433} EXTRA_PIP_ARGS: $EXTRA_PIP_ARGS @@ -593,12 +594,12 @@ services: cic-notify-tasker: - image: ${DEV_DOCKER_REGISTRY:-registry.gitlab.com/grassrootseconomics/cic-internal-integration}/cic-notify:${TAG:-latest} + image: ${DEV_DOCKER_REGISTRY:-registry.gitlab.com/grassrootseconomics/cic-base-images}/cic-notify:${TAG:-latest} build: context: apps/cic-notify dockerfile: docker/Dockerfile args: - DOCKER_REGISTRY: ${DEV_DOCKER_REGISTRY:-registry.gitlab.com/grassrootseconomics} + DOCKER_REGISTRY: ${DEV_DOCKER_REGISTRY:-registry.gitlab.com/grassrootseconomics/cic-base-images} PIP_INDEX_URL: ${PIP_INDEX_URL:-https://pypi.org/simple} EXTRA_PIP_INDEX_URL: ${EXTRA_PIP_INDEX_URL:-https://pip.grassrootseconomics.net:8433} EXTRA_PIP_ARGS: $EXTRA_PIP_ARGS @@ -624,12 +625,12 @@ services: command: "/root/start_tasker.sh -q cic-notify -vv" data-seeding: - image: ${DEV_DOCKER_REGISTRY:-registry.gitlab.com/grassrootseconomics/cic-internal-integration}/data-seeding:${TAG:-latest} + image: ${DEV_DOCKER_REGISTRY:-registry.gitlab.com/grassrootseconomics/cic-base-images}/data-seeding:${TAG:-latest} build: context: apps/data-seeding dockerfile: docker/Dockerfile args: - DOCKER_REGISTRY: ${DEV_DOCKER_REGISTRY:-registry.gitlab.com/grassrootseconomics} + DOCKER_REGISTRY: ${DEV_DOCKER_REGISTRY:-registry.gitlab.com/grassrootseconomics/cic-base-images} NPM_REPOSITORY: ${DEV_NPM_REPOSITORY:-https://registry.npmjs.org} PIP_INDEX_URL: ${PIP_INDEX_URL:-https://pypi.org/simple} EXTRA_PIP_INDEX_URL: ${EXTRA_PIP_INDEX_URL:-https://pip.grassrootseconomics.net:8433}