-
Notifications
You must be signed in to change notification settings - Fork 1
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
[WAR-489] DKG test mockup using Fp and sample tracing #21
Merged
Merged
Changes from 1 commit
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
6f19578
[WAR-489] DKG test mockup using Fp
merolish 059c0e0
Example commitment fail/kick
merolish 55a0971
Merge branch 'main' of https://github.com/warlock-labs/alt-bn128-bls …
merolish 14e6e45
Merge branch 'main' of https://github.com/warlock-labs/alt-bn128-bls …
merolish 54dbfcb
Move dkg to examples
merolish c0e15c0
Merge branch 'main' of https://github.com/warlock-labs/alt-bn128-bls …
merolish 42e7fc3
Fix config
merolish dd25ede
cleanup
merolish 5391601
fmt
merolish 94d1d9f
clippy
merolish acd1593
Some debug tracing for intermediate operations
merolish 003c8da
review fixes
merolish 4d2f531
Add Eq/Hash for Fp to support use as hash key
merolish 25d2c8f
Merge branch 'main' of https://github.com/warlock-labs/alt-bn128-bls …
merolish de8b2b2
More tracing
merolish 6a87548
fix, yet more tracing
merolish 82426c6
typo fix
merolish d303b0b
Remove unused fields from example
merolish 3375169
Merge branch 'main' of https://github.com/warlock-labs/alt-bn128-bls …
merolish File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -109,6 +109,7 @@ impl MillerLoopResult { | |
let t1 = b.square(); | ||
// Line 3 | ||
let c0 = t1.residue_mul(); | ||
tracing::debug!(?t0, ?t1, ?c0, "MillerLoopResult::fp4_square"); | ||
// Line 4 | ||
let c0 = c0 + t0; | ||
// Line 5 | ||
|
@@ -130,6 +131,7 @@ impl MillerLoopResult { | |
let mut z5 = f.0[1].0[2]; | ||
// Line 9 | ||
let (t0, t1) = fp4_square(z0, z1); | ||
tracing::debug!(?t0, ?t1, "MillerLoopResult::cyclotonic_squared"); | ||
// Line 13-22 for A | ||
z0 = t0 - z0; | ||
z0 = z0 + z0 + t0; | ||
|
@@ -139,6 +141,7 @@ impl MillerLoopResult { | |
|
||
let (mut t0, t1) = fp4_square(z2, z3); | ||
let (t2, t3) = fp4_square(z4, z5); | ||
tracing::debug!(?t0, ?t1, ?t2, ?t3, "MillerLoopResult::cyclotonic_squared"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. see above comment |
||
|
||
// Lines 25-31, for C | ||
z4 = t0 - z4; | ||
|
@@ -220,6 +223,30 @@ impl MillerLoopResult { | |
let s = input.unitary_inverse(); | ||
let t = s * l; | ||
let u = t.frobenius(3); | ||
tracing::debug!( | ||
?a, | ||
?b, | ||
?c, | ||
?d, | ||
?e, | ||
?f, | ||
?g, | ||
?h, | ||
?i, | ||
?j, | ||
?k, | ||
?l, | ||
?m, | ||
?n, | ||
?o, | ||
?p, | ||
?q, | ||
?r, | ||
?s, | ||
?t, | ||
?u, | ||
"MillerLoopResult::hard_part" | ||
); | ||
u * r | ||
} | ||
|
||
|
@@ -265,20 +292,24 @@ impl G2PreComputed { | |
let c = &self.coeffs[idx]; | ||
idx += 1; | ||
f = f.square().sparse_mul(c.0, c.1.scale(g1.y), c.2.scale(g1.x)); | ||
tracing::debug!(?idx, ?f, "G2PreComputed::miller_loop"); | ||
|
||
if *i != 0 { | ||
let c = &self.coeffs[idx]; | ||
idx += 1; | ||
f = f.sparse_mul(c.0, c.1.scale(g1.y), c.2.scale(g1.x)); | ||
tracing::debug!(?idx, ?f, "G2PreComputed::miller_loop"); | ||
} | ||
} | ||
|
||
let c = &self.coeffs[idx]; | ||
idx += 1; | ||
f = f.sparse_mul(c.0, c.1.scale(g1.y), c.2.scale(g1.x)); | ||
tracing::debug!(?idx, ?f, "G2PreComputed::miller_loop"); | ||
|
||
let c = &self.coeffs[idx]; | ||
f = f.sparse_mul(c.0, c.1.scale(g1.y), c.2.scale(g1.x)); | ||
tracing::debug!(?idx, ?f, "G2PreComputed::miller_loop"); | ||
|
||
MillerLoopResult(f) | ||
} | ||
|
@@ -343,6 +374,7 @@ impl G2Projective { | |
let h = d * f; | ||
let i = self.x * f; | ||
let j = self.z * g + h - (i + i); | ||
tracing::debug!(?d, ?e, ?f, ?g, ?h, ?i, ?j, "G2Projective::addition_step"); | ||
|
||
self.x = d * j; | ||
self.y = e * (i - j) - h * self.y; | ||
|
@@ -366,6 +398,7 @@ impl G2Projective { | |
let i = e - b; | ||
let j = self.x.square(); | ||
let e_sq = e.square(); | ||
tracing::debug!(?f, ?g, ?h, ?i, ?j, ?e_sq, "G2Projective::doubling_step"); | ||
|
||
self.x = a * (b - f); | ||
self.y = g.square() - (e_sq + e_sq + e_sq); | ||
|
@@ -394,6 +427,7 @@ pub fn pairing(p: &G1Projective, q: &G2Projective) -> Gt { | |
let q = G2Affine::conditional_select(q, &G2Affine::generator(), either_zero); | ||
let tmp = q.precompute().miller_loop(&p).0; | ||
let tmp = MillerLoopResult(Fp12::conditional_select(&tmp, &Fp12::one(), either_zero)); | ||
tracing::debug!(?p, ?q, ?tmp, "pairing"); | ||
tmp.final_exponentiation() | ||
} | ||
|
||
|
@@ -423,11 +457,13 @@ pub fn glued_miller_loop(g2_precomps: &[G2PreComputed], g1s: &[G1Affine]) -> Mil | |
idx += 1; | ||
} | ||
} | ||
tracing::debug!(?f, "glued_miller_loop 1"); | ||
|
||
for (g2_precompute, g1) in g2_precomps.iter().zip(g1s.iter()) { | ||
let c = &g2_precompute.coeffs[idx]; | ||
f = f.sparse_mul(c.0, c.1.scale(g1.y), c.2.scale(g1.x)); | ||
} | ||
tracing::debug!(?f, "glued_miller_loop 2"); | ||
idx += 1; | ||
for (g2_precompute, g1) in g2_precomps.iter().zip(g1s.iter()) { | ||
let c = &g2_precompute.coeffs[idx]; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typos here and in line 144, should be "cyclotomic" with an "m", not "cyclotonic"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops.