Compare commits
13 Commits
lash/tmp-b
...
lash/verif
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
29423449b7 | ||
|
|
8855ccd3d2 | ||
|
|
09dfdbb38a | ||
| 1abb642361 | |||
| 93bcbd7d51 | |||
|
|
818899670a | ||
|
|
1882910a8e | ||
|
|
7ce68021bd | ||
|
|
71a7e3d3d5
|
||
|
|
335b7b30a4
|
||
|
|
3b1f470ddf
|
||
|
|
4c9f20aa7f
|
||
|
|
980191be4f
|
@@ -10,6 +10,7 @@ include:
|
|||||||
#- local: 'apps/data-seeding/.gitlab-ci.yml'
|
#- local: 'apps/data-seeding/.gitlab-ci.yml'
|
||||||
|
|
||||||
stages:
|
stages:
|
||||||
|
- version
|
||||||
- build
|
- build
|
||||||
- test
|
- test
|
||||||
- deploy
|
- deploy
|
||||||
@@ -20,9 +21,39 @@ variables:
|
|||||||
DOCKER_BUILDKIT: "1"
|
DOCKER_BUILDKIT: "1"
|
||||||
COMPOSE_DOCKER_CLI_BUILD: "1"
|
COMPOSE_DOCKER_CLI_BUILD: "1"
|
||||||
CI_DEBUG_TRACE: "true"
|
CI_DEBUG_TRACE: "true"
|
||||||
|
SEMVERBOT_VERSION: "0.2.0"
|
||||||
|
|
||||||
before_script:
|
#before_script:
|
||||||
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
|
# - docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
|
||||||
|
|
||||||
|
version:
|
||||||
|
#image: python:3.7-stretch
|
||||||
|
image: registry.gitlab.com/grassrootseconomics/cic-base-images/ci-version:b01318ae
|
||||||
|
stage: version
|
||||||
|
script:
|
||||||
|
- mkdir -p ~/.ssh && chmod 700 ~/.ssh
|
||||||
|
- ssh-keyscan gitlab.com >> ~/.ssh/known_hosts && chmod 644 ~/.ssh/known_hosts
|
||||||
|
- eval $(ssh-agent -s)
|
||||||
|
- ssh-add <(echo "$SSH_PRIVATE_KEY")
|
||||||
|
- git remote set-url origin git@gitlab.com:grassrootseconomics/cic-internal-integration.git
|
||||||
|
- export TAG=$(sbot predict version -m auto)
|
||||||
|
- |
|
||||||
|
if [[ -z $TAG ]]
|
||||||
|
then
|
||||||
|
echo "tag could not be set $@"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
- echo $TAG > version
|
||||||
|
- git tag -a v$TAG -m "ci tagged"
|
||||||
|
- git push origin v$TAG
|
||||||
|
artifacts:
|
||||||
|
paths:
|
||||||
|
- version
|
||||||
|
rules:
|
||||||
|
- if: $CI_COMMIT_REF_PROTECTED == "true"
|
||||||
|
when: always
|
||||||
|
- if: $CI_COMMIT_REF_NAME == "master"
|
||||||
|
when: always
|
||||||
|
|
||||||
# runs on protected branches and pushes to repo
|
# runs on protected branches and pushes to repo
|
||||||
build-push:
|
build-push:
|
||||||
@@ -30,12 +61,17 @@ build-push:
|
|||||||
tags:
|
tags:
|
||||||
- integration
|
- integration
|
||||||
#script:
|
#script:
|
||||||
# - TAG=$CI_COMMIT_REF_SLUG-$CI_COMMIT_SHORT_SHA sh ./scripts/build-push.sh
|
# - TAG=$CI_Cbefore_script:
|
||||||
|
before_script:
|
||||||
|
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
|
||||||
script:
|
script:
|
||||||
- TAG=latest sh ./scripts/build-push.sh
|
- TAG=latest ./scripts/build-push.sh
|
||||||
|
- TAG=$(cat ./version) ./scripts/build-push.sh
|
||||||
rules:
|
rules:
|
||||||
- if: $CI_COMMIT_REF_PROTECTED == "true"
|
- if: $CI_COMMIT_REF_PROTECTED == "true"
|
||||||
when: always
|
when: always
|
||||||
|
- if: $CI_COMMIT_REF_NAME == "master"
|
||||||
|
when: always
|
||||||
|
|
||||||
deploy-dev:
|
deploy-dev:
|
||||||
stage: deploy
|
stage: deploy
|
||||||
|
|||||||
16
.semverbot.toml
Normal file
16
.semverbot.toml
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
[git]
|
||||||
|
|
||||||
|
[git.config]
|
||||||
|
email = "semverbot@grassroots.org"
|
||||||
|
name = "semvervot"
|
||||||
|
|
||||||
|
[git.tags]
|
||||||
|
prefix = "v"
|
||||||
|
|
||||||
|
[semver]
|
||||||
|
mode = "git-commit"
|
||||||
|
|
||||||
|
[semver.detection]
|
||||||
|
patch = ["fix", "[fix]", "patch", "[patch]"]
|
||||||
|
minor = ["minor", "[minor]", "feat", "[feat]", "release", "[release]", "bump", "[bump]"]
|
||||||
|
major = ["BREAKING CHANGE"]
|
||||||
@@ -4,6 +4,7 @@
|
|||||||
|
|
||||||
This repo uses docker-compose and docker buildkit. Set the following environment variables to get started:
|
This repo uses docker-compose and docker buildkit. Set the following environment variables to get started:
|
||||||
|
|
||||||
|
|
||||||
```
|
```
|
||||||
export COMPOSE_DOCKER_CLI_BUILD=1
|
export COMPOSE_DOCKER_CLI_BUILD=1
|
||||||
export DOCKER_BUILDKIT=1
|
export DOCKER_BUILDKIT=1
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
[cic]
|
[cic]
|
||||||
registry_address =
|
registry_address =
|
||||||
trust_address =
|
trust_address =
|
||||||
health_modules = cic_eth.check.db,cic_eth.check.redis,cic_eth.check.signer,cic_eth.check.gas
|
health_modules =
|
||||||
|
|||||||
@@ -5,7 +5,10 @@ import re
|
|||||||
import base64
|
import base64
|
||||||
|
|
||||||
# external imports
|
# external imports
|
||||||
from hexathon import add_0x
|
from hexathon import (
|
||||||
|
add_0x,
|
||||||
|
strip_0x,
|
||||||
|
)
|
||||||
|
|
||||||
# local imports
|
# local imports
|
||||||
from cic_cache.cache import (
|
from cic_cache.cache import (
|
||||||
@@ -19,6 +22,7 @@ logg = logging.getLogger(__name__)
|
|||||||
re_transactions_all_bloom = r'/tx/(\d+)?/?(\d+)/?'
|
re_transactions_all_bloom = r'/tx/(\d+)?/?(\d+)/?'
|
||||||
re_transactions_account_bloom = r'/tx/user/((0x)?[a-fA-F0-9]+)(/(\d+)(/(\d+))?)?/?'
|
re_transactions_account_bloom = r'/tx/user/((0x)?[a-fA-F0-9]+)(/(\d+)(/(\d+))?)?/?'
|
||||||
re_transactions_all_data = r'/txa/(\d+)?/?(\d+)/?'
|
re_transactions_all_data = r'/txa/(\d+)?/?(\d+)/?'
|
||||||
|
re_transactions_account_data = r'/txa/user/((0x)?[a-fA-F0-9]+)(/(\d+)(/(\d+))?)?/?'
|
||||||
|
|
||||||
DEFAULT_LIMIT = 100
|
DEFAULT_LIMIT = 100
|
||||||
|
|
||||||
@@ -28,9 +32,7 @@ def process_transactions_account_bloom(session, env):
|
|||||||
if not r:
|
if not r:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
address = r[1]
|
address = strip_0x(r[1])
|
||||||
if r[2] == None:
|
|
||||||
address = add_0x(address)
|
|
||||||
offset = 0
|
offset = 0
|
||||||
if r.lastindex > 2:
|
if r.lastindex > 2:
|
||||||
offset = r[4]
|
offset = r[4]
|
||||||
@@ -113,3 +115,38 @@ def process_transactions_all_data(session, env):
|
|||||||
j = json.dumps(o)
|
j = json.dumps(o)
|
||||||
|
|
||||||
return ('application/json', j.encode('utf-8'),)
|
return ('application/json', j.encode('utf-8'),)
|
||||||
|
|
||||||
|
|
||||||
|
def process_transactions_account_data(session, env):
|
||||||
|
r = re.match(re_transactions_account_data, env.get('PATH_INFO'))
|
||||||
|
if not r:
|
||||||
|
return None
|
||||||
|
if env.get('HTTP_X_CIC_CACHE_MODE') != 'all':
|
||||||
|
return None
|
||||||
|
|
||||||
|
logg.debug('got data request {}'.format(env))
|
||||||
|
address = strip_0x(r[1])
|
||||||
|
#if r[2] == None:
|
||||||
|
# address = add_0x(address)
|
||||||
|
offset = 0
|
||||||
|
if r.lastindex > 2:
|
||||||
|
offset = r[4]
|
||||||
|
limit = DEFAULT_LIMIT
|
||||||
|
if r.lastindex > 4:
|
||||||
|
limit = r[6]
|
||||||
|
|
||||||
|
c = DataCache(session)
|
||||||
|
(lowest_block, highest_block, tx_cache) = c.load_transactions_account_with_data(address, offset, limit)
|
||||||
|
|
||||||
|
for r in tx_cache:
|
||||||
|
r['date_block'] = r['date_block'].timestamp()
|
||||||
|
|
||||||
|
o = {
|
||||||
|
'low': lowest_block,
|
||||||
|
'high': highest_block,
|
||||||
|
'data': tx_cache,
|
||||||
|
}
|
||||||
|
|
||||||
|
j = json.dumps(o)
|
||||||
|
|
||||||
|
return ('application/json', j.encode('utf-8'),)
|
||||||
|
|||||||
@@ -13,20 +13,18 @@ from cic_cache.db import dsn_from_config
|
|||||||
from cic_cache.db.models.base import SessionBase
|
from cic_cache.db.models.base import SessionBase
|
||||||
from cic_cache.runnable.daemons.query import (
|
from cic_cache.runnable.daemons.query import (
|
||||||
process_transactions_account_bloom,
|
process_transactions_account_bloom,
|
||||||
|
process_transactions_account_data,
|
||||||
process_transactions_all_bloom,
|
process_transactions_all_bloom,
|
||||||
process_transactions_all_data,
|
process_transactions_all_data,
|
||||||
)
|
)
|
||||||
|
import cic_cache.cli
|
||||||
|
|
||||||
logging.basicConfig(level=logging.WARNING)
|
logging.basicConfig(level=logging.WARNING)
|
||||||
logg = logging.getLogger()
|
logg = logging.getLogger()
|
||||||
|
|
||||||
rootdir = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
|
|
||||||
dbdir = os.path.join(rootdir, 'cic_cache', 'db')
|
|
||||||
migrationsdir = os.path.join(dbdir, 'migrations')
|
|
||||||
|
|
||||||
# process args
|
arg_flags = cic_cache.cli.argflag_std_read
|
||||||
arg_flags = cic_cache.cli.argflag_std_base
|
local_arg_flags = cic_cache.cli.argflag_local_sync | cic_cache.cli.argflag_local_task
|
||||||
local_arg_flags = cic_cache.cli.argflag_local_task
|
|
||||||
argparser = cic_cache.cli.ArgumentParser(arg_flags)
|
argparser = cic_cache.cli.ArgumentParser(arg_flags)
|
||||||
argparser.process_local_flags(local_arg_flags)
|
argparser.process_local_flags(local_arg_flags)
|
||||||
args = argparser.parse_args()
|
args = argparser.parse_args()
|
||||||
@@ -50,6 +48,7 @@ def application(env, start_response):
|
|||||||
process_transactions_all_data,
|
process_transactions_all_data,
|
||||||
process_transactions_all_bloom,
|
process_transactions_all_bloom,
|
||||||
process_transactions_account_bloom,
|
process_transactions_account_bloom,
|
||||||
|
process_transactions_account_data,
|
||||||
]:
|
]:
|
||||||
r = None
|
r = None
|
||||||
try:
|
try:
|
||||||
|
|||||||
@@ -1,3 +0,0 @@
|
|||||||
[celery]
|
|
||||||
broker_url = redis:///
|
|
||||||
result_url = redis:///
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
[cic]
|
|
||||||
registry_address =
|
|
||||||
trust_address =
|
|
||||||
0
apps/cic-cache/config/config.ini
Normal file
0
apps/cic-cache/config/config.ini
Normal file
@@ -1,9 +0,0 @@
|
|||||||
[database]
|
|
||||||
NAME=cic_cache
|
|
||||||
USER=postgres
|
|
||||||
PASSWORD=
|
|
||||||
HOST=localhost
|
|
||||||
PORT=5432
|
|
||||||
ENGINE=postgresql
|
|
||||||
DRIVER=psycopg2
|
|
||||||
DEBUG=0
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
[celery]
|
|
||||||
broker_url = redis://localhost:63379
|
|
||||||
result_url = redis://localhost:63379
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
[cic]
|
|
||||||
registry_address =
|
|
||||||
trust_address = 0xEb3907eCad74a0013c259D5874AE7f22DcBcC95C
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
[database]
|
|
||||||
NAME=cic_cache
|
|
||||||
USER=grassroots
|
|
||||||
PASSWORD=
|
|
||||||
HOST=localhost
|
|
||||||
PORT=63432
|
|
||||||
ENGINE=postgresql
|
|
||||||
DRIVER=psycopg2
|
|
||||||
DEBUG=0
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
[syncer]
|
|
||||||
loop_interval = 1
|
|
||||||
offset = 0
|
|
||||||
no_history = 0
|
|
||||||
@@ -18,11 +18,6 @@ COPY . .
|
|||||||
|
|
||||||
RUN python setup.py install
|
RUN python setup.py install
|
||||||
|
|
||||||
# ini files in config directory defines the configurable parameters for the application
|
|
||||||
# they can all be overridden by environment variables
|
|
||||||
# to generate a list of environment variables from configuration, use: confini-dump -z <dir> (executable provided by confini package)
|
|
||||||
#COPY config/ /usr/local/etc/cic-cache/
|
|
||||||
|
|
||||||
# for db migrations
|
# for db migrations
|
||||||
COPY ./aux/wait-for-it/wait-for-it.sh ./
|
COPY ./aux/wait-for-it/wait-for-it.sh ./
|
||||||
COPY cic_cache/db/migrations/ /usr/local/share/cic-cache/alembic/
|
COPY cic_cache/db/migrations/ /usr/local/share/cic-cache/alembic/
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ alembic==1.4.2
|
|||||||
confini>=0.3.6rc4,<0.5.0
|
confini>=0.3.6rc4,<0.5.0
|
||||||
uwsgi==2.0.19.1
|
uwsgi==2.0.19.1
|
||||||
moolb~=0.1.1b2
|
moolb~=0.1.1b2
|
||||||
cic-eth-registry~=0.6.1a1
|
cic-eth-registry~=0.6.1a5
|
||||||
SQLAlchemy==1.3.20
|
SQLAlchemy==1.3.20
|
||||||
semver==2.13.0
|
semver==2.13.0
|
||||||
psycopg2==2.8.6
|
psycopg2==2.8.6
|
||||||
@@ -12,3 +12,4 @@ chainsyncer[sql]>=0.0.6a3,<0.1.0
|
|||||||
erc20-faucet>=0.3.2a2, <0.4.0
|
erc20-faucet>=0.3.2a2, <0.4.0
|
||||||
chainlib-eth>=0.0.9a14,<0.1.0
|
chainlib-eth>=0.0.9a14,<0.1.0
|
||||||
eth-address-index>=0.2.3a4,<0.3.0
|
eth-address-index>=0.2.3a4,<0.3.0
|
||||||
|
okota>=0.2.4a6,<0.3.0
|
||||||
|
|||||||
@@ -1,14 +1,19 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python3
|
||||||
|
|
||||||
|
# standard imports
|
||||||
import os
|
import os
|
||||||
import argparse
|
import argparse
|
||||||
import logging
|
import logging
|
||||||
import re
|
import re
|
||||||
|
|
||||||
|
# external imports
|
||||||
import alembic
|
import alembic
|
||||||
from alembic.config import Config as AlembicConfig
|
from alembic.config import Config as AlembicConfig
|
||||||
import confini
|
import confini
|
||||||
|
|
||||||
|
# local imports
|
||||||
from cic_cache.db import dsn_from_config
|
from cic_cache.db import dsn_from_config
|
||||||
|
import cic_cache.cli
|
||||||
|
|
||||||
logging.basicConfig(level=logging.WARNING)
|
logging.basicConfig(level=logging.WARNING)
|
||||||
logg = logging.getLogger()
|
logg = logging.getLogger()
|
||||||
@@ -21,28 +26,25 @@ configdir = os.path.join(rootdir, 'cic_cache', 'data', 'config')
|
|||||||
|
|
||||||
#config_dir = os.path.join('/usr/local/etc/cic-cache')
|
#config_dir = os.path.join('/usr/local/etc/cic-cache')
|
||||||
|
|
||||||
argparser = argparse.ArgumentParser()
|
arg_flags = cic_cache.cli.argflag_std_base
|
||||||
argparser.add_argument('-c', type=str, help='config file')
|
local_arg_flags = cic_cache.cli.argflag_local_sync
|
||||||
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 = cic_cache.cli.ArgumentParser(arg_flags)
|
||||||
argparser.add_argument('--migrations-dir', dest='migrations_dir', default=migrationsdir, type=str, help='path to alembic migrations directory')
|
argparser.process_local_flags(local_arg_flags)
|
||||||
argparser.add_argument('--reset', action='store_true', help='downgrade before upgrading')
|
argparser.add_argument('--reset', action='store_true', help='downgrade before upgrading')
|
||||||
argparser.add_argument('-f', action='store_true', help='force action')
|
argparser.add_argument('-f', '--force', action='store_true', help='force action')
|
||||||
argparser.add_argument('-v', action='store_true', help='be verbose')
|
argparser.add_argument('--migrations-dir', dest='migrations_dir', type=str, help='migrations directory')
|
||||||
argparser.add_argument('-vv', action='store_true', help='be more verbose')
|
|
||||||
args = argparser.parse_args()
|
args = argparser.parse_args()
|
||||||
|
|
||||||
if args.vv:
|
extra_args = {
|
||||||
logging.getLogger().setLevel(logging.DEBUG)
|
'reset': None,
|
||||||
elif args.v:
|
'force': None,
|
||||||
logging.getLogger().setLevel(logging.INFO)
|
'migrations_dir': None,
|
||||||
|
}
|
||||||
|
|
||||||
config = confini.Config(configdir, args.env_prefix)
|
# process config
|
||||||
config.process()
|
config = cic_cache.cli.Config.from_args(args, arg_flags, local_arg_flags, extra_args=extra_args)
|
||||||
config.censor('PASSWORD', 'DATABASE')
|
|
||||||
config.censor('PASSWORD', 'SSL')
|
|
||||||
logg.debug('config:\n{}'.format(config))
|
|
||||||
|
|
||||||
migrations_dir = os.path.join(args.migrations_dir, config.get('DATABASE_ENGINE'))
|
migrations_dir = os.path.join(config.get('_MIGRATIONS_DIR'), config.get('DATABASE_ENGINE'))
|
||||||
if not os.path.isdir(migrations_dir):
|
if not os.path.isdir(migrations_dir):
|
||||||
logg.debug('migrations dir for engine {} not found, reverting to default'.format(config.get('DATABASE_ENGINE')))
|
logg.debug('migrations dir for engine {} not found, reverting to default'.format(config.get('DATABASE_ENGINE')))
|
||||||
migrations_dir = os.path.join(args.migrations_dir, 'default')
|
migrations_dir = os.path.join(args.migrations_dir, 'default')
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ def upgrade():
|
|||||||
op.create_table(
|
op.create_table(
|
||||||
'lock',
|
'lock',
|
||||||
sa.Column('id', sa.Integer, primary_key=True),
|
sa.Column('id', sa.Integer, primary_key=True),
|
||||||
sa.Column("address", sa.String, nullable=True),
|
sa.Column("address", sa.String(42), nullable=True),
|
||||||
sa.Column('blockchain', sa.String),
|
sa.Column('blockchain', sa.String),
|
||||||
sa.Column("flags", sa.BIGINT(), nullable=False, default=0),
|
sa.Column("flags", sa.BIGINT(), nullable=False, default=0),
|
||||||
sa.Column("date_created", sa.DateTime, nullable=False, default=datetime.datetime.utcnow),
|
sa.Column("date_created", sa.DateTime, nullable=False, default=datetime.datetime.utcnow),
|
||||||
|
|||||||
@@ -1,31 +0,0 @@
|
|||||||
"""Add gas cache
|
|
||||||
|
|
||||||
Revision ID: c91cafc3e0c1
|
|
||||||
Revises: aee12aeb47ec
|
|
||||||
Create Date: 2021-10-28 20:45:34.239865
|
|
||||||
|
|
||||||
"""
|
|
||||||
from alembic import op
|
|
||||||
import sqlalchemy as sa
|
|
||||||
|
|
||||||
|
|
||||||
# revision identifiers, used by Alembic.
|
|
||||||
revision = 'c91cafc3e0c1'
|
|
||||||
down_revision = 'aee12aeb47ec'
|
|
||||||
branch_labels = None
|
|
||||||
depends_on = None
|
|
||||||
|
|
||||||
|
|
||||||
def upgrade():
|
|
||||||
op.create_table(
|
|
||||||
'gas_cache',
|
|
||||||
sa.Column('id', sa.Integer, primary_key=True),
|
|
||||||
sa.Column("address", sa.String, nullable=False),
|
|
||||||
sa.Column("tx_hash", sa.String, nullable=True),
|
|
||||||
sa.Column("method", sa.String, nullable=True),
|
|
||||||
sa.Column("value", sa.BIGINT(), nullable=False),
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def downgrade():
|
|
||||||
op.drop_table('gas_cache')
|
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
# standard imports
|
|
||||||
import logging
|
|
||||||
|
|
||||||
# external imports
|
|
||||||
from sqlalchemy import Column, String, NUMERIC
|
|
||||||
|
|
||||||
# local imports
|
|
||||||
from .base import SessionBase
|
|
||||||
|
|
||||||
logg = logging.getLogger(__name__)
|
|
||||||
|
|
||||||
|
|
||||||
class GasCache(SessionBase):
|
|
||||||
"""Provides gas budget cache for token operations
|
|
||||||
"""
|
|
||||||
__tablename__ = 'gas_cache'
|
|
||||||
|
|
||||||
address = Column(String())
|
|
||||||
tx_hash = Column(String())
|
|
||||||
method = Column(String())
|
|
||||||
value = Column(NUMERIC())
|
|
||||||
|
|
||||||
def __init__(self, address, method, value, tx_hash):
|
|
||||||
self.address = address
|
|
||||||
self.tx_hash = tx_hash
|
|
||||||
self.method = method
|
|
||||||
self.value = value
|
|
||||||
@@ -12,7 +12,7 @@ from cic_eth.error import (
|
|||||||
IntegrityError,
|
IntegrityError,
|
||||||
)
|
)
|
||||||
|
|
||||||
logg = logging.getLogger(__name__)
|
logg = logging.getLogger()
|
||||||
|
|
||||||
|
|
||||||
class Nonce(SessionBase):
|
class Nonce(SessionBase):
|
||||||
@@ -21,7 +21,7 @@ class Nonce(SessionBase):
|
|||||||
__tablename__ = 'nonce'
|
__tablename__ = 'nonce'
|
||||||
|
|
||||||
nonce = Column(Integer)
|
nonce = Column(Integer)
|
||||||
address_hex = Column(String(40))
|
address_hex = Column(String(42))
|
||||||
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
|||||||
@@ -10,9 +10,6 @@ from chainlib.eth.tx import (
|
|||||||
TxFormat,
|
TxFormat,
|
||||||
unpack,
|
unpack,
|
||||||
)
|
)
|
||||||
from chainlib.eth.contract import (
|
|
||||||
ABIContractEncoder,
|
|
||||||
)
|
|
||||||
from cic_eth_registry import CICRegistry
|
from cic_eth_registry import CICRegistry
|
||||||
from cic_eth_registry.erc20 import ERC20Token
|
from cic_eth_registry.erc20 import ERC20Token
|
||||||
from hexathon import (
|
from hexathon import (
|
||||||
@@ -158,7 +155,7 @@ def transfer_from(self, tokens, holder_address, receiver_address, value, chain_s
|
|||||||
|
|
||||||
session = self.create_session()
|
session = self.create_session()
|
||||||
nonce_oracle = CustodialTaskNonceOracle(holder_address, self.request.root_id, session=session)
|
nonce_oracle = CustodialTaskNonceOracle(holder_address, self.request.root_id, session=session)
|
||||||
gas_oracle = self.create_gas_oracle(rpc, t['address'], MaxGasOracle.gas)
|
gas_oracle = self.create_gas_oracle(rpc, MaxGasOracle.gas)
|
||||||
c = ERC20(chain_spec, signer=rpc_signer, gas_oracle=gas_oracle, nonce_oracle=nonce_oracle)
|
c = ERC20(chain_spec, signer=rpc_signer, gas_oracle=gas_oracle, nonce_oracle=nonce_oracle)
|
||||||
try:
|
try:
|
||||||
(tx_hash_hex, tx_signed_raw_hex) = c.transfer_from(t['address'], spender_address, holder_address, receiver_address, value, tx_format=TxFormat.RLP_SIGNED)
|
(tx_hash_hex, tx_signed_raw_hex) = c.transfer_from(t['address'], spender_address, holder_address, receiver_address, value, tx_format=TxFormat.RLP_SIGNED)
|
||||||
@@ -229,11 +226,6 @@ def transfer(self, tokens, holder_address, receiver_address, value, chain_spec_d
|
|||||||
|
|
||||||
session = self.create_session()
|
session = self.create_session()
|
||||||
nonce_oracle = CustodialTaskNonceOracle(holder_address, self.request.root_id, session=session)
|
nonce_oracle = CustodialTaskNonceOracle(holder_address, self.request.root_id, session=session)
|
||||||
|
|
||||||
enc = ABIContractEncoder()
|
|
||||||
enc.method('transferFrom')
|
|
||||||
method = enc.get()
|
|
||||||
|
|
||||||
gas_oracle = self.create_gas_oracle(rpc, MaxGasOracle.gas)
|
gas_oracle = self.create_gas_oracle(rpc, MaxGasOracle.gas)
|
||||||
c = ERC20(chain_spec, signer=rpc_signer, gas_oracle=gas_oracle, nonce_oracle=nonce_oracle)
|
c = ERC20(chain_spec, signer=rpc_signer, gas_oracle=gas_oracle, nonce_oracle=nonce_oracle)
|
||||||
try:
|
try:
|
||||||
|
|||||||
@@ -41,7 +41,6 @@ from chainqueue.db.models.tx import TxCache
|
|||||||
from chainqueue.db.models.otx import Otx
|
from chainqueue.db.models.otx import Otx
|
||||||
|
|
||||||
# local imports
|
# local imports
|
||||||
from cic_eth.db.models.gas_cache import GasCache
|
|
||||||
from cic_eth.db.models.role import AccountRole
|
from cic_eth.db.models.role import AccountRole
|
||||||
from cic_eth.db.models.base import SessionBase
|
from cic_eth.db.models.base import SessionBase
|
||||||
from cic_eth.error import (
|
from cic_eth.error import (
|
||||||
@@ -71,33 +70,12 @@ celery_app = celery.current_app
|
|||||||
logg = logging.getLogger()
|
logg = logging.getLogger()
|
||||||
|
|
||||||
|
|
||||||
|
MAXIMUM_FEE_UNITS = 8000000
|
||||||
|
|
||||||
@celery_app.task(base=CriticalSQLAlchemyTask)
|
class MaxGasOracle:
|
||||||
def apply_gas_value_cache(address, method, value, tx_hash):
|
|
||||||
return apply_gas_value_cache_local(address, method, value, tx_hash)
|
|
||||||
|
|
||||||
|
def gas(code=None):
|
||||||
def apply_gas_value_cache_local(address, method, value, tx_hash, session=None):
|
return MAXIMUM_FEE_UNITS
|
||||||
address = tx_normalize.executable_address(address)
|
|
||||||
tx_hash = tx_normalize.tx_hash(tx_hash)
|
|
||||||
value = int(value)
|
|
||||||
|
|
||||||
session = SessionBase.bind_session(session)
|
|
||||||
q = session.query(GasCache)
|
|
||||||
q = q.filter(GasCache.address==address)
|
|
||||||
q = q.filter(GasCache.method==method)
|
|
||||||
o = q.first()
|
|
||||||
|
|
||||||
if o == None:
|
|
||||||
o = GasCache(address, method, value, tx_hash)
|
|
||||||
elif tx.gas_used > o.value:
|
|
||||||
o.value = value
|
|
||||||
o.tx_hash = strip_0x(tx_hash)
|
|
||||||
|
|
||||||
session.add(o)
|
|
||||||
session.commit()
|
|
||||||
|
|
||||||
SessionBase.release_session(session)
|
|
||||||
|
|
||||||
|
|
||||||
def create_check_gas_task(tx_signed_raws_hex, chain_spec, holder_address, gas=None, tx_hashes_hex=None, queue=None):
|
def create_check_gas_task(tx_signed_raws_hex, chain_spec, holder_address, gas=None, tx_hashes_hex=None, queue=None):
|
||||||
|
|||||||
@@ -1,63 +0,0 @@
|
|||||||
# standard imports
|
|
||||||
import logging
|
|
||||||
|
|
||||||
# external imports
|
|
||||||
from eth_erc20 import ERC20
|
|
||||||
from chainlib.eth.contract import (
|
|
||||||
ABIContractEncoder,
|
|
||||||
ABIContractType,
|
|
||||||
)
|
|
||||||
from chainlib.eth.constant import ZERO_ADDRESS
|
|
||||||
from chainlib.eth.address import is_same_address
|
|
||||||
from cic_eth_registry import CICRegistry
|
|
||||||
from cic_eth_registry.erc20 import ERC20Token
|
|
||||||
from eth_token_index import TokenUniqueSymbolIndex
|
|
||||||
import celery
|
|
||||||
|
|
||||||
# local imports
|
|
||||||
from .base import SyncFilter
|
|
||||||
|
|
||||||
#logg = logging.getLogger(__name__)
|
|
||||||
logg = logging.getLogger()
|
|
||||||
|
|
||||||
|
|
||||||
class TokenFilter(SyncFilter):
|
|
||||||
|
|
||||||
def __init__(self, chain_spec, queue, call_address=ZERO_ADDRESS):
|
|
||||||
self.queue = queue
|
|
||||||
self.chain_spec = chain_spec
|
|
||||||
self.caller_address = call_address
|
|
||||||
|
|
||||||
|
|
||||||
def filter(self, conn, block, tx, db_session=None):
|
|
||||||
if not tx.payload:
|
|
||||||
return (None, None)
|
|
||||||
|
|
||||||
try:
|
|
||||||
r = ERC20.parse_transfer_request(tx.payload)
|
|
||||||
except RequestMismatchException:
|
|
||||||
return (None, None)
|
|
||||||
|
|
||||||
token_address = tx.inputs[0]
|
|
||||||
token = ERC20Token(self.chain_spec, conn, token_address)
|
|
||||||
|
|
||||||
registry = CICRegistry(self.chain_spec, conn)
|
|
||||||
r = registry.by_name(token.symbol, sender_address=self.caller_address)
|
|
||||||
if is_same_address(r, ZERO_ADDRESS):
|
|
||||||
return None
|
|
||||||
|
|
||||||
enc = ABIContractEncoder()
|
|
||||||
enc.method('transfer')
|
|
||||||
method = enc.get()
|
|
||||||
|
|
||||||
s = celery.signature(
|
|
||||||
'cic_eth.eth.gas.apply_gas_value_cache',
|
|
||||||
[
|
|
||||||
token_address,
|
|
||||||
method,
|
|
||||||
tx.gas_used,
|
|
||||||
tx.hash,
|
|
||||||
],
|
|
||||||
queue=self.queue,
|
|
||||||
)
|
|
||||||
return s.apply_async()
|
|
||||||
@@ -10,6 +10,7 @@ from chainlib.chain import ChainSpec
|
|||||||
from chainlib.connection import RPCConnection
|
from chainlib.connection import RPCConnection
|
||||||
from chainlib.eth.constant import ZERO_ADDRESS
|
from chainlib.eth.constant import ZERO_ADDRESS
|
||||||
from chainlib.eth.nonce import RPCNonceOracle
|
from chainlib.eth.nonce import RPCNonceOracle
|
||||||
|
from chainlib.eth.gas import RPCGasOracle
|
||||||
from cic_eth_registry import CICRegistry
|
from cic_eth_registry import CICRegistry
|
||||||
from cic_eth_registry.error import UnknownContractError
|
from cic_eth_registry.error import UnknownContractError
|
||||||
|
|
||||||
@@ -29,7 +30,7 @@ class BaseTask(celery.Task):
|
|||||||
call_address = ZERO_ADDRESS
|
call_address = ZERO_ADDRESS
|
||||||
trusted_addresses = []
|
trusted_addresses = []
|
||||||
create_nonce_oracle = RPCNonceOracle
|
create_nonce_oracle = RPCNonceOracle
|
||||||
create_gas_oracle = CacheGasOracle
|
create_gas_oracle = RPCGasOracle
|
||||||
default_token_address = None
|
default_token_address = None
|
||||||
default_token_symbol = None
|
default_token_symbol = None
|
||||||
default_token_name = None
|
default_token_name = None
|
||||||
|
|||||||
@@ -1,96 +0,0 @@
|
|||||||
# external imports
|
|
||||||
from eth_erc20 import ERC20
|
|
||||||
from chainlib.connection import RPCConnection
|
|
||||||
from chainlib.eth.nonce import RPCNonceOracle
|
|
||||||
from chainlib.eth.gas import (
|
|
||||||
Gas,
|
|
||||||
OverrideGasOracle,
|
|
||||||
)
|
|
||||||
from chainlib.eth.tx import (
|
|
||||||
TxFormat,
|
|
||||||
receipt,
|
|
||||||
raw,
|
|
||||||
unpack,
|
|
||||||
Tx,
|
|
||||||
)
|
|
||||||
from chainlib.eth.block import (
|
|
||||||
Block,
|
|
||||||
block_latest,
|
|
||||||
block_by_number,
|
|
||||||
)
|
|
||||||
from chainlib.eth.contract import ABIContractEncoder
|
|
||||||
from hexathon import strip_0x
|
|
||||||
from eth_token_index import TokenUniqueSymbolIndex
|
|
||||||
|
|
||||||
# local imports
|
|
||||||
from cic_eth.runnable.daemons.filters.token import TokenFilter
|
|
||||||
from cic_eth.db.models.gas_cache import GasCache
|
|
||||||
from cic_eth.db.models.base import SessionBase
|
|
||||||
|
|
||||||
|
|
||||||
def test_filter_gas(
|
|
||||||
default_chain_spec,
|
|
||||||
init_database,
|
|
||||||
eth_rpc,
|
|
||||||
eth_signer,
|
|
||||||
contract_roles,
|
|
||||||
agent_roles,
|
|
||||||
token_roles,
|
|
||||||
foo_token,
|
|
||||||
token_registry,
|
|
||||||
register_lookups,
|
|
||||||
celery_worker,
|
|
||||||
cic_registry,
|
|
||||||
):
|
|
||||||
|
|
||||||
rpc = RPCConnection.connect(default_chain_spec, 'default')
|
|
||||||
nonce_oracle = RPCNonceOracle(token_roles['FOO_TOKEN_OWNER'], eth_rpc)
|
|
||||||
gas_oracle = OverrideGasOracle(price=1000000000, limit=1000000)
|
|
||||||
c = ERC20(default_chain_spec, signer=eth_signer, nonce_oracle=nonce_oracle, gas_oracle=gas_oracle)
|
|
||||||
(tx_hash_hex, tx_signed_raw_hex) = c.transfer(foo_token, token_roles['FOO_TOKEN_OWNER'], agent_roles['ALICE'], 100, tx_format=TxFormat.RLP_SIGNED)
|
|
||||||
o = raw(tx_signed_raw_hex)
|
|
||||||
eth_rpc.do(o)
|
|
||||||
o = receipt(tx_hash_hex)
|
|
||||||
rcpt = eth_rpc.do(o)
|
|
||||||
assert rcpt['status'] == 1
|
|
||||||
|
|
||||||
fltr = TokenFilter(default_chain_spec, queue=None, call_address=agent_roles['ALICE'])
|
|
||||||
|
|
||||||
o = block_latest()
|
|
||||||
r = eth_rpc.do(o)
|
|
||||||
o = block_by_number(r, include_tx=False)
|
|
||||||
r = eth_rpc.do(o)
|
|
||||||
block = Block(r)
|
|
||||||
block.txs = [tx_hash_hex]
|
|
||||||
|
|
||||||
tx_signed_raw_bytes = bytes.fromhex(strip_0x(tx_signed_raw_hex))
|
|
||||||
tx_src = unpack(tx_signed_raw_bytes, default_chain_spec)
|
|
||||||
tx = Tx(tx_src, block=block)
|
|
||||||
tx.apply_receipt(rcpt)
|
|
||||||
t = fltr.filter(eth_rpc, block, tx, db_session=init_database)
|
|
||||||
assert t == None
|
|
||||||
|
|
||||||
nonce_oracle = RPCNonceOracle(contract_roles['CONTRACT_DEPLOYER'], eth_rpc)
|
|
||||||
c = TokenUniqueSymbolIndex(default_chain_spec, signer=eth_signer, nonce_oracle=nonce_oracle)
|
|
||||||
(tx_hash_hex_register, o) = c.register(token_registry, contract_roles['CONTRACT_DEPLOYER'], foo_token)
|
|
||||||
eth_rpc.do(o)
|
|
||||||
o = receipt(tx_hash_hex)
|
|
||||||
r = eth_rpc.do(o)
|
|
||||||
assert r['status'] == 1
|
|
||||||
|
|
||||||
t = fltr.filter(eth_rpc, block, tx, db_session=init_database)
|
|
||||||
r = t.get_leaf()
|
|
||||||
assert t.successful()
|
|
||||||
|
|
||||||
q = init_database.query(GasCache)
|
|
||||||
q = q.filter(GasCache.tx_hash==strip_0x(tx_hash_hex))
|
|
||||||
o = q.first()
|
|
||||||
|
|
||||||
assert o.address == strip_0x(foo_token)
|
|
||||||
assert o.value > 0
|
|
||||||
|
|
||||||
enc = ABIContractEncoder()
|
|
||||||
enc.method('transfer')
|
|
||||||
method = enc.get()
|
|
||||||
|
|
||||||
assert o.method == method
|
|
||||||
@@ -193,6 +193,7 @@ async function processRequest(req, res) {
|
|||||||
res.end();
|
res.end();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
content = '';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'get:automerge:client':
|
case 'get:automerge:client':
|
||||||
@@ -251,7 +252,7 @@ async function processRequest(req, res) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (content === undefined) {
|
if (content === undefined) {
|
||||||
console.error('empty content', data);
|
console.error('empty content', mod, digest, data);
|
||||||
res.writeHead(404, {"Content-Type": "text/plain"});
|
res.writeHead(404, {"Content-Type": "text/plain"});
|
||||||
res.end();
|
res.end();
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -18,18 +18,6 @@ fi
|
|||||||
must_address "$CIC_REGISTRY_ADDRESS" "registry"
|
must_address "$CIC_REGISTRY_ADDRESS" "registry"
|
||||||
must_eth_rpc
|
must_eth_rpc
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
default_token=`eth-contract-registry-list -u -i $CHAIN_SPEC -p $RPC_PROVIDER -e $CIC_REGISTRY_ADDRESS $DEV_DEBUG_FLAG --raw DefaultToken`
|
|
||||||
h=`erc20-transfer -u -e $default_token -a $DEV_ETH_ACCOUNT_CONTRACT_DEPLOYER -y $WALLET_KEY_FILE -s 10`
|
|
||||||
r=`eth-receipt
|
|
||||||
|
|
||||||
set +e
|
|
||||||
set +a
|
|
||||||
|
|
||||||
exit 0
|
|
||||||
|
|
||||||
|
|
||||||
# get required addresses from registries
|
# get required addresses from registries
|
||||||
token_index_address=`eth-contract-registry-list -u -i $CHAIN_SPEC -p $RPC_PROVIDER -e $CIC_REGISTRY_ADDRESS $DEV_DEBUG_FLAG --raw TokenRegistry`
|
token_index_address=`eth-contract-registry-list -u -i $CHAIN_SPEC -p $RPC_PROVIDER -e $CIC_REGISTRY_ADDRESS $DEV_DEBUG_FLAG --raw TokenRegistry`
|
||||||
accounts_index_address=`eth-contract-registry-list -u -i $CHAIN_SPEC -p $RPC_PROVIDER -e $CIC_REGISTRY_ADDRESS $DEV_DEBUG_FLAG --raw AccountRegistry`
|
accounts_index_address=`eth-contract-registry-list -u -i $CHAIN_SPEC -p $RPC_PROVIDER -e $CIC_REGISTRY_ADDRESS $DEV_DEBUG_FLAG --raw AccountRegistry`
|
||||||
|
|||||||
@@ -68,7 +68,11 @@ admin_tests = [
|
|||||||
'local_key',
|
'local_key',
|
||||||
]
|
]
|
||||||
|
|
||||||
all_tests = eth_tests + custodial_tests + metadata_tests + phone_tests
|
cache_tests = [
|
||||||
|
'cache_tx_user',
|
||||||
|
]
|
||||||
|
|
||||||
|
all_tests = eth_tests + custodial_tests + metadata_tests + phone_tests + cache_tests
|
||||||
|
|
||||||
argparser = argparse.ArgumentParser(description='daemon that monitors transactions in new blocks')
|
argparser = argparse.ArgumentParser(description='daemon that monitors transactions in new blocks')
|
||||||
argparser.add_argument('-p', '--provider', dest='p', type=str, help='chain rpc provider address')
|
argparser.add_argument('-p', '--provider', dest='p', type=str, help='chain rpc provider address')
|
||||||
@@ -77,11 +81,14 @@ argparser.add_argument('--old-chain-spec', type=str, dest='old_chain_spec', defa
|
|||||||
argparser.add_argument('-i', '--chain-spec', type=str, dest='i', help='chain spec')
|
argparser.add_argument('-i', '--chain-spec', type=str, dest='i', help='chain spec')
|
||||||
argparser.add_argument('--meta-provider', type=str, dest='meta_provider', default='http://localhost:63380', help='cic-meta url')
|
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('--ussd-provider', type=str, dest='ussd_provider', default='http://localhost:63315', help='cic-ussd url')
|
||||||
|
argparser.add_argument('--cache-provider', type=str, dest='cache_provider', default='http://localhost:63313', help='cic-cache url')
|
||||||
argparser.add_argument('--skip-custodial', dest='skip_custodial', action='store_true', help='skip all custodial verifications')
|
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-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('--skip-metadata', dest='skip_metadata', action='store_true', help='skip all metadata verifications')
|
||||||
|
argparser.add_argument('--skip-cache', dest='skip_cache', action='store_true', help='skip all cache verifications')
|
||||||
argparser.add_argument('--exclude', action='append', type=str, default=[], help='skip specified verification')
|
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')
|
argparser.add_argument('--include', action='append', type=str, help='include specified verification')
|
||||||
|
argparser.add_argument('--list-verifications', action='store_true', help='print a list of verification check identifiers')
|
||||||
argparser.add_argument('--token-symbol', default='GFT', 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('-r', '--registry-address', type=str, dest='r', help='CIC Registry address')
|
argparser.add_argument('-r', '--registry-address', type=str, dest='r', help='CIC Registry address')
|
||||||
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('--env-prefix', default=os.environ.get('CONFINI_ENV_PREFIX'), dest='env_prefix', type=str, help='environment prefix for variables to overwrite configuration')
|
||||||
@@ -115,6 +122,7 @@ config.censor('PASSWORD', 'DATABASE')
|
|||||||
config.censor('PASSWORD', 'SSL')
|
config.censor('PASSWORD', 'SSL')
|
||||||
config.add(args.meta_provider, '_META_PROVIDER', True)
|
config.add(args.meta_provider, '_META_PROVIDER', True)
|
||||||
config.add(args.ussd_provider, '_USSD_PROVIDER', True)
|
config.add(args.ussd_provider, '_USSD_PROVIDER', True)
|
||||||
|
config.add(args.cache_provider, '_CACHE_PROVIDER', True)
|
||||||
|
|
||||||
token_symbol = args.token_symbol
|
token_symbol = args.token_symbol
|
||||||
|
|
||||||
@@ -351,6 +359,24 @@ class Verifier:
|
|||||||
raise VerifierError(o_retrieved, 'metadata (person)')
|
raise VerifierError(o_retrieved, 'metadata (person)')
|
||||||
|
|
||||||
|
|
||||||
|
def verify_cache_tx_user(self, address, balance=None):
|
||||||
|
url = os.path.join(config.get('_CACHE_PROVIDER'), 'txa', 'user', address)
|
||||||
|
req = urllib.request.Request(url)
|
||||||
|
req.add_header('X_CIC_CACHE_MODE', 'all')
|
||||||
|
try:
|
||||||
|
res = urllib.request.urlopen(req)
|
||||||
|
except urllib.error.HTTPError as e:
|
||||||
|
raise VerifierError(
|
||||||
|
'({}) {}'.format(url, e),
|
||||||
|
'cache (tx user)',
|
||||||
|
)
|
||||||
|
r = json.load(res)
|
||||||
|
if len(r['data']) == 0:
|
||||||
|
raise VerifierError('empty tx list for address {}'.format(address), 'cache (tx user)')
|
||||||
|
for tx in r['data']:
|
||||||
|
logg.warning('found tx {} for {} but not checking validity'.format(tx['tx_hash'], address))
|
||||||
|
|
||||||
|
|
||||||
def verify_metadata_phone(self, address, balance=None):
|
def verify_metadata_phone(self, address, balance=None):
|
||||||
upper_address = strip_0x(address).upper()
|
upper_address = strip_0x(address).upper()
|
||||||
f = open(os.path.join(
|
f = open(os.path.join(
|
||||||
@@ -397,11 +423,13 @@ class Verifier:
|
|||||||
if m != 'CON Welcome':
|
if m != 'CON Welcome':
|
||||||
raise VerifierError(response_data, 'ussd')
|
raise VerifierError(response_data, 'ussd')
|
||||||
|
|
||||||
|
|
||||||
def verify_ussd_pins(self, address, balance):
|
def verify_ussd_pins(self, address, balance):
|
||||||
response_data = send_ussd_request(address, self.data_dir)
|
response_data = send_ussd_request(address, self.data_dir)
|
||||||
if response_data[:11] != 'CON Balance' and response_data[:9] != 'CON Salio':
|
if response_data[:11] != 'CON Balance' and response_data[:9] != 'CON Salio':
|
||||||
raise VerifierError(response_data, 'pins')
|
raise VerifierError(response_data, 'pins')
|
||||||
|
|
||||||
|
|
||||||
def verify(self, address, balance, debug_stem=None):
|
def verify(self, address, balance, debug_stem=None):
|
||||||
|
|
||||||
for k in active_tests:
|
for k in active_tests:
|
||||||
|
|||||||
@@ -159,14 +159,6 @@ services:
|
|||||||
volumes:
|
volumes:
|
||||||
- signer-data:/run/crypto-dev-signer
|
- signer-data:/run/crypto-dev-signer
|
||||||
- contract-config:/tmp/cic/config/:ro
|
- contract-config:/tmp/cic/config/:ro
|
||||||
command:
|
|
||||||
- /bin/bash
|
|
||||||
- -c
|
|
||||||
- |
|
|
||||||
set -a
|
|
||||||
if [[ -f /tmp/cic/config/env_reset ]]; then source /tmp/cic/config/env_reset; fi
|
|
||||||
set +a
|
|
||||||
./start_tasker.sh --aux-all -q cic-eth -vv
|
|
||||||
|
|
||||||
|
|
||||||
cic-eth-tracker:
|
cic-eth-tracker:
|
||||||
|
|||||||
@@ -6,4 +6,7 @@ set -e
|
|||||||
TAG=${TAG?Variable not set} \
|
TAG=${TAG?Variable not set} \
|
||||||
docker-compose \
|
docker-compose \
|
||||||
-f docker-compose.yml \
|
-f docker-compose.yml \
|
||||||
build
|
build \
|
||||||
|
--no-cache \
|
||||||
|
--parallel \
|
||||||
|
--progress plain
|
||||||
|
|||||||
Reference in New Issue
Block a user