The library compiles on the 1.51.0 stable
toolchain of the Rust compiler. To install Rust, first install rustup
by following the instructions here, or via your platform's package manager. Once rustup
is installed, install the appropriate Rust toolchain by invoking:
rustup install 1.51.0
After that, use cargo
, the standard Rust build tool, to build the library:
git clone https://github.com/HorizenOfficial/ginger-lib.git
cd ginger-lib
cargo build --release
This library comes with unit tests for each of the provided crates. Run the tests with:
cargo test --all-features
Compiling with adcxq
, adoxq
and mulxq
instructions can lead to a 30-70% speedup. These are available on most x86_64
platforms (Broadwell onwards for Intel and Ryzen onwards for AMD). Run the following command:
RUSTFLAGS="-C target-feature=+bmi2,+adx" cargo test/build/bench --features asm
Tip: If optimising for performance, your mileage may vary with passing --emit=asm
to RUSTFLAGS
.