Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move R1CS compiler to manta-crypto #284

Merged
merged 5 commits into from
Nov 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
### Added

### Changed
- [\#284](https://github.com/Manta-Network/manta-rs/pull/284) Moved `R1CS` implementation to `manta-crypto`
- [\#282](https://github.com/Manta-Network/manta-rs/pull/282) Upgrade key system.

### Deprecated
Expand Down
23 changes: 23 additions & 0 deletions manta-accounting/src/asset.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ use core::{
};
use derive_more::{Add, AddAssign, Display, From, Sub, SubAssign, Sum};
use manta_crypto::{
constraint::{Input, ProofSystem},
eclair::alloc::{mode::Secret, Allocate, Allocator, Variable},
rand::{Rand, RngCore, Sample},
};
Expand Down Expand Up @@ -120,6 +121,17 @@ impl From<AssetId> for [u8; AssetId::SIZE] {
}
}

impl<P> Input<P> for AssetId
where
P: ProofSystem,
AssetIdType: Input<P>,
{
#[inline]
fn extend(&self, input: &mut P::Input) {
self.0.extend(input);
}
}

impl PartialEq<AssetIdType> for AssetId {
#[inline]
fn eq(&self, rhs: &AssetIdType) -> bool {
Expand Down Expand Up @@ -251,6 +263,17 @@ impl From<AssetValue> for [u8; AssetValue::SIZE] {
}
}

impl<P> Input<P> for AssetValue
where
P: ProofSystem,
AssetValueType: Input<P>,
{
#[inline]
fn extend(&self, input: &mut P::Input) {
self.0.extend(input);
}
}

impl PartialEq<AssetValueType> for AssetValue {
#[inline]
fn eq(&self, rhs: &AssetValueType) -> bool {
Expand Down
11 changes: 9 additions & 2 deletions manta-crypto/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ arkworks = [
"ark-r1cs-std",
"ark-relations",
"ark-serialize",
"ark-snark",
"ark-std"
]

# Dalek Cryptography Backend
Expand All @@ -45,7 +47,7 @@ serde = [
"ed25519-dalek?/serde",
"manta-util/serde-alloc",
"manta-util/serde-array",
"rand_chacha?/serde1",
"rand_chacha?/serde1"
]

# Standard Library
Expand All @@ -56,12 +58,14 @@ std = [
"ark-ed-on-bls12-381?/std",
"ark-ed-on-bn254?/std",
"ark-ff?/std",
"ark-groth16?/std",
"ark-r1cs-std?/std",
"ark-relations?/std",
"ark-serialize?/std",
"ark-std?/std",
"manta-util/std",
"rand?/std",
"rand_chacha?/std",
"rand_chacha?/std"
]

# Testing Frameworks
Expand All @@ -74,9 +78,12 @@ ark-ec = { version = "0.3.0", optional = true, default-features = false }
ark-ed-on-bls12-381 = { version = "0.3.0", optional = true, default-features = false, features = ["r1cs"] }
ark-ed-on-bn254 = { version = "0.3.0", optional = true, default-features = false, features = ["r1cs"] }
ark-ff = { version = "0.3.0", optional = true, default-features = false }
ark-groth16 = { version = "0.3.0", optional = true, default-features = false }
ark-r1cs-std = { version = "0.3.1", optional = true, default-features = false }
ark-relations = { version = "0.3.0", optional = true, default-features = false }
ark-serialize = { version = "0.3.0", optional = true, default-features = false, features = ["derive"] }
ark-snark = { version = "0.3.0", optional = true, default-features = false }
ark-std = { version = "0.3.0", optional = true, default-features = false }
derivative = { version = "2.2.0", default-features = false, features = ["use_core"] }
ed25519-dalek = { version = "1.0.1", optional = true, default-features = false, features = ["u64_backend"] }
manta-util = { path = "../manta-util", default-features = false, features = ["alloc"] }
Expand Down
Loading