Skip to content
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

ack time, logging #465

Merged
merged 1 commit into from
Sep 30, 2024
Merged
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
13 changes: 8 additions & 5 deletions iris-mpc-upgrade/src/bin/tcp_upgrade_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ use iris_mpc_common::{
IRIS_CODE_LENGTH,
};
use iris_mpc_upgrade::{
config::{UpgradeClientConfig, BATCH_SUCCESSFUL_ACK, FINAL_BATCH_SUCCESSFUL_ACK},
config::{
UpgradeClientConfig, BATCH_SUCCESSFUL_ACK, BATCH_TIMEOUT_SECONDS,
FINAL_BATCH_SUCCESSFUL_ACK,
},
db::V1Db,
packets::{MaskShareMessage, TwoToThreeIrisCodeMessage},
OldIrisShareSource,
Expand Down Expand Up @@ -329,7 +332,7 @@ async fn send_batch_and_wait_for_ack(
}

async fn wait_for_ack(server: &mut TlsStream<TcpStream>) -> eyre::Result<()> {
match timeout(Duration::from_secs(10), server.read_u8()).await {
match timeout(Duration::from_secs(BATCH_TIMEOUT_SECONDS), server.read_u8()).await {
Ok(Ok(BATCH_SUCCESSFUL_ACK)) => {
// Ack received successfully
tracing::info!("ACK received for batch");
Expand Down Expand Up @@ -505,7 +508,7 @@ impl OldIrisShareSource for MockOldDbParty1 {
fn stream_shares(
&self,
share_id_range: std::ops::Range<u64>,
) -> eyre::Result<impl futures::Stream<Item = eyre::Result<(u64, EncodedBits)>>> {
) -> eyre::Result<impl Stream<Item = eyre::Result<(u64, EncodedBits)>>> {
let mut id = share_id_range.start;
Ok(futures::stream::poll_fn(move |_| {
if id < share_id_range.end {
Expand Down Expand Up @@ -564,7 +567,7 @@ impl OldIrisShareSource for MockOldDbParty2 {
fn stream_shares(
&self,
share_id_range: std::ops::Range<u64>,
) -> eyre::Result<impl futures::Stream<Item = eyre::Result<(u64, EncodedBits)>>> {
) -> eyre::Result<impl Stream<Item = eyre::Result<(u64, EncodedBits)>>> {
let mut id = share_id_range.start;
Ok(futures::stream::poll_fn(move |_| {
if id < share_id_range.end {
Expand All @@ -584,7 +587,7 @@ impl OldIrisShareSource for MockOldDbParty2 {
fn stream_masks(
&self,
share_id_range: std::ops::Range<u64>,
) -> eyre::Result<impl futures::Stream<Item = eyre::Result<(u64, Bits)>>> {
) -> eyre::Result<impl Stream<Item = eyre::Result<(u64, Bits)>>> {
let mut id = share_id_range.start;
Ok(futures::stream::poll_fn(move |_| {
if id >= share_id_range.end {
Expand Down
6 changes: 6 additions & 0 deletions iris-mpc-upgrade/src/bin/tcp_upgrade_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -189,10 +189,16 @@ async fn main() -> eyre::Result<()> {
let duration = start_time.elapsed();
tracing::info!("Processed batch in {:.2?}", duration);
}

tracing::info!("Finalizing upgrade");
client_stream2.write_u8(FINAL_BATCH_SUCCESSFUL_ACK).await?;
tracing::info!("Sent final ACK to client2");
client_stream1.write_u8(FINAL_BATCH_SUCCESSFUL_ACK).await?;
tracing::info!("Sent final ACK to client1");

tracing::info!("Updating iris id sequence");
sink.update_iris_id_sequence().await?;
tracing::info!("Iris id sequence updated");

Ok(())
}
Expand Down
1 change: 1 addition & 0 deletions iris-mpc-upgrade/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use std::{
str::FromStr,
};

pub const BATCH_TIMEOUT_SECONDS: u64 = 30;
pub const BATCH_SUCCESSFUL_ACK: u8 = 1;
pub const FINAL_BATCH_SUCCESSFUL_ACK: u8 = 42;

Expand Down
Loading