test suite: use monero-python as reference tool
This commit is contained in:
parent
e7cbfc2bd1
commit
4aa9f731c2
4 changed files with 29 additions and 25 deletions
|
|
@ -672,7 +672,7 @@ class CoinInfo(object):
|
|||
'WUBS', 'XC', 'XPM', 'YAC', 'ZOOM', 'ZRC'),
|
||||
'ethkey': ('ETH','ETC'),
|
||||
'zcash-mini': ('ZEC',),
|
||||
'moneropy': ('XMR',),
|
||||
'monero-python': ('XMR',),
|
||||
},
|
||||
'testnet': {
|
||||
'pycoin': {
|
||||
|
|
|
|||
|
|
@ -94,9 +94,9 @@ EXAMPLES:
|
|||
Same for Zcash:
|
||||
$ test/gentest.py --coin=zec --type=zcash_z 1 10000
|
||||
|
||||
Test all configured Monero backends against 'moneropy' library, 3 rounds
|
||||
Test all configured Monero backends against the 'monero-python' library, 3 rounds
|
||||
+ edge cases:
|
||||
$ test/gentest.py --coin=xmr all:moneropy 3
|
||||
$ test/gentest.py --coin=xmr all:monero-python 3
|
||||
|
||||
Test 'nacl' and 'ed25519ll_djbec' backends against each other, 10,000 rounds
|
||||
+ edge cases:
|
||||
|
|
@ -111,8 +111,8 @@ SUPPORTED EXTERNAL TOOLS:
|
|||
+ zcash-mini (for Zcash-Z addresses and view keys)
|
||||
https://github.com/FiloSottile/zcash-mini
|
||||
|
||||
+ moneropy (for Monero addresses and view keys)
|
||||
https://github.com/bigreddmachine/MoneroPy
|
||||
+ monero-python (for Monero addresses and view keys)
|
||||
https://github.com/monero-ecosystem/monero-python
|
||||
|
||||
+ pycoin (for supported coins)
|
||||
https://github.com/richardkiss/pycoin
|
||||
|
|
@ -226,19 +226,22 @@ class GenToolPycoin(GenTool):
|
|||
addr = key.address()
|
||||
return gtr( key.wif(), addr, None )
|
||||
|
||||
class GenToolMoneropy(GenTool):
|
||||
desc = 'moneropy'
|
||||
class GenToolMonero_python(GenTool):
|
||||
desc = 'monero-python'
|
||||
|
||||
def __init__(self,*args,**kwargs):
|
||||
super().__init__(*args,**kwargs)
|
||||
try:
|
||||
import moneropy.account
|
||||
from monero.seed import Seed
|
||||
except:
|
||||
raise ImportError('Unable to import moneropy. Is moneropy installed on your system?')
|
||||
self.mpa = moneropy.account
|
||||
raise ImportError('Unable to import monero-python. Is monero-python installed on your system?')
|
||||
self.Seed = Seed
|
||||
|
||||
def run(self,sec,vcoin):
|
||||
sk,vk,addr = self.mpa.account_from_spend_key(sec.hex()) # VERY slow!
|
||||
seed = self.Seed( sec.orig_bytes.hex() )
|
||||
sk = seed.secret_spend_key()
|
||||
vk = seed.secret_view_key()
|
||||
addr = seed.public_address()
|
||||
return gtr( sk, addr, vk )
|
||||
|
||||
def find_or_check_tool(proto,addr_type,toolname):
|
||||
|
|
|
|||
|
|
@ -10,8 +10,8 @@ sec = 'deadbeef' * 8
|
|||
|
||||
class unit_tests:
|
||||
|
||||
altcoin_deps = ('pycoin','moneropy','keyconv','zcash_mini','ethkey','ssh_socks_proxy')
|
||||
win_skip = ('losetup','moneropy','zcash_mini')
|
||||
altcoin_deps = ('pycoin','monero_python','keyconv','zcash_mini','ethkey','ssh_socks_proxy')
|
||||
win_skip = ('losetup','monero_python','zcash_mini')
|
||||
|
||||
def core_repo(self,name,ut):
|
||||
crr = os.getenv('CORE_REPO_ROOT')
|
||||
|
|
@ -33,9 +33,9 @@ class unit_tests:
|
|||
addr = network.address.for_p2pkh_wit(hash160_c)
|
||||
return True
|
||||
|
||||
def moneropy(self,name,ut):
|
||||
from moneropy import account
|
||||
res = account.account_from_spend_key(sec)
|
||||
def monero_python(self,name,ut):
|
||||
from monero.seed import Seed
|
||||
res = Seed('deadbeef' * 8).public_address()
|
||||
return True
|
||||
|
||||
def keyconv(self,name,ut):
|
||||
|
|
|
|||
|
|
@ -59,9 +59,9 @@ class unit_test(object):
|
|||
vmsg(f' {chk}')
|
||||
chk = tuple(chk.split())
|
||||
res = b.fromhex(privhex)
|
||||
if use_moneropy:
|
||||
mp_chk = tuple( mnemonic.mn_encode(privhex) )
|
||||
assert res[:24] == mp_chk, f'check failed:\nres: {res[:24]}\nchk: {chk}'
|
||||
if use_monero_python:
|
||||
mp_chk = tuple( wl.encode(privhex).split() )
|
||||
assert res == mp_chk, f'check failed:\nres: {res}\nchk: {chk}'
|
||||
assert res == chk, f'check failed:\nres: {res}\nchk: {chk}'
|
||||
|
||||
def test_tohex(b):
|
||||
|
|
@ -70,8 +70,8 @@ class unit_test(object):
|
|||
for chk,words in self.vectors:
|
||||
vmsg(f' {chk}')
|
||||
res = b.tohex( words.split() )
|
||||
if use_moneropy:
|
||||
mp_chk = mnemonic.mn_decode( words.split() )
|
||||
if use_monero_python:
|
||||
mp_chk = wl.decode( words )
|
||||
assert res == mp_chk, f'check failed:\nres: {res}\nchk: {mp_chk}'
|
||||
assert res == chk, f'check failed:\nres: {res}\nchk: {chk}'
|
||||
|
||||
|
|
@ -84,12 +84,13 @@ class unit_test(object):
|
|||
b.check_wordlist()
|
||||
|
||||
try:
|
||||
from moneropy import mnemonic
|
||||
from monero.wordlists.english import English
|
||||
wl = English()
|
||||
except ImportError:
|
||||
use_moneropy = False
|
||||
ymsg('Warning: unable to import moneropy, skipping external library checks')
|
||||
use_monero_python = False
|
||||
ymsg('Warning: unable to import monero-python, skipping external library checks')
|
||||
else:
|
||||
use_moneropy = True
|
||||
use_monero_python = True
|
||||
|
||||
test_fromhex(b)
|
||||
test_tohex(b)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue