We recommend to use nix for installing the correct version of rust and additional libraries:
> curl -L https://nixos.org/nix/install | sh
> . ~/.nix-profile/etc/profile.d/nix.sh
> nix-shell
> cargo build
We use cargo-husky
to automatically load any scripts under .cargo-husky/hooks
into .git/hooks
.
Changes made to any .cargo-husky/hooks
will be automatically synced to .git/
every time you run cargo test
-- no special extra command to run.
> cargo test --release
Note that by default the release mode does not check integers overflow. In order to enforce this check run:
> ./scripts/run_tests.sh
We use grcov for test coverage
> ./scripts/test_coverage.sh
> cargo doc --open
To format your code run
> cargo fmt
- To update the nix packages run
./nix/update-nix
. - To update the rust overlay run
./nix/update-rust-overlay
.
To use the updates enter a new nix-shell
.
Refer to the nix/vagrant directory.
Running the benchmarks produces a csv file containing the information about the note being benched (type, number of inputs/outputs, number of constraints, size in KB etc...) as well as the running time.
Benchmarks can be run
- with or without asm optimization
- using all cores or a single core
>./scripts/run_benchmarks.sh --help
CAP benchmarks
Usage: ./scripts/run_benchmarks.sh [--(no-)asm] [--(no-)multi_threads] [-h|--help]
-h, --help: Prints help
# By default no asm and no multicore
> ./scripts/run_benchmarks.sh
Multi-threads: OFF
Asm feature: OFF
...
# Activate asm and multicore
> ./scripts/run_benchmarks.sh --asm --multi_threads
Multi-threads: ON
Asm feature: ON
The csv files can be found at /tmp/{note_description}_cap_benchmark.csv
,
e.g. /tmp/transfer_note_cap_benchmark.csv
.
The criterion report can be found at target/criterion/report/index.html
.