refactor(server): typed pubkey len via u32::try_from in ReplaceOperator

This commit is contained in:
CleverWild
2026-06-13 21:53:46 +02:00
committed by Skipper
parent d12109c2c9
commit 291ef2e831
3 changed files with 58 additions and 34 deletions

View File

@@ -54,7 +54,8 @@ async fn handle_create(
},
Some(ProtoKind::ApproveServerUpdate(_)) => ProposalKind::ApproveServerUpdate,
Some(ProtoKind::ReplaceOperator(p)) => ProposalKind::ReplaceOperator {
new_pubkey: p.new_pubkey,
new_pubkey: p.new_pubkey.try_into()
.map_err(|_| Status::invalid_argument("replace_operator: pubkey must be 32 bytes"))?,
},
Some(ProtoKind::UpdateShamirParameters(p)) => ProposalKind::UpdateShamirParameters {
#[expect(clippy::cast_possible_truncation, clippy::as_conversions, reason = "new_n is always a small operator count")]