https://github.com/dineshpinto/gossip-protocol-rs
Simulating a gossip protocol with Byzantine nodes in Rust with PyO3 Python bindings
https://github.com/dineshpinto/gossip-protocol-rs
blockchain gossip-protocol maturin pyo3 rust
Last synced: about 1 month ago
JSON representation
Simulating a gossip protocol with Byzantine nodes in Rust with PyO3 Python bindings
- Host: GitHub
- URL: https://github.com/dineshpinto/gossip-protocol-rs
- Owner: dineshpinto
- License: mit
- Created: 2023-09-03T00:32:32.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2023-10-13T05:35:40.000Z (almost 2 years ago)
- Last Synced: 2025-02-04T13:25:34.826Z (8 months ago)
- Topics: blockchain, gossip-protocol, maturin, pyo3, rust
- Language: Rust
- Homepage:
- Size: 1.97 MB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://github.com/dineshpinto/gossip-protocol-rs/actions/workflows/rust.yml)
[](https://codecov.io/gh/dineshpinto/gossip-protocol-rs)
# gossip-protocol-rsA blazingly-fast implementation of a synchronous gossip protocol in Rust with PyO3 Python bindings.
## Build Rust library
```bash
cargo build --release
cargo run --release
```## Build Python bindings (optional, for data analytics)
Add `crate-type = ["cdylib"]` under `[lib]` to `Cargo.toml`, then:
```bash
poetry install --no-root
poetry run maturin build --release
poetry add target/wheels/*.whl
```### Call the Rust functions from Python
```ipython
>>> from gossip_protocol_rs import pyrun_gossip_protocol
>>> res = pyrun_gossip_protocol(num_honest_sample=3000, num_adversarial_sample=2000,
num_non_sample=100000, num_peers=8, cycles=50)
```## Simulation

See [dineshpinto/synchronous-gossip-protocol](https://github.com/dineshpinto/synchronous-gossip-protocol) for a pure
Python implementation, along with additional
theoretical details.## Benchmark
Uses `criterion` to benchmark the library.
```bash
cargo bench
```| Param | Value |
|-----------------|-------|
| num_non_sample | 1000 |
| num_honest | 6 |
| num_adversarial | 4 |
| num_peers | 6 |
| cycles | 200 |

