Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
62 changes: 31 additions & 31 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 27 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -173,3 +173,30 @@ webpki-roots = { version = "1.0" }
webpki-root-certs = { version = "1.0" }
ws_stream_wasm = { version = "0.7.5" }
zeroize = { version = "1.8" }

# Patch mpz to the fork carrying the per-instance KOS domain-separation change.
[patch."https://github.com/privacy-ethereum/mpz"]
clmul = { git = "https://github.com/AdamDawidKrol/mpz", rev = "c0379ef" }
matrix-transpose = { git = "https://github.com/AdamDawidKrol/mpz", rev = "c0379ef" }
mpz-circuits = { git = "https://github.com/AdamDawidKrol/mpz", rev = "c0379ef" }
mpz-circuits-core = { git = "https://github.com/AdamDawidKrol/mpz", rev = "c0379ef" }
mpz-circuits-data = { git = "https://github.com/AdamDawidKrol/mpz", rev = "c0379ef" }
mpz-cointoss = { git = "https://github.com/AdamDawidKrol/mpz", rev = "c0379ef" }
mpz-cointoss-core = { git = "https://github.com/AdamDawidKrol/mpz", rev = "c0379ef" }
mpz-common = { git = "https://github.com/AdamDawidKrol/mpz", rev = "c0379ef" }
mpz-core = { git = "https://github.com/AdamDawidKrol/mpz", rev = "c0379ef" }
mpz-fields = { git = "https://github.com/AdamDawidKrol/mpz", rev = "c0379ef" }
mpz-garble = { git = "https://github.com/AdamDawidKrol/mpz", rev = "c0379ef" }
mpz-garble-core = { git = "https://github.com/AdamDawidKrol/mpz", rev = "c0379ef" }
mpz-hash = { git = "https://github.com/AdamDawidKrol/mpz", rev = "c0379ef" }
mpz-ideal-vm = { git = "https://github.com/AdamDawidKrol/mpz", rev = "c0379ef" }
mpz-memory-core = { git = "https://github.com/AdamDawidKrol/mpz", rev = "c0379ef" }
mpz-ole = { git = "https://github.com/AdamDawidKrol/mpz", rev = "c0379ef" }
mpz-ole-core = { git = "https://github.com/AdamDawidKrol/mpz", rev = "c0379ef" }
mpz-ot = { git = "https://github.com/AdamDawidKrol/mpz", rev = "c0379ef" }
mpz-ot-core = { git = "https://github.com/AdamDawidKrol/mpz", rev = "c0379ef" }
mpz-share-conversion = { git = "https://github.com/AdamDawidKrol/mpz", rev = "c0379ef" }
mpz-share-conversion-core = { git = "https://github.com/AdamDawidKrol/mpz", rev = "c0379ef" }
mpz-vm-core = { git = "https://github.com/AdamDawidKrol/mpz", rev = "c0379ef" }
mpz-zk = { git = "https://github.com/AdamDawidKrol/mpz", rev = "c0379ef" }
mpz-zk-core = { git = "https://github.com/AdamDawidKrol/mpz", rev = "c0379ef" }
27 changes: 18 additions & 9 deletions crates/tlsn/src/deps/prover.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,16 +58,21 @@ impl ProverMpcDeps {
// RCOT only flushes once all its clones reach the flush barrier, but the
// preprocess branches (ke / record_layer / vm) don't all flush together, so a
// shared instance deadlocks. All senders use the same global delta.
let new_send = || {
let id = |n: u128| Block::new(n.to_le_bytes());
let new_send = |instance_id: Block| {
SharedRCOTSender::new(kos::Sender::new(
kos::SenderConfig::default(),
delta.into_inner(),
instance_id,
co::Receiver::default(),
))
};
let new_recv = |rng: &mut rand::rngs::ThreadRng| {
let rcot_recv =
kos::Receiver::new(kos::ReceiverConfig::default(), co::Sender::default());
let new_recv = |rng: &mut rand::rngs::ThreadRng, instance_id: Block| {
let rcot_recv = kos::Receiver::new(
kos::ReceiverConfig::default(),
instance_id,
co::Sender::default(),
);
let rcot_recv = ferret::Receiver::new(
ferret::FerretConfig::builder()
.lpn_type(ferret::LpnType::Regular)
Expand All @@ -82,22 +87,22 @@ impl ProverMpcDeps {
let mpc = cfg_select! {
tlsn_insecure => { mpz_ideal_vm::IdealVm::new() }
_ => {
ProverMpc::new(DerandCOTSender::new(new_send()), rng.random(), delta)
ProverMpc::new(DerandCOTSender::new(new_send(id(0))), rng.random(), delta)
}
};

let zk = cfg_select! {
tlsn_insecure => { mpz_ideal_vm::IdealVm::new() }
_ => { ProverZk::new(Default::default(), new_recv(&mut rng)) }
_ => { ProverZk::new(Default::default(), new_recv(&mut rng, id(1))) }
};

let vm = Arc::new(Mutex::new(Deap::new(tlsn_deap::Role::Leader, mpc, zk)));
let mpc_tls = MpcTlsLeader::new(
build_mpc_tls_config(config),
ctx,
vm.clone(),
(new_send(), new_send(), new_send()),
new_recv(&mut rng),
(new_send(id(2)), new_send(id(3)), new_send(id(4))),
new_recv(&mut rng, id(5)),
);

Self {
Expand Down Expand Up @@ -150,7 +155,11 @@ impl ProverProxyDeps {
let mut rng = rand::rng();

let base_ot_send = co::Sender::default();
let rcot_recv = kos::Receiver::new(kos::ReceiverConfig::default(), base_ot_send);
let rcot_recv = kos::Receiver::new(
kos::ReceiverConfig::default(),
Block::ZERO,
base_ot_send,
);
let rcot_recv = ferret::Receiver::new(
ferret::FerretConfig::builder()
.lpn_type(ferret::LpnType::Regular)
Expand Down
Loading
Loading