commit 96a0f3beb04170167859a2fce25d59b90929479a
parent 1fbd94d382853493acee570f9e717ac8a372a3ee
Author: lash <dev@holbrook.no>
Date: Sun, 9 Jan 2022 12:09:23 +0000
Skip compulsory exec address for offline encode, add wait to raw
Diffstat:
3 files changed, 16 insertions(+), 5 deletions(-)
diff --git a/chainlib/eth/runnable/encode.py b/chainlib/eth/runnable/encode.py
@@ -66,9 +66,6 @@ extra_args = {
}
config = chainlib.eth.cli.Config.from_args(args, arg_flags, extra_args=extra_args, default_config_dir=config_dir)
-if not config.get('_EXEC_ADDRESS'):
- argparser.error('exec address (-e) must be defined')
-
block_all = args.ww
block_last = args.w or block_all
@@ -109,12 +106,18 @@ def main():
print(strip_0x(code))
return
- exec_address = add_0x(to_checksum_address(config.get('_EXEC_ADDRESS')))
+ exec_address = config.get('_EXEC_ADDRESS')
+ if exec_address:
+ exec_address = add_0x(to_checksum_address(exec_address))
if signer == None or config.true('_NOTX'):
if config.true('_RAW'):
print(strip_0x(code))
return
+
+ if not exec_address:
+ argparser.error('exec address (-e) must be defined')
+
c = TxFactory(chain_spec)
j = JSONRPCRequest(id_generator=rpc.id_generator)
o = j.template()
@@ -140,6 +143,9 @@ def main():
sys.stderr.write('query returned an empty value ({})\n'.format(r))
sys.exit(1)
+ if not exec_address:
+ argparser.error('exec address (-e) must be defined')
+
if chain_spec == None:
raise ValueError('chain spec must be specified')
diff --git a/chainlib/eth/runnable/gas.py b/chainlib/eth/runnable/gas.py
@@ -106,7 +106,7 @@ def main():
logg.debug('sender {} balance after: {}'.format(signer_address, sender_balance))
logg.debug('recipient {} balance after: {}'.format(recipient, recipient_balance))
if r['status'] == 0:
- logg.critical('VM revert. Wish I could tell you more')
+ logg.critical('VM revert for {}. Wish I could tell you more'.format(tx_hash_hex))
sys.exit(1)
print(tx_hash_hex)
else:
diff --git a/chainlib/eth/runnable/raw.py b/chainlib/eth/runnable/raw.py
@@ -133,6 +133,11 @@ def main():
o = raw(args.data, id_generator=rpc.id_generator)
if send:
r = conn.do(o)
+ if block_last:
+ r = conn.wait(tx_hash_hex)
+ if r['status'] == 0:
+ logg.critical('VM revert for {}. Wish I could tell you more'.format(tx_hash_hex))
+ sys.exit(1)
print(r)
else:
print(o)