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

Ark nifs #8

Merged
merged 3 commits into from
Dec 16, 2023
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
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
"./Cargo.toml",
"./Cargo.toml",
"./Cargo.toml",
"./Cargo.toml",
"./Cargo.toml",
"./Cargo.toml",
"./Cargo.toml"
]
}
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ rayon = "1.7"
num-traits = "0.2"
digest = "0.10"
generic-array = "1.0.0"
ark-bn254 = "0.4.0"

ark-crypto-primitives = { version = "0.4.0", default-features = false, features = [
"sponge",
Expand All @@ -22,6 +23,5 @@ ark-std = { version = "0.4.0", default-features = false }
ark-ec = {version = "0.4.0", default-features = false}
ark-ff = {version= "0.4.0", default-features = false}
ark-poly = {version = "0.4.0", default-features = false}
ark-bn254 = "0.4.0"
jf_primitives = {git = "https://github.com/EspressoSystems/jellyfish", package = "jf-primitives"}
jf_utils = {git = "https://github.com/EspressoSystems/jellyfish", package = "jf-utils"}
8 changes: 8 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
pub mod error;
pub mod nifs;
pub mod plonk;
pub mod poseidon;
pub mod primary;
pub mod provider;
pub mod secondary;
pub mod traits;

type Commitment<G> = <<G as traits::Group>::CE as traits::CommitmentEngineTrait<G>>::Commitment;
type CommitmentKey<G> =
<<G as traits::Group>::CE as traits::CommitmentEngineTrait<G>>::CommitmentKey;
42 changes: 42 additions & 0 deletions src/nifs.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
use crate::{
error::MyError,
plonk::*,
traits::{Group, ROConstantsTrait, ROTrait},
Commitment, CommitmentKey,
};
use std::marker::PhantomData;

pub struct NIFS<G: Group> {
pub(crate) comm_T: Commitment<G>,
_p: PhantomData<G>,
}

impl<G: Group> NIFS<G> {
pub fn prove(
ck: &CommitmentKey<G>,
pp_digest: &<G as Group>::ScalarField,
S: &PLONKShape<G>,
U1: &RelaxedPLONKInstance<G>,
W1: &RelaxedPLONKWitness<G>,
U2: &PLONKInstance<G>,
W2: &PLONKWitness<G>,
) -> Result<(NIFS<G>, (RelaxedPLONKInstance<G>, RelaxedPLONKWitness<G>)), MyError> {
let constants = <<G as Group>::RO as ROTrait<
<G as Group>::BaseField,
<G as Group>::ScalarField,
>>::Constants::new(3);
let ro = <<G as Group>::RO as ROTrait<
<G as Group>::BaseField,
<G as Group>::ScalarField,
>>::new(constants.clone());
todo!()
}
pub fn verifiy(
&self,
pp_digest: &<G as Group>::ScalarField,
U1: &RelaxedPLONKInstance<G>,
U2: &PLONKInstance<G>,
) -> Result<RelaxedPLONKInstance<G>, MyError> {
todo!()
}
}
Loading
Loading