mirror of
https://github.com/logos-blockchain/logos-blockchain-specs.git
synced 2026-01-03 13:43:11 +00:00
Remove main block
This commit is contained in:
parent
2e247d65f4
commit
a58f24941e
@ -101,27 +101,3 @@ def calculate_subnetwork_assignations(
|
||||
heappush(available_nodes, participant)
|
||||
heappush(subnetworks, subnetwork)
|
||||
return [subnetwork.participants for subnetwork in sorted(subnetworks, key=lambda x: x.subnetwork_id)]
|
||||
|
||||
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
import random
|
||||
number_of_columns = 4096
|
||||
for size in [100, 500, 1000, 10000]:
|
||||
nodes_ids = [random.randbytes(32) for _ in range(size)]
|
||||
replication_factor = 3
|
||||
print(size, replication_factor)
|
||||
# print(a := calculate_subnets(nodes_ids, number_of_columns, replication_factor))
|
||||
from pprint import pprint
|
||||
b = calculate_subnetwork_assignations(nodes_ids, [set() for _ in range(number_of_columns)], replication_factor)
|
||||
# pprint(b)
|
||||
assert len(set(chain.from_iterable(b))) == len(nodes_ids)
|
||||
# fill up new nodes
|
||||
for i in range(0, size, 5):
|
||||
nodes_ids[i] = random.randbytes(32)
|
||||
b = calculate_subnetwork_assignations(nodes_ids, b, replication_factor)
|
||||
# pprint(b)
|
||||
assert len(set(chain.from_iterable(b))) == len(nodes_ids), f"{len(set(chain.from_iterable(b)))} != {len(nodes_ids)}"
|
||||
print(Counter(chain.from_iterable(b)).values())
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user