Skip to content

Commit

Permalink
xmr: test fixes after refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
ph4r05 committed Sep 18, 2018
1 parent 192785a commit 4abf9dc
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 13 deletions.
11 changes: 6 additions & 5 deletions tests/test_apps.monero.bulletproof.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
16 changes: 8 additions & 8 deletions tests/test_apps.monero.crypto.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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,
)
Expand Down Expand Up @@ -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(
Expand Down

0 comments on commit 4abf9dc

Please sign in to comment.