Simulator for message flooding protocols on graphs where nodes (i.e. parties) have weights. This simulator is intended to evaluate the performance of the WFF
protocol given in the paper Practical Provably Secure Flooding for Blockchains.. For more details on the scope of the simulator as well as on the WFF
protocol please refer to our paper.
The simulator was implemented in C++, and makes use of OpenMP.
The documentation of the code can be found inside the ./doc/html
folder.
We provide a Makefile
for compiling the source code of the project.
The simulator relies on a library <sys/sysinfo.h>
that (to the best of our knowledge) is not available in MacOS.
The Makefile
allows for compiling three distinct targets:
make bench
compilesbenchmark.cc
(and all other necessary files), generating executablebench-bin
. The purpose of this executable is benchmarking the performance of theWFF
protocol via simulations (the results of the benchmarks are written to.csv
files). To see how to runbench-bin
, refer to section Running The Benchmarks. These are the same benchmarks considered in our paper1.make kout
compilesmain.cc
(and all other necessary files), generating executablekout-bin
. This executable allows running the simulator of theWFF
protocol where the execution parameters are passed as command-line arguments.make hybrid
compileshybrid_main.cc
(and all other necessary files), generating executablehybrid-bin
. This executable allows running the simulator of a variant of theWFF
protocol (more on this variant below) where the execution parameters are passed as command-line arguments.
To cleanup all compilation object files and executables, run make clean
.
To execute either kout-bin
or hybrid-bin
, run
./[kout-bin|hybrid-bin] <#runs> <tests (9 bits)> <corrupt_parties> <corruption_threshold in [0,1]> <#min_parties> <#max_parties> <ratio_heavy_light> <#heavy_parties> <to_show (5 bits)> <#min_factor> <#max_factor>
This will run the simulator on each possible configuration for <#runs>
times, each configuration being a different combination of the input parameters.
For instance, for
./kout-bin 10 000000001 1 0.5 512 512 1000000 20 a 20 30
there are only 11 possible configurations, one for the multiplicative factor set to 20
, another for the multiplicative factor set to 21
, all the way up to 30
.
In all configurations, the stake distribution is always the constant distribution (meaning all parties have exactly the same stake), parties are corrupted uniformly at random, the corruption threshold is 0.5
the total stake, there are 512
parties (both the minimum number of parties and the maximum number of parties is 512
), and the multiplicative factors vary from 20 (inclusive) to 30 (inclusive).
Since for all the configurations the stake distribution is always the constant stake distribution, the parameters 1000000 20
are ignored, as they represent the ratio between the stake of the heaviest party(ies) and the lightest party(ies) (for more information on the stake distributions, refer to our paper).
Parameter Description
[kout-bin|hybrid-bin]
: Indicates which protocol to simulate;kout-bin
simulates theWFF
protocol presented in our paper Practical Provably Secure Flooding for Blockchains, whereashybrid-bin
simulates a variant ofWFF
where parties who did not (yet) get the message query other parties for incoming messages.<#runs>
: The number of runs to make for each possible configuration.<tests (9 bits)>
: Each bit indicates whether to benchmark the protocol against a certain stake distribution (see below for a list of what each bit means).<corrupt_parties>
: If set to0
parties are not corrupted; if set to1
parties are corrupted in a random fashion; if set to2
heavy parties are corrupted first; if set to3
light parties are corrupted first.<corruption_threshold in [0,1]>
: Indicates the fraction of stake that can be corrupted.<#min_parties>
and<#max_parties>
: Indicate the minimum and maximum number of parties; both values should be a power of2
; the possible numbers of parties are each power of2
that is greater or equal to<#min_parties>
and smaller or equal to<#max_parties>
.<ratio_heavy_light>
and<#heavy_parties>
: Indicate, respectively, the ratio of stake between the heaviest party(ies) and the lightest party(ies), and the number of heavy parties. Both parameters only apply to Few-Heavy and Exponential stake distributions. The second parameter only applies to Few-Heavy stake distributions.<to_show (5 bits)>
: Each bit indicates whether to display certain information when running the protocol on each configuration (see below for a list of possible values). Valuea
will set all bits to1
and thus will make all possible information be output.<#min_factor>
and<#max_factor>
: Indicates the minimum and maximum multiplicative factors; the possible values for the factor are all integers that are greater or equal to<#min_factor>
and smaller or equal to<#max_factor>
.
000000001
- Deterministic Constant distribution; all parties have stake1
.000000010
- Deterministic Few-Heavy distribution, light sender; all light parties have stake1
, whereas all heavy parties have stake<ratio_heavy_light>
; the sender has stake1
; there are<#heavy_parties>
parties with stake<ratio_heavy_light>
.000000100
- Deterministic Few-Heavy distribution, heavy sender; all light parties have stake1
, whereas all heavy parties have stake<ratio_heavy_light>
; the sender has stake<ratio_heavy_light>
; there are<#heavy_parties>
parties with stake<ratio_heavy_light>
.000001000
- Deterministic Exponential distribution, lightest sender; lightest party has stake1000000
, second lightest party has stakef * 1000000
, third lightest party has stakef * (f * 1000000)
, ..., heaviest party has stake<ratio_heavy_light> * 1000000 = f^(<#parties> - 1) * 1000000
; the sender has stake1000000
.000010000
- Deterministic Exponential distribution, median sender; lightest party has stake1000000
, second lightest party has stakef * 1000000
, third lightest party has stakef * (f * 1000000)
, ..., heaviest party has stake<ratio_heavy_light> * 1000000 = f^(<#parties> - 1) * 1000000
; the sender has stakef^(<#parties>/2) * 1000000
.000100000
- Deterministic Exponential distribution, heaviest sender; lightest party has stake1000000
, second lightest party has stakef * 1000000
, third lightest party has stakef * (f * 1000000)
, ..., heaviest party has stake<ratio_heavy_light> * 1000000 = f^(<#parties> - 1) * 1000000
; the sender has stake<ratio_heavy_light> * 1000000
.001000000
- Random Exponential distribution; stakes of each party are picked according to a (random) exponential distribution with parameter<ratio_heavy_light>
; the sender is picked uniformly at random.010000000
- Random Uniform distribution; stakes of each party are picked according to a (random) uniform distribution with parameters(1,<ratio_heavy_light>+1)
; the sender is picked uniformly at random.100000000
- Random Geometric distribution; stakes of each party are picked according to a random geometric distribution with parameter<ratio_heavy_light>
; the sender is picked uniformly at random.
00001
- Show Distribution: shows which (type of) stake distribution is being used for the test being executed.00010
- Show Factor: shows which multiplicative factor is being used for the test being executed.00100
- Show Success: shows the success rate of the test (i.e. how often all parties received the message).01000
- Show Number Of Parties: shows the number of parties for the current test being executed.10000
- Show Test: shows the bitstring identifying which (type of) stake distribution is being used for the test being executed.
An alternative way for running the simulator is by simply running the benchmarks:
- Run
./setup-bench clean-all
to erase folder./results
and all its subfolders. - Run
./setup-bench setup
to create all necessary directories. - Run
./bench-bin
to run the benchmarks (beware, depending on the parameters defined inbenchmark.cc
, running the benchmarks may take a ==very long time==). - The benchmark results will be stored inside the
results
folder.\