Skip to content

Commit

Permalink
Merge pull request #121 from dusk-network/port_contracts
Browse files Browse the repository at this point in the history
- Restructure the Citadel protocol implementation (now in the /core folder)
- Port the license contract to this repository (now in the /contract folder)
  • Loading branch information
xevisalle authored Nov 28, 2024
2 parents bf6527e + c1d492d commit 90bc004
Show file tree
Hide file tree
Showing 31 changed files with 1,877 additions and 916 deletions.
21 changes: 16 additions & 5 deletions .github/workflows/dusk_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,22 @@ jobs:

test_std:
name: Stable toolchain tests
uses: dusk-network/.github/.github/workflows/run-tests.yml@main
runs-on: core
steps:
- uses: actions/checkout@v4
- uses: dsherret/rust-toolchain-file@v1
- run: cargo b --release
- run: rustup target add wasm32-unknown-unknown
- run: cd contract && cargo b --target wasm32-unknown-unknown --release
- run: cargo t --release

test_no_std:
name: Stable toolchain no_std tests
uses: dusk-network/.github/.github/workflows/run-tests.yml@main
with:
test_flags: --no-default-features

runs-on: core
steps:
- uses: actions/checkout@v4
- uses: dsherret/rust-toolchain-file@v1
- run: cargo b --release
- run: rustup target add wasm32-unknown-unknown
- run: cd contract && cargo b --target wasm32-unknown-unknown --release
- run: cargo t --release --no-default-features
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/target/
/setup/
**/target/
Cargo.lock
**/*.rs.bk
.DS_Store
Expand Down
44 changes: 9 additions & 35 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,35 +1,9 @@
[package]
name = "zk-citadel"
version = "0.14.0"
repository = "https://github.com/dusk-network/citadel"
description = "Implementation of Citadel, a SSI system integrated in Dusk Network."
categories = ["cryptography", "authentication", "mathematics", "science"]
keywords = ["cryptography", "self-sovereign", "identity", "zk-snarks", "zero-knowledge"]
edition = "2021"
license = "MPL-2.0"

[dependencies]
dusk-bytes = "0.1"
dusk-poseidon = { version = "0.40", features = ["zk"] }
poseidon-merkle = { version = "0.7", features = ["rkyv-impl", "zk", "size_32"] }
dusk-plonk = { version = "0.20", default-features = false, features = ["rkyv-impl", "alloc"] }
dusk-bls12_381 = { version = "0.13", default-features = false, features = ["rkyv-impl", "alloc"] }
dusk-jubjub = { version = "0.14", default-features = false, features = ["rkyv-impl", "alloc"] }
ff = { version = "0.13", default-features = false }
jubjub-schnorr = { version = "0.5", features = ["zk", "rkyv-impl", "alloc"] }
phoenix-core = { version = "0.32", features = ["rkyv-impl", "alloc"] }
rand_core = { version = "0.6", default-features=false, features = ["getrandom"] }
rkyv = { version = "0.7", default-features = false }
bytecheck = { version = "0.6", default-features = false }

[dev-dependencies]
criterion = "0.5"
lazy_static = "1.4"

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

[features]
rkyv-impl = []
default=["rkyv-impl"]
[workspace]
members = [
"core",
"contract",
]
resolver = "2"

[profile.release.build-override]
opt-level = 3
24 changes: 7 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,14 @@
# Citadel: Self-Sovereign Identities on Dusk

![Build Status](https://github.com/dusk-network/citadel/workflows/Continuous%20integration/badge.svg)
![Build Status](https://github.com/dusk-network/citadel/actions/workflows/dusk_ci.yml/badge.svg)
[![Repository](https://img.shields.io/badge/github-citadel-blueviolet?logo=github)](https://github.com/dusk-network/citadel)

This repository contains the implementation of Citadel, a protocol that integrates a self-sovereign identity system into the Dusk blockchain. A document with all the details about the protocol can be found [here](https://github.com/dusk-network/citadel/tree/main/docs/specs.pdf).
This repository contains the implementation of Citadel, a protocol that integrates a self-sovereign identity system into the Dusk blockchain. Our implementation is based on the original idea from this [paper](https://arxiv.org/pdf/2301.09378).

**DISCLAIMER**: this library **has not gone through an exhaustive security analysis**, so it is not intended to be used in a production environment, only for academic purposes.
This repository is structured as follows:

## Tests
- :computer: [**Core**](core): the core Citadel protocol implementation, containing all the involved data types, the protocol workflows, and the license circuit.
- :pencil: [**License Contract**](contract): The license contract, along with all the required code to test and deploy it.
- :scroll: [**Docs**](docs): A folder where you can find the documentation concerning the our Citadel specific implementation.

The library can be tested by running:

```
cargo t --release
```

## Benchmarks

The library can be benchmarked by running:

```
cargo bench
```
**DISCLAIMER**: the code in this repository **has not gone through an exhaustive security analysis**, so it is not intended to be used in a production environment, only for academic purposes.
184 changes: 0 additions & 184 deletions benches/citadel.rs

This file was deleted.

39 changes: 39 additions & 0 deletions contract/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# 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

### Added

- Renamed method 'noop' to 'request_license' [#1151]
- Added method 'get_info' [#1052]

### Changed

- Change dependencies declarations enforce bytecheck [#1371]
- Changed 'get_licenses' to use feeder for passing return values [#1054]
- Changed 'use_license' to check if license already nullified [#1051]
- Changed 'get_licenses' to return values by adding 'pos' to every license returned [#1040]
- Changed 'issue_license' by removing the 'pos' argument and self position determination [#1039]
- Fixed `license` tests error when creating `PublicParameters` from a slice
- Moved the `license-contract` to the `Citadel` repository [#122]

## [0.1.0] - 2023-07-13

### Added

- Add `license` contract to Rusk [#960]

[#122]: https://github.com/dusk-network/citadel/issues/122
[#1371]: https://github.com/dusk-network/rusk/issues/1371
[#1151]: https://github.com/dusk-network/rusk/issues/1151
[#1054]: https://github.com/dusk-network/rusk/issues/1054
[#1052]: https://github.com/dusk-network/rusk/issues/1052
[#1051]: https://github.com/dusk-network/rusk/issues/1051
[#1040]: https://github.com/dusk-network/rusk/issues/1040
[#1039]: https://github.com/dusk-network/rusk/issues/1039
[#960]: https://github.com/dusk-network/rusk/issues/960
34 changes: 34 additions & 0 deletions contract/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
[package]
name = "license-contract"
version = "0.1.0"
edition = "2021"

[lib]
crate-type = ["cdylib", "rlib"]

[dependencies]
dusk-bls12_381 = { version = "=0.13.0", default-features = false }
rkyv = { version = "=0.7.39", default-features = false, features = ["size_32"] }
bytecheck = { version = "=0.6.12", default-features = false }
poseidon-merkle = { version = "=0.7.0", features = ["rkyv-impl"] }

[target.'cfg(target_family = "wasm")'.dependencies]
rusk-abi = { version = "0.13.0-rc.0", git = "https://github.com/dusk-network/rusk/", branch = "master", features = ["abi", "dlmalloc"] }

[build-dependencies]
zk-citadel = { path = "../core"}
dusk-plonk = { version = "0.20", default-features = false, features = ["rkyv-impl", "alloc"] }
rand_core = { version = "0.6", default-features=false, features = ["getrandom"] }
reqwest = "0.12"
tokio = { version = "1.41.1", features = ["macros", "rt-multi-thread"] }
build-print = "0.1.1"
sha2 = { version = "0.10.8", default-features = false }

[dev-dependencies]
execution-core = { version = "0.1.0", git = "https://github.com/dusk-network/rusk/", branch = "master", features = ["zk"] }
rusk-abi = { version = "0.13.0-rc.0", git = "https://github.com/dusk-network/rusk/", branch = "master", default-features = false, features = ["host"] }
zk-citadel = { path = "../core"}
ff = { version = "=0.13.0", default-features = false }
rand = { version = "=0.8.5", default-features = false }
dusk-poseidon = "=0.40.0"
dusk-bytes = "=0.1.7"
Loading

0 comments on commit 90bc004

Please sign in to comment.