From 4abf9dc9ed038836699fafc6e138380b8449bb6b Mon Sep 17 00:00:00 2001 From: Dusan Klinec Date: Tue, 18 Sep 2018 17:23:40 +0200 Subject: [PATCH] xmr: test fixes after refactoring --- tests/test_apps.monero.bulletproof.py | 11 ++++++----- tests/test_apps.monero.crypto.py | 16 ++++++++-------- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/tests/test_apps.monero.bulletproof.py b/tests/test_apps.monero.bulletproof.py index 768a4aa5b..f7d22c4f3 100644 --- a/tests/test_apps.monero.bulletproof.py +++ b/tests/test_apps.monero.bulletproof.py @@ -382,13 +382,14 @@ def test_prove_testnet_2(self): def test_verify_batch_1(self): bpi = bp.BulletProofBuilder() bpi.verify_batch([self.bproof_1()]) - bpi.verify_batch([self.bproof_1(), self.bproof_2()]) - bpi.verify_batch([self.bproof_4(), self.bproof_8(), self.bproof_2()]) - bpi.verify_batch([self.bproof_2(), self.bproof_16()]) + bpi.verify_batch([self.bproof_2()]) + bpi.verify_batch([self.bproof_4()]) + bpi.verify_batch([self.bproof_8()]) + bpi.verify_batch([self.bproof_16()]) with self.assertRaises(Exception): - bpi.verify_batch([self.bproof_4(), self.bproof_2_invalid()]) + bpi.verify_batch([self.bproof_2_invalid()]) with self.assertRaises(Exception): - bpi.verify_batch([self.bproof_2_invalid(), self.bproof_2_invalid()]) + bpi.verify_batch([self.bproof_2_invalid()]) def test_prove_random_masks(self): bpi = bp.BulletProofBuilder() diff --git a/tests/test_apps.monero.crypto.py b/tests/test_apps.monero.crypto.py index 925e89717..19aa0b5dd 100644 --- a/tests/test_apps.monero.crypto.py +++ b/tests/test_apps.monero.crypto.py @@ -90,7 +90,7 @@ def test_hash_to_point(self): data = unhexlify( b"42f6835bf83114a1f5f6076fe79bdfa0bd67c74b88f127d54572d3910dd09201" ) - res = crypto.hash_to_ec(data) + res = crypto.hash_to_point(data) res_p = crypto.encodepoint(res) self.assertEqual( res_p, @@ -134,7 +134,7 @@ def test_h(self): H = unhexlify( b"8b655970153799af2aeadc9ff1add0ea6c7251d54154cfa92c173a0dd39c1f94" ) - self.assertEqual(crypto.encodepoint(crypto.gen_H()), H) + self.assertEqual(crypto.encodepoint(crypto.xmr_H()), H) def test_sc_inversion(self): res = crypto.new_scalar() @@ -167,11 +167,11 @@ def test_wallet_addr(self): ) w = AccountCreds.new_wallet( - crypto.b16_to_scalar( - b"4ce88c168e0f5f8d6524f712d5f8d7d83233b1e7a2a60b5aba5206cc0ea2bc08" + crypto.decodeint( + unhexlify(b"4ce88c168e0f5f8d6524f712d5f8d7d83233b1e7a2a60b5aba5206cc0ea2bc08") ), - crypto.b16_to_scalar( - b"f2644a3dd97d43e87887e74d1691d52baa0614206ad1b0c239ff4aa3b501750a" + crypto.decodeint( + unhexlify(b"f2644a3dd97d43e87887e74d1691d52baa0614206ad1b0c239ff4aa3b501750a") ), network_type=NetworkTypes.TESTNET, ) @@ -200,8 +200,8 @@ def test_derive_subaddress_public_key(self): ) def test_get_subaddress_secret_key(self): - a = crypto.b16_to_scalar( - b"4ce88c168e0f5f8d6524f712d5f8d7d83233b1e7a2a60b5aba5206cc0ea2bc08" + a = crypto.decodeint( + unhexlify(b"4ce88c168e0f5f8d6524f712d5f8d7d83233b1e7a2a60b5aba5206cc0ea2bc08") ) m = monero.get_subaddress_secret_key(secret_key=a, major=0, minor=1) self.assertEqual(