From 7d8781c57d71e042f85d4d89b67527435e916f11 Mon Sep 17 00:00:00 2001 From: Kevin Froman Date: Sun, 24 Jan 2021 22:05:21 +0000 Subject: [PATCH] adjusted cost again --- CHANGELOG.md | 5 +++++ onionrblocks/generators/anonvdf.py | 5 +++-- setup.py | 2 +- tests/test_anonvdf.py | 4 ++-- tests/test_blockcreator.py | 8 ++++---- 5 files changed, 15 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4dba88e..42e63df 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,11 @@ This project uses Semantic Versioning +## 4.0.0 + +* Make blocks less expensive + + ## 3.0.0 * Use better cost system in anonvdf diff --git a/onionrblocks/generators/anonvdf.py b/onionrblocks/generators/anonvdf.py index 61fdcb5..4d2b247 100644 --- a/onionrblocks/generators/anonvdf.py +++ b/onionrblocks/generators/anonvdf.py @@ -19,9 +19,10 @@ class AnonVDFGenerator(generator.KastenBaseGenerator): # jan 2021 disk price metric = 0.000017 USD per MB # mobile MB transfer US/Canada = 0.0125 USD # Max cost of block storage + American mobile data transfer = 0.0751 USD + # Goal: approximately 2 seconds of computation for 1 hour of 1 MB storage - byte_cost = 1000 - second_cost = 26 + byte_cost = 10 + second_cost = 4 @classmethod def get_rounds_for_ttl_seconds(cls, seconds: int, size_bytes: int): diff --git a/setup.py b/setup.py index 8de0d44..5cebe75 100644 --- a/setup.py +++ b/setup.py @@ -1,7 +1,7 @@ from setuptools import setup, find_packages setup(name='onionrblocks', - version='3.0.0', + version='4.0.0', description='Onionr message format', author='Kevin Froman', author_email='beardog@mailbox.org', diff --git a/tests/test_anonvdf.py b/tests/test_anonvdf.py index 5fded76..26ad56b 100644 --- a/tests/test_anonvdf.py +++ b/tests/test_anonvdf.py @@ -69,8 +69,8 @@ class TestAnonVDF(unittest.TestCase): def test_vdf_rounds_seconds(self): size = 10000 - per_byte = 1000 - per_second = 26 + per_byte = 10 + per_second = 4 expected_rounds = (3600 * per_second) + (size * per_byte) self.assertEqual(anonvdf.AnonVDFGenerator.get_rounds_for_ttl_seconds(3600, size), expected_rounds) diff --git a/tests/test_blockcreator.py b/tests/test_blockcreator.py index b3a04af..018a127 100644 --- a/tests/test_blockcreator.py +++ b/tests/test_blockcreator.py @@ -7,23 +7,23 @@ class TestBlockCreator(unittest.TestCase): def test_create_anonvdf(self): bl = create_anonvdf_block(b"Test", "txt", 3600) # (rounds - (size_bytes * cls.byte_cost)) // cls.second_cost - expected_rounds = (3600 * 26) + (len(bl.get_packed()) * 1000) - 1000 + expected_rounds = (3600 * 4) + (len(bl.get_packed()) * 100) + 100 self.assertEqual(expected_rounds, bl.get_metadata()['rds']) def test_create_anonvdf_half_hour(self): bl = create_anonvdf_block(b"Test", "txt", 1800) - expected_rounds = (len(bl.get_packed()) * anonvdf.AnonVDFGenerator.byte_cost) + (1800 * anonvdf.AnonVDFGenerator.second_cost) - 1000 + expected_rounds = (len(bl.get_packed()) * anonvdf.AnonVDFGenerator.byte_cost) + (1800 * anonvdf.AnonVDFGenerator.second_cost) + 100 self.assertEqual(expected_rounds, bl.get_metadata()['rds']) def test_create_anonvdf_odd(self): #(rounds - (size_bytes * cls.byte_cost)) // cls.second_cost bl = create_anonvdf_block(b"Test", "txt", 1303) - expected_rounds = (len(bl.get_packed()) * anonvdf.AnonVDFGenerator.byte_cost) + (1303 * anonvdf.AnonVDFGenerator.second_cost) + 1000 + expected_rounds = (len(bl.get_packed()) * anonvdf.AnonVDFGenerator.byte_cost) + (1303 * anonvdf.AnonVDFGenerator.second_cost) + 100 self.assertEqual(expected_rounds, bl.get_metadata()['rds']) def test_create_anonvdf_verify(self): bl = create_anonvdf_block(b"Test", "txt", 3600) - expected_rounds = (len(bl.get_packed()) * anonvdf.AnonVDFGenerator.byte_cost) + (3600 * anonvdf.AnonVDFGenerator.second_cost) - 1000 + expected_rounds = (len(bl.get_packed()) * anonvdf.AnonVDFGenerator.byte_cost) + (3600 * anonvdf.AnonVDFGenerator.second_cost) + 100 self.assertEqual(expected_rounds, bl.get_metadata()['rds']) packed = bl.get_packed()