diff --git a/Cargo.lock b/Cargo.lock index 19b9227022..69b4d51ad8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5644,6 +5644,7 @@ dependencies = [ "thiserror", "throbber-widgets-tui", "tokio", + "tokio-util 0.7.10", ] [[package]] diff --git a/app/src/routes/ceremony/+page.svelte b/app/src/routes/ceremony/+page.svelte index e30a462c79..b1cb587985 100644 --- a/app/src/routes/ceremony/+page.svelte +++ b/app/src/routes/ceremony/+page.svelte @@ -3,9 +3,9 @@ import { createClient, type Provider } from "@supabase/supabase-js"; const apiKey = - "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6ImJmZmNvbHdjYWtxcmhsem55am5zIiwicm9sZSI6ImFub24iLCJpYXQiOjE3MjIwOTc5OTgsImV4cCI6MjAzNzY3Mzk5OH0.9dVeafP8atsYqwdtPVYmzIhqMr_DEkHKdfoN3eqxjC0"; + "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6Ind3cXB5bGJyY3ByaXlhcXVnenNpIiwicm9sZSI6ImFub24iLCJpYXQiOjE3MjI0MzMyMjQsImV4cCI6MjAzODAwOTIyNH0.UQOmQ-wE63O32lyrLDO7ryowrM5LNA2UILHDA7hTH8E"; const supabase = createClient( - "https://bffcolwcakqrhlznyjns.supabase.co", + "https://wwqpylbrcpriyaqugzsi.supabase.co", apiKey, ); diff --git a/mpc/client/Cargo.toml b/mpc/client/Cargo.toml index dafe51e673..4e20e5aa8a 100644 --- a/mpc/client/Cargo.toml +++ b/mpc/client/Cargo.toml @@ -22,3 +22,4 @@ serde = { workspace = true, features = ["derive"] } serde_json = { workspace = true } thiserror = { workspace = true } tokio = { workspace = true, features = ["full"] } +tokio-util = "0.7" \ No newline at end of file diff --git a/mpc/client/src/main.rs b/mpc/client/src/main.rs index f9adfefc33..696663763f 100644 --- a/mpc/client/src/main.rs +++ b/mpc/client/src/main.rs @@ -35,9 +35,10 @@ use tokio::{ mpsc, oneshot, RwLock, }, }; +use tokio_util::sync::CancellationToken; use types::Status; -const SUPABASE_PROJECT: &str = "https://bffcolwcakqrhlznyjns.supabase.co"; +const SUPABASE_PROJECT: &str = "https://wwqpylbrcpriyaqugzsi.supabase.co"; const ENDPOINT: &str = "/contribute"; #[derive(PartialEq, Eq, Debug, Clone, Deserialize)] @@ -376,9 +377,9 @@ async fn input_and_status_handling( tokio::spawn(async move { while let Ok(status) = rx_status.recv().await { *latest_status.write().await = status.clone(); - tx_ui_clone - .send(ui::Event::NewStatus(status)) - .expect("impossible"); + if let Err(_) = tx_ui_clone.send(ui::Event::NewStatus(status)) { + break; + } } }); tokio::spawn(async move { @@ -410,8 +411,9 @@ async fn main() -> Result<(), DynError> { let lock = Arc::new(AtomicBool::new(false)); let (tx_status, rx_status) = broadcast::channel(64); let graceful = GracefulShutdown::new(); - let (tx_shutdown, mut rx_shutdown) = oneshot::channel::<()>(); let status_clone = status.clone(); + let token = CancellationToken::new(); + let token_clone = token.clone(); let handle = tokio::spawn(async move { let addr = SocketAddr::from(([127, 0, 0, 1], 0x1337)); let listener = TcpListener::bind(addr).await.unwrap(); @@ -440,12 +442,12 @@ async fn main() -> Result<(), DynError> { } }); } - _ = &mut rx_shutdown => { - graceful.shutdown().await; - break + _ = token_clone.cancelled() => { + break; } } } + graceful.shutdown().await; }); // Dispatch terminal let (tx_ui, rx_ui) = mpsc::unbounded_channel(); @@ -462,7 +464,7 @@ async fn main() -> Result<(), DynError> { ui::run_ui(&mut terminal, rx_ui).await?; crossterm::terminal::disable_raw_mode()?; terminal.clear()?; - tx_shutdown.send(()).expect("impossible"); + token.cancel(); handle.await.expect("impossible"); - Ok(()) + std::process::exit(0); } diff --git a/mpc/coordinator/src/main.rs b/mpc/coordinator/src/main.rs index 69e652feaf..87f9de45d8 100644 --- a/mpc/coordinator/src/main.rs +++ b/mpc/coordinator/src/main.rs @@ -1,7 +1,7 @@ use clap::{Parser, Subcommand}; use mpc_shared::{phase2_verify, supabase::SupabaseMPCApi}; -const SUPABASE_PROJECT: &str = "https://bffcolwcakqrhlznyjns.supabase.co"; +const SUPABASE_PROJECT: &str = "https://wwqpylbrcpriyaqugzsi.supabase.co"; #[derive(Parser, Debug)] #[command(version, about, long_about = None)]