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

Make defer-decryption default #573

Merged
merged 17 commits into from
Sep 11, 2024
Merged

Make defer-decryption default #573

merged 17 commits into from
Sep 11, 2024

Conversation

th4s
Copy link
Member

@th4s th4s commented Aug 21, 2024

This PR makes defer-decryption default and introduces the necessary config changes.

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.

LGTM!

As agreed, I pushed a commit with clarifying comments and a name change with the goal of:

  • Emphasize that deferred decryption is toggleable.
  • I tried to avoid leaking the concept of "deferred" into the Transcript-related type.
    From Transcripts pov there is only data written to it in the online and in the offline phases. I hope this abstraction is correct and I'm not overlooking sth.

@th4s
Copy link
Member Author

th4s commented Aug 30, 2024

lgtm, thank you! Having the inner transcript not know about the concept of deferred decryption makes sense to me.

Seems like some test doesn't like the changes, or randomly fails.

@th4s
Copy link
Member Author

th4s commented Aug 30, 2024

Seems like some test doesn't like the changes, or randomly fails.

Opened an issue for this.

crates/benches/bin/prover.rs Outdated Show resolved Hide resolved
Copy link
Member

@yuroitaki yuroitaki left a comment

Choose a reason for hiding this comment

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

great stuff! just one nit

@th4s th4s requested a review from sinui0 September 3, 2024 16:54
Copy link
Member

@sinui0 sinui0 left a comment

Choose a reason for hiding this comment

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

I feel we should just remove the defaults entirely. It would be an error to not set one of the recv sizes. It's not much burden on the user to make sure they think about how much data will be communicated.

@@ -31,14 +34,29 @@ pub struct ProtocolConfig {
/// Maximum number of bytes that can be sent.
#[builder(default = "DEFAULT_MAX_SENT_LIMIT")]
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
#[builder(default = "DEFAULT_MAX_SENT_LIMIT")]

max_recv_data_online: usize,
/// Maximum number of bytes for which the decryption can be deferred until after the MPC-TLS
/// connection is closed.
#[builder(default = "self.default_max_deferred_size()")]
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
#[builder(default = "self.default_max_deferred_size()")]

crates/common/src/config.rs Show resolved Hide resolved
@th4s
Copy link
Member Author

th4s commented Sep 5, 2024

I am not sure. Users will have to dive into our ProtocolConfig. You can no longer just create a ProverConfig with a default ProtocolConfig. Now you have to think about all these traffic sizes and understand what it is and what deferred decryption is. No simple "just-do-the-thing" mode anymore.

What is the advantage of having no defaults?

@sinui0
Copy link
Member

sinui0 commented Sep 5, 2024

Users will have to understand this particular configuration anyhow, unless we find an abstraction in higher level tooling. I recall several people running into transcript limit issues. The defaults we have right now are arbitrary.

The solution to hiding deferred decryption complexity is to change our approach slightly. It's the default, so we can invert the naming:

  1. max_sent: Sent data length
  2. max_recv: Received data length
  3. max_recv_online: The amount of data that needs to be decrypted online.

Assert max_recv_online <= max_recv, the difference is what we decrypt offline.

@th4s
Copy link
Member Author

th4s commented Sep 5, 2024

That sounds good. But then max_recv_online will get a default of 0 and the other two will have no default so that they have to be set by the user, right?

@th4s th4s requested a review from sinui0 September 11, 2024 10:23
Copy link
Member

@sinui0 sinui0 left a comment

Choose a reason for hiding this comment

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

1 change

crates/tls/mpc/src/follower.rs Outdated Show resolved Hide resolved
@th4s th4s requested a review from sinui0 September 11, 2024 19:12
@th4s th4s force-pushed the defer-decryption-default branch from 7b228b4 to 38c94a1 Compare September 11, 2024 19:13
@th4s th4s merged commit 9bbb2fb into dev Sep 11, 2024
5 checks passed
@th4s th4s deleted the defer-decryption-default branch September 11, 2024 19:50
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