Merge remote-tracking branch 'origin/master' into lash/improve-cache

This commit is contained in:
nolash 2021-12-22 20:09:54 +00:00
commit 03b06ca8c1
9 changed files with 35 additions and 19 deletions

View File

@ -515,7 +515,7 @@ class Api(ApiBase):
:param password: Password to encode the password with in the backend (careful, you will have to remember it)
:type password: str
:param register: Register the new account in accounts index backend
:type password: bool
:type register: bool
:returns: uuid of root task
:rtype: celery.Task
"""

View File

@ -73,6 +73,7 @@ class Config(BaseConfig):
db,
)
celery_config_url = urllib.parse.urlsplit(config.get('CELERY_BROKER_URL'))
hostport = urlhostmerge(
celery_config_url[1],

View File

@ -397,6 +397,8 @@ def cache_transfer_data(
sender_address = tx_normalize.wallet_address(tx['from'])
recipient_address = tx_normalize.wallet_address(tx_data[0])
token_value = tx_data[1]
source_token_address = tx_normalize.executable_address(tx['to'])
destination_token_address = source_token_address
session = SessionBase.create_session()
@ -404,8 +406,8 @@ def cache_transfer_data(
'hash': tx_hash_hex,
'from': sender_address,
'to': recipient_address,
'source_token': tx['to'],
'destination_token': tx['to'],
'source_token': source_token_address,
'destination_token': destination_token_address,
'from_value': token_value,
'to_value': token_value,
}
@ -437,14 +439,16 @@ def cache_transfer_from_data(
spender_address = tx_data[0]
recipient_address = tx_data[1]
token_value = tx_data[2]
source_token_address = tx_normalize.executable_address(tx['to'])
destination_token_address = source_token_address
session = SessionBase.create_session()
tx_dict = {
'hash': tx_hash_hex,
'from': tx['from'],
'to': recipient_address,
'source_token': tx['to'],
'destination_token': tx['to'],
'source_token': source_token_address,
'destination_token': destination_token_address,
'from_value': token_value,
'to_value': token_value,
}
@ -476,14 +480,16 @@ def cache_approve_data(
sender_address = tx_normalize.wallet_address(tx['from'])
recipient_address = tx_normalize.wallet_address(tx_data[0])
token_value = tx_data[1]
source_token_address = tx_normalize.executable_address(tx['to'])
destination_token_address = source_token_address
session = SessionBase.create_session()
tx_dict = {
'hash': tx_hash_hex,
'from': sender_address,
'to': recipient_address,
'source_token': tx['to'],
'destination_token': tx['to'],
'source_token': source_token_address,
'destination_token': destination_token_address,
'from_value': token_value,
'to_value': token_value,
}

View File

@ -72,7 +72,7 @@ def __balance_incoming_compatible(token_address, receiver_address):
status_compare = dead()
q = q.filter(Otx.status.op('&')(status_compare)==0)
# TODO: this can change the result for the recipient if tx is later obsoleted and resubmission is delayed.
q = q.filter(Otx.status.op('&')(StatusBits.IN_NETWORK)==StatusBits.IN_NETWORK)
#q = q.filter(Otx.status.op('&')(StatusBits.IN_NETWORK)==StatusBits.IN_NETWORK)
q = q.filter(TxCache.destination_token_address==token_address)
delta = 0
for r in q.all():

View File

@ -1,6 +1,6 @@
celery==4.4.7
semver==2.13.0
chainlib-eth~=0.0.14
chainlib-eth~=0.0.15
urlybird~=0.0.1
cic-eth-registry~=0.6.5
cic-types~=0.2.1a8

View File

@ -41,8 +41,7 @@ def test_filter_gas(
token_registry,
register_lookups,
register_tokens,
#celery_session_worker,
celery_worker,
celery_session_worker,
cic_registry,
):

View File

@ -4,7 +4,7 @@ chainlib-eth~=0.0.15
eth-erc20~=0.1.5
erc20-demurrage-token~=0.0.7
eth-address-index~=0.2.4
cic-eth-registry~=0.6.4
cic-eth-registry~=0.6.5
erc20-faucet==0.3.2
sarafu-faucet==0.0.7
confini~=0.5.3

View File

@ -1,16 +1,25 @@
# syntax = docker/dockerfile:1.2
FROM registry.gitlab.com/grassrootseconomics/cic-base-images:python-3.8.6-dev-5ab8bf45
ARG DOCKER_REGISTRY="registry.gitlab.com/grassrootseconomics"
FROM $DOCKER_REGISTRY/cic-base-images:python-3.8.6-dev-e8eb2ee2
WORKDIR /root
RUN mkdir -vp /usr/local/etc/cic
COPY package.json \
package-lock.json \
./
ARG NPM_REPOSITORY=${NPM_REPOSITORY:-https://registry.npmjs.org}
RUN npm config set snyk=false
#RUN npm config set registry={NPM_REPOSITORY}
RUN npm config set registry=${NPM_REPOSITORY}
# copy the dependencies
COPY package.json package-lock.json ./
RUN --mount=type=cache,mode=0755,target=/root/.npm \
npm set cache /root/.npm && \
npm cache verify && \
npm ci --verbose
RUN npm ci --production
#RUN npm ci --production --verbose
#RUN --mount=type=cache,mode=0755,target=/root/node_modules npm install
COPY common/ cic_ussd/common/
@ -22,6 +31,7 @@ ARG EXTRA_PIP_ARGS=""
ARG PIP_INDEX_URL=https://pypi.org/simple
RUN pip install --index-url $PIP_INDEX_URL \
--pre \
--extra-index-url $EXTRA_PIP_INDEX_URL $EXTRA_PIP_ARGS \
-r requirements.txt

View File

@ -4,7 +4,7 @@ cic-types~=0.2.1a8
funga>=0.5.1
faker==4.17.1
chainsyncer~=0.0.7a3
chainlib-eth~=0.0.14
chainlib-eth~=0.0.15
eth-address-index~=0.2.4a1
eth-contract-registry~=0.6.3a3
eth-accounts-index~=0.1.2a3