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

Fix/upgrade server simplification #523

Merged
merged 2 commits into from
Oct 15, 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
2 changes: 0 additions & 2 deletions deploy/stage/smpcv2-0-stage/values-upgrade-server-left.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ args:
- "left"
- "--environment"
- "$(ENVIRONMENT)"
- "--batch-size"
- "50"

initContainer:
enabled: true
Expand Down
2 changes: 0 additions & 2 deletions deploy/stage/smpcv2-0-stage/values-upgrade-server-right.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ args:
- "right"
- "--environment"
- "$(ENVIRONMENT)"
- "--batch-size"
- "50"

initContainer:
enabled: true
Expand Down
2 changes: 0 additions & 2 deletions deploy/stage/smpcv2-1-stage/values-upgrade-server-left.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ args:
- "left"
- "--environment"
- "$(ENVIRONMENT)"
- "--batch-size"
- "50"

initContainer:
enabled: true
Expand Down
2 changes: 0 additions & 2 deletions deploy/stage/smpcv2-1-stage/values-upgrade-server-right.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ args:
- "right"
- "--environment"
- "$(ENVIRONMENT)"
- "--batch-size"
- "50"

initContainer:
enabled: true
Expand Down
2 changes: 0 additions & 2 deletions deploy/stage/smpcv2-2-stage/values-upgrade-server-left.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ args:
- "left"
- "--environment"
- "$(ENVIRONMENT)"
- "--batch-size"
- "50"

initContainer:
enabled: true
Expand Down
2 changes: 0 additions & 2 deletions deploy/stage/smpcv2-2-stage/values-upgrade-server-right.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ args:
- "right"
- "--environment"
- "$(ENVIRONMENT)"
- "--batch-size"
- "50"

initContainer:
enabled: true
Expand Down
5 changes: 5 additions & 0 deletions iris-mpc-upgrade/src/bin/tcp_ssl_upgrade_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,15 @@ async fn main() -> eyre::Result<()> {
server1.write_u64(start).await?;
server2.write_u64(start).await?;
server3.write_u64(start).await?;

server1.write_u64(end).await?;
server2.write_u64(end).await?;
server3.write_u64(end).await?;

server1.write_u8(args.batch_size).await?;
server2.write_u8(args.batch_size).await?;
server3.write_u8(args.batch_size).await?;

server1.flush().await?;
server2.flush().await?;
server3.flush().await?;
Expand Down
26 changes: 15 additions & 11 deletions iris-mpc-upgrade/src/bin/tcp_upgrade_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,22 +107,26 @@ async fn main() -> eyre::Result<()> {
end2
);
}

let batch_size1 = client_stream1.read_u8().await?;
let batch_size2 = client_stream2.read_u8().await?;

if batch_size1 != batch_size2 {
bail!(
"Invalid batch size: client1: {}, client2: {}",
batch_size1,
batch_size2,
);
}

let num_elements = end1.checked_sub(start1).unwrap();
let num_batches = num_elements / u64::from(args.batch_size);
tracing::info!(
"Batch size: {}, num batches: {}",
args.batch_size,
num_batches
);
let num_batches = num_elements / u64::from(batch_size1);
tracing::info!("Batch size: {}, num batches: {}", batch_size1, num_batches);

let mut batch = Vec::new();

for batch_num in 0..num_batches + 1 {
tracing::info!(
"Processing batch {} of size: {}",
batch_num,
args.batch_size
);
tracing::info!("Processing batch {} of size: {}", batch_num, batch_size1);
let start_time = Instant::now();
let batch_size_1_message = client_stream1.read_u8().await?;
let batch_size_2_message = client_stream2.read_u8().await?;
Expand Down
5 changes: 1 addition & 4 deletions iris-mpc-upgrade/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,17 +49,14 @@ pub struct UpgradeServerConfig {
#[clap(long)]
pub party_id: PartyID,

#[clap(long)]
pub batch_size: u8,

#[clap(long)]
pub eye: Eye,

#[clap(long)]
pub environment: String,
}

impl std::fmt::Debug for UpgradeServerConfig {
impl fmt::Debug for UpgradeServerConfig {
fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
f.debug_struct("UpgradeServerConfig")
.field("bind_addr", &self.bind_addr)
Expand Down
Loading