Skip to content

feat(prf): reduced MPC variant #735

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

Open
wants to merge 35 commits into
base: chore/bump-mpz-alpha.3
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
f36218c
feat(prf): reduced MPC variant
th4s Apr 23, 2025
645a1d7
move sending `client_random` from `alloc` to `preprocess`
th4s Apr 24, 2025
6fcfc0d
rename `Config` -> `Mode` and rename variants
th4s Apr 24, 2025
509ffe1
add feedback for handling of prf config
th4s Apr 24, 2025
20a4b47
fix formatting to nightly
th4s Apr 24, 2025
66dded4
simplify `MpcPrf`
th4s Apr 25, 2025
6875442
improve external flush handling
th4s Apr 25, 2025
14bbced
improve control flow
th4s Apr 25, 2025
97e12eb
improved inner control flow for normal prf version
th4s Apr 25, 2025
1a17be1
rename leftover `config` -> `mode`
th4s Apr 25, 2025
59314fb
remove unnecessary pub(crate)
th4s Apr 25, 2025
1d28c5e
rewrite state flow for reduced prf
th4s Apr 28, 2025
7f86206
improve state transition for reduced prf
th4s Apr 28, 2025
079f122
repair prf bench
th4s Apr 28, 2025
ea3e164
WIP: Adapting to new `Sha256` from mpz
th4s Apr 29, 2025
671ff38
repair failing test
th4s Apr 29, 2025
2efb226
fixed all tests
th4s Apr 29, 2025
4504099
remove output decoding for p
th4s Apr 29, 2025
d015704
do not use mod.rs file hierarchy
th4s May 2, 2025
ea874a8
remove pub(crate) from function
th4s May 2, 2025
93bb180
improve config handling
th4s May 2, 2025
33f7aa3
use `Array::try_from`
th4s May 2, 2025
1366dbe
simplify hmac to function
th4s May 2, 2025
ad1d10a
remove `merge_vecs`
th4s May 2, 2025
077c704
move `mark_public` to allocation
th4s May 2, 2025
93f4a08
minor fixes
th4s May 2, 2025
3ce2dff
simplify state logic for reduced prf even more
th4s May 2, 2025
2724c89
simplify reduced prf even more
th4s May 6, 2025
b4f5d03
set reduced prf as default
th4s May 6, 2025
78a51b1
temporarily fix commit for mpz
th4s May 7, 2025
a67ab86
add part of feedback
th4s May 7, 2025
4573784
simplify state transition
th4s May 7, 2025
354b642
adapt comment
th4s May 7, 2025
ea00c6c
improve state transition in flush
th4s May 7, 2025
46465a0
simplify flush
th4s May 7, 2025
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
31 changes: 15 additions & 16 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ members = [
"crates/common",
"crates/components/deap",
"crates/components/cipher",
#"crates/components/hmac-sha256",
#"crates/components/hmac-sha256-circuits",
"crates/components/hmac-sha256",
"crates/components/key-exchange",
"crates/core",
"crates/data-fixtures",
Expand Down Expand Up @@ -57,8 +56,7 @@ tlsn-core = { path = "crates/core" }
tlsn-data-fixtures = { path = "crates/data-fixtures" }
tlsn-deap = { path = "crates/components/deap" }
tlsn-formats = { path = "crates/formats" }
#tlsn-hmac-sha256 = { path = "crates/components/hmac-sha256" }
#tlsn-hmac-sha256-circuits = { path = "crates/components/hmac-sha256-circuits" }
tlsn-hmac-sha256 = { path = "crates/components/hmac-sha256" }
tlsn-key-exchange = { path = "crates/components/key-exchange" }
tlsn-mpc-tls = { path = "crates/mpc-tls" }
tlsn-prover = { path = "crates/prover" }
Expand All @@ -71,18 +69,19 @@ tlsn-tls-core = { path = "crates/tls/core" }
tlsn-utils = { git = "https://github.com/tlsnotary/tlsn-utils", rev = "6168663" }
tlsn-verifier = { path = "crates/verifier" }

mpz-circuits = { git = "https://github.com/privacy-scaling-explorations/mpz", branch = "alpha.3" }
mpz-memory-core = { git = "https://github.com/privacy-scaling-explorations/mpz", branch = "alpha.3" }
mpz-common = { git = "https://github.com/privacy-scaling-explorations/mpz", branch = "alpha.3" }
mpz-core = { git = "https://github.com/privacy-scaling-explorations/mpz", branch = "alpha.3" }
mpz-vm-core = { git = "https://github.com/privacy-scaling-explorations/mpz", branch = "alpha.3" }
mpz-garble = { git = "https://github.com/privacy-scaling-explorations/mpz", branch = "alpha.3" }
mpz-garble-core = { git = "https://github.com/privacy-scaling-explorations/mpz", branch = "alpha.3" }
mpz-ole = { git = "https://github.com/privacy-scaling-explorations/mpz", branch = "alpha.3" }
mpz-ot = { git = "https://github.com/privacy-scaling-explorations/mpz", branch = "alpha.3" }
mpz-share-conversion = { git = "https://github.com/privacy-scaling-explorations/mpz", branch = "alpha.3" }
mpz-fields = { git = "https://github.com/privacy-scaling-explorations/mpz", branch = "alpha.3" }
mpz-zk = { git = "https://github.com/privacy-scaling-explorations/mpz", branch = "alpha.3" }
mpz-circuits = { git = "https://github.com/privacy-scaling-explorations/mpz", rev = "39f64de" }
mpz-memory-core = { git = "https://github.com/privacy-scaling-explorations/mpz", rev = "39f64de" }
mpz-common = { git = "https://github.com/privacy-scaling-explorations/mpz", rev = "39f64de" }
mpz-core = { git = "https://github.com/privacy-scaling-explorations/mpz", rev = "39f64de" }
mpz-vm-core = { git = "https://github.com/privacy-scaling-explorations/mpz", rev = "39f64de" }
mpz-garble = { git = "https://github.com/privacy-scaling-explorations/mpz", rev = "39f64de" }
mpz-garble-core = { git = "https://github.com/privacy-scaling-explorations/mpz", rev = "39f64de" }
mpz-ole = { git = "https://github.com/privacy-scaling-explorations/mpz", rev = "39f64de" }
mpz-ot = { git = "https://github.com/privacy-scaling-explorations/mpz", rev = "39f64de" }
mpz-share-conversion = { git = "https://github.com/privacy-scaling-explorations/mpz", rev = "39f64de" }
mpz-fields = { git = "https://github.com/privacy-scaling-explorations/mpz", rev = "39f64de" }
mpz-zk = { git = "https://github.com/privacy-scaling-explorations/mpz", rev = "39f64de" }
mpz-hash = { git = "https://github.com/privacy-scaling-explorations/mpz", rev = "39f64de" }

rangeset = { version = "0.2" }
serio = { version = "0.2" }
Expand Down
9 changes: 5 additions & 4 deletions crates/benches/binary/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ mpz-core = { workspace = true }
mpz-garble = { workspace = true }
mpz-ot = { workspace = true, features = ["ideal"] }
tlsn-benches-library = { workspace = true }
tlsn-benches-browser-native = { workspace = true, optional = true}
tlsn-benches-browser-native = { workspace = true, optional = true }
tlsn-common = { workspace = true }
tlsn-core = { workspace = true }
#tlsn-hmac-sha256 = { workspace = true }
tlsn-hmac-sha256 = { workspace = true }
tlsn-prover = { workspace = true }
tlsn-server-fixture = { workspace = true }
tlsn-server-fixture-certs = { workspace = true }
Expand All @@ -30,7 +30,7 @@ tlsn-verifier = { workspace = true }

anyhow = { workspace = true }
async-trait = { workspace = true }
charming = {version = "0.3.1", features = ["ssr"]}
charming = { version = "0.3.1", features = ["ssr"] }
csv = "1.3.0"
dhat = { version = "0.3.3" }
env_logger = { version = "0.6.0", default-features = false }
Expand All @@ -46,7 +46,8 @@ tokio = { workspace = true, features = [
] }
tokio-util = { workspace = true }
toml = "0.8.11"
tracing-subscriber = {workspace = true, features = ["env-filter"]}
tracing-subscriber = { workspace = true, features = ["env-filter"] }
rand = { workspace = true }

[[bin]]
name = "bench"
Expand Down
1 change: 0 additions & 1 deletion crates/benches/binary/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
pub mod config;
pub mod metrics;
mod preprocess;
pub mod prover;
pub mod prover_main;
pub mod verifier_main;
Expand Down
5 changes: 0 additions & 5 deletions crates/benches/binary/src/preprocess.rs

This file was deleted.

5 changes: 0 additions & 5 deletions crates/benches/binary/src/prover_main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ use std::{
use crate::{
config::{BenchInstance, Config},
metrics::Metrics,
preprocess::preprocess_prf_circuits,
set_interface, PROVER_INTERFACE,
};
use anyhow::Context;
Expand Down Expand Up @@ -58,10 +57,6 @@ pub async fn prover_main(is_memory_profiling: bool) -> anyhow::Result<()> {
.open("metrics.csv")
.context("failed to open metrics file")?;

// Preprocess the PRF circuits as they are allocating a lot of memory, which
// don't need to be accounted for in the benchmarks.
preprocess_prf_circuits().await;

{
let mut metric_wrt = WriterBuilder::new()
// If file is not empty, assume that the CSV header is already present in the file.
Expand Down
5 changes: 0 additions & 5 deletions crates/benches/binary/src/verifier_main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

use crate::{
config::{BenchInstance, Config},
preprocess::preprocess_prf_circuits,
set_interface, VERIFIER_INTERFACE,
};
use tls_core::verify::WebPkiVerifier;
Expand Down Expand Up @@ -40,10 +39,6 @@ pub async fn verifier_main(is_memory_profiling: bool) -> anyhow::Result<()> {
.await
.context("failed to bind to port")?;

// Preprocess the PRF circuits as they are allocating a lot of memory, which
// don't need to be accounted for in the benchmarks.
preprocess_prf_circuits().await;

for bench in config.benches {
for instance in bench.flatten() {
if is_memory_profiling && !instance.memory_profile {
Expand Down
26 changes: 26 additions & 0 deletions crates/common/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ pub struct ProtocolConfig {
/// Maximum number of application data records that can be received.
#[builder(setter(strip_option), default)]
max_recv_records: Option<usize>,
/// Network settings.
#[builder(default)]
network: NetworkSetting,
/// Version that is being run by prover/verifier.
#[builder(setter(skip), default = "VERSION.clone()")]
version: Version,
Expand Down Expand Up @@ -85,6 +88,11 @@ impl ProtocolConfig {
pub fn max_recv_records(&self) -> Option<usize> {
self.max_recv_records
}

/// Returns the network settings.
pub fn network(&self) -> NetworkSetting {
self.network
}
}

/// Protocol configuration validator used by checker (i.e. verifier) to perform
Expand Down Expand Up @@ -206,6 +214,24 @@ impl ProtocolConfigValidator {
}
}

/// Settings for the network environment.
///
/// Provides optimization options to adapt the protocol to different network
/// situations.
#[derive(Debug, Clone, Copy, Serialize, Deserialize)]
pub enum NetworkSetting {
/// Prefers a bandwidth-heavy protocol.
Bandwidth,
/// Prefers a latency-heavy protocol.
Latency,
}

impl Default for NetworkSetting {
fn default() -> Self {
Self::Bandwidth
}
}

/// A ProtocolConfig error.
#[derive(thiserror::Error, Debug)]
pub struct ProtocolConfigError {
Expand Down
22 changes: 0 additions & 22 deletions crates/components/hmac-sha256-circuits/Cargo.toml

This file was deleted.

159 changes: 0 additions & 159 deletions crates/components/hmac-sha256-circuits/src/hmac_sha256.rs

This file was deleted.

Loading