-
Notifications
You must be signed in to change notification settings - Fork 93
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
Simple mixed merkle tree #525
Conversation
This stack of pull requests is managed by Graphite. Learn more about stacking. Join @spapinistarkware and the rest of your teammates on Graphite |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## spapini/03-20-avx_blake #525 +/- ##
===========================================================
+ Coverage 95.40% 95.47% +0.07%
===========================================================
Files 65 68 +3
Lines 9678 9963 +285
Branches 9678 9963 +285
===========================================================
+ Hits 9233 9512 +279
- Misses 387 389 +2
- Partials 58 62 +4 ☔ View full report in Codecov by Sentry. |
1cdc3c2
to
b8b4d6b
Compare
fad54a8
to
7b36b0e
Compare
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.
Reviewable status: 0 of 5 files reviewed, 4 unresolved discussions (waiting on @andrewmilson and @spapinistarkware)
src/commitment_scheme/prover.rs
line 10 at r2 (raw file):
pub struct MerkleProver<B: MerkleOps<H>, H: MerkleHasher> { pub layers: Vec<Col<B, H::Hash>>,
Document (also the order)
Code quote:
pub layers: Vec<Col<B, H::Hash>>,
src/commitment_scheme/prover.rs
line 13 at r2 (raw file):
} impl<B: MerkleOps<H>, H: MerkleHasher> MerkleProver<B, H> { /// Commits to columns.
Document: Each column leaves is in the height of the length of the column
Code quote:
/// Commits to columns.
src/commitment_scheme/prover.rs
line 51 at r2 (raw file):
if layer.len() > 1 { witness.push(layer.at(query ^ 1)); }
Remove and replace with
for layer in &self.layers[:-1]
Code quote:
if layer.len() > 1 {
witness.push(layer.at(query ^ 1));
}
src/commitment_scheme/verifier.rs
line 16 at r2 (raw file):
impl<H: MerkleHasher> MerkleTreeVerifier<H> { /// Verifies the decommitment of the columns. /// Queries are given as indices to the largest column.
We are assuming that this is enough
Code quote:
/// Queries are given as indices to the largest column.
b8b4d6b
to
9f67f18
Compare
7b36b0e
to
74d0ad5
Compare
9f67f18
to
884140b
Compare
74d0ad5
to
c1ab684
Compare
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.
Reviewable status: 0 of 5 files reviewed, 4 unresolved discussions (waiting on @andrewmilson and @shaharsamocha7)
src/commitment_scheme/prover.rs
line 10 at r2 (raw file):
Previously, shaharsamocha7 wrote…
Document (also the order)
Done.
src/commitment_scheme/prover.rs
line 13 at r2 (raw file):
Previously, shaharsamocha7 wrote…
Document: Each column leaves is in the height of the length of the column
Done.
src/commitment_scheme/prover.rs
line 51 at r2 (raw file):
Previously, shaharsamocha7 wrote…
Remove and replace with
for layer in &self.layers[:-1]
Done.
src/commitment_scheme/verifier.rs
line 16 at r2 (raw file):
Previously, shaharsamocha7 wrote…
We are assuming that this is enough
Done.
c1ab684
to
027ceda
Compare
884140b
to
f1c6f1c
Compare
027ceda
to
d3176d8
Compare
f1c6f1c
to
ec5d9d8
Compare
d3176d8
to
16a10c7
Compare
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.
Reviewed 2 of 3 files at r2, 2 of 2 files at r3, 1 of 1 files at r4, all commit messages.
Reviewable status: all files reviewed, 6 unresolved discussions (waiting on @andrewmilson and @spapinistarkware)
src/commitment_scheme/ops.rs
line 9 at r4 (raw file):
/// The node may or may not need to hash 2 hashes from the previous layer - depending if it is a /// leaf or not. /// In addition, the node may have extra column values that need to be hashed.
How did ohad describe that as well?
Code quote:
/// Hashes a single Merkle node.
/// The node may or may not need to hash 2 hashes from the previous layer - depending if it is a
/// leaf or not.
/// In addition, the node may have extra column values that need to be hashed.
src/commitment_scheme/prover.rs
line 14 at r3 (raw file):
/// The last layer is the root. /// Layer n holds the 2^n hashes of the previous layer if exists, and all the columns of size /// 2^n.
How did Ohad described that?
Code quote:
/// Layer n holds the 2^n hashes of the previous layer if exists, and all the columns of size
/// 2^n.
src/commitment_scheme/verifier.rs
line 21 at r3 (raw file):
/// /// * `queries` - A vector of indices representing the queries to the largest column. This is /// assumed to be sufficient for our use case, though it could be extended to support queries
for bit reversed commitments
Code quote:
for our use case
src/commitment_scheme/verifier.rs
line 79 at r4 (raw file):
} struct MerkleVerifier<H: MerkleHasher> {
Document
Code quote:
struct MerkleVerifier<H: MerkleHasher> {
src/commitment_scheme/verifier.rs
line 82 at r4 (raw file):
witness: std::vec::IntoIter<<H as MerkleHasher>::Hash>, column_values: Peekable<std::vec::IntoIter<(u32, Vec<BaseField>)>>, layer_column_values: Vec<std::vec::IntoIter<BaseField>>,
document all
Code quote:
witness: std::vec::IntoIter<<H as MerkleHasher>::Hash>,
column_values: Peekable<std::vec::IntoIter<(u32, Vec<BaseField>)>>,
layer_column_values: Vec<std::vec::IntoIter<BaseField>>,
src/commitment_scheme/verifier.rs
line 162 at r4 (raw file):
children_hashes: ChildrenHashesAtQuery<H>, ) -> Result<H::Hash, MerkleVerificationError> { let hashes_part = children_hashes
Read witness from decommitment if not already known.
Code quote:
let hashes_part = children_hashes
ec5d9d8
to
da3de7d
Compare
16a10c7
to
5db48f0
Compare
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.
Reviewable status: all files reviewed, 5 unresolved discussions (waiting on @andrewmilson and @shaharsamocha7)
src/commitment_scheme/ops.rs
line 9 at r4 (raw file):
Previously, shaharsamocha7 wrote…
How did ohad describe that as well?
Done.
src/commitment_scheme/prover.rs
line 14 at r3 (raw file):
Previously, shaharsamocha7 wrote…
How did Ohad described that?
Done.
src/commitment_scheme/verifier.rs
line 79 at r4 (raw file):
Previously, shaharsamocha7 wrote…
Document
Done.
src/commitment_scheme/verifier.rs
line 82 at r4 (raw file):
Previously, shaharsamocha7 wrote…
document all
Done.
src/commitment_scheme/verifier.rs
line 162 at r4 (raw file):
Previously, shaharsamocha7 wrote…
Read witness from decommitment if not already known.
Done.
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.
Reviewed 3 of 3 files at r5, all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @andrewmilson and @spapinistarkware)
src/commitment_scheme/ops.rs
line 8 at r5 (raw file):
/// "[]" denotes optional values. /// The largest Merkle layer has no left and right child hashes. The rest of the layers have /// children hases
Suggestion:
/// The largest Merkle layer has no left and right child hashes. The rest of the layers have
/// children hashes
src/commitment_scheme/verifier.rs
line 79 at r5 (raw file):
} /// A helper struct for verifying a [Decommitment].
Rename to MerkleDecommitment
Suggestion:
/// A helper struct for verifying a [MerkleDecommitment].
5db48f0
to
43bb6bf
Compare
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.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @andrewmilson and @shaharsamocha7)
src/commitment_scheme/ops.rs
line 8 at r5 (raw file):
/// "[]" denotes optional values. /// The largest Merkle layer has no left and right child hashes. The rest of the layers have /// children hases
Done.
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.
Reviewable status: 1 of 5 files reviewed, 2 unresolved discussions (waiting on @andrewmilson and @shaharsamocha7)
src/commitment_scheme/verifier.rs
line 79 at r5 (raw file):
Previously, shaharsamocha7 wrote…
Rename to MerkleDecommitment
Done.
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.
Reviewed 4 of 4 files at r6, all commit messages.
Reviewable status: complete! all files reviewed, all discussions resolved (waiting on @andrewmilson)
This change is