Add signer liveness check
This commit is contained in:
parent
e914569c8d
commit
2320a6b39b
@ -1,5 +1,6 @@
|
||||
from cic_eth.db.models.base import SessionBase
|
||||
|
||||
|
||||
def health(*args, **kwargs):
|
||||
session = SessionBase.create_session()
|
||||
session.execute('SELECT count(*) from alembic_version')
|
||||
|
26
apps/cic-eth/cic_eth/check/signer.py
Normal file
26
apps/cic-eth/cic_eth/check/signer.py
Normal file
@ -0,0 +1,26 @@
|
||||
# standard imports
|
||||
import logging
|
||||
from urllib.error import URLError
|
||||
|
||||
# external imports
|
||||
from chainlib.connection import RPCConnection
|
||||
from chainlib.eth.constant import ZERO_ADDRESS
|
||||
from chainlib.eth.sign import sign_message
|
||||
from chainlib.error import JSONRPCException
|
||||
|
||||
logg = logging.getLogger().getChild(__name__)
|
||||
|
||||
|
||||
def health(*args, **kwargs):
|
||||
conn = RPCConnection.connect(kwargs['config'].get('CIC_CHAIN_SPEC'), tag='signer')
|
||||
try:
|
||||
conn.do(sign_message(ZERO_ADDRESS, '0x2a'))
|
||||
except FileNotFoundError:
|
||||
return False
|
||||
except ConnectionError:
|
||||
return False
|
||||
except URLError:
|
||||
return False
|
||||
except JSONRPCException as e:
|
||||
pass
|
||||
return True
|
@ -140,14 +140,15 @@ else:
|
||||
|
||||
chain_spec = ChainSpec.from_chain_str(config.get('CIC_CHAIN_SPEC'))
|
||||
RPCConnection.register_location(config.get('ETH_PROVIDER'), chain_spec, 'default')
|
||||
RPCConnection.register_location(config.get('SIGNER_SOCKET_PATH'), chain_spec, 'signer', constructor=EthUnixSignerConnection)
|
||||
#RPCConnection.register_location(config.get('SIGNER_SOCKET_PATH'), chain_spec, 'signer', constructor=EthUnixSignerConnection)
|
||||
RPCConnection.register_location(config.get('SIGNER_SOCKET_PATH'), chain_spec, 'signer')
|
||||
|
||||
Otx.tracing = config.true('TASKS_TRACE_QUEUE_STATUS')
|
||||
|
||||
#import cic_eth.checks.gas
|
||||
#if not cic_eth.checks.gas.health(config=config):
|
||||
# raise RuntimeError()
|
||||
liveness.linux.load(health_modules, config=config)
|
||||
liveness.linux.load(health_modules, rundir=config.get('CIC_RUN_DIR'), config=config)
|
||||
|
||||
def main():
|
||||
argv = ['worker']
|
||||
|
@ -3,4 +3,5 @@ registry_address =
|
||||
chain_spec = evm:bloxberg:8996
|
||||
tx_retry_delay =
|
||||
trust_address =
|
||||
health_modules = cic_eth.check.db,cic_eth.check.gas
|
||||
health_modules = cic_eth.check.db,cic_eth.check.signer,cic_eth.check.gas
|
||||
run_dir = /run
|
||||
|
@ -3,3 +3,5 @@ registry_address =
|
||||
chain_spec = evm:bloxberg:8996
|
||||
trust_address = 0xEb3907eCad74a0013c259D5874AE7f22DcBcC95C
|
||||
tx_retry_delay = 20
|
||||
health_modules = cic_eth.check.db,cic_eth.check.signer,cic_eth.check.gas
|
||||
run_dir = /run
|
||||
|
@ -1,6 +1,6 @@
|
||||
cic-base==0.1.2a79+build.d412618d
|
||||
cic-base==0.1.2b1
|
||||
celery==4.4.7
|
||||
crypto-dev-signer~=0.4.14b2
|
||||
crypto-dev-signer~=0.4.14b3
|
||||
confini~=0.3.6rc3
|
||||
cic-eth-registry~=0.5.4a16
|
||||
#cic-bancor~=0.0.6
|
||||
|
Loading…
Reference in New Issue
Block a user