This repository contains the code for a tool that tests Ripple's consensus algorithm (RCA). The tool tests RCA for distributed concurrency bugs. It creates schedules based on an evolutionary algorithm, which are executed by running a test case. This test case consists of submitting transactions to the network, and waiting for these transactions to be included in a validated ledger.
The thesis: "DiscoTest: Evolutionary Distributed Concurrency Testing of Blockchain Consensus Algorithms", can be found here
Docker
Rust
OpenSSL (1.0.1 - 1.1.1)
Docker containers for the different Rippled versions
To run the network, follow the steps below.
- Clone this repository
git clone https://github.com/SERG-Delft/ConsensusTesting
- Create the docker network ripple-net
docker network create ripple-net
- Change directory to rust-ripple-p2p
cd ../rust-ripple-p2p
- Run the tool
- PowerShell:
$Env:RUST_LOG="error";$Env:OPENSSL_DIR="[path/to/openssl/dir]"; cargo run [path_to_config_file]
- Other:
RUST_LOG=error;OPENSSL_DIR=[path/to/openssl/dir] cargo run [path_to_config_file]
- PowerShell:
Coming soon
The settings and configurations for the tool can be set in config.json.
- num_nodes: The number of nodes in the network.
- unl_type: The type of unl configuration [Full, Limit, Buggy].
- rippled_version: The version of rippled to run [Fixed, LivenessBug]
- scheduler_type: The type of scheduler to run [Delay, Priority, RandomDelay, RandomPriority, DelayTraceGraph, PriorityTraceGraph, PredeterminedDelay, PredeterminedPriority, DelayLocalityExperiment, PriorityLocalityExperiment, ScalingExperiment, None].
- search_budget: The time in seconds to run the ga for.
Logs of a run can be found in the logs folder. Each run of the tool creates a new folder with the current date and time [yyyy-mm-ddThh-mm-ss] in UTC.
Most of the code can be found in the rust-ripple-p2p folder. The application is started in main.rs and enters app.rs from there. In app.rs the p2p connections to the nodes are made. Code for the handshake and individual message passing can be found in peer_connection.rs. Other components that are started in app.rs are the scheduler, the genetic algorithm, the collector and the clients. See the README in rust-ripple-p2p for a more detailed explanation of the code.
The code for calculation of the Graph Edit Distance can be found in the ged folder. The HED algorithm used in the comparison of trace graphs is located in approximate_edit_distance.rs in the function approximate_hed_graph_edit_distance
.
Note that the other algorithms are not used and might not work correctly.