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

feat: reveal multiple rangesets with one rangeset. #664

Open
wants to merge 29 commits into
base: dev
Choose a base branch
from
Open
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Update crates/core/src/transcript/proof.rs
Co-authored-by: dan <[email protected]>
yuroitaki and themighty1 authored Jan 17, 2025

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit 47ff4ce4bb5049afd215d8401b86256910f7da00
2 changes: 1 addition & 1 deletion crates/core/src/transcript/proof.rs
Original file line number Diff line number Diff line change
@@ -228,11 +228,11 @@
(Some(_), None) => Ordering::Greater,
// All N ranges of [self] are the same as the first N ranges of [other],
// i.e. [self] is a subset of [other].
(None, Some(_)) => Ordering::Less,

Check warning on line 231 in crates/core/src/transcript/proof.rs

Codecov / codecov/patch

crates/core/src/transcript/proof.rs#L231

Added line #L231 was not covered by tests
// All ranges of [self] are the same as all ranges of [other].
(None, None) => Ordering::Equal,

Check warning on line 233 in crates/core/src/transcript/proof.rs

Codecov / codecov/patch

crates/core/src/transcript/proof.rs#L233

Added line #L233 was not covered by tests
(Some(_), Some(_)) => {
unreachable!("self_range_option and other_range_option cannot be both some")

Check warning on line 235 in crates/core/src/transcript/proof.rs

Codecov / codecov/patch

crates/core/src/transcript/proof.rs#L235

Added line #L235 was not covered by tests
}
}
}
@@ -439,15 +439,15 @@
}
}
TranscriptCommitmentKind::Hash { .. } => {
// Insert the rangeset [dir_idx] if it's is in [plaintext_hashes], i.e. it's
// Insert the rangeset [dir_idx] if it's in [plaintext_hashes], i.e. it's
// committed.
if self
.plaintext_hashes
.get_by_transcript_idx(&dir_idx)
.is_some()
{
self.hash_proof_idxs.insert(dir_idx);
} else {

Check warning on line 450 in crates/core/src/transcript/proof.rs

Codecov / codecov/patch

crates/core/src/transcript/proof.rs#L448-L450

Added lines #L448 - L450 were not covered by tests
// Check if there is any committed rangeset in [plaintext_hashes] that is a
// subset of [dir_idx] — if yes, stage them into a temporary collection
// first.
@@ -555,29 +555,29 @@

let mut hash_proofs = Vec::new();
if !self.hash_proof_idxs.is_empty() {
self.hash_proof_idxs.prune_subset();

Check warning on line 558 in crates/core/src/transcript/proof.rs

Codecov / codecov/patch

crates/core/src/transcript/proof.rs#L558

Added line #L558 was not covered by tests

for dir_idx in self.hash_proof_idxs.iter() {
let PlaintextHashSecret {
commitment,
blinder,
..
} = self
.plaintext_hashes
.get_by_transcript_idx(dir_idx)
.expect("idx was checked to be committed");

let (_, data) = self
.transcript
.get(dir_idx.0, &dir_idx.1)
.expect("subsequence was checked to be in transcript")
.into_parts();

hash_proofs.push(PlaintextHashProof::new(
Blinded::new_with_blinder(data, blinder.clone()),
*commitment,
));
}

Check warning on line 580 in crates/core/src/transcript/proof.rs

Codecov / codecov/patch

crates/core/src/transcript/proof.rs#L560-L580

Added lines #L560 - L580 were not covered by tests
}

Ok(TranscriptProof {

Unchanged files with check annotations Beta

impl From<Vec<Field<PlaintextHash>>> for Index<Field<PlaintextHash>> {
fn from(items: Vec<Field<PlaintextHash>>) -> Self {
Self::new(items, |field: &Field<PlaintextHash>| {
(&field.id, field.data.direction, &field.data.idx)

Check warning on line 96 in crates/core/src/index.rs

Codecov / codecov/patch

crates/core/src/index.rs#L96

Added line #L96 was not covered by tests
})
}
}
}
/// Returns the number of ranges in the index.
pub fn len_ranges(&self) -> usize {
self.0.len_ranges()
}

Check warning on line 500 in crates/core/src/transcript.rs

Codecov / codecov/patch

crates/core/src/transcript.rs#L498-L500

Added lines #L498 - L500 were not covered by tests
/// Returns whether the index is empty.
pub fn is_empty(&self) -> bool {