Skip to content

Commit 968d6f7

Browse files
committed
Run test & build CI (#2)
1 parent 1cb44c5 commit 968d6f7

16 files changed

Lines changed: 1536 additions & 160 deletions

File tree

.circleci/config.yml

Lines changed: 0 additions & 111 deletions
This file was deleted.

.dockerignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
target/
2+
keypair
3+
.env
4+
solidity/cache

.github/workflows/packages.yml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: Packages
2+
3+
on:
4+
push:
5+
branches:
6+
- 'master'
7+
tags:
8+
- '*.*.*'
9+
pull_request:
10+
branches:
11+
- 'master'
12+
13+
jobs:
14+
build:
15+
name: Build and push docker images to ghcr.io
16+
runs-on: ubuntu-latest
17+
env:
18+
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
19+
DOCKER_REGISTRY: ghcr.io
20+
DOCKER_IMAGE_BASE: ${{ github.repository_owner }}
21+
outputs:
22+
operator: ${{ steps.meta-tezos-operator.outputs.tags }}
23+
steps:
24+
- name: Check out the repo
25+
uses: actions/checkout@v2
26+
27+
- name: Set up QEMU
28+
uses: docker/setup-qemu-action@v3
29+
30+
- name: Set up Docker Buildx
31+
uses: docker/setup-buildx-action@v1
32+
33+
- name: Log in to the registry
34+
uses: docker/login-action@v1
35+
with:
36+
registry: ${{ env.DOCKER_REGISTRY }}
37+
username: ${{ github.actor }}
38+
password: ${{ secrets.GITHUB_TOKEN }}
39+
40+
- name: Set image tags & labels
41+
id: meta
42+
uses: docker/metadata-action@v3
43+
with:
44+
images: ${{ env.DOCKER_REGISTRY }}/${{ env.DOCKER_IMAGE_BASE }}/dkg-cli
45+
46+
- name: Image build & push
47+
uses: docker/build-push-action@v2
48+
with:
49+
context: .
50+
platforms: linux/amd64,linux/arm64,
51+
file: crates/dkg-cli/Dockerfile
52+
push: true
53+
cache-from: type=gha
54+
cache-to: type=gha,mode=max
55+
tags: ${{ steps.meta.outputs.tags }}
56+
labels: ${{ steps.meta.outputs.labels }}

.github/workflows/releases.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Releases
2+
3+
on:
4+
push:
5+
tags:
6+
- '*.*'
7+
8+
jobs:
9+
build:
10+
name: Build and publish static binaries
11+
runs-on: ubuntu-latest
12+
13+
strategy:
14+
matrix:
15+
target: [x86_64-unknown-linux-gnu]
16+
17+
steps:
18+
- name: Checkout code
19+
uses: actions/checkout@v2
20+
21+
- name: Setup Rust
22+
uses: actions-rs/toolchain@v1
23+
with:
24+
toolchain: stable
25+
override: true
26+
27+
- name: Build
28+
run: RUSTFLAGS="-C target-feature=-crt-static" NO_SOLC_BUILD=1 cargo build --release --target=${{ matrix.target }}
29+
30+
- name: Release
31+
uses: softprops/action-gh-release@v2
32+
with:
33+
files: /home/runner/work/dkg-tooling/dkg-tooling/target/x86_64-unknown-linux-gnu/release/dkg-cli

.github/workflows/tests.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Tests
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- 'master'
8+
9+
jobs:
10+
test:
11+
name: Check formatting and run unit tests
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout sources
15+
uses: actions/checkout@v2
16+
17+
- name: Install stable toolchain
18+
uses: actions-rs/toolchain@v1
19+
with:
20+
profile: minimal
21+
toolchain: stable
22+
override: true
23+
components: rustfmt, clippy
24+
25+
- name: Check formatting
26+
run: cargo fmt --check
27+
28+
- name: Run tests
29+
run: NO_SOLC_BUILD=1 cargo test

.gitignore

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,9 @@ react-native
2020

2121
solidity/cache
2222
solidity/build
23+
solidity/artifacts
2324
*.swp
24-
*.bin
2525
.DS_Store
26-
*.json
27-
crates/dkg-cli/src/dkg_contract.rs
2826

2927
keypair
3028
dkg-output

Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,6 @@ run:
1414

1515
start:
1616
./target/release/dkg-cli start -n $(NODE_URL) -p $(PRIVATE_KEY) -c $(CONTRACT_ADDRESS)
17+
18+
image:
19+
docker build -t dkg-cli -f crates/dkg-cli/Dockerfile .

README.md

Lines changed: 25 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,44 @@
1-
<h1 align="center">Threshold BLS Signatures and DKG</h1>
1+
# DKG tooling
22

3-
Fork of the Celo [project](https://github.com/celo-org/celo-threshold-bls-rs).
3+
This is a fork of the Celo's [threshold-bls](https://github.com/celo-org/celo-threshold-bls-rs) project.
44

55
## Overview
66

7-
This crate provides libraries and command line interfaces for producing threshold BLS signatures. The signatures can also be [blind](https://en.wikipedia.org/wiki/Blind_signature) in order to preserve the privacy of the user asking for a signature from another set of parties.
7+
This project provides tooling for running an interactive distributed key generation protocol.
8+
All participants (administrator and key holders) use a command line app to participate in the protocol, and all the communication is hapenning through a smart contract.
89

9-
Distributed Key Generation for generating the threshold public key is based on [Secure Distributed Key Generation for Discrete-Log Based Cryptosystems
10-
](https://link.springer.com/article/10.1007/s00145-006-0347-3)
11-
12-
## Build Guide
13-
14-
Build with `cargo build (--release)`.
10+
In the beginning of the DKG procedure:
11+
- The list of account addresses belonging to key holders is publicly known
12+
- There is a designated administrator that deploys and initialized the contract
1513

16-
Test with `cargo test`.
17-
18-
All crates require Rust 2021 edition and are tested on the following channels:
19-
- `1.64.0`
14+
In the result of the DKG procedure:
15+
- All key holders have their secret key share locally
16+
- Individual public key shares and master public key are available publicly
2017

21-
If you do not have Rust installed, run: `curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh`
18+
This project implements the JF-DKG scheme described in [Secure Distributed Key Generation for Discrete-Log Based Cryptosystems
19+
](https://link.springer.com/article/10.1007/s00145-006-0347-3)
2220

23-
## Android and iOS
21+
## Install
2422

25-
The library compiles to Android and iOS. This has been tested with Rust v1.64.0.
23+
Get latest binaries from the [releases](https://github.com/trilitech/dkg-tooling/releases) page.
2624

27-
To compile to Android:
25+
Alternatively use Docker images:
26+
```
27+
docker run ghcr.io/trilitech/dkg-cli:$RELEASE_TAG -h
28+
```
2829

29-
1. Download Android NDK r21 and unzip it
30-
2. Set the `NDK_HOME` env var to the extracted directory
31-
3. `cd cross`
32-
4. `./create-ndk-standalone`
33-
5. `make android`
30+
## Use
3431

35-
To compile to ios:
36-
3. `cd cross`
37-
4. `make ios`
32+
Check out the [instructions](crates/dkg-cli).
3833

39-
## Directory Structure
34+
## Build from sources
4035

41-
This repository contains several Rust crates that implement the different building blocks of the MPC. The high-level structure of the repository is as follows:
36+
Build with `NO_SOLC_BUILD=1 cargo build --release`.
4237

43-
- [`dkg-cli`](crates/dkg-cli): Rust crate that provides a CLI for the distributed key generation
44-
- [`dkg-core`](crates/dkg-core): Rust crate that provides the implementation utilities for the DKG
45-
- [`threshold-bls`](crates/threshold-bls): (blind) threshold BLS signatures for BLS12-381 and BLS12-377
46-
- [`threshold-bls-ffi`](crates/threshold-bls-ffi): FFI and WASM bindings to `threshold-bls` for cross platform interoperability
38+
All crates require Rust 2021 edition and are tested on the following channels:
39+
- `1.76.0`
4740

41+
If you do not have Rust installed, run: `curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh`
4842

4943
## Disclaimers
5044

crates/dkg-cli/Dockerfile

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
1-
FROM cimg/rust:1.65.0
2-
3-
ENV HOME=/home/circleci
4-
ENV PATH=$HOME/bin:$PATH
5-
6-
RUN cd $HOME && git clone https://github.com/m-kus/threshold-bls-rs
7-
RUN mkdir $HOME/bin && wget -q https://github.com/ethereum/solidity/releases/download/v0.6.6/solc-static-linux -O $HOME/bin/solc && chmod u+x $HOME/bin/solc && solc --version
8-
RUN cd $HOME && cd threshold-bls-rs/crates/dkg-cli && RUSTFLAGS="-C target-feature=-crt-static" cargo build --release
1+
FROM rust:1.76
2+
WORKDIR /root
3+
COPY . /root/dkg-tooling/
4+
#RUN git clone https://github.com/trilitech/dkg-tooling
5+
RUN cd $HOME/dkg-tooling/crates/dkg-cli \
6+
&& RUSTFLAGS="-C target-feature=-crt-static" NO_SOLC_BUILD=1 cargo build --release
97

108
FROM ubuntu:22.04
11-
COPY --from=0 /home/circleci/threshold-bls-rs/target/release/dkg-cli /dkgbin
12-
WORKDIR /dkg
13-
ENTRYPOINT [ "/dkgbin" ]
9+
COPY --from=0 /root/dkg-tooling/target/release/dkg-cli /usr/bin/
10+
ENTRYPOINT [ "dkg-cli" ]

crates/dkg-cli/README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ in the [Solidity docs](https://solidity.readthedocs.io/en/latest/installing-soli
1313

1414

1515
Install the DKG CLI with `cargo build --release`.
16-
We will use the Alfajores testnet for this example, which you can access by using `https://alfajores-forno.celo-testnet.org` as a `NODE_URL`. You can fund your account by inserting your `address` to the [Alfajores faucet](https://celo.org/developers/faucet).
1716

1817
1. `dkg-cli keygen --path ./keypair`
1918

0 commit comments

Comments
 (0)