chik_rs
A collection of Rust crates for working with the Chik blockchain. There are also Python bindings in the form of a wheel.
Prerequisites
- Python 3.8 or higher installed.
- The Rust toolchain must be installed.
Unit Tests
To run the unit tests for the whole workspace:
Some slow tests are only enabled in optimized builds, so it may also be a good idea to run the tests in release mode:
Python Linking
You may need a Python virtual environment activated for the tests to link properly, due to the pyo3 dependency in wheel.
You can setup a virtual environment with the following command:
Activate the virtual env:
Python Tests
The wheel crate is a single Python wheel that exports bindings to various functionality in the repository, mostly from chik-consensus and chik-protocol.
It's built with maturin, so you need to have activated a python virtual environment for the build to work.
The bindings are tested with pytest. Before you run them, install the following dependencies:
And build the Python wheel:
Finally, you can run the Python binding tests:
Note that these tests can take several minutes to complete.
Benchmarks
To run benchmarks for a specific crate before you make changes:
After you apply the changes, finish the benchmark:
You can also run all the benchmarks by including --workspace.
Note that you must include the flag before the --, for example:
Precommit Hook
This repository has a pre-commit configuration, which is hooked into git by running:
It runs Prettier and then cargo fmt on all crates on every commit. When you push, it runs cargo clippy, cargo test, and cargo build.
To run all checks explicitly (without pushing), run:
Fuzzers
Fuzzers can't be run or listed for the whole workspace, but only for individual crates. There is a tool to generate a fuzzing corpus from a blockchain database.
It's run like this:
The following crates have fuzzers:
- chik-bls
- chik-consensus
- chik-protocol
- chik-puzzles
- klvm-utils
To list and run fuzzers:
Bumping Version Number
Make sure you have cargo-workspaces installed:
To bump the versions of all relevant crates:
Select "minor update" if there has not been any incompatible API changes, otherwise "major update".