From 4417410266ef34ad42b373ee8e826125815014a2 Mon Sep 17 00:00:00 2001 From: Arnould Geelhand Date: Thu, 18 Sep 2025 17:23:32 +0200 Subject: [PATCH] Add missing hotkey parameter to test functions - Update test calls to include hotkey parameter added in PR #45 - Remove async from test function that contains no await calls --- src/python_bindings.rs | 1 + tests/test_all_functions.py | 4 ++++ tests/test_commit_reveal.py | 9 +++++++-- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/python_bindings.rs b/src/python_bindings.rs index 82568e6..dade894 100644 --- a/src/python_bindings.rs +++ b/src/python_bindings.rs @@ -21,6 +21,7 @@ use std::time::{SystemTime, UNIX_EPOCH}; /// netuid (int): Subnet identifier. /// subnet_reveal_period_epochs (int): Number of epochs to wait before decryption. /// block_time (float, optional): Block time in seconds (default = 12.0). +/// hotkey (bytes): The hotkey of a neuron-committer is represented as public_key bytes /// /// Returns: /// Tuple[bytes, int]: A tuple containing: diff --git a/tests/test_all_functions.py b/tests/test_all_functions.py index 08f754d..056c371 100644 --- a/tests/test_all_functions.py +++ b/tests/test_all_functions.py @@ -43,6 +43,8 @@ def test_get_encrypted_commit(): current_block = 100 netuid = 1 subnet_reveal_period_epochs = 2 + block_time = 12 + hotkey = bytes([1, 2, 3]) encrypted, round_ = btcr.get_encrypted_commit( uids, @@ -52,6 +54,8 @@ def test_get_encrypted_commit(): current_block, netuid, subnet_reveal_period_epochs, + block_time, + hotkey ) assert isinstance(encrypted, bytes) assert isinstance(round_, int) diff --git a/tests/test_commit_reveal.py b/tests/test_commit_reveal.py index 70f6077..f6a9506 100644 --- a/tests/test_commit_reveal.py +++ b/tests/test_commit_reveal.py @@ -16,6 +16,7 @@ def test_get_encrypted_commits(): netuid = 1 reveal_period = 2 block_time = 12 + hotkey = bytes([1, 2, 3]) start_time = int(time.time()) ct_pybytes, reveal_round = get_encrypted_commit( @@ -27,6 +28,7 @@ def test_get_encrypted_commits(): netuid, reveal_period, block_time, + hotkey, ) # Basic checks @@ -54,6 +56,7 @@ def test_generate_commit_success(): netuid = 100 subnet_reveal_period_epochs = 2 block_time = 12 + hotkey = bytes([1, 2, 3]) start_time = int(time.time()) ct_pybytes, reveal_round = get_encrypted_commit( @@ -65,6 +68,7 @@ def test_generate_commit_success(): netuid, subnet_reveal_period_epochs, block_time, + hotkey, ) assert ct_pybytes is not None and len(ct_pybytes) > 0, ( @@ -101,8 +105,7 @@ def test_generate_commit_success(): ) -@pytest.mark.asyncio -async def test_generate_commit_various_tempos(): +def test_generate_commit_various_tempos(): NETUID = 1 CURRENT_BLOCK = 100_000 SUBNET_REVEAL_PERIOD_EPOCHS = 1 @@ -112,6 +115,7 @@ async def test_generate_commit_various_tempos(): uids = [0] values = [100] version_key = 1 + hotkey = bytes([1, 2, 3]) for tempo in TEMPOS: start_time = int(time.time()) @@ -125,6 +129,7 @@ async def test_generate_commit_various_tempos(): NETUID, SUBNET_REVEAL_PERIOD_EPOCHS, BLOCK_TIME, + hotkey ) assert len(ct_pybytes) > 0, f"Ciphertext is empty for tempo {tempo}"