Skip to content

Commit

Permalink
Merge branch 'main' into use-sha256
Browse files Browse the repository at this point in the history
  • Loading branch information
piotr-roslaniec authored Feb 1, 2023
2 parents c71dbf2 + 027eff3 commit fa1c1a8
Show file tree
Hide file tree
Showing 37 changed files with 2,333 additions and 1,176 deletions.
189 changes: 169 additions & 20 deletions .github/workflows/workspace.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,34 +17,183 @@ env:
RUSTFLAGS: "-Dwarnings"

jobs:
clippy:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
components: clippy
override: true
profile: minimal
- run: cargo clippy --all --all-features -- -D warnings

rustfmt:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
components: clippy
override: true
profile: minimal
- uses: actions/cache@v3
continue-on-error: false
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-cargo-
- run: cargo clippy --all --all-features -- -D warnings
- uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check

test:
runs-on: ubuntu-latest
needs: [ check ]
strategy:
matrix:
include:
- target: x86_64-unknown-linux-gnu
rust: 1.63 # MSRV, `cargo msrv`
- target: x86_64-unknown-linux-gnu
rust: stable
steps:
- name: Checkout sources
uses: actions/checkout@v1
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ matrix.rust }}
target: ${{ matrix.target }}
override: true
- uses: actions/cache@v3
continue-on-error: false
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-cargo-
- run: ${{ matrix.deps }}
- run: cargo check --all-features
- run: cargo test --release --all-features

- name: Install stable toolchain
uses: actions-rs/toolchain@v1
codecov:
runs-on: ubuntu-latest
needs: [ test ]
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
components: rustfmt
target: x86_64-unknown-linux-gnu
override: true
- name: Install cargo-llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov
# Only checking the coverage of the main library,
# bindings are covered by their language's tests.
- name: Generate code coverage
run: cargo llvm-cov --workspace --lcov --output-path lcov.info --all-features
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
files: lcov.info
fail_ci_if_error: true

benchmark:
runs-on: ubuntu-latest
needs: [ test ]
strategy:
matrix:
component:
- tpke
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly
target: x86_64-unknown-linux-gnu
override: true
- uses: actions/cache@v3
continue-on-error: false
with:
# Not caching ~/.cargo/bin/ because it breaks `cargo install critcmp` in `boa-dev/criterion-compare-action@v3`
path: |
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-cargo-

# - name: Run benchmarks
# uses: boa-dev/criterion-compare-action@v3
# if: github.event_name == 'pull_request'
# with:
# cwd: ${{ matrix.component }}
# branchName: ${{ github.base_ref }}

# The next steps have been adapted from https://raw.githubusercontent.com/unicode-org/icu4x/main/.github/workflows/build-test.yml

# Benchmarking & dashboards job > Run benchmark.

- name: Run cargo fmt
uses: actions-rs/cargo@v1
- name: Run benchmark
run: |
pushd $PWD && cd ${{ matrix.component }};
export REL_OUTPUT_PATH="`dirs +1`/benchmarks/perf/${{ matrix.component }}";
eval OUTPUT_PATH=$REL_OUTPUT_PATH;
mkdir -p $OUTPUT_PATH;
touch $OUTPUT_PATH/output.txt;
# Currently fails to extract benchmark information https://github.com/rhysd/github-action-benchmark/issues/39
# Thats why '::' is replaced with ' '
cargo bench -- --output-format bencher | sed 's/::/__/' | tee $OUTPUT_PATH/output.txt;
echo "Saved output to $OUTPUT_PATH/output.txt";
popd
# In the following step(s) regarding converting benchmark output to dashboards, the branch in `gh-pages-branch` needs to exist.
# If it doesn't already exist, it should be created by someone with push permissions, like so:
# # Create a local branch
# $ git checkout --orphan <newbranch>
# $ git commit --allow-empty -m "root commit"
# # Push it to create a remote branch
# $ git push origin <newbranch>:<newbranch>

# Benchmarking & dashboards job > (unmerged PR only) Convert benchmark output into dashboard HTML in a commit of a branch of the local repo.

- name: Store benchmark result & create dashboard (unmerged PR only)
if: github.event_name == 'pull_request'
uses: rhysd/github-action-benchmark@v1
with:
command: fmt
args: --all -- --check
name: Rust Benchmark
tool: 'cargo'
output-file-path: ./benchmarks/perf/${{ matrix.component }}/output.txt
benchmark-data-dir-path: ./benchmarks/perf/${{ matrix.component }}
# Show alert with commit comment on detecting possible performance regression
alert-threshold: '200%' # If for nothing else, enabling the possibility of alerts with meaningful thresholds requires this job to be done per-component
fail-on-alert: true
gh-pages-branch: unmerged-pr-bench-data # Requires one-time-only creation of this branch on remote repo.
auto-push: false # Do not store historical benchmark info of unfinished PRs. Commits seem to get made anyways, so make sure
# that the branch in `gh-pages-branch` is different from the branch used for merges to main branch.
github-token: ${{ secrets.GITHUB_TOKEN }}
comment-on-alert: true

# Benchmarking & dashboards job > (PR merge to main only) Convert benchmark output into dashboard HTML in a commit of a branch of the local repo.

- name: Store benchmark result & create dashboard (merge to main only)
# only merges to main (implies PR is finished and approved by this point)
if: github.event_name == 'push' && github.ref == 'refs/heads/main' && github.repository == 'nucypher/ferveo'
uses: rhysd/github-action-benchmark@v1
with:
name: Rust Benchmark
tool: 'cargo'
output-file-path: ./benchmarks/perf/${{ matrix.component }}/output.txt
benchmark-data-dir-path: ./benchmarks/perf/${{ matrix.component }}
# Show alert with commit comment on detecting possible performance regression
alert-threshold: '200%' # If for nothing else, enabling the possibility of alerts with meaningful thresholds requires this job to be done per-component
fail-on-alert: true
gh-pages-branch: merged-bench-data # Requires one-time-only creation of this branch on remote repo.
auto-push: true # Use the branch at `gh-pages-branch` to store historical info of benchmark data.
github-token: ${{ secrets.GITHUB_TOKEN }}
comment-on-alert: true
alert-comment-cc-users: '@piotr-roslaniec'
45 changes: 0 additions & 45 deletions .gitlab-ci.yml

This file was deleted.

38 changes: 16 additions & 22 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 13 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,28 @@
<h1 align="center">Ferveo</h1>

![ci-badge](https://github.com/heliaxdev/ferveo/actions/workflows/build.yaml/badge.svg)
![ci-badge](https://github.com/nucypher/ferveo/actions/workflows/build.yaml/badge.svg)

# Ferveo
A synchronous Distributed Key Generation protocol for front-running protection on public blockchains.

A synchronous Distributed Key Generation protocol for front-running protection on public blockchains.

## About

The distributed key generated by Ferveo can be input into a compatible threshold encryption/decryption or a threshold signature protocol. Ferveo distributes the shared private key by relative staking weight and relies on an underlying blockchain for synchonicity.
The distributed key generated by Ferveo can be input into a compatible threshold encryption/decryption or a threshold
signature protocol. Ferveo distributes the shared private key by relative staking weight and relies on an underlying
blockchain for synchonicity.

## Security Warning

This library is under development and has not been reviewed, audited, or prepared for use.

## Documentation

Documentation can be found [here](book/).
It is recommended to use [mdbook](https://rust-lang.github.io/mdBook/) to render the docs. Run `mdbook serve` in the `book` folder.
It is recommended to use [mdbook](https://rust-lang.github.io/mdBook/) to render the docs. Run `mdbook serve` in
the `book` folder.

A preprint paper describing the construction of Ferveo and the novel cryptosystems used is available at
A preprint paper describing the construction of Ferveo and the novel cryptosystems used is available at
[IACR](https://eprint.iacr.org/2022/898).

## Build
Expand All @@ -30,10 +35,11 @@ Please note that performance may be significantly poorer when compiling in `Debu

## Testing

Run `cargo test --release` to run tests. Please note that performance may be significantly poorer when testing in `Debug` mode.
Run `cargo test --release` to run tests. Please note that performance may be significantly poorer when testing
in `Debug` mode.

## Benchmarks

Run `cargo bench --benches` to run benchmarks.
Run `cargo bench --benches` to run benchmarks. Benchmark report is available in the `target/criterion/report` folder.


Loading

0 comments on commit fa1c1a8

Please sign in to comment.