Compare commits

..

No commits in common. "f66f93d8673cf0eab9838a250b8a74db2787072e" and "272bf43ba5692a3b9cb7b761d2f5b7ce489a1d4d" have entirely different histories.

9 changed files with 28 additions and 89 deletions

View File

@ -1,6 +1,3 @@
- 0.3.0
* Implement arg handling from aiee
* Implement value argument handling from aiee
- 0.2.1 - 0.2.1
* Fix bug in wire format generation for tx * Fix bug in wire format generation for tx
- 0.2.0 - 0.2.0

View File

@ -27,10 +27,6 @@ class Block(Src):
self.get_tx = self.tx_index_by_hash self.get_tx = self.tx_index_by_hash
self.tx = self.tx_by_index self.tx = self.tx_by_index
self.fee_limit = 0
self.fee_cost = 0
self.parent_hash = None
super(Block, self).__init__(src=src) super(Block, self).__init__(src=src)

View File

@ -50,12 +50,12 @@ class ArgFlag(BaseArgFlag):
self.add('env') self.add('env')
self.add('provider') self.add('provider')
self.add('chain_spec') self.add('chain_spec')
self.add('target')
self.add('unsafe') self.add('unsafe')
self.add('seq') self.add('seq')
self.add('key_file') self.add('key_file')
self.add('fee') self.add('fee')
self.add('nonce') self.add('nonce')
self.add('sign')
self.add('no_target') self.add('no_target')
self.add('exec') self.add('exec')
self.add('wallet') self.add('wallet')
@ -67,16 +67,13 @@ class ArgFlag(BaseArgFlag):
self.add('fmt_wire') self.add('fmt_wire')
self.add('fmt_rpc') self.add('fmt_rpc')
self.add('veryverbose') self.add('veryverbose')
self.add('path')
self.add('backend')
self.alias('sign', 'key_file', 'send') self.alias('std_base', 'verbose', 'config', 'raw', 'env', 'no_target')
self.alias('std_base', 'verbose', 'config', 'raw', 'env', 'target')
self.alias('std_base_read', 'verbose', 'config', 'raw', 'env', 'provider', 'chain_spec', 'seq') self.alias('std_base_read', 'verbose', 'config', 'raw', 'env', 'provider', 'chain_spec', 'seq')
self.alias('std_read', 'std_base', 'provider', 'chain_spec', 'unsafe', 'seq', 'sign', 'fee', 'target') self.alias('std_read', 'std_base', 'provider', 'chain_spec', 'unsafe', 'seq', 'key_file', 'fee', 'no_target')
self.alias('std_write', 'verbose', 'config', 'raw', 'env', 'provider', 'chain_spec', 'unsafe', 'seq', 'key_file', 'sign', 'target', 'wait', 'wait_all', 'send', 'rpc_auth', 'nonce', 'fee') self.alias('std_write', 'provider', 'chain_spec', 'unsafe', 'seq', 'key_file', 'sign', 'no_target', 'wait', 'wait_all', 'send', 'rpc_auth')
self.alias('std_target', 'no_target', 'exec', 'wallet') self.alias('std_target', 'no_target', 'exec', 'wallet')
self.alias('state', 'backend', 'path')
class Arg(BaseArg): class Arg(BaseArg):
@ -94,12 +91,6 @@ class Arg(BaseArg):
self.set_long('c', 'config') self.set_long('c', 'config')
self.add_long('dumpconfig', 'config', help='Output configuration and quit. Use with --raw to omit values and output schema only.') self.add_long('dumpconfig', 'config', help='Output configuration and quit. Use with --raw to omit values and output schema only.')
self.add('a', 'wallet', dest='recipient', help='Recipient address')
self.set_long('a', 'recipient')
self.add('e', 'exec', dest='executable_address', help='Recipient address')
self.set_long('e', 'executable')
self.add('w', 'wait', typ=bool, help='Wait for the last transaction to be confirmed') self.add('w', 'wait', typ=bool, help='Wait for the last transaction to be confirmed')
self.add('ww', 'wait', check=False, typ=bool, help='Wait for every transaction to be confirmed') self.add('ww', 'wait', check=False, typ=bool, help='Wait for every transaction to be confirmed')
@ -111,7 +102,7 @@ class Arg(BaseArg):
self.add_long('rpc-timeout', 'provider', help='RPC autentication credential values') self.add_long('rpc-timeout', 'provider', help='RPC autentication credential values')
self.add_long('rpc-proxy', 'provider', help='RPC autentication credential values') self.add_long('rpc-proxy', 'provider', help='RPC autentication credential values')
self.add_long('height', 'target', default='latest', help='Block height to execute against') self.add_long('height', 'no_target', default='latest', help='Block height to execute against')
self.add_long('rpc-auth', 'rpc_auth', help='RPC autentication scheme') self.add_long('rpc-auth', 'rpc_auth', help='RPC autentication scheme')
self.add_long('rpc-credentials', 'rpc_auth', help='RPC autentication credential values') self.add_long('rpc-credentials', 'rpc_auth', help='RPC autentication credential values')
@ -119,13 +110,13 @@ class Arg(BaseArg):
self.add('i', 'chain_spec', help='Chain specification string') self.add('i', 'chain_spec', help='Chain specification string')
self.set_long('i', 'chain-spec') self.set_long('i', 'chain-spec')
self.add('u', 'unsafe', typ=bool, help='Do not verify address checksums') self.add('u', 'unsafe', help='Do not verify address checksums')
self.set_long('u', 'unsafe') self.set_long('u', 'unsafe')
self.add_long('seq', 'seq', typ=bool, help='Use sequential rpc ids') self.add_long('seq', 'seq', typ=bool, help='Use sequential rpc ids')
self.add('y', 'key_file', help='Keystore file to use for signing or address') self.add('y', 'key_file', help='Keystore file to use for signing or address')
self.set_long('y', 'key_file') self.set_long('y', 'key-file')
self.add_long('passphrase-file', 'key_file', help='Keystore file to use for signing or address') self.add_long('passphrase-file', 'key_file', help='Keystore file to use for signing or address')
self.add('s', 'send', typ=bool, help='Send to network') self.add('s', 'send', typ=bool, help='Send to network')
@ -137,7 +128,3 @@ class Arg(BaseArg):
self.add_long('nonce', 'nonce', typ=int, help='override nonce') self.add_long('nonce', 'nonce', typ=int, help='override nonce')
self.add_long('fee-price', 'fee', typ=int, help='override fee price') self.add_long('fee-price', 'fee', typ=int, help='override fee price')
self.add_long('fee-limit', 'fee', typ=int, help='override fee limit') self.add_long('fee-limit', 'fee', typ=int, help='override fee limit')
self.add_long('state-path', 'path', help='Path to store state data under')
self.add_long('runtime-path', 'path', help='Path to store volatile data under')
self.add_long('backend', 'backend', help='Backend to use for data storage')

View File

@ -85,40 +85,36 @@ def process_config(config, arg, args, flags):
f.close() f.close()
config.censor('PASSPHRASE', 'WALLET') config.censor('PASSPHRASE', 'WALLET')
if arg.match('backend', flags):
args_override['STATE_BACKEND'] = getattr(args, 'backend')
if arg.match('path', flags):
args_override['STATE_PATH'] = getattr(args, 'state_path')
config.dict_override(args_override, 'cli args', allow_empty=True) config.dict_override(args_override, 'cli args', allow_empty=True)
if arg.match('provider', flags): if arg.match('provider', flags):
if arg.match('target', flags): if arg.match('no_target', flags, negate=True):
config.add(getattr(args, 'height'), '_HEIGHT') config.add(getattr(args, 'height'), '_HEIGHT')
if arg.match('unsafe', flags): if arg.match('unsafe', flags):
config.add(getattr(args, 'u'), '_UNSAFE') config.add(getattr(args, 'u'), '_UNSAFE')
if arg.match('sign', flags): if arg.match('sign', flags):
config.add(getattr(args, 's'), '_RPC_SEND')
if arg.match('fee', flags): if arg.match('fee', flags):
config.add(getattr(args, 'fee_price'), '_FEE_PRICE') config.add(getattr(args, 'fee_price'), '_FEE_PRICE')
fee_limit = getattr(args, 'fee_limit') fee_limit = getattr(args, 'fee_limit')
if fee_limit == None: if fee_limit == None:
fee_limit = int(config.get('CHAIN_MIN_FEE')) fee_limit = default_fee_limit
if fee_limit == None:
fee_limit = cls.default_fee_limit
config.add(fee_limit, '_FEE_LIMIT') config.add(fee_limit, '_FEE_LIMIT')
if arg.match('nonce', flags): if arg.match('nonce', flags):
config.add(getattr(args, 'nonce'), '_NONCE') config.add(getattr(args, 'nonce'), '_NONCE')
if arg.match('wait', flags): config.add(getattr(args, 's'), '_RPC_SEND')
if args.ww:
config.add(True, '_WAIT_ALL') if args.ww:
config.add(True, '_WAIT') config.add(True, '_WAIT_ALL')
elif args.w: config.add(True, '_WAIT')
config.add(True, '_WAIT') elif args.w:
config.add(True, '_WAIT')
if arg.match('seq', flags): if arg.match('seq', flags):
config.add(getattr(args, 'seq'), '_SEQ') config.add(getattr(args, 'seq'), '_SEQ')
@ -133,5 +129,4 @@ def process_config(config, arg, args, flags):
config.add(getattr(args, 'rpc_auth'), 'RPC_AUTH') config.add(getattr(args, 'rpc_auth'), 'RPC_AUTH')
config.add(getattr(args, 'rpc_credentials'), 'RPC_CREDENTIALS') config.add(getattr(args, 'rpc_credentials'), 'RPC_CREDENTIALS')
return config return config

View File

@ -10,14 +10,7 @@ proxy =
[chain] [chain]
spec = spec =
min_fee = 0
max_fee = 0
[wallet] [wallet]
key_file = key_file =
passphrase = passphrase =
[state]
path =
runtime_path =
backend =

View File

@ -11,18 +11,13 @@ class JSONRPCException(RPCException):
pass pass
class InitializationError(Exception):
"""Base error for errors occurring while processing settings
"""
pass
class ExecutionError(Exception): class ExecutionError(Exception):
"""Base error for transaction execution failures """Base error for transaction execution failures
""" """
pass pass
class SignerMissingException(InitializationError): class SignerMissingException(Exception):
"""Raised when attempting to retrieve a signer when none has been added """Raised when attempting to retrieve a signer when none has been added
""" """

View File

@ -1,6 +1,3 @@
# external imports
from aiee.numbers import postfix_to_int
# local imports # local imports
from .chain import ChainSpec from .chain import ChainSpec
@ -12,8 +9,12 @@ class ChainSettings:
self.get = self.o.get self.get = self.o.get
def set(self, k, v): def process_common(self, config):
self.o[k] = v self.o['CHAIN_SPEC'] = ChainSpec.from_chain_str(config.get('CHAIN_SPEC'))
def process(self, config):
self.process_common(config)
def __str__(self): def __str__(self):
@ -23,27 +24,3 @@ class ChainSettings:
for k in ks: for k in ks:
s += '{}: {}\n'.format(k, self.o.get(k)) s += '{}: {}\n'.format(k, self.o.get(k))
return s return s
def process_settings_common(settings, config):
chain_spec = ChainSpec.from_chain_str(config.get('CHAIN_SPEC'))
settings.set('CHAIN_SPEC', chain_spec)
return settings
def process_settings_value(settings, config):
value = None
try:
value = config.get('_VALUE')
except KeyError:
return settings
value = postfix_to_int(config.get('_VALUE'))
settings.set('VALUE', value)
return settings
def process_settings(settings, config):
settings = process_settings_common(settings, config)
settings = process_settings_value(settings, config)
return settings

View File

@ -1,5 +1,4 @@
funga~=0.5.2 funga~=0.5.2
pysha3==1.0.2 pysha3==1.0.2
hexathon~=0.1.7 hexathon~=0.1.7
confini~=0.6.1 confini~=0.6.0
aiee~=0.3.1

View File

@ -3,7 +3,7 @@ name=chainlib
license=WTFPL2 license=WTFPL2
author_email=dev@holbrook.no author_email=dev@holbrook.no
description=Generic blockchain access library and tooling description=Generic blockchain access library and tooling
version=0.3.0 version=0.2.1
url=https://gitlab.com/chaintools/chainlib url=https://gitlab.com/chaintools/chainlib
author=Louis Holbrook author=Louis Holbrook