Skip to content

Commit

Permalink
removed mmap dependency, removed unused imports
Browse files Browse the repository at this point in the history
  • Loading branch information
0xKitsune committed Jan 31, 2024
1 parent 7e04980 commit 9c25c4e
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 24 deletions.
11 changes: 0 additions & 11 deletions Cargo.lock

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

5 changes: 2 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,14 @@ bytemuck = { version = "1.14.1", features = ["derive"] }
clap = { version = "4.4.18", features = ["derive", "env"] }
config = "0.13.4"
criterion = "0.5.1"
docker-db = { git = "https://github.com/Dzejkop/docker-db", rev = "ef9a4dfccd9cb9b4babeebfea0ba815e36afbafe" }
dotenv = "0.15.0"
eyre = "0.6.11"
futures = "0.3.30"
hex = { version = "0.4.3", features = ["serde"] }
itertools = "0.12.0"
memmap = "0.7.0"
metrics = "0.21.1"
ordered-float = "4.2.0"
rand = "0.8.5"
rayon = "1.8.1"
serde = { version = "1.0.195", features = ["derive"] }
Expand All @@ -27,12 +28,10 @@ sqlx = { version = "0.7.3", features = [
"postgres",
"chrono",
] }
docker-db = { git = "https://github.com/Dzejkop/docker-db", rev = "ef9a4dfccd9cb9b4babeebfea0ba815e36afbafe" }
telemetry-batteries = { git = "https://github.com/worldcoin/telemetry-batteries.git", rev = "c6816624415ae194da5203a5161621a9e10ad3b0" }
tokio = { version = "1.35.1", features = ["macros"] }
tracing = "0.1.40"
tracing-subscriber = "0.3.18"
ordered-float = "4.2.0"

[dev-dependencies]
float_eq = "1.0.1"
Expand Down
3 changes: 1 addition & 2 deletions bin/mpc_coordinator.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
use std::env;
use std::path::PathBuf;

use aws_config::BehaviorVersion;
use clap::Parser;
use mpc::config::CoordinatorConfig;
use mpc::coordinator::Coordinator;
Expand Down Expand Up @@ -61,7 +60,7 @@ async fn main() -> eyre::Result<()> {
.add_source(config::Environment::with_prefix("MPC").separator("__"))
.build()?;

let config = settings.try_deserialize::<CoordinatorConfig>()?;
let _config = settings.try_deserialize::<CoordinatorConfig>()?;

//TODO: update to use config instead of env vars
let query_queue_url = env::var("AWS_QUERY_QUEUE")?;
Expand Down
2 changes: 1 addition & 1 deletion bin/mpc_participant.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ async fn main() -> eyre::Result<()> {
settings = settings.add_source(config::File::from(path).required(true));
}

let settings = settings
let _settings = settings
.add_source(config::Environment::with_prefix("MPC").separator("__"))
.build()?;

Expand Down
6 changes: 3 additions & 3 deletions src/coordinator.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
use std::collections::BinaryHeap;
use std::fs::{File, OpenOptions};

use std::net::SocketAddr;
use std::sync::Arc;
use std::time::Duration;

use futures::future;
use memmap::Mmap;

use rayon::iter::{IntoParallelIterator, ParallelIterator};
use tokio::io::{AsyncReadExt, AsyncWriteExt, BufReader};
use tokio::net::TcpStream;
Expand Down Expand Up @@ -157,7 +157,7 @@ impl Coordinator {
// Collect futures of denominator and share batches
let streams_future = future::try_join_all(
participants.iter_mut().enumerate().map(
|(i, stream)| async move {
|(_i, stream)| async move {
let mut batch = vec![[0_u16; 31]; BATCH_SIZE];
let mut buffer: &mut [u8] =
bytemuck::cast_slice_mut(batch.as_mut_slice());
Expand Down
6 changes: 3 additions & 3 deletions src/distance.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use bytemuck::{Pod, Zeroable};

use rayon::prelude::*;
use serde::{Deserialize, Serialize};

Expand Down Expand Up @@ -211,7 +211,7 @@ mod tests {
let query = &data[d.left];
let entry = &data[d.right];

let encrypted = encode(&entry);
let encrypted = encode(entry);
for (i, v) in encrypted.0.iter().enumerate() {
match *v {
u16::MAX => assert!(entry.mask[i] && entry.pattern[i]),
Expand All @@ -222,7 +222,7 @@ mod tests {
}

// Encode entry
let preprocessed = encode(&query);
let preprocessed = encode(query);
let distances =
distances(&preprocessed, &[encrypted]).next().unwrap();
let denominators =
Expand Down
2 changes: 1 addition & 1 deletion src/encoded_bits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use bytemuck::{cast_slice_mut, Pod, Zeroable};
use rand::distributions::{Distribution, Standard};
use rand::{thread_rng, Rng};
use serde::de::{SeqAccess, Visitor};
use serde::{de, Deserialize, Deserializer, Serialize};
use serde::{de, Deserialize, Deserializer};

use crate::bits::{Bits, BITS, COLS};

Expand Down

0 comments on commit 9c25c4e

Please sign in to comment.