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

Hybrid shuffle #1387

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

eriktaubeneck
Copy link
Member

This implements the plumbing required to shuffle IndistinguishableHybridReports and adds the shuffle step to the protocol.

As we discussed earlier, we may need to add the right Sharded + Malicious trait which will then make the ctx used here have the sharded + malicious shuffle.

Copy link

codecov bot commented Oct 29, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 93.73%. Comparing base (2c9b38d) to head (7f61f8e).
Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1387      +/-   ##
==========================================
+ Coverage   93.70%   93.73%   +0.03%     
==========================================
  Files         223      224       +1     
  Lines       37561    37672     +111     
==========================================
+ Hits        35195    35313     +118     
+ Misses       2366     2359       -7     

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


/// Converts `IndistinguishableHybridReport` into
/// an `AdditiveShare` needed for shuffle protocol.
pub fn hybrid_report_to_shuffle_input<YS, BK, V>(
Copy link
Member Author

Choose a reason for hiding this comment

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

would it make more sense to implement these as From traits.

Right now, ctx.shuffle has the trait bound

I: IntoIterator<Item = AdditiveShare<S>> + Send,

but you could also consider updating that so that Item implements conversion into AdditiveShare<S>, rather than being an AdditiveShare directly.

Updating this now will either mean updating existing IPA to work the same way (yuck!), so maybe we wait for now.

Comment on lines 39 to 40
.into_iter()
.map(|item| shuffled_to_hybrid_report(&item))
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nit: iter().map(shuffled_to_hybrid_report)

Comment on lines 32 to 33
.into_iter()
.map(|item| hybrid_report_to_shuffle_input::<BA112, BK, V>(&item))
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nit: Don't think you need the owning iterator. See comment bellow.


/// Converts an `AdditiveShare` obtained from shuffle protocol
/// into an `IndistinguishableHybridReport`.
pub fn shuffled_to_hybrid_report<YS, BK, V>(
Copy link
Collaborator

Choose a reason for hiding this comment

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

these go away with the new sharded shuffle and its Shufflable trait?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yes, they do.

let world = TestWorld::default();

let mut rng = rand::thread_rng();
let mut records = Vec::new();
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: Can you do something like?

let records = (0..BATCHSIZE).map(|_| TestIndistinguishableHybridReport{ ... })

@akoshelev
Copy link
Collaborator

I don't think we should use the old shuffle as it is not sharded and it won't be possible to make it sharded. Instead, we should take the sharded implementation for Hybrid (protocol/prf/shuffle/sharded.rs)

@akoshelev akoshelev closed this Oct 30, 2024
@akoshelev
Copy link
Collaborator

akoshelev commented Oct 30, 2024

mmm, I didn't mean to close it, it was a misclick

@akoshelev akoshelev reopened this Oct 30, 2024
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.

4 participants