-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from dusk-network/initial-commit
bls12_381-bls: Initial commit
- Loading branch information
Showing
54 changed files
with
70 additions
and
4,126 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,101 +1,29 @@ | ||
on: [pull_request] | ||
|
||
name: Continuous integration | ||
name: Dusk CI | ||
|
||
jobs: | ||
analyze: | ||
name: Dusk Analyzer | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions-rs/toolchain@v1 | ||
with: | ||
profile: minimal | ||
- run: rustup component add rustfmt | ||
- uses: actions-rs/cargo@v1 | ||
with: | ||
command: install | ||
args: --git https://github.com/dusk-network/cargo-dusk-analyzer | ||
- uses: actions-rs/cargo@v1 | ||
with: | ||
command: dusk-analyzer | ||
args: --manifest-path rust/Cargo.toml | ||
|
||
check_nightly_no_std: | ||
name: Nightly check no_std | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions-rs/toolchain@v1 | ||
with: | ||
profile: minimal | ||
target: thumbv6m-none-eabi | ||
- run: rustup component add rustfmt | ||
- uses: actions-rs/cargo@v1 | ||
with: | ||
command: check | ||
args: --manifest-path rust/bls12_381-sign/Cargo.toml --no-default-features --target thumbv6m-none-eabi | ||
code_analysis: | ||
name: Code Analysis | ||
uses: dusk-network/.github/.github/workflows/code-analysis.yml@main | ||
with: | ||
clippy_default: false | ||
clippy_args: --release --features=rkyv-impl,rkyv/size_16 -- -D warnings | ||
|
||
test_nightly: | ||
name: Nightly tests | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions-rs/toolchain@v1 | ||
with: | ||
profile: minimal | ||
- run: rustup component add rustfmt | ||
- uses: actions-rs/cargo@v1 | ||
with: | ||
command: test | ||
args: --manifest-path rust/Cargo.toml --workspace --release | ||
|
||
fmt: | ||
name: Rustfmt | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions-rs/toolchain@v1 | ||
with: | ||
profile: minimal | ||
- run: rustup component add rustfmt | ||
- uses: actions-rs/cargo@v1 | ||
with: | ||
command: fmt | ||
args: --manifest-path rust/Cargo.toml --all -- --check | ||
dusk_analysis: | ||
name: Dusk Analyzer | ||
uses: dusk-network/.github/.github/workflows/dusk-analysis.yml@main | ||
|
||
test: | ||
strategy: | ||
matrix: | ||
go-version: [ 1.17.x ] | ||
os: [ ubuntu-latest, macos-latest ] | ||
runs-on: ${{ matrix.os }} | ||
check_no_std: | ||
name: check no_std | ||
runs-on: core | ||
steps: | ||
- name: Install Go | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: ${{ matrix.go-version }} | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
- name: Change toolchain | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
profile: minimal | ||
toolchain: nightly | ||
override: true | ||
- name: Rustfmt | ||
run: rustup component add rustfmt | ||
- name: Generate Rust FFI and IPC binaries | ||
run: make lib | ||
- name: Upload binaries for platform | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: bls12_381_sign_${{ matrix.os }} | ||
path: | | ||
go/cgo/bls/libdusk_bls12_381_sign_ffi_${{ matrix.os }}.a | ||
- name: Build Go Stuff | ||
run: make build | ||
- name: Test Go Stuff | ||
run: make test | ||
- name: Run all bls12-381 benches for Cgo, IPC | ||
run: make bench | ||
- uses: actions/checkout@v4 | ||
- uses: dsherret/rust-toolchain-file@v1 | ||
- run: cargo check --no-default-features --target thumbv6m-none-eabi | ||
|
||
test_std: | ||
name: Nightly std tests | ||
uses: dusk-network/.github/.github/workflows/run-tests.yml@main | ||
with: | ||
test_flags: --features=rkyv-impl,rkyv/size_16 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
.DS_Store | ||
/target | ||
/rust/target | ||
Cargo.lock | ||
.idea | ||
/.idea |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Changelog | ||
|
||
All notable changes to this project will be documented in this file. | ||
|
||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), | ||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). | ||
|
||
## [Unreleased] | ||
|
||
## [0.1.0] - 2024-01-08 | ||
|
||
### Added | ||
|
||
- Add initial commit, this package continues the development of [dusk-bls12_381-sign](https://github.com/dusk-network/bls12_381-sign/) at version `0.6.0` under the new name: `bls12_381-bls` and without the go related code. | ||
|
||
<!-- ISSUES --> | ||
|
||
<!-- VERSIONS --> | ||
[Unreleased]: https://github.com/dusk-network/bls12_381-bls/compare/v0.1.0...HEAD | ||
[0.1.0]: https://github.com/dusk-network/bls12_381-bls/releases/tag/v0.1.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,30 @@ | ||
# BLS12-381 Curve Signature | ||
# Implementation of [BLS signatures](https://crypto.stanford.edu/~dabo/pubs/papers/BLSmultisig.html) using the BLS12-381 curve. | ||
|
||
This repo contains Dusk Network's [implementation](/rust/bls12_381-sign) of the BLS Signatures using the BLS12-381 curve. This implementation currently only supports rogue-key attack resistant batching, and does not support distinct message verification. | ||
|
||
## Rust | ||
|
||
The [library](/rust/bls12_381-sign) is written in rust. | ||
|
||
We also provide a sample IPC [micro-service](/rust/grpc-server) that provides a synchronous gRPC interface to the library for third-party clients. | ||
|
||
## Go | ||
|
||
We provide a couple options to work with the library using Go: | ||
|
||
1. [Using CGo](/go/cgo/bls) to build and link directly to the lib binaries. | ||
1. [Using gRPC](/go/grpc/bls) to communicate with our simple lib IPC server. | ||
This implementation currently only supports rogue-key attack resistant batching, and does not support distinct message verification. | ||
|
||
## Benchmarks | ||
|
||
We've found the CGo version to perform faster with `Go 1.17+` | ||
### Machine specs | ||
|
||
Recent benchmarks are attached for reference: | ||
The benchmarks were ran on a 2020 13.3" MacBook Pro. | ||
|
||
### CGo | ||
CPU: | ||
``` | ||
cpu: Intel(R) Xeon(R) CPU E5-2673 v4 @ 2.30GHz | ||
BenchmarkSign 1264 4416508 ns/op 48 B/op 1 allocs/op | ||
BenchmarkVerify 706 8568588 ns/op 0 B/op 0 allocs/op | ||
BenchmarkAggregatePk 864 6687951 ns/op 216 B/op 3 allocs/op | ||
BenchmarkAggregateSig 4274 1443901 ns/op 120 B/op 3 allocs/op | ||
$ lscpu | ||
Intel(R) Core(TM) i7-1068NG7 CPU @ 2.30GHz | ||
``` | ||
|
||
### gRPC | ||
RAM: | ||
``` | ||
16 GB 3733 MHz LPDDR4X | ||
``` | ||
|
||
### Results | ||
|
||
``` | ||
test benches::bench_aggregate_pk ... bench: 1,654,552 ns/iter (+/- 107,025) | ||
test benches::bench_aggregate_sig ... bench: 36,893 ns/iter (+/- 3,399) | ||
test benches::bench_sign ... bench: 1,480,169 ns/iter (+/- 106,151) | ||
test benches::bench_sign_vulnerable ... bench: 1,024,052 ns/iter (+/- 111,395) | ||
test benches::bench_verify ... bench: 4,740,114 ns/iter (+/- 336,036) | ||
``` | ||
BenchmarkSign 1317 4507956 ns/op 5317 B/op 95 allocs/op | ||
BenchmarkVerify 693 8767921 ns/op 5207 B/op 94 allocs/op | ||
BenchmarkAggregatePk 656 9209897 ns/op 5385 B/op 96 allocs/op | ||
BenchmarkAggregateSig 3651 1645111 ns/op 5194 B/op 96 allocs/op | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.