Skip to content
This repository has been archived by the owner on Jan 6, 2025. It is now read-only.

Commit

Permalink
update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
naterush committed Apr 27, 2018
1 parent 574a03e commit f92629f
Showing 1 changed file with 9 additions and 74 deletions.
83 changes: 9 additions & 74 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,105 +49,40 @@ Optionally, you can add a message passing mode to each protocol. For example,
```
make run-binary MODE=rrob
```
There are currently four message passing modes:
There are currently three message passing modes:

`rand:` each round, some randomly selected validators propagate their most recent message to other randomly selected validators, who then create new messages.

`rrob:` each round, the creator of the last round's block sends it to the next receiver, who then creates a block.

`full:` each round, all validators receive all other validators previous messages, and then all create messages.

`nofinal:` each round, two simultaneous round-robin message propagations occur at the same time. This results in validators never being able to finalize later blocks (they may finalize initial blocks, depending on weight distribution).

`binary:` unlike the above message propagation schemes, this changes the protocol to cbc-casper with binary data structures! Instead of a blockchain, this protocol just comes to consensus on a single bit.

By default, a gif and associated images of the simulation will be saved in `graphs/graph_num_0/`. These settings can be modified, along with the number of validators, the number of messages that propagate per round, and the report interval in the `config.ini`.

### Advanced
Advanced simulations can be run with a little command line wizardy.
- First ensure that you are using the virtual environment via: `. venv/bin/activate`
- Simulations can then be run via `casper.py`. The following are example usages:
```
# get help and all options for casper.py
python casper.py --help
# run a simulation with 100 validators and random message propagation
python casper.py rand --validators 100
python casper.py --protocol blockchain --msg-mode rand --validators 100
# run a simulation without displaying the viewgraphs, but instead save them and create a GIF
python casper.py rand --hide-display --save
python casper.py --protocol blockchain --msg-mode rand --display false --save true
# run a simulation with 20 validators and 1000 rounds of round robin message propagation,
# reporting every 100 rounds
python casper.py rrob --validators 6 --rounds 300 --report-interval 100
# get help and all options for casper.py
python casper.py --help
```

## Write Simulations
Simulations can be created/managed by `SimulationRunner`. See `casper.py` for sample usage.
python casper.py --protocol blockchain --msg-mode rrob --validators 6 --rounds 300 --report-interval 100
More sample simulations with data collection will be added soon.
## Run Experiments
An Experiment runs a type of simulation some number of times, collects some
specified data on on each simulation and on aggregate of the simulations and
outputs the results in `.json` and `.csv ` formats for further analysis and visualizations.
Experimental output is written to `out/{experiment_name-timestamp}/`

The parameters of an experiment are specified via a `.json` file and are run
using the python script, `run_experiment.py`. For example:

```
python run_experiment.py experiments/blockchain/fast_test.json
```

The following are the fields that make up an experiment to be defined in a `.json` file:

`msg_mode` (string): Specifies the message generation/propagation scheme. The
available schemes are "rand", "rrob", "full", and "nofinal".

`protocol` (string): Specifies the protocol to test. Available protocols are
"blockchain", "integer", and "binary".

`network` (string): Specifies the network model test. Available networks are
"no-delay", "constant", "linear", and "gaussian".

`num_simulations` (number): Specifies the number of simulations to run. Each
simulation starts with a fresh setup -- messages, validators, etc.

`rounds_per_sim` (number): Specifies the number of rounds of the message
propagation scheme to run per simulation.

`report_interval` (number): Specifies at which intervals of the message
propagation to collect data. For example, if `rounds_per_sim` is 100 and `report_interval` is 20,
the experiment will collect data at round 20, 40, 60, 80, and 100.

`data` (list): Specifies which types of data to collect from the simulations as
strings. The available types of data are the methods of `Analyzer`. New types of data
can be added by simply adding a method to Analyzer and referencing the method
name in `data` of an experiment.

`validator_info` (object): Specifies the parameters for generating a validator
set for each simulation.

`validator_info.gen_type` (string): Specifies the type of validator generation
scheme. The available schemes are "gauss" and "weights".

`validator_info.num_validators` (number): [*only "gauss" `gen_type`*]
Specifies the number of validators per validator set.

`validator_info.mu` (number): [*only "gauss" `gen_type`*]
Specifies the mean of the gaussian distribution used to generate validator weights.

`validator_info.sigma` (number): [*only "gauss" `gen_type`*]
Specifies the standard deviation of the gaussian distribution used to generate validator weights.

`validator_info.min_weight` (number): [*only "gauss" `gen_type`*]
Specifies the absolute minimum validator weight can result from the "gauss"
`gen_type`
## Write Simulations

`validator_info.weights` (array): [*only "weights" `gen_type`*]
Specifies an explicit set of validator weights to be used in each simulation.
It is formatted as a json array with positive numbers as values.
COMING SOON...

## Run Tests
To run all tests:
Expand Down

0 comments on commit f92629f

Please sign in to comment.