Move signer from middleware to dedicated connection

This commit is contained in:
nolash 2021-03-12 09:36:57 +01:00
parent 10835979bc
commit 958bd9af96
Signed by untrusted user who does not match committer: lash
GPG Key ID: 21D2E7BB88C2A746
11 changed files with 24 additions and 17 deletions

View File

@ -2,10 +2,15 @@
import logging
# external imports
import sha3
import celery
from cic_registry.chain import ChainSpec
from chainlib.eth.sign import sign_transaction
from chainlib.eth.connection import RPCConnection
from hexathon import (
strip_0x,
add_0x,
)
# local imports
from cic_eth.eth import RpcClient
@ -40,10 +45,10 @@ def sign_tx(tx, chain_str):
raise SignerError('sign tx {}: {}'.format(tx, e))
logg.debug('tx_transfer_signed {}'.format(tx_transfer_signed))
h = sha3.keccak_256()
h.update(tx_transfer_signed['raw'])
g = h.digest()
h.update(bytes.fromhex(strip_0x(tx_transfer_signed['raw'])))
tx_hash = h.digest()
#tx_hash = c.w3.keccak(hexstr=tx_transfer_signed['raw'])
tx_hash_hex = tx_hash.hex()
tx_hash_hex = add_0x(tx_hash.hex())
return (tx_hash_hex, tx_transfer_signed['raw'],)

View File

@ -410,7 +410,8 @@ def send(self, txs, chain_str):
queue=queue,
)
try:
r = c.w3.eth.send_raw_transaction(tx_hex)
#r = c.w3.eth.send_raw_transaction(tx_hex)
r = c.w3.eth.sendRawTransaction(tx_hex)
except requests.exceptions.ConnectionError as e:
raise(e)
except Exception as e:

View File

@ -10,7 +10,7 @@ version = (
0,
10,
0,
'alpha.41',
'alpha.46',
)
version_object = semver.VersionInfo(

View File

@ -1,4 +1,4 @@
[signer]
secret = deadbeef
#database = crypto-dev-signer
socket_path = /run/crypto-dev-signer/jsonrpc.ipc
socket_path = ipc:///run/crypto-dev-signer/jsonrpc.ipc

View File

@ -6,7 +6,7 @@ set -e
# set CONFINI_ENV_PREFIX to override the env prefix to override env vars
echo "!!! starting signer"
python /usr/local/bin/crypto-dev-daemon -c /usr/local/etc/crypto-dev-signer &
python /usr/local/bin/crypto-dev-daemon -c /usr/local/etc/crypto-dev-signer -vv 2> /tmp/signer.log &
echo "!!! starting tracker"
/usr/local/bin/cic-eth-taskerd $@

View File

@ -1,7 +1,7 @@
cic-base~=0.1.1a24
cic-base~=0.1.1a30
web3==5.12.2
celery==4.4.7
crypto-dev-signer~=0.4.13rc4
crypto-dev-signer~=0.4.13rc6
confini~=0.3.6rc3
cic-registry~=0.5.3a22
cic-bancor~=0.0.6
@ -19,6 +19,7 @@ eth-gas-proxy==0.0.1a4
websocket-client==0.57.0
moolb~=0.1.1b2
eth-address-index~=0.1.0a8
chainlib~=0.0.1a21
chainlib~=0.0.1a25
hexathon~=0.0.1a3
chainsyncer~=0.0.1a19
pysha3==1.0.2

View File

@ -107,7 +107,7 @@ RUN cd cic-bancor/python && \
RUN apt-get install -y cargo
ARG cic_base_version=0.1.1a24
ARG cic_base_version=0.1.1a30
RUN pip install --extra-index-url $pip_extra_index_url cic-base[full_graph]==$cic_base_version
ARG cic_registry_version=0.5.3a24

View File

@ -1,3 +1,3 @@
cic-base[full_graph]==0.1.1a25
cic-eth==0.10.0a42
cic-base[full_graph]==0.1.1a28
cic-eth==0.10.0a46
cic-types==0.1.0a8

View File

@ -31,7 +31,7 @@ set -e
set -a
# We need to not install these here...
pip install --extra-index-url $DEV_PIP_EXTRA_INDEX_URL cic-eth==0.10.0a41 chainlib==0.0.1a21 cic-contracts==0.0.2a2
pip install --extra-index-url $DEV_PIP_EXTRA_INDEX_URL cic-eth==0.10.0a46 chainlib==0.0.1a25 cic-contracts==0.0.2a2
>&2 echo "create account for gas gifter"
old_gas_provider=$DEV_ETH_ACCOUNT_GAS_PROVIDER

View File

@ -3,7 +3,7 @@ alembic==1.4.2
bcrypt==3.2.0
celery==4.4.7
confini==0.3.6rc3
crypto-dev-signer==0.4.13rc4
crypto-dev-signer==0.4.13rc6
cryptography==3.2.1
ecuth==0.4.5a1
eth-accounts-index==0.0.10a10
@ -42,6 +42,6 @@ rlp==2.0.1
cryptocurrency-cli-tools==0.0.4
giftable-erc20-token==0.0.7b12
hexathon==0.0.1a3
chainlib==0.0.1a21
chainlib==0.0.1a25
chainsyncer==0.0.1a19
cic-registry==0.5.3.a22

View File

@ -219,7 +219,7 @@ services:
BANCOR_DIR: ${BANCOR_DIR:-/usr/local/share/cic/bancor}
CELERY_BROKER_URL: ${CELERY_BROKER_URL:-redis://redis}
CELERY_RESULT_URL: ${CELERY_RESULT_URL:-redis://redis}
SIGNER_SOCKET_PATH: ${SIGNER_SOCKET_PATH:-/tmp/cic/signer/jsonrpc.ipc}
SIGNER_SOCKET_PATH: ${SIGNER_SOCKET_PATH:-ipc:///tmp/cic/signer/jsonrpc.ipc}
SIGNER_SECRET: ${SIGNER_SECRET:-deadbeef}
ETH_ACCOUNT_ACCOUNTS_INDEX_WRITER: ${DEV_ETH_ACCOUNT_ACCOUNTS_INDEX_WRITER:-0xACB0BC74E1686D62dE7DC6414C999EA60C09F0eA}
TASKS_TRACE_QUEUE_STATUS: ${TASKS_TRACE_QUEUE_STATUS:-1}