Skip to content

Commit

Permalink
refactor: move benches
Browse files Browse the repository at this point in the history
  • Loading branch information
ashWhiteHat committed Nov 5, 2023
1 parent 0b7d8a9 commit c5186dc
Show file tree
Hide file tree
Showing 16 changed files with 48 additions and 138 deletions.
20 changes: 0 additions & 20 deletions .github/workflows/bench.yml

This file was deleted.

16 changes: 0 additions & 16 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,22 +23,6 @@ jobs:
command: fmt
args: --all -- --check

bench:
if: contains(github.event.pull_request.labels.*.name, 'performance')
name: Benchmark
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
with:
submodules: recursive
- name: Update submodules
id: update
run: git submodule update -i
- uses: actions-rs/cargo@v1
with:
command: bench

clippy:
if: github.event.pull_request.draft == false
name: Clippy Check
Expand Down
23 changes: 8 additions & 15 deletions Cargo.lock

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

58 changes: 0 additions & 58 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,30 +1,3 @@
[package]
authors = [
'ashWhiteHat<[email protected]>',
'KiriosK<[email protected]>'
]
name = "kogarashi-network"
description = 'Kogarashi Network hybrid smart contract blockchain'
version = "0.1.0"
edition = "2021"
license = "Apache-2.0"
homepage = 'https://github.com/KogarashiNetwork/Kogarashi/'
repository = 'https://github.com/KogarashiNetwork/Kogarashi/'
readme = 'README.md'

[dependencies]
bls-12-381 = { path = "./bls12_381", default-features = false }
zkstd = { path = "./zkstd", default-features = false }
she-elgamal = { path = "./elgamal", default-features = false }
jub-jub = { path = "./jubjub", default-features = false }
poly-commit = { path = "./poly", default-features = false }
ec-pairing = { path = "./pairing", default-features = false }
zksnarks = { path = "./zksnarks", default-features = false }

[dev-dependencies]
criterion = "0.4.0"
rand = { version = "0.8" }

[workspace]
members = [
"bls12_381",
Expand All @@ -50,34 +23,3 @@ overflow-checks = false
lto = true
incremental = false
codegen-units = 1

[features]
default = ["std"]
std = [
'poly-commit/std',
]

[[bench]]
name = "bls12_381_curve"
harness = false

[[bench]]
name = "bls12_381_field"
harness = false

[[bench]]
name = "jubjub_curve"
harness = false

[[bench]]
name = "jubjub_field"
harness = false

[[bench]]
name = "msm"
harness = false
required-features = ["std"]

[[bench]]
name = "pairing"
harness = false
35 changes: 7 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,7 @@ We supports following functionalities.
3. Trustless Single Node Off-Chain Oracle
4. IoT TEE Device Remote Attestation

## Library

All users balances are encrypted by the `homomorphic encryption` by default and all transactions executions are proved by the `non-interactive zero knowledge proof`. The blockchain runtime is optimized its structure and execution environment for improving encryption scheme. This blockchain supports the privacy and simplicity of use at the same time. Users balances are encrypted as default and transactions are verified by zero knowledge proof on chain.

### [Crypto Primitives](https://github.com/KogarashiNetwork/Kogarashi/tree/master/primitive)
## Crypto Primitives

| Name | Crates.io | Documentation | Description |
|-------------|-----------|-----------|-----------|
Expand All @@ -28,20 +24,10 @@ All users balances are encrypted by the `homomorphic encryption` by default and
| [`ec-pairing`] | [![crates.io badge](https://img.shields.io/crates/v/ec-pairing.svg)](https://crates.io/crates/ec-pairing) | [![Documentation](https://docs.rs/ec-pairing/badge.svg)](https://docs.rs/ec-pairing) |`Tate Pairing` implementation. This includes the Miller loop algorithm and pairing construction with pairing-friendly curve.
| [`she-elgamal`] | [![crates.io](https://img.shields.io/crates/v/she-elgamal.svg)](https://crates.io/crates/she-elgamal) | [![Documentation](https://docs.rs/she-elgamal/badge.svg)](https://docs.rs/she-elgamal) | `ElGamal Encryption` implementation. This includes a public key encryption interface that supports **additive homomorphism**.
| [`poly-commit`] | [![crates.io](https://img.shields.io/crates/v/poly-commit.svg)](https://crates.io/crates/poly-commit) | [![Documentation](https://docs.rs/poly-commit/badge.svg)](https://docs.rs/poly-commit) | `Kate Polynomial Commitment` implementation. This includes polynomial commitment and operations used for **zero knowledge proof plonk**.
| [`red-jubjub`] | [![crates.io](https://img.shields.io/crates/v/red-jubjub.svg)](https://crates.io/crates/red-jubjub) | [![Documentation](https://docs.rs/red-jubjub/badge.svg)](https://docs.rs/red-jubjub) | `Redjubjub` implementation. This includes **RedDSA** interfact and public key encryption algorithm.

### [Pallet Functionalities](https://github.com/KogarashiNetwork/Kogarashi/tree/master/pallets)

|Name|Documentation|Description|
|----|-------------|-----------|
| [`pallet-plonk`] | [Plonk Tutorial](https://kogarashinetwork.github.io/Kogarashi/plonk_pallet/) |$gen(d) \rightarrow srs,\ com(f, srs) \rightarrow commitment,\ V_{PC} \rightarrow acc\ or\ rej$|
| [`pallet-encrypted-balance`] |-|$get(address) \rightarrow (g^{r + r'}, g^{a + c} * b^{r + r'})$|
| [`confidential_transfer`] | [Confidential Transfer Tutorial](https://kogarashinetwork.github.io/Kogarashi/confidential_transfer/) |$C = g^{b^\star}y^r \land \hat C = g^{b^\star} \hat y^r \land D = g^r \land C_L/C = g^{b'}(C_R/D)^{sk} \land y = g^{sk} \land b^\star \in [0, MAX] \land b' \in [0,MAX] $|

## Test

```shell
$ git submodule update --init --recursive
$ cargo test --all --release
```

Expand All @@ -61,16 +47,9 @@ You can check more detail [here](./LICENSE).

[//]: # (crypto primitives)

[`zkstd`]: https://github.com/KogarashiNetwork/Kogarashi/tree/master/primitive/zkstd
[`jub-jub`]: https://github.com/KogarashiNetwork/Kogarashi/tree/master/primitive/jubjub
[`bls-12-381`]: https://github.com/KogarashiNetwork/Kogarashi/tree/master/primitive/bls12_381
[`ec-pairing`]: https://github.com/KogarashiNetwork/Kogarashi/tree/master/primitive/pairing
[`she-elgamal`]: https://github.com/KogarashiNetwork/Kogarashi/tree/master/primitive/elgamal
[`poly-commit`]: https://github.com/KogarashiNetwork/Kogarashi/tree/master/primitive/poly
[`red-jubjub`]: https://github.com/KogarashiNetwork/Kogarashi/tree/master/primitive/redjubjub

[//]: # (pallet functionalities)

[`pallet-plonk`]: https://github.com/KogarashiNetwork/Kogarashi/tree/master/pallets/plonk
[`pallet-encrypted-balance`]: https://github.com/KogarashiNetwork/Kogarashi/tree/master/pallets/encrypted_balance
[`confidential_transfer`]: https://github.com/KogarashiNetwork/Kogarashi/tree/master/pallets/confidential_transfer
[`zkstd`]: https://github.com/KogarashiNetwork/Kogarashi/tree/master/zkstd
[`jub-jub`]: https://github.com/KogarashiNetwork/Kogarashi/tree/master/jubjub
[`bls-12-381`]: https://github.com/KogarashiNetwork/Kogarashi/tree/master/bls12_381
[`ec-pairing`]: https://github.com/KogarashiNetwork/Kogarashi/tree/master/pairing
[`she-elgamal`]: https://github.com/KogarashiNetwork/Kogarashi/tree/master/elgamal
[`poly-commit`]: https://github.com/KogarashiNetwork/Kogarashi/tree/master/poly
10 changes: 10 additions & 0 deletions bls12_381/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,15 @@ parity-scale-codec = { version = "2.0.0", default-features = false, features = [
zkstd = { path = "../zkstd", default-features = false }

[dev-dependencies]
criterion = "0.4.0"
rand = { version = "0.8" }
paste = "1.0.11"
proptest = "1"

[[bench]]
name = "bls12_381_curve"
harness = false

[[bench]]
name = "bls12_381_field"
harness = false
File renamed without changes.
File renamed without changes.
10 changes: 10 additions & 0 deletions jubjub/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,15 @@ parity-scale-codec = { version = "2.0.0", default-features = false, features = [
rand_core = { version="0.6.4", default-features = false }

[dev-dependencies]
criterion = "0.4.0"
rand = { version = "0.8" }
proptest = "1"
paste = "1.0.11"

[[bench]]
name = "jubjub_curve"
harness = false

[[bench]]
name = "jubjub_field"
harness = false
File renamed without changes.
File renamed without changes.
6 changes: 6 additions & 0 deletions pairing/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,10 @@ jub-jub = { path = "../jubjub", default-features = false }
parity-scale-codec = { version = "2.0.0", default-features = false, features = ["derive"] }

[dev-dependencies]
criterion = "0.4.0"
rand = { version = "0.8" }
rand_core = { version="0.6.4", features = ["getrandom"] }

[[bench]]
name = "pairing"
harness = false
File renamed without changes.
7 changes: 7 additions & 0 deletions poly/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,15 @@ rand_core = { version = "0.6", default-features = false }
rayon = { version = "1.5.1", optional = true }

[dev-dependencies]
criterion = "0.4.0"
rand = { version = "0.8" }
zksnarks = { path = "../zksnarks" }

[features]
default = ["std"]
std = ["rand_core/getrandom", "rayon"]

[[bench]]
name = "msm"
harness = false
required-features = ["std"]
File renamed without changes.
1 change: 0 additions & 1 deletion src/lib.rs

This file was deleted.

0 comments on commit c5186dc

Please sign in to comment.