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 25 commits into
base: dev
Choose a base branch
from

Conversation

yuroitaki
Copy link
Member

Addresses #655

@yuroitaki yuroitaki requested a review from themighty1 November 29, 2024 05:25
Copy link

codecov bot commented Nov 29, 2024

Codecov Report

Attention: Patch coverage is 86.99187% with 32 lines in your changes missing coverage. Please review.

Project coverage is 56.25%. Comparing base (65299d7) to head (47ff4ce).

Files with missing lines Patch % Lines
crates/core/src/transcript/proof.rs 87.15% 28 Missing ⚠️
crates/core/src/transcript.rs 50.00% 3 Missing ⚠️
crates/core/src/index.rs 94.73% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##              dev     #664      +/-   ##
==========================================
+ Coverage   55.76%   56.25%   +0.48%     
==========================================
  Files         189      189              
  Lines       20886    20869      -17     
==========================================
+ Hits        11648    11740      +92     
+ Misses       9238     9129     -109     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@yuroitaki yuroitaki marked this pull request as draft November 29, 2024 10:33
@sinui0
Copy link
Member

sinui0 commented Dec 2, 2024

This doesn't address the issue, we're not looking for a method to pass in a slice. Instead, we want to address the problem that the user has to specify each range individually which corresponds to a commitment. When the user provides a range set to reveal, we should look into the encoding tree/hash commitments and determine if we can satisfy it with one or more of the available commitments.

@yuroitaki
Copy link
Member Author

This doesn't address the issue, we're not looking for a method to pass in a slice. Instead, we want to address the problem that the user has to specify each range individually which corresponds to a commitment. When the user provides a range set to reveal, we should look into the encoding tree/hash commitments and determine if we can satisfy it with one or more of the available commitments.

Yeap! Got the same feedback from @themighty1 , and am working on it

@yuroitaki yuroitaki changed the title Add reveal groups of ranges. feat: reveal committed ranges given one rangeset. Dec 5, 2024
@yuroitaki yuroitaki marked this pull request as ready for review December 6, 2024 11:20
@yuroitaki yuroitaki requested review from heeckhau and sinui0 December 6, 2024 11:20
@yuroitaki yuroitaki changed the title feat: reveal committed ranges given one rangeset. feat: reveal committed ranges with one rangeset. Dec 6, 2024
crates/core/src/transcript/proof.rs Outdated Show resolved Hide resolved
@yuroitaki yuroitaki marked this pull request as draft January 14, 2025 16:13
@yuroitaki
Copy link
Member Author

Just realised there is one more polishing to do, will notify when it's ready to be reviewed

@yuroitaki yuroitaki marked this pull request as ready for review January 15, 2025 10:50
Copy link
Member

@themighty1 themighty1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nicely done!!!

crates/core/src/transcript/proof.rs Outdated Show resolved Hide resolved
crates/core/src/transcript/proof.rs Show resolved Hide resolved
Comment on lines 54 to 59
// NOTE: Ideally, one should NOT call any `reveal` function more than once
// for these superset ranges to avoid unnecessary computation time.
//
// Instead of `reveal` on 'superset range A', and then `reveal` again
// on 'superset range B', one should union all these superset ranges,
// and then `reveal` at once.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would avoid putting here the rest of the comment starting from NOTE:
The way that the reveal API works now is the actual expected behaviour.
Talking about "unnecessary computation time" will cause the user to wonder about such small details. But we know that compute overhead is so miniscule, it's not worth drawing attention to.

Additionally, we encourage to use reveal() only once but then immediately a few lines below call it multiple times in this example. This will make the user think the example is wrong/the comment is wrong/the user missed something.

I feel we can allow the user to be able to both call reveal one time or multiple times, depending on their code ergonomics needs.
I feel that the user should be exposed to as few inconsequential details as possible. But feel free to keep the NOTE: if you still think it is valuable.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would avoid putting here the rest of the comment starting from NOTE: The way that the reveal API works now is the actual expected behaviour. Talking about "unnecessary computation time" will cause the user to wonder about such small details. But we know that compute overhead is so miniscule, it's not worth drawing attention to.

Additionally, we encourage to use reveal() only once but then immediately a few lines below call it multiple times in this example. This will make the user think the example is wrong/the comment is wrong/the user missed something.

I feel we can allow the user to be able to both call reveal one time or multiple times, depending on their code ergonomics needs. I feel that the user should be exposed to as few inconsequential details as possible. But feel free to keep the NOTE: if you still think it is valuable.

Ah i see, i guess the point i was trying to convey wasn't clear: that for superset ranges, they should call reveal once after union-ing all of them; but for exact ranges, they can call multiple times. I was mainly worrying about the compute overhead when the following is executed N times (the number of times user call reveal with superset ranges):

 for committed_dir_idx in encoding_tree
      .transcript_indices()
          .into_iter()
          .filter(|(dir, _)| *dir == dir_idx.0)
      {
          if committed_dir_idx.1.is_subset(&dir_idx.1) {
              staged_subsets.push(committed_dir_idx);
          }
      }

Because if N is big, then this block might cause some noticeable overhead, since is_subset itself contains an inner loop. But rationally users wouldn't reveal such large N — let me try to change the wording to make it clearer and less confusing.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@themighty1 just updated the example and new comments, let me know what you think :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants