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

Migrate Crypto Upgrades from #153 #197

Merged
merged 16 commits into from
Aug 23, 2022
Merged
Show file tree
Hide file tree
Changes from 10 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
5 changes: 1 addition & 4 deletions .github/workflows/audit.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
name: Audit
on:
pull_request:
push:
schedule:
- cron: '0 */12 * * *'
workflow_dispatch:
jobs:
audit:
runs-on: ubuntu-latest
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/bench.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
name: Benchmark
on:
push:
branches:
- 'main'
workflow_dispatch:
env:
CARGO_TERM_COLOR: always
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:
- 'main'
schedule:
- cron: '0 0 * * */2'
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
## [Unreleased]
### Added
- [\#172](https://github.com/Manta-Network/manta-rs/pull/172) Add abstract Phase 2 for Groth16 trusted setup
- [\#197](https://github.com/Manta-Network/manta-rs/pull/197) Add ECLAIR utilities for next circuit upgrade

### Changed
- [\#180](https://github.com/Manta-Network/manta-rs/pull/180) Start moving to new `arkworks` backend for `manta-crypto`
Expand Down
17 changes: 8 additions & 9 deletions manta-accounting/src/transfer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ use alloc::vec::Vec;
use core::{fmt::Debug, hash::Hash, marker::PhantomData, ops::Deref};
use manta_crypto::{
accumulator::{self, AssertValidVerification, MembershipProof, Model},
constraint::{ProofSystem, ProofSystemInput},
constraint::{HasInput, ProofSystem},
eclair::{
self,
alloc::{
Expand Down Expand Up @@ -236,12 +236,12 @@ pub trait Configuration {

/// Proof System Type
type ProofSystem: ProofSystem<Compiler = Self::Compiler>
+ ProofSystemInput<AssetId>
+ ProofSystemInput<AssetValue>
+ ProofSystemInput<UtxoAccumulatorOutput<Self>>
+ ProofSystemInput<Utxo<Self>>
+ ProofSystemInput<VoidNumber<Self>>
+ ProofSystemInput<PublicKey<Self>>;
+ HasInput<AssetId>
+ HasInput<AssetValue>
+ HasInput<UtxoAccumulatorOutput<Self>>
+ HasInput<Utxo<Self>>
+ HasInput<VoidNumber<Self>>
+ HasInput<PublicKey<Self>>;

/// Note Base Encryption Scheme Type
type NoteEncryptionScheme: encryption::Encrypt<
Expand Down Expand Up @@ -297,8 +297,7 @@ pub type UtxoAccumulatorOutput<C> =
pub type UtxoMembershipProof<C> = MembershipProof<<C as Configuration>::UtxoAccumulatorModel>;

/// UTXO Membership Proof Variable Type
pub type UtxoMembershipProofVar<C> =
MembershipProof<<C as Configuration>::UtxoAccumulatorModelVar, Compiler<C>>;
pub type UtxoMembershipProofVar<C> = MembershipProof<<C as Configuration>::UtxoAccumulatorModelVar>;

/// Encrypted Note Type
pub type EncryptedNote<C> = EncryptedMessage<
Expand Down
13 changes: 1 addition & 12 deletions manta-accounting/src/transfer/receiver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ use crate::{
};
use core::{fmt::Debug, hash::Hash, iter};
use manta_crypto::{
accumulator::Accumulator,
constraint::ProofSystemInput,
constraint::HasInput,
eclair::{
alloc::{
mode::{Derived, Public},
Expand Down Expand Up @@ -97,16 +96,6 @@ where
self.encrypted_note.ephemeral_public_key()
}

/// Returns `true` whenever `self.utxo` and `rhs.utxo` can be inserted in any order into the
/// `utxo_accumulator`.
#[inline]
pub fn is_independent_from<A>(&self, rhs: &Self, utxo_accumulator: &A) -> bool
where
A: Accumulator<Item = Utxo<C>, Model = C::UtxoAccumulatorModel>,
{
utxo_accumulator.are_independent(&self.utxo, &rhs.utxo)
}

/// Extracts the ledger posting data from `self`.
#[inline]
pub fn into_post(self) -> ReceiverPost<C> {
Expand Down
22 changes: 1 addition & 21 deletions manta-accounting/src/transfer/sender.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ use crate::{
use core::{fmt::Debug, hash::Hash, iter};
use manta_crypto::{
accumulator::Accumulator,
constraint::ProofSystemInput,
constraint::HasInput,
eclair::{
alloc::{mode::Derived, Allocate, Allocator, Variable},
bool::AssertEq,
Expand Down Expand Up @@ -142,16 +142,6 @@ where
None
}
}

/// Returns `true` whenever `self.utxo` and `rhs.utxo` can be inserted in any order into the
/// `utxo_accumulator`.
#[inline]
pub fn is_independent_from<A>(&self, rhs: &Self, utxo_accumulator: &A) -> bool
where
A: Accumulator<Item = Utxo<C>, Model = C::UtxoAccumulatorModel>,
{
utxo_accumulator.are_independent(&self.utxo, &rhs.utxo)
}
}

/// Sender Proof
Expand Down Expand Up @@ -211,16 +201,6 @@ where
self.asset.value
}

/// Returns `true` whenever `self.utxo` and `rhs.utxo` can be inserted in any order into the
/// `utxo_accumulator`.
#[inline]
pub fn is_independent_from<A>(&self, rhs: &Self, utxo_accumulator: &A) -> bool
where
A: Accumulator<Item = Utxo<C>, Model = C::UtxoAccumulatorModel>,
{
utxo_accumulator.are_independent(&self.utxo, &rhs.utxo)
}

/// Reverts `self` back into a [`PreSender`].
///
/// This method should be called if the [`Utxo`] membership proof attached to `self` was deemed
Expand Down
3 changes: 2 additions & 1 deletion manta-crypto/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,5 @@ rand_core = { version = "0.6.3", default-features = false }
workspace-hack = { version = "0.1.0", path = "../workspace-hack" }

[dev-dependencies]
rand = "0.8.4"
ark-bn254 = { version = "0.3.0", default-features = false, features = ["scalar_field"] }
manta-crypto = { path = ".", default-features = false, features = ["getrandom"] }
Loading