Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Komodo
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Dragoon
Komodo
Commits
6170d5c2
Commit
6170d5c2
authored
1 year ago
by
STEVAN Antoine
Browse files
Options
Downloads
Patches
Plain Diff
add documentation to zk module (
!61
)
woopsie, it was missing from
!54
parent
1b26be8c
No related branches found
No related tags found
1 merge request
!61
add documentation to zk module
Pipeline
#4689
passed
1 year ago
Stage: fmt
Stage: test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/zk.rs
+8
-0
8 additions, 0 deletions
src/zk.rs
with
8 additions
and
0 deletions
src/zk.rs
+
8
−
0
View file @
6170d5c2
...
...
@@ -6,6 +6,9 @@ use ark_std::{end_timer, rand::RngCore, start_timer};
use
crate
::
error
::
KomodoError
;
/// the representation of a ZK trusted setup
///
/// this is a simple wrapper around a sequence of elements of the curve.
#[derive(Debug,
Clone,
Default,
CanonicalSerialize,
CanonicalDeserialize,
PartialEq)]
pub
struct
Powers
<
F
:
PrimeField
,
G
:
CurveGroup
<
ScalarField
=
F
>>
(
Vec
<
G
::
Affine
>
);
...
...
@@ -24,9 +27,13 @@ impl<F: PrimeField, G: CurveGroup<ScalarField = F>> IntoIterator for Powers<F, G
}
}
/// a ZK commitment, i.e. an evaluatio of a given polynomial on a secret
///
/// this is a simpler wrapper around a single elemenf of the curve.
#[derive(Debug,
Clone,
Copy,
Default,
CanonicalSerialize,
CanonicalDeserialize,
PartialEq)]
pub
struct
Commitment
<
F
:
PrimeField
,
G
:
CurveGroup
<
ScalarField
=
F
>>
(
pub
G
::
Affine
);
/// create a trusted setup of a given size, the expected maximum degree of the data
pub
fn
setup
<
R
:
RngCore
,
F
:
PrimeField
,
G
:
CurveGroup
<
ScalarField
=
F
>>
(
max_degree
:
usize
,
rng
:
&
mut
R
,
...
...
@@ -92,6 +99,7 @@ fn convert_to_bigints<F: PrimeField>(p: &[F]) -> Vec<F::BigInt> {
coeffs
}
/// compute a commitment of a polynomial on a trusted setup
pub
fn
commit
<
F
,
G
,
P
>
(
powers
:
&
Powers
<
F
,
G
>
,
polynomial
:
&
P
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment