various fixes and cleanups
This commit is contained in:
parent
b84e68d486
commit
01f52617f6
14 changed files with 24 additions and 25 deletions
|
|
@ -6,15 +6,11 @@ from py_ecc.secp256k1 import privtopub,ecdsa_raw_sign,ecdsa_raw_recover
|
|||
from .. import rlp
|
||||
from ..rlp.sedes import Binary
|
||||
|
||||
from mmgen.globalvars import g
|
||||
try:
|
||||
assert not g.use_internal_keccak_module
|
||||
import sha3 as _sha3
|
||||
def sha3_256(x): return _sha3.keccak_256(x).digest()
|
||||
except:
|
||||
from mmgen.keccak import keccak_256
|
||||
def sha3_256(x):
|
||||
return keccak_256(x).digest()
|
||||
from ....util import get_keccak
|
||||
keccak_256 = get_keccak()
|
||||
|
||||
def sha3_256(bstr):
|
||||
return keccak_256(bstr).digest()
|
||||
|
||||
import struct
|
||||
ALL_BYTES = tuple( struct.pack('B', i) for i in range(256) )
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ from subprocess import run,PIPE,CompletedProcess
|
|||
from collections import namedtuple
|
||||
|
||||
from .globalvars import g
|
||||
from .util import msg,die
|
||||
from .util import msg,Msg_r,die
|
||||
from .flags import *
|
||||
|
||||
_dd = namedtuple('daemon_data',['coind_name','coind_version','coind_version_str']) # latest tested version
|
||||
|
|
|
|||
|
|
@ -168,6 +168,7 @@ async def check_daemons_running():
|
|||
proto = init_proto(coin,testnet=g.testnet,need_amt=True)
|
||||
if proto.sign_mode == 'daemon':
|
||||
vmsg(f'Checking {coin} daemon')
|
||||
from .exception import SocketError
|
||||
try:
|
||||
await rpc_init(proto)
|
||||
except SocketError as e:
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ msg: base message signing classes
|
|||
import os,importlib,json
|
||||
from .globalvars import g
|
||||
from .objmethods import MMGenObject,Hilite,InitErrors
|
||||
from .util import msg,vmsg,die,suf,make_chksum_6,fmt_list,remove_dups
|
||||
from .util import msg,die,suf,make_chksum_6,fmt_list,remove_dups
|
||||
from .color import red,orange,grnbg
|
||||
from .protocol import init_proto
|
||||
from .fileutil import get_data_from_file,write_data_to_file
|
||||
|
|
|
|||
|
|
@ -57,8 +57,6 @@ def print_help(po,opts_data,opt_filter):
|
|||
opts_data['code']['long_options'] = common_opts_data['code']
|
||||
def remove_unneeded_long_opts():
|
||||
d = opts_data['text']['long_options']
|
||||
if g.prog_name != 'mmgen-tool':
|
||||
d = '\n'.join(''+i for i in d.split('\n') if not '--monero-wallet' in i)
|
||||
if proto.base_proto != 'Ethereum':
|
||||
d = '\n'.join(''+i for i in d.split('\n') if not '--token' in i)
|
||||
opts_data['text']['long_options'] = d
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ class tool_cmd(tool_cmd_base):
|
|||
"decode hexdump from file (use '-' for stdin) (warning: outputs binary data)"
|
||||
from ..globalvars import g
|
||||
if g.platform == 'win':
|
||||
import msvcrt
|
||||
import sys,os,msvcrt
|
||||
msvcrt.setmode( sys.stdout.fileno(), os.O_BINARY )
|
||||
from ..fileutil import get_data_from_file
|
||||
from ..util import decode_pretty_hexdump
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ tx.info: transaction info class
|
|||
from ..globalvars import *
|
||||
from ..color import red,green,orange
|
||||
from ..opts import opt
|
||||
from ..util import msg,msg_r
|
||||
from ..util import msg,msg_r,do_pager
|
||||
|
||||
import importlib
|
||||
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ python_requires = >=3.7
|
|||
include_package_data = True
|
||||
|
||||
# pysha3 is used by XMR and ETH for the keccak hash function only. If the
|
||||
# module is not available, the native Python implementation in mmgen.keccak
|
||||
# module is unavailable, the native Python implementation in contrib.keccak
|
||||
# will be used instead.
|
||||
install_requires =
|
||||
importlib-resources; python_version < "3.9"
|
||||
|
|
@ -34,7 +34,7 @@ install_requires =
|
|||
requests
|
||||
pysocks # xmrwallet.py
|
||||
pexpect
|
||||
scrypt; platform_system != "Windows" # requires user intervention to install on MSYS2
|
||||
scrypt; platform_system != "Windows" # must be installed by hand on MSYS2
|
||||
semantic-version; platform_system != "Windows" # scripts/create-token.py
|
||||
aiohttp; platform_system != "Windows"
|
||||
pysha3; platform_system != "Windows"
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
"99E0FC61:S:102"
|
||||
],
|
||||
"message": "24/3/2022 Russia announces it will sell gas for bitcoin",
|
||||
"msghash_type": "raw",
|
||||
"network": "btc_mainnet"
|
||||
},
|
||||
"signatures": {}
|
||||
|
|
@ -6,6 +6,7 @@
|
|||
"DEADBEEF:C:1"
|
||||
],
|
||||
"message": "08/Jun/2021 Bitcoin Law Enacted by El Salvador Legislative Assembly",
|
||||
"msghash_type": "raw",
|
||||
"network": "btc_mainnet"
|
||||
},
|
||||
"signatures": {}
|
||||
|
|
@ -5,6 +5,7 @@
|
|||
"98831F3A:B:1"
|
||||
],
|
||||
"message": "24/3/2022 Russia announces it will sell gas for bitcoin",
|
||||
"msghash_type": "raw",
|
||||
"network": "ltc_mainnet"
|
||||
},
|
||||
"signatures": {}
|
||||
|
|
@ -134,10 +134,10 @@ do
|
|||
N) test_py+=" --no-timings" ;;
|
||||
O) test_py+=" --pexpect-spawn" ;;
|
||||
p) PAUSE=1 ;;
|
||||
s) SKIP_LIST="$OPTARG" ;;
|
||||
s) SKIP_LIST+=" $OPTARG" ;;
|
||||
t) LIST_CMDS=1 ;;
|
||||
v) EXACT_OUTPUT=1 test_py+=" --exact-output" ;&
|
||||
V) VERBOSE=1
|
||||
V) VERBOSE='--verbose'
|
||||
[ "$EXACT_OUTPUT" ] || test_py+=" --verbose"
|
||||
unit_tests_py="${unit_tests_py/--quiet/--verbose}"
|
||||
altcoin_mod_opts="${altcoin_mod_opts/--quiet/--verbose}"
|
||||
|
|
|
|||
|
|
@ -264,7 +264,7 @@ class TestSuiteAutosignBase(TestSuiteBase):
|
|||
else:
|
||||
for fn in self.ref_msgfiles:
|
||||
if op == 'copy':
|
||||
if os.path.basename(fn) == '9DA060[BTC].rawmsg.json': # contains bad Seed ID
|
||||
if os.path.basename(fn) == 'ED405C[BTC].rawmsg.json': # contains bad Seed ID
|
||||
self.bad_msg_count += 1
|
||||
else:
|
||||
self.good_msg_count += 1
|
||||
|
|
|
|||
|
|
@ -383,11 +383,12 @@ class TestSuiteEthdev(TestSuiteBase,TestSuiteShared):
|
|||
for d in ('mm1','mm2'):
|
||||
copytree(os.path.join(srcdir,d),os.path.join(self.tmpdir,d))
|
||||
|
||||
if g.daemon_id == 'geth' and not (opt.resume or opt.resume_after or opt.skip_deps):
|
||||
self.geth_setup()
|
||||
set_vt100()
|
||||
# await geth_devnet_init_bug_workaround() # uncomment to enable testing with v1.10.17
|
||||
|
||||
if not opt.no_daemon_autostart:
|
||||
if g.daemon_id == 'geth':
|
||||
self.geth_setup()
|
||||
set_vt100()
|
||||
# await geth_devnet_init_bug_workaround() # uncomment to enable testing with v1.10.17
|
||||
if not start_test_daemons(
|
||||
self.proto.coin+'_rt',
|
||||
remove_datadir = not g.daemon_id in ('geth','erigon') ):
|
||||
|
|
@ -438,7 +439,7 @@ class TestSuiteEthdev(TestSuiteBase,TestSuiteShared):
|
|||
|
||||
def init_genesis(fn):
|
||||
cmd = f'geth init --datadir {d.datadir} {fn}'
|
||||
cp = run(cmd.split(),stdout=PIPE,stderr=PIPE)
|
||||
cp = run( cmd.split(), stdout=PIPE, stderr=PIPE )
|
||||
if cp.returncode:
|
||||
die(1,cp.stderr.decode())
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue