chainlib

Generic blockchain access library and tooling
Log | Files | Refs | README | LICENSE

commit 9f537ff569a78610f1f60ea25505cbe221b3bbf2
parent e225b4e3334735cf5ab9ae0815628c1a8c3e334a
Author: lash <dev@holbrook.no>
Date:   Fri, 13 May 2022 13:44:15 +0000

Add state settings and config

Diffstat:
Mchainlib/cli/arg.py | 9+++++++--
Mchainlib/cli/config.py | 7+++++++
Mchainlib/data/config/config.ini | 5+++++
3 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/chainlib/cli/arg.py b/chainlib/cli/arg.py @@ -67,6 +67,8 @@ class ArgFlag(BaseArgFlag): self.add('fmt_wire') self.add('fmt_rpc') self.add('veryverbose') + self.add('path') + self.add('backend') self.alias('sign', 'key_file', 'send') self.alias('std_base', 'verbose', 'config', 'raw', 'env', 'target') @@ -74,7 +76,7 @@ class ArgFlag(BaseArgFlag): self.alias('std_read', 'std_base', 'provider', 'chain_spec', 'unsafe', 'seq', 'sign', 'fee', '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_target', 'no_target', 'exec', 'wallet') - + self.alias('state', 'backend', 'path') class Arg(BaseArg): @@ -109,7 +111,6 @@ class Arg(BaseArg): 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('height', 'no_target', default='latest', help='Block height to execute against') self.add_long('height', 'target', default='latest', help='Block height to execute against') self.add_long('rpc-auth', 'rpc_auth', help='RPC autentication scheme') @@ -136,3 +137,7 @@ class Arg(BaseArg): 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-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') diff --git a/chainlib/cli/config.py b/chainlib/cli/config.py @@ -85,6 +85,12 @@ def process_config(config, arg, args, flags): f.close() 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) if arg.match('provider', flags): @@ -127,4 +133,5 @@ def process_config(config, arg, args, flags): config.add(getattr(args, 'rpc_auth'), 'RPC_AUTH') config.add(getattr(args, 'rpc_credentials'), 'RPC_CREDENTIALS') + return config diff --git a/chainlib/data/config/config.ini b/chainlib/data/config/config.ini @@ -16,3 +16,8 @@ max_fee = 0 [wallet] key_file = passphrase = + +[state] +path = +runtime_path = +backend =