Compare commits
9 Commits
lash/right
...
lash/versi
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f4bbd22f54
|
||
|
|
b99b5bd4fa | ||
|
|
8f33ce40e1
|
||
|
|
3a63d0505f
|
||
|
|
334c63b1e6
|
||
|
|
b123e050c3
|
||
|
|
e27d5d8b33
|
||
|
|
cc35c498c8
|
||
|
|
dea7bc8a1c
|
@@ -60,29 +60,6 @@ class AdminApi:
|
|||||||
self.call_address = call_address
|
self.call_address = call_address
|
||||||
|
|
||||||
|
|
||||||
def proxy_do(self, chain_spec, o):
|
|
||||||
s_proxy = celery.signature(
|
|
||||||
'cic_eth.task.rpc_proxy',
|
|
||||||
[
|
|
||||||
chain_spec.asdict(),
|
|
||||||
o,
|
|
||||||
'default',
|
|
||||||
],
|
|
||||||
queue=self.queue
|
|
||||||
)
|
|
||||||
return s_proxy.apply_async()
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def registry(self):
|
|
||||||
s_registry = celery.signature(
|
|
||||||
'cic_eth.task.registry',
|
|
||||||
[],
|
|
||||||
queue=self.queue
|
|
||||||
)
|
|
||||||
return s_registry.apply_async()
|
|
||||||
|
|
||||||
|
|
||||||
def unlock(self, chain_spec, address, flags=None):
|
def unlock(self, chain_spec, address, flags=None):
|
||||||
s_unlock = celery.signature(
|
s_unlock = celery.signature(
|
||||||
'cic_eth.admin.ctrl.unlock',
|
'cic_eth.admin.ctrl.unlock',
|
||||||
@@ -169,6 +146,7 @@ class AdminApi:
|
|||||||
|
|
||||||
# TODO: This check should most likely be in resend task itself
|
# TODO: This check should most likely be in resend task itself
|
||||||
tx_dict = s_get_tx_cache.apply_async().get()
|
tx_dict = s_get_tx_cache.apply_async().get()
|
||||||
|
#if tx_dict['status'] in [StatusEnum.REVERTED, StatusEnum.SUCCESS, StatusEnum.CANCELLED, StatusEnum.OBSOLETED]:
|
||||||
if not is_alive(getattr(StatusEnum, tx_dict['status']).value):
|
if not is_alive(getattr(StatusEnum, tx_dict['status']).value):
|
||||||
raise TxStateChangeError('Cannot resend mined or obsoleted transaction'.format(txold_hash_hex))
|
raise TxStateChangeError('Cannot resend mined or obsoleted transaction'.format(txold_hash_hex))
|
||||||
|
|
||||||
@@ -248,6 +226,9 @@ class AdminApi:
|
|||||||
break
|
break
|
||||||
last_nonce = nonce_otx
|
last_nonce = nonce_otx
|
||||||
|
|
||||||
|
#nonce_cache = Nonce.get(address)
|
||||||
|
#nonce_w3 = self.w3.eth.getTransactionCount(address, 'pending')
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'nonce': {
|
'nonce': {
|
||||||
#'network': nonce_cache,
|
#'network': nonce_cache,
|
||||||
@@ -291,6 +272,20 @@ class AdminApi:
|
|||||||
return s_nonce.apply_async()
|
return s_nonce.apply_async()
|
||||||
|
|
||||||
|
|
||||||
|
# # TODO: this is a stub, complete all checks
|
||||||
|
# def ready(self):
|
||||||
|
# """Checks whether all required initializations have been performed.
|
||||||
|
#
|
||||||
|
# :raises cic_eth.error.InitializationError: At least one setting pre-requisite has not been met.
|
||||||
|
# :raises KeyError: An address provided for initialization is not known by the keystore.
|
||||||
|
# """
|
||||||
|
# addr = AccountRole.get_address('ETH_GAS_PROVIDER_ADDRESS')
|
||||||
|
# if addr == ZERO_ADDRESS:
|
||||||
|
# raise InitializationError('missing account ETH_GAS_PROVIDER_ADDRESS')
|
||||||
|
#
|
||||||
|
# self.w3.eth.sign(addr, text='666f6f')
|
||||||
|
|
||||||
|
|
||||||
def account(self, chain_spec, address, include_sender=True, include_recipient=True, renderer=None, w=sys.stdout):
|
def account(self, chain_spec, address, include_sender=True, include_recipient=True, renderer=None, w=sys.stdout):
|
||||||
"""Lists locally originated transactions for the given Ethereum address.
|
"""Lists locally originated transactions for the given Ethereum address.
|
||||||
|
|
||||||
@@ -353,7 +348,6 @@ class AdminApi:
|
|||||||
|
|
||||||
|
|
||||||
# TODO: Add exception upon non-existent tx aswell as invalid tx data to docstring
|
# TODO: Add exception upon non-existent tx aswell as invalid tx data to docstring
|
||||||
# TODO: This method is WAY too long
|
|
||||||
def tx(self, chain_spec, tx_hash=None, tx_raw=None, registry=None, renderer=None, w=sys.stdout):
|
def tx(self, chain_spec, tx_hash=None, tx_raw=None, registry=None, renderer=None, w=sys.stdout):
|
||||||
"""Output local and network details about a given transaction with local origin.
|
"""Output local and network details about a given transaction with local origin.
|
||||||
|
|
||||||
@@ -376,6 +370,7 @@ class AdminApi:
|
|||||||
|
|
||||||
if tx_raw != None:
|
if tx_raw != None:
|
||||||
tx_hash = add_0x(keccak256_hex_to_hex(tx_raw))
|
tx_hash = add_0x(keccak256_hex_to_hex(tx_raw))
|
||||||
|
#tx_hash = self.w3.keccak(hexstr=tx_raw).hex()
|
||||||
|
|
||||||
s = celery.signature(
|
s = celery.signature(
|
||||||
'cic_eth.queue.query.get_tx_cache',
|
'cic_eth.queue.query.get_tx_cache',
|
||||||
@@ -391,78 +386,38 @@ class AdminApi:
|
|||||||
|
|
||||||
source_token = None
|
source_token = None
|
||||||
if tx['source_token'] != ZERO_ADDRESS:
|
if tx['source_token'] != ZERO_ADDRESS:
|
||||||
if registry != None:
|
try:
|
||||||
try:
|
source_token = registry.by_address(tx['source_token'])
|
||||||
source_token = registry.by_address(tx['source_token'])
|
#source_token = CICRegistry.get_address(chain_spec, tx['source_token']).contract
|
||||||
except UnknownContractError:
|
except UnknownContractError:
|
||||||
logg.warning('unknown source token contract {} (direct)'.format(tx['source_token']))
|
#source_token_contract = self.w3.eth.contract(abi=CICRegistry.abi('ERC20'), address=tx['source_token'])
|
||||||
else:
|
#source_token = CICRegistry.add_token(chain_spec, source_token_contract)
|
||||||
s = celery.signature(
|
logg.warning('unknown source token contract {}'.format(tx['source_token']))
|
||||||
'cic_eth.task.registry_address_lookup',
|
|
||||||
[
|
|
||||||
chain_spec.asdict(),
|
|
||||||
tx['source_token'],
|
|
||||||
],
|
|
||||||
queue=self.queue
|
|
||||||
)
|
|
||||||
t = s.apply_async()
|
|
||||||
source_token = t.get()
|
|
||||||
if source_token == None:
|
|
||||||
logg.warning('unknown source token contract {} (task pool)'.format(tx['source_token']))
|
|
||||||
|
|
||||||
|
|
||||||
destination_token = None
|
destination_token = None
|
||||||
if tx['destination_token'] != ZERO_ADDRESS:
|
if tx['source_token'] != ZERO_ADDRESS:
|
||||||
if registry != None:
|
try:
|
||||||
try:
|
#destination_token = CICRegistry.get_address(chain_spec, tx['destination_token'])
|
||||||
destination_token = registry.by_address(tx['destination_token'])
|
destination_token = registry.by_address(tx['destination_token'])
|
||||||
except UnknownContractError:
|
except UnknownContractError:
|
||||||
logg.warning('unknown destination token contract {}'.format(tx['destination_token']))
|
#destination_token_contract = self.w3.eth.contract(abi=CICRegistry.abi('ERC20'), address=tx['source_token'])
|
||||||
else:
|
#destination_token = CICRegistry.add_token(chain_spec, destination_token_contract)
|
||||||
s = celery.signature(
|
logg.warning('unknown destination token contract {}'.format(tx['destination_token']))
|
||||||
'cic_eth.task.registry_address_lookup',
|
|
||||||
[
|
|
||||||
chain_spec.asdict(),
|
|
||||||
tx['destination_token'],
|
|
||||||
],
|
|
||||||
queue=self.queue
|
|
||||||
)
|
|
||||||
t = s.apply_async()
|
|
||||||
destination_token = t.get()
|
|
||||||
if destination_token == None:
|
|
||||||
logg.warning('unknown destination token contract {} (task pool)'.format(tx['destination_token']))
|
|
||||||
|
|
||||||
|
|
||||||
tx['sender_description'] = 'Custodial account'
|
tx['sender_description'] = 'Custodial account'
|
||||||
tx['recipient_description'] = 'Custodial account'
|
tx['recipient_description'] = 'Custodial account'
|
||||||
|
|
||||||
o = code(tx['sender'])
|
o = code(tx['sender'])
|
||||||
t = self.proxy_do(chain_spec, o)
|
r = self.rpc.do(o)
|
||||||
r = t.get()
|
|
||||||
if len(strip_0x(r, allow_empty=True)) > 0:
|
if len(strip_0x(r, allow_empty=True)) > 0:
|
||||||
if registry != None:
|
try:
|
||||||
try:
|
#sender_contract = CICRegistry.get_address(chain_spec, tx['sender'])
|
||||||
sender_contract = registry.by_address(tx['sender'], sender_address=self.call_address)
|
sender_contract = registry.by_address(tx['sender'], sender_address=self.call_address)
|
||||||
tx['sender_description'] = 'Contract at {}'.format(tx['sender'])
|
tx['sender_description'] = 'Contract at {}'.format(tx['sender']) #sender_contract)
|
||||||
except UnknownContractError:
|
except UnknownContractError:
|
||||||
tx['sender_description'] = 'Unknown contract'
|
tx['sender_description'] = 'Unknown contract'
|
||||||
except KeyError as e:
|
except KeyError as e:
|
||||||
tx['sender_description'] = 'Unknown contract'
|
tx['sender_description'] = 'Unknown contract'
|
||||||
else:
|
|
||||||
s = celery.signature(
|
|
||||||
'cic_eth.task.registry_address_lookup',
|
|
||||||
[
|
|
||||||
chain_spec.asdict(),
|
|
||||||
tx['sender'],
|
|
||||||
],
|
|
||||||
queue=self.queue
|
|
||||||
)
|
|
||||||
t = s.apply_async()
|
|
||||||
tx['sender_description'] = t.get()
|
|
||||||
if tx['sender_description'] == None:
|
|
||||||
tx['sender_description'] = 'Unknown contract'
|
|
||||||
|
|
||||||
|
|
||||||
else:
|
else:
|
||||||
s = celery.signature(
|
s = celery.signature(
|
||||||
'cic_eth.eth.account.have',
|
'cic_eth.eth.account.have',
|
||||||
@@ -491,31 +446,16 @@ class AdminApi:
|
|||||||
tx['sender_description'] = role
|
tx['sender_description'] = role
|
||||||
|
|
||||||
o = code(tx['recipient'])
|
o = code(tx['recipient'])
|
||||||
t = self.proxy_do(chain_spec, o)
|
r = self.rpc.do(o)
|
||||||
r = t.get()
|
|
||||||
if len(strip_0x(r, allow_empty=True)) > 0:
|
if len(strip_0x(r, allow_empty=True)) > 0:
|
||||||
if registry != None:
|
try:
|
||||||
try:
|
#recipient_contract = CICRegistry.by_address(tx['recipient'])
|
||||||
recipient_contract = registry.by_address(tx['recipient'])
|
recipient_contract = registry.by_address(tx['recipient'])
|
||||||
tx['recipient_description'] = 'Contract at {}'.format(tx['recipient'])
|
tx['recipient_description'] = 'Contract at {}'.format(tx['recipient']) #recipient_contract)
|
||||||
except UnknownContractError as e:
|
except UnknownContractError as e:
|
||||||
tx['recipient_description'] = 'Unknown contract'
|
tx['recipient_description'] = 'Unknown contract'
|
||||||
except KeyError as e:
|
except KeyError as e:
|
||||||
tx['recipient_description'] = 'Unknown contract'
|
tx['recipient_description'] = 'Unknown contract'
|
||||||
else:
|
|
||||||
s = celery.signature(
|
|
||||||
'cic_eth.task.registry_address_lookup',
|
|
||||||
[
|
|
||||||
chain_spec.asdict(),
|
|
||||||
tx['recipient'],
|
|
||||||
],
|
|
||||||
queue=self.queue
|
|
||||||
)
|
|
||||||
t = s.apply_async()
|
|
||||||
tx['recipient_description'] = t.get()
|
|
||||||
if tx['recipient_description'] == None:
|
|
||||||
tx['recipient_description'] = 'Unknown contract'
|
|
||||||
|
|
||||||
else:
|
else:
|
||||||
s = celery.signature(
|
s = celery.signature(
|
||||||
'cic_eth.eth.account.have',
|
'cic_eth.eth.account.have',
|
||||||
@@ -557,8 +497,7 @@ class AdminApi:
|
|||||||
r = None
|
r = None
|
||||||
try:
|
try:
|
||||||
o = transaction(tx_hash)
|
o = transaction(tx_hash)
|
||||||
t = self.proxy_do(chain_spec, o)
|
r = self.rpc.do(o)
|
||||||
r = t.get()
|
|
||||||
if r != None:
|
if r != None:
|
||||||
tx['network_status'] = 'Mempool'
|
tx['network_status'] = 'Mempool'
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
@@ -567,8 +506,7 @@ class AdminApi:
|
|||||||
if r != None:
|
if r != None:
|
||||||
try:
|
try:
|
||||||
o = receipt(tx_hash)
|
o = receipt(tx_hash)
|
||||||
t = self.proxy_do(chain_spec, o)
|
r = self.rpc.do(o)
|
||||||
r = t.get()
|
|
||||||
logg.debug('h {} o {}'.format(tx_hash, o))
|
logg.debug('h {} o {}'.format(tx_hash, o))
|
||||||
if int(strip_0x(r['status'])) == 1:
|
if int(strip_0x(r['status'])) == 1:
|
||||||
tx['network_status'] = 'Confirmed'
|
tx['network_status'] = 'Confirmed'
|
||||||
@@ -583,13 +521,11 @@ class AdminApi:
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
o = balance(tx['sender'])
|
o = balance(tx['sender'])
|
||||||
t = self.proxy_do(chain_spec, o)
|
r = self.rpc.do(o)
|
||||||
r = t.get()
|
|
||||||
tx['sender_gas_balance'] = r
|
tx['sender_gas_balance'] = r
|
||||||
|
|
||||||
o = balance(tx['recipient'])
|
o = balance(tx['recipient'])
|
||||||
t = self.proxy_do(chain_spec, o)
|
r = self.rpc.do(o)
|
||||||
r = t.get()
|
|
||||||
tx['recipient_gas_balance'] = r
|
tx['recipient_gas_balance'] = r
|
||||||
|
|
||||||
tx_unpacked = unpack(bytes.fromhex(strip_0x(tx['signed_tx'])), chain_spec)
|
tx_unpacked = unpack(bytes.fromhex(strip_0x(tx['signed_tx'])), chain_spec)
|
||||||
|
|||||||
@@ -114,7 +114,7 @@ def list_tx_by_bloom(self, bloomspec, address, chain_spec_dict):
|
|||||||
|
|
||||||
# TODO: pass through registry to validate declarator entry of token
|
# TODO: pass through registry to validate declarator entry of token
|
||||||
#token = registry.by_address(tx['to'], sender_address=self.call_address)
|
#token = registry.by_address(tx['to'], sender_address=self.call_address)
|
||||||
token = ERC20Token(chain_spec, rpc, tx['to'])
|
token = ERC20Token(rpc, tx['to'])
|
||||||
token_symbol = token.symbol
|
token_symbol = token.symbol
|
||||||
token_decimals = token.decimals
|
token_decimals = token.decimals
|
||||||
times = tx_times(tx['hash'], chain_spec)
|
times = tx_times(tx['hash'], chain_spec)
|
||||||
|
|||||||
@@ -12,7 +12,6 @@ from chainqueue.error import NotLocalTxError
|
|||||||
|
|
||||||
# local imports
|
# local imports
|
||||||
from cic_eth.task import CriticalSQLAlchemyAndWeb3Task
|
from cic_eth.task import CriticalSQLAlchemyAndWeb3Task
|
||||||
from cic_eth.db.models.base import SessionBase
|
|
||||||
|
|
||||||
celery_app = celery.current_app
|
celery_app = celery.current_app
|
||||||
|
|
||||||
|
|||||||
@@ -29,5 +29,5 @@ def connect(rpc, chain_spec, registry_address):
|
|||||||
CICRegistry.address = registry_address
|
CICRegistry.address = registry_address
|
||||||
registry = CICRegistry(chain_spec, rpc)
|
registry = CICRegistry(chain_spec, rpc)
|
||||||
registry_address = registry.by_name('ContractRegistry')
|
registry_address = registry.by_name('ContractRegistry')
|
||||||
|
|
||||||
return registry
|
return registry
|
||||||
|
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ default_config_dir = os.environ.get('CONFINI_DIR', '/usr/local/etc/cic')
|
|||||||
|
|
||||||
argparser = argparse.ArgumentParser()
|
argparser = argparse.ArgumentParser()
|
||||||
argparser.add_argument('-p', '--provider', dest='p', default='http://localhost:8545', type=str, help='Web3 provider url (http only)')
|
argparser.add_argument('-p', '--provider', dest='p', default='http://localhost:8545', type=str, help='Web3 provider url (http only)')
|
||||||
|
argparser.add_argument('-r', '--registry-address', type=str, help='CIC registry address')
|
||||||
argparser.add_argument('-f', '--format', dest='f', default=default_format, type=str, help='Output format')
|
argparser.add_argument('-f', '--format', dest='f', default=default_format, type=str, help='Output format')
|
||||||
argparser.add_argument('-c', type=str, default=default_config_dir, help='config root to use')
|
argparser.add_argument('-c', type=str, default=default_config_dir, help='config root to use')
|
||||||
argparser.add_argument('-i', '--chain-spec', dest='i', type=str, help='chain spec')
|
argparser.add_argument('-i', '--chain-spec', dest='i', type=str, help='chain spec')
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ from cic_eth.eth import (
|
|||||||
from cic_eth.admin import (
|
from cic_eth.admin import (
|
||||||
debug,
|
debug,
|
||||||
ctrl,
|
ctrl,
|
||||||
|
token,
|
||||||
)
|
)
|
||||||
from cic_eth.queue import (
|
from cic_eth.queue import (
|
||||||
query,
|
query,
|
||||||
|
|||||||
@@ -85,6 +85,9 @@ def main():
|
|||||||
callback_queue=args.q,
|
callback_queue=args.q,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
#register = not args.no_register
|
||||||
|
#logg.debug('register {}'.format(register))
|
||||||
|
#t = api.create_account(register=register)
|
||||||
t = api.transfer(config.get('_SENDER'), config.get('_RECIPIENT'), config.get('_VALUE'), config.get('_SYMBOL'))
|
t = api.transfer(config.get('_SENDER'), config.get('_RECIPIENT'), config.get('_VALUE'), config.get('_SYMBOL'))
|
||||||
|
|
||||||
ps.get_message()
|
ps.get_message()
|
||||||
|
|||||||
@@ -81,14 +81,10 @@ chain_spec = ChainSpec.from_chain_str(config.get('CIC_CHAIN_SPEC'))
|
|||||||
|
|
||||||
rpc = EthHTTPConnection(args.p)
|
rpc = EthHTTPConnection(args.p)
|
||||||
|
|
||||||
#registry_address = config.get('CIC_REGISTRY_ADDRESS')
|
registry_address = config.get('CIC_REGISTRY_ADDRESS')
|
||||||
|
|
||||||
admin_api = AdminApi(rpc)
|
admin_api = AdminApi(rpc)
|
||||||
|
|
||||||
t = admin_api.registry()
|
|
||||||
registry_address = t.get()
|
|
||||||
logg.info('got registry address from task pool: {}'.format(registry_address))
|
|
||||||
|
|
||||||
trusted_addresses_src = config.get('CIC_TRUST_ADDRESS')
|
trusted_addresses_src = config.get('CIC_TRUST_ADDRESS')
|
||||||
if trusted_addresses_src == None:
|
if trusted_addresses_src == None:
|
||||||
logg.critical('At least one trusted address must be declared in CIC_TRUST_ADDRESS')
|
logg.critical('At least one trusted address must be declared in CIC_TRUST_ADDRESS')
|
||||||
@@ -155,16 +151,14 @@ def main():
|
|||||||
txs = []
|
txs = []
|
||||||
renderer = render_tx
|
renderer = render_tx
|
||||||
if len(config.get('_QUERY')) > 66:
|
if len(config.get('_QUERY')) > 66:
|
||||||
#registry = connect_registry(rpc, chain_spec, registry_address)
|
registry = connect_registry(rpc, chain_spec, registry_address)
|
||||||
#admin_api.tx(chain_spec, tx_raw=config.get('_QUERY'), registry=registry, renderer=renderer)
|
admin_api.tx(chain_spec, tx_raw=config.get('_QUERY'), registry=registry, renderer=renderer)
|
||||||
admin_api.tx(chain_spec, tx_raw=config.get('_QUERY'), renderer=renderer)
|
|
||||||
elif len(config.get('_QUERY')) > 42:
|
elif len(config.get('_QUERY')) > 42:
|
||||||
#registry = connect_registry(rpc, chain_spec, registry_address)
|
registry = connect_registry(rpc, chain_spec, registry_address)
|
||||||
#admin_api.tx(chain_spec, tx_hash=config.get('_QUERY'), registry=registry, renderer=renderer)
|
admin_api.tx(chain_spec, tx_hash=config.get('_QUERY'), registry=registry, renderer=renderer)
|
||||||
admin_api.tx(chain_spec, tx_hash=config.get('_QUERY'), renderer=renderer)
|
|
||||||
|
|
||||||
elif len(config.get('_QUERY')) == 42:
|
elif len(config.get('_QUERY')) == 42:
|
||||||
#registry = connect_registry(rpc, chain_spec, registry_address)
|
registry = connect_registry(rpc, chain_spec, registry_address)
|
||||||
txs = admin_api.account(chain_spec, config.get('_QUERY'), include_recipient=False, renderer=render_account)
|
txs = admin_api.account(chain_spec, config.get('_QUERY'), include_recipient=False, renderer=render_account)
|
||||||
renderer = render_account
|
renderer = render_account
|
||||||
elif len(config.get('_QUERY')) >= 4 and config.get('_QUERY')[:4] == 'lock':
|
elif len(config.get('_QUERY')) >= 4 and config.get('_QUERY')[:4] == 'lock':
|
||||||
|
|||||||
@@ -7,13 +7,9 @@ import uuid
|
|||||||
# external imports
|
# external imports
|
||||||
import celery
|
import celery
|
||||||
import sqlalchemy
|
import sqlalchemy
|
||||||
from chainlib.chain import ChainSpec
|
|
||||||
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 chainlib.eth.gas import RPCGasOracle
|
||||||
from cic_eth_registry import CICRegistry
|
|
||||||
from cic_eth_registry.error import UnknownContractError
|
|
||||||
import liveness.linux
|
import liveness.linux
|
||||||
|
|
||||||
# local imports
|
# local imports
|
||||||
@@ -105,35 +101,12 @@ class CriticalWeb3AndSignerTask(CriticalTask):
|
|||||||
safe_gas_refill_amount = safe_gas_threshold_amount * 5
|
safe_gas_refill_amount = safe_gas_threshold_amount * 5
|
||||||
|
|
||||||
|
|
||||||
|
@celery_app.task(bind=True, base=BaseTask)
|
||||||
|
def hello(self):
|
||||||
|
time.sleep(0.1)
|
||||||
|
return id(SessionBase.create_session)
|
||||||
|
|
||||||
|
|
||||||
@celery_app.task()
|
@celery_app.task()
|
||||||
def check_health(self):
|
def check_health(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
# TODO: registry / rpc methods should perhaps be moved to better named module
|
|
||||||
@celery_app.task()
|
|
||||||
def registry():
|
|
||||||
return CICRegistry.address
|
|
||||||
|
|
||||||
|
|
||||||
@celery_app.task()
|
|
||||||
def registry_address_lookup(chain_spec_dict, address, connection_tag='default'):
|
|
||||||
chain_spec = ChainSpec.from_dict(chain_spec_dict)
|
|
||||||
conn = RPCConnection.connect(chain_spec, tag=connection_tag)
|
|
||||||
registry = CICRegistry(chain_spec, conn)
|
|
||||||
return registry.by_address(address)
|
|
||||||
|
|
||||||
|
|
||||||
@celery_app.task(throws=(UnknownContractError,))
|
|
||||||
def registry_name_lookup(chain_spec_dict, name, connection_tag='default'):
|
|
||||||
chain_spec = ChainSpec.from_dict(chain_spec_dict)
|
|
||||||
conn = RPCConnection.connect(chain_spec, tag=connection_tag)
|
|
||||||
registry = CICRegistry(chain_spec, conn)
|
|
||||||
return registry.by_name(name)
|
|
||||||
|
|
||||||
|
|
||||||
@celery_app.task()
|
|
||||||
def rpc_proxy(chain_spec_dict, o, connection_tag='default'):
|
|
||||||
chain_spec = ChainSpec.from_dict(chain_spec_dict)
|
|
||||||
conn = RPCConnection.connect(chain_spec, tag=connection_tag)
|
|
||||||
return conn.do(o)
|
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ version = (
|
|||||||
0,
|
0,
|
||||||
11,
|
11,
|
||||||
0,
|
0,
|
||||||
'beta.11',
|
'beta.10',
|
||||||
)
|
)
|
||||||
|
|
||||||
version_object = semver.VersionInfo(
|
version_object = semver.VersionInfo(
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
cic-base==0.1.2b5
|
cic-base==0.1.2b3
|
||||||
celery==4.4.7
|
celery==4.4.7
|
||||||
crypto-dev-signer~=0.4.14b3
|
crypto-dev-signer~=0.4.14b3
|
||||||
confini~=0.3.6rc3
|
confini~=0.3.6rc3
|
||||||
@@ -15,10 +15,10 @@ semver==2.13.0
|
|||||||
websocket-client==0.57.0
|
websocket-client==0.57.0
|
||||||
moolb~=0.1.1b2
|
moolb~=0.1.1b2
|
||||||
eth-address-index~=0.1.1a9
|
eth-address-index~=0.1.1a9
|
||||||
chainlib~=0.0.2a20
|
chainlib~=0.0.2a18
|
||||||
hexathon~=0.0.1a7
|
hexathon~=0.0.1a7
|
||||||
chainsyncer[sql]~=0.0.2a2
|
chainsyncer[sql]~=0.0.2a2
|
||||||
chainqueue~=0.0.2a2
|
chainqueue~=0.0.1a7
|
||||||
pysha3==1.0.2
|
pysha3==1.0.2
|
||||||
coincurve==15.0.0
|
coincurve==15.0.0
|
||||||
sarafu-faucet==0.0.2a28
|
sarafu-faucet==0.0.2a28
|
||||||
|
|||||||
@@ -210,11 +210,9 @@ def test_callback_filter(
|
|||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.results = {}
|
self.results = {}
|
||||||
self.queue = 'test'
|
|
||||||
|
|
||||||
def call_back(self, transfer_type, result):
|
def call_back(self, transfer_type, result):
|
||||||
self.results[transfer_type] = result
|
self.results[transfer_type] = result
|
||||||
return self
|
|
||||||
|
|
||||||
mock = CallbackMock()
|
mock = CallbackMock()
|
||||||
fltr.call_back = mock.call_back
|
fltr.call_back = mock.call_back
|
||||||
|
|||||||
@@ -65,7 +65,6 @@ def test_tx(
|
|||||||
tx_hash_hex_orig = tx_hash_hex
|
tx_hash_hex_orig = tx_hash_hex
|
||||||
|
|
||||||
gas_oracle = OverrideGasOracle(price=1100000000, limit=21000)
|
gas_oracle = OverrideGasOracle(price=1100000000, limit=21000)
|
||||||
c = Gas(default_chain_spec, signer=eth_signer, nonce_oracle=nonce_oracle, gas_oracle=gas_oracle)
|
|
||||||
(tx_hash_hex, tx_signed_raw_hex) = c.create(agent_roles['ALICE'], agent_roles['BOB'], 100 * (10 ** 6), tx_format=TxFormat.RLP_SIGNED)
|
(tx_hash_hex, tx_signed_raw_hex) = c.create(agent_roles['ALICE'], agent_roles['BOB'], 100 * (10 ** 6), tx_format=TxFormat.RLP_SIGNED)
|
||||||
queue_create(
|
queue_create(
|
||||||
default_chain_spec,
|
default_chain_spec,
|
||||||
|
|||||||
@@ -53,9 +53,6 @@ def init_database(
|
|||||||
alembic.command.downgrade(ac, 'base')
|
alembic.command.downgrade(ac, 'base')
|
||||||
alembic.command.upgrade(ac, 'head')
|
alembic.command.upgrade(ac, 'head')
|
||||||
|
|
||||||
session.execute('DELETE FROM lock')
|
|
||||||
session.commit()
|
|
||||||
|
|
||||||
yield session
|
yield session
|
||||||
session.commit()
|
session.commit()
|
||||||
session.close()
|
session.close()
|
||||||
|
|||||||
@@ -273,7 +273,7 @@ def test_tx(
|
|||||||
eth_signer,
|
eth_signer,
|
||||||
agent_roles,
|
agent_roles,
|
||||||
contract_roles,
|
contract_roles,
|
||||||
celery_session_worker,
|
celery_worker,
|
||||||
):
|
):
|
||||||
|
|
||||||
nonce_oracle = RPCNonceOracle(agent_roles['ALICE'], eth_rpc)
|
nonce_oracle = RPCNonceOracle(agent_roles['ALICE'], eth_rpc)
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ def test_list_tx(
|
|||||||
foo_token,
|
foo_token,
|
||||||
register_tokens,
|
register_tokens,
|
||||||
init_eth_tester,
|
init_eth_tester,
|
||||||
celery_session_worker,
|
celery_worker,
|
||||||
):
|
):
|
||||||
|
|
||||||
tx_hashes = []
|
tx_hashes = []
|
||||||
|
|||||||
@@ -13,10 +13,11 @@ DEV_PIP_EXTRA_INDEX_URL=${DEV_PIP_EXTRA_INDEX_URL:-https://pip.grassrootseconomi
|
|||||||
DEV_DATABASE_NAME_CIC_ETH=${DEV_DATABASE_NAME_CIC_ETH:-"cic-eth"}
|
DEV_DATABASE_NAME_CIC_ETH=${DEV_DATABASE_NAME_CIC_ETH:-"cic-eth"}
|
||||||
CIC_DATA_DIR=${CIC_DATA_DIR:-/tmp/cic}
|
CIC_DATA_DIR=${CIC_DATA_DIR:-/tmp/cic}
|
||||||
ETH_PASSPHRASE=''
|
ETH_PASSPHRASE=''
|
||||||
CIC_DEFAULT_TOKEN_SYMBOL=${CIC_DEFAULT_TOKEN_SYMBOL:-GFT}
|
DEV_TOKEN_TYPE=${DEV_TOKEN_TYPE:-giftable}
|
||||||
if [[ $CIC_DEFAULT_TOKEN_SYMBOL != 'GFT' && $CIC_DEFAULT_TOKEN_SYMBOL != 'SRF' ]]; then
|
if [ $DEV_TOKEN_TYPE = 'giftable' ]; then
|
||||||
>&2 echo CIC_DEFAULT_TOKEN_SYMBOL must be one of [GFT,SRF], but was $CIC_DEFAULT_TOKEN_SYMBOL
|
token_symbol='GFT'
|
||||||
exit 1
|
else
|
||||||
|
token_symbol='SRF'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Debug flag
|
# Debug flag
|
||||||
|
|||||||
Reference in New Issue
Block a user