From 9098d0c11f43f5a277771abb52b7cc7d63eac191 Mon Sep 17 00:00:00 2001 From: danielSanchezQ <3danimanimal@gmail.com> Date: Thu, 10 Jul 2025 14:35:30 +0000 Subject: [PATCH] Raise error on too small network --- da/assignations/refill.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/da/assignations/refill.py b/da/assignations/refill.py index 1b59769..4e79d91 100644 --- a/da/assignations/refill.py +++ b/da/assignations/refill.py @@ -134,6 +134,8 @@ def calculate_subnetwork_assignations( replication_factor: int, random_seed: bytes, ) -> Assignations: + if len(new_nodes_list) < replication_factor: + raise ValueError("The network size is smaller than the replication factor") # The algorithm works as follows: # 1. Remove nodes that are not active from the previous subnetworks assignations # 2. If the network is decreasing (less available nodes than previous nodes), balance subnetworks: