To install Moose from source:
git clone https://github.com/tf-encrypted/moose
cd mooseYou will need a working installation of Rust to compile and test this project; we generally use the stable toolchain.
Install dependencies:
sudo apt install libopenblas-dev
sudo apt install python3-devInstall dependencies (using Homebrew):
brew install openblasIf you wish you can install the Moose binaries as follows:
cargo install --path moosebut for development purposes this is often not the best approach. Instead we suggest you use cargo run --bin and perhaps create the following aliases for the binaries you would otherwise obtain via cargo install:
alias elk="cargo run --bin elk --"
alias comet="cargo run --bin comet --"
alias cometctl="cargo run --bin cometctl --"
alias rudolph="cargo run --bin rudolph --"cargo buildThere are three types of testing regimes which can be found in the Makefile:
make test
make test-ci
make test-longWhen doing local development we suggest using make test command. The
make-ci command is used mostly for ci purposes and runs a smaller range of test cases. For
a more extensive test suite we recommend using make test-long command.
export RUST_LOG="moose=debug"To generate documentation provided by rust using the source files use:
cargo doc --no-deps --openOur whitepaper contains more documentation on the cryptographic protocols implemented in Moose.
We require code to be formatted according to:
cargo fmtso make sure to run this command before submitted your work. You should also run
cargo clippy --all-targets --no-deps -- -D warningsto lint your code.
To ensure your changes will pass our CI, it's wise to run the following commands before committing:
make ci-ready
# or, more verbosely:
make fmt
make lint
make test-ciWe have been using heaptrack to measure the memory consumptions of computations, but in order to do so it appears that you need to launch the binaries directly, and not via cargo run.
This can be done by first building them, eg rudolph in this case:
cargo build --release --bin rudolphand then passing the produced executable to heaptrack:
heaptrack ./target/release/rudolphMoose also has basic support for Jaeger/OpenTelemetry and telemetry can be turned on in the reindeer via the --telemetry flag.
Jaeger may be launched in docker using:
docker run -p6831:6831/udp -p6832:6832/udp -p16686:16686 jaegertracing/all-in-one:latestWe encourage setting RUST_LOG to an appropriate value to limit the number of spans generated, in particular for large computations.
Follow these steps to release a new version:
-
Make sure
cargo releaseis installed (cargo install cargo-release) -
create a new branch from
main, eggit checkout -b new-release -
run
make release -
Update the CHANGELOG.md file to include notable changes since the last release.
-
if successful then
git pushto create a new PR
Once your PR has been merged to main:
-
checkout main branch:
git checkout main -
create a new tag matching the version of
python-bindings: eggit tag v{x.y.z} -
push tag:
git push origin v{x.y.z} -
create a release on GitHub based on your tag
-
additionally tag the new versioned release with the
stabletag, if the release is deemed stable. -
update to the next dev version with
cargo release --workspace --no-publish beta --executeand create a PR for that
If needed then tags on GitHub can be deleted using git push --delete origin {tag-name}
TODO
Build and push the Docker image using:
docker build -t tfencrypted/moose .
docker push tfencrypted/mooseTo ease your development we encourage you to install the following cargo subcommands:
-
install-updateto keep cargo subcommands up-to-date. -
watchto type check your code on every save;cargo watch --exec testwill run all tests on every save. -
outdatedto check if your dependencies are up to date. -
auditto check if any vulnerabilities have been detected for your current dependencies. -
denyto check for security advisories and license conflicts. -
releaseto automate the release cycle, including bumping versions. -
udepsto list unused dependencies. -
expandto dump what macros expand into. -
asmto dump assembly, LLVM IR, MIR or Wasm. -
llvm-linesto inspect code bloat.
Tokio Console is also interesting.
During development it can be useful to have cargo watch automatically re-launch eg reindeer on code changes. This can be achieved as follows, in this case for Rudolph:
cargo watch -c -x 'run --bin rudolph -- --identity "localhost:50000" --port 50000 --sessions ./examples' -i examplesNote that -i examples means workers are not re-launched when files in ./examples are changed.