Added algorithm description

This commit is contained in:
Alexander Mozeika 2023-06-27 15:14:15 +01:00 committed by GitHub
parent 8e05937715
commit 90ab66a4dc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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