From 90ab66a4dccddbbbfc12419a8599290bcba714fa Mon Sep 17 00:00:00 2001 From: Alexander Mozeika <106667936+AMozeika@users.noreply.github.com> Date: Tue, 27 Jun 2023 15:14:15 +0100 Subject: [PATCH] Added algorithm description --- carnot/committee_sizes.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/carnot/committee_sizes.py b/carnot/committee_sizes.py index 4a27f82..e0e6fac 100644 --- a/carnot/committee_sizes.py +++ b/carnot/committee_sizes.py @@ -1,3 +1,14 @@ +""" +This algorithm given the number_of_nodes in the network, fraction of Byzantine nodes in the network, network_adversary_threshold, +fraction of Byzantine modes in a committee, adversaries_threshold_per_committee, and the probability of failure_threshold which can be tolerated computes the maximum number_of_committees and committee_size. + +The algorithm computes the current_probability for the number_of_nodes=committee_size*number_of_committees+remainder nodes where the committee_size and committee_size+1 number of nodes are assigned, respectively, to the number_of_committees-remainder and remainder number of committees. + +Initially, all number_of_nodes are in one committee, and in subsequent iterations, the number_of_committees is increased by two until the current_probability <= failure_threshold. When the latter condition is violated then the algorithm stops and outputs the number_of_committees, committee_size, remainder and current_probability. + +A more detailed description of the algorithm, and of its mathematical aspects, is provided in the "Carnot paper" available at https://www.notion.so/Nomos-Specification-419bfb7a939648e9b3894a90d188c3be?pvs=4 +""" + import math from scipy.stats import binom @@ -15,7 +26,7 @@ def compute_optimal_number_of_committees_and_committee_size( assert failure_threshold > 0 # number_of_nodes is the number of nodes in the network # failure_threshold is the prob. of failure which can be tolerated - # adversaries_threshold_per_committee is the fraction Byzantine modes in a committee + # adversaries_threshold_per_committee is the fraction of Byzantine modes in a committee # network_adversary_threshold is the fraction of Byzantine nodes in the network number_of_committees = 1 committee_size = number_of_nodes