Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/worldcoin/gpu-iris-mpc into…
Browse files Browse the repository at this point in the history
… POP-1859/add-client-tests-for-identity-deletion
  • Loading branch information
philsippl committed Sep 19, 2024
2 parents 2045c55 + bb97421 commit 93d6f9e
Show file tree
Hide file tree
Showing 9 changed files with 43 additions and 19 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ COPY --from=build-app /src/gpu-iris-mpc/target/x86_64-unknown-linux-gnu/release/
COPY --from=build-app /src/gpu-iris-mpc/target/x86_64-unknown-linux-gnu/release/key-manager /bin/key-manager
COPY --from=build-app /src/gpu-iris-mpc/target/x86_64-unknown-linux-gnu/release/upgrade-server /bin/upgrade-server
COPY --from=build-app /src/gpu-iris-mpc/target/x86_64-unknown-linux-gnu/release/upgrade-client /bin/upgrade-client
COPY --from=build-app /src/gpu-iris-mpc/target/x86_64-unknown-linux-gnu/release/upgrade-client /bin/upgrade-checker
COPY --from=build-app /src/gpu-iris-mpc/target/x86_64-unknown-linux-gnu/release/upgrade-checker /bin/upgrade-checker

USER 65534
ENTRYPOINT ["/bin/server"]
2 changes: 1 addition & 1 deletion deploy/stage/common-values-iris-mpc.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
image: "ghcr.io/worldcoin/iris-mpc:v0.6.13"
image: "ghcr.io/worldcoin/iris-mpc:v0.7.1"

environment: stage
replicaCount: 1
Expand Down
2 changes: 1 addition & 1 deletion deploy/stage/common-values-upgrade-server-left.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
image: "ghcr.io/worldcoin/iris-mpc:v0.6.13"
image: "ghcr.io/worldcoin/iris-mpc:v0.7.0"

environment: stage
replicaCount: 1
Expand Down
2 changes: 1 addition & 1 deletion deploy/stage/common-values-upgrade-server-right.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
image: "ghcr.io/worldcoin/iris-mpc:v0.6.13"
image: "ghcr.io/worldcoin/iris-mpc:v0.7.0"

environment: stage
replicaCount: 1
Expand Down
2 changes: 1 addition & 1 deletion iris-mpc-store/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ DO UPDATE SET right_code = EXCLUDED.right_code, right_mask = EXCLUDED.right_mask
.await?;

// We also need to reset the sequence to avoid gaps in the IDs.
sqlx::query("SELECT setval(pg_get_serial_sequence('irises', 'id'), $1 + 1)")
sqlx::query("SELECT setval(pg_get_serial_sequence('irises', 'id'), $1 + 1, false)")
.bind(db_len as i64)
.execute(&self.pool)
.await?;
Expand Down
12 changes: 10 additions & 2 deletions iris-mpc-upgrade/src/bin/seed_v1_dbs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,11 @@ async fn main() -> eyre::Result<()> {
};

let shares_db0 = Db::new(&shares_db_config0).await?;
let latest_shares_id_0 = shares_db0.fetch_latest_share_id().await?;
let mut latest_shares_id_0 = shares_db0.fetch_latest_share_id().await?;
let shares_db1 = Db::new(&shares_db_config1).await?;
let latest_shares_id_1 = shares_db1.fetch_latest_share_id().await?;
let masks_db = Db::new(&masks_db_config).await?;
let latest_masks_id = masks_db.fetch_latest_mask_id().await?;
let mut latest_masks_id = masks_db.fetch_latest_mask_id().await?;

if latest_shares_id_0 != latest_shares_id_1 {
return Err(eyre::eyre!(
Expand All @@ -84,6 +84,14 @@ async fn main() -> eyre::Result<()> {
let mut shares0 = Vec::with_capacity(args.fill_to as usize);
let mut shares1 = Vec::with_capacity(args.fill_to as usize);

if latest_shares_id_0 == 0 {
latest_shares_id_0 += 1;
}

if latest_masks_id == 0 {
latest_masks_id += 1;
}

for i in latest_shares_id_0..args.fill_to {
let mut iris_code = rng.gen::<Template>();
// fix the iris code mask to be valid: all chunks of 2 bits are equal, since
Expand Down
13 changes: 1 addition & 12 deletions iris-mpc-upgrade/src/bin/tcp_upgrade_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,7 @@ use rand::{Rng, SeedableRng};
use rand_chacha::ChaCha20Rng;
use rustls::{pki_types::ServerName, ClientConfig};
use std::{array, convert::TryFrom, pin::Pin, sync::Arc};
use tokio::{
io::{AsyncReadExt, AsyncWriteExt},
net::TcpStream,
};
use tokio::{io::AsyncWriteExt, net::TcpStream};
use tokio_rustls::{client::TlsStream, TlsConnector};

fn install_tracing() {
Expand Down Expand Up @@ -269,15 +266,7 @@ async fn main() -> eyre::Result<()> {
pb.inc(diff);
}
tracing::info!("Processing done!");
let mut buf = [0u8; 1];
server1.read_exact(&mut buf[..]).await?;
server2.read_exact(&mut buf[..]).await?;
server3.read_exact(&mut buf[..]).await?;
server1.shutdown().await?;
server2.shutdown().await?;
server3.shutdown().await?;
pb.finish();

Ok(())
}

Expand Down
15 changes: 15 additions & 0 deletions scripts/delete_mongodb_mpcv2_collections.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/usr/bin/env bash

set -e

CONNECTION_STRING="$1"

DATABASE="iris"
COLLECTIONS="mpcv2.results mpcv2.results.partial mpcv2.results.deletion deletion.requests"

for COLLECTION in $COLLECTIONS; do
echo "Deleting collection $COLLECTION from database $DATABASE..."
mongosh "$CONNECTION_STRING" --eval "db.getCollection('$COLLECTION').drop()"
done

echo "MPC collections deleted successfully."
12 changes: 12 additions & 0 deletions scripts/purge_stage_mongo_collections.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/usr/bin/env bash

printf "\n=============================="
printf "\nActivate teleport tunnel to mongo_db iris and delete collections\n"

tsh login --proxy=teleport.worldcoin.dev:443 --auth=okta
tsh db login --db-user developer-read-write mongo-atlas-iris-stage --db-name iris
tsh proxy db --tunnel mongo-atlas-iris-stage -p 60003 --db-user arn:aws:iam::510867353226:role/developer-read-write &

sleep 5

./delete_mongodb_mpcv2_collections.sh "mongodb://127.0.0.1:60003/iris?serverSelectionTimeoutMS=10000"

0 comments on commit 93d6f9e

Please sign in to comment.