diff --git a/tests/test_anonvdf.py b/tests/test_anonvdf.py index c5d4625..5fded76 100644 --- a/tests/test_anonvdf.py +++ b/tests/test_anonvdf.py @@ -27,11 +27,12 @@ class TestAnonVDF(unittest.TestCase): anonvdf.AnonVDFGenerator.validate_id(test_id, test_data, rounds=rds) def test_vdf_block_validate_not_enough(self): + rds = 133240 t = floor(time()) - 60 test_data = kasten.generator.pack.pack(b"test", "tst", app_metadata=None, timestamp=t) test_id = mimcvdf.vdf_create(test_data, rds) - self.assertRaises(anonvdf.NotEnoughRounds, anonvdf.AnonVDFGenerator.validate_id, test_id, test_data, rounds=rds) + self.assertRaises(anonvdf.InvalidID, anonvdf.AnonVDFGenerator.validate_id, test_id, test_data, rounds=rds-1) def test_vdf_incermental(self): last = 1 @@ -46,27 +47,31 @@ class TestAnonVDF(unittest.TestCase): self.assertGreater(newT - t, last) def test_block_embedded_vdf_rounds(self): + t = floor(time()) - rds = 90000 + (4000 * 1000) + test_data = kasten.generator.pack.pack(b"test", "tst", app_metadata={"rds": 900000}, timestamp=t) + rds = (3600 * 26) + (len(test_data) * 1000) - 1000 test_data = kasten.generator.pack.pack(b"test", "tst", app_metadata={"rds": rds}, timestamp=t) test_vdf = anonvdf.AnonVDFGenerator.generate(test_data, None) anonvdf.AnonVDFGenerator.validate_id(test_vdf.id, test_data, rounds=None) def test_block_embedded_vdf_rounds_invalid(self): t = floor(time()) - rds = 90000 + test_data = kasten.generator.pack.pack(b"test", "tst", app_metadata={"rds": 900000}, timestamp=t) + rds = (3600 * 26) + (len(test_data) * 1000) - 2000 + test_data = kasten.generator.pack.pack(b"test", "tst", app_metadata={"rds": rds}, timestamp=t) - test_vdf = anonvdf.AnonVDFGenerator.generate(test_data, None) + test_vdf = anonvdf.AnonVDFGenerator.generate(test_data) self.assertRaises( - anonvdf.NotEnoughRounds, - anonvdf.AnonVDFGenerator.validate_id, test_vdf.id, test_data, rounds=None) + anonvdf.InvalidID, + anonvdf.AnonVDFGenerator.validate_id, test_vdf.id, test_data, rounds=50000) def test_vdf_rounds_seconds(self): size = 10000 per_byte = 1000 - per_second = 25 - expected_rounds = (3600 * 25) + 100000 - self.assertEqual(anonvdf.AnonVDFGenerator.get_rounds_for_ttl_seconds(3600, 100), expected_rounds) + per_second = 26 + expected_rounds = (3600 * per_second) + (size * per_byte) + self.assertEqual(anonvdf.AnonVDFGenerator.get_rounds_for_ttl_seconds(3600, size), expected_rounds) unittest.main() \ No newline at end of file