gentest.py: use ethkey for Ethereum tests
This commit is contained in:
parent
174caeebd3
commit
e5abf419c0
3 changed files with 23 additions and 28 deletions
|
|
@ -498,7 +498,7 @@ class CoinInfo(object):
|
|||
# broken: DASH - only compressed, LTC segwit old fmt
|
||||
'BTC','LTC','VIA','FTC','DOGE','MEC',
|
||||
'JBS','MZC','RIC','DFC','FAI','ARG','ZEC','DCR'),
|
||||
'pyethereum': ('ETH','ETC'),
|
||||
'ethkey': ('ETH','ETC'),
|
||||
'zcash_mini': ('ZEC',),
|
||||
'keyconv': ( # all supported by vanitygen-plus 'keyconv' util
|
||||
# broken: PIVX
|
||||
|
|
@ -515,7 +515,7 @@ class CoinInfo(object):
|
|||
# broken: DASH - only compressed { 'DASH':'tDASH' }
|
||||
'BTC':'XTN','LTC':'XLT','VIA':'TVI','FTC':'FTX','DOGE':'XDT','DCR':'DCRT'
|
||||
},
|
||||
'pyethereum': {},
|
||||
'ethkey': {},
|
||||
'keyconv': {}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ EXAMPLES:
|
|||
(compare addrs generated with secp256k1 library to {dn} wallet dump)
|
||||
|
||||
External libraries required for the 'ext' generator:
|
||||
+ pyethereum (for ETH,ETC) https://github.com/ethereum/pyethereum
|
||||
+ ethkey (for ETH,ETC) https://github.com/paritytech/parity-ethereum
|
||||
+ zcash-mini (for zcash_z addresses) https://github.com/FiloSottile/zcash-mini
|
||||
+ pycoin (for supported coins) https://github.com/richardkiss/pycoin
|
||||
+ keyconv (for all other coins) https://github.com/exploitagency/vanitygen-plus
|
||||
|
|
@ -88,8 +88,10 @@ if not 1 <= len(cmd_args) <= 2: opts.usage()
|
|||
|
||||
addr_type = MMGenAddrType(opt.type or g.proto.dfl_mmtype)
|
||||
|
||||
def pyethereum_sec2addr(sec):
|
||||
return sec,eth.privtoaddr(sec).hex()
|
||||
def ethkey_sec2addr(sec):
|
||||
p = sp.Popen(['ethkey','info',sec],stdout=sp.PIPE)
|
||||
o = p.stdout.read().decode().splitlines()
|
||||
return sec,o[-1].split()[1]
|
||||
|
||||
def keyconv_sec2addr(sec):
|
||||
p = sp.Popen(['keyconv','-C',g.coin,sec.wif],stderr=sp.PIPE,stdout=sp.PIPE)
|
||||
|
|
@ -136,13 +138,10 @@ def init_external_prog():
|
|||
ext_lib = 'zcash_mini'
|
||||
init_coin('zec')
|
||||
addr_type = MMGenAddrType('Z')
|
||||
elif test_support('pyethereum'):
|
||||
try:
|
||||
import mmgen.altcoins.eth.pyethereum.utils as eth
|
||||
except:
|
||||
raise ImportError("Unable to import 'ethereum' module. Is pyethereum installed?")
|
||||
ext_sec2addr = pyethereum_sec2addr
|
||||
ext_lib = 'pyethereum'
|
||||
elif test_support('ethkey'): # build with 'cargo build -p ethkey-cli --release'
|
||||
import subprocess as sp
|
||||
ext_sec2addr = ethkey_sec2addr
|
||||
ext_lib = 'ethkey'
|
||||
elif test_support('pycoin'):
|
||||
global network_for_netcode
|
||||
try:
|
||||
|
|
@ -286,7 +285,7 @@ else:
|
|||
try:
|
||||
a = int(a)
|
||||
assert 1 <= a <= len(g.key_generators),'{}: invalid key generator'.format(a)
|
||||
if b in ('ext','pyethereum','pycoin','keyconv','zcash_mini'):
|
||||
if b in ('ext','ethkey','pycoin','keyconv','zcash_mini'):
|
||||
init_external_prog()
|
||||
else:
|
||||
b = int(b)
|
||||
|
|
@ -309,9 +308,10 @@ if a and b:
|
|||
for coin in ci.external_tests[('mainnet','testnet')[g.testnet]][ext_lib]:
|
||||
if coin not in mmgen_supported: continue
|
||||
init_coin(coin)
|
||||
tmp_addr_type = addr_type if addr_type in g.proto.mmtypes else MMGenAddrType(g.proto.dfl_mmtype)
|
||||
kg_a = KeyGenerator(tmp_addr_type,a)
|
||||
ag = AddrGenerator(tmp_addr_type)
|
||||
if addr_type not in g.proto.mmtypes:
|
||||
addr_type = MMGenAddrType(g.proto.dfl_mmtype)
|
||||
kg_a = KeyGenerator(addr_type,a)
|
||||
ag = AddrGenerator(addr_type)
|
||||
compare_test()
|
||||
else:
|
||||
if b != 'ext':
|
||||
|
|
|
|||
|
|
@ -247,23 +247,18 @@ t_alts="
|
|||
# disabled, pycoin generates old-style LTC Segwit addrs:
|
||||
# $gentest_py --coin=ltc --type=segwit 2:ext $rounds
|
||||
|
||||
# disabled, no pyethereum:
|
||||
# $gentest_py --coin=etc 2:ext $rounds
|
||||
# $gentest_py --coin=eth 2:ext $rounds
|
||||
# $gentest_py --all 2:pyethereum $rounds
|
||||
|
||||
[ "$MSYS2" ] || { # no pycoin, zcash-mini
|
||||
t_alts="$t_alts
|
||||
$gentest_py --coin=zec --type=zcash_z 2:ext $rounds_mid
|
||||
$gentest_py --all 2:zcash_mini $rounds_mid
|
||||
$gentest_py --all 2:pycoin $rounds
|
||||
$gentest_py --coin=btc 2:ext $rounds
|
||||
$gentest_py --coin=btc --type=compressed 2:ext $rounds
|
||||
$gentest_py --all --type=legacy 2:pycoin $rounds
|
||||
$gentest_py --all --type=compressed 2:pycoin $rounds
|
||||
$gentest_py --coin=btc --type=segwit 2:ext $rounds
|
||||
$gentest_py --coin=btc --type=bech32 2:ext $rounds
|
||||
$gentest_py --coin=ltc 2:ext $rounds
|
||||
$gentest_py --coin=ltc --type=compressed 2:ext $rounds
|
||||
$gentest_py --coin=etc 2:ext $rounds
|
||||
$gentest_py --coin=eth 2:ext $rounds
|
||||
$gentest_py --all 2:ethkey $rounds
|
||||
$gentest_py --coin=zec 2:ext $rounds
|
||||
$gentest_py --coin=zec --type=zcash_z 2:ext $rounds_mid
|
||||
$gentest_py --all 2:zcash_mini $rounds_mid
|
||||
"
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue