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
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