feat(server): ProposalKind::UpdateShamirParameters

This commit is contained in:
CleverWild
2026-06-13 21:20:06 +02:00
parent f080a8615f
commit ab767fe158
4 changed files with 71 additions and 1 deletions

View File

@@ -20,6 +20,7 @@ pub enum ProposalKind {
GrantWalletAccess { wallet_id: i32, client_id: i32 },
ApproveServerUpdate,
ReplaceOperator { new_pubkey: Vec<u8> },
UpdateShamirParameters { new_n: u8 },
}
impl ProposalKind {
@@ -29,6 +30,7 @@ impl ProposalKind {
Self::GrantWalletAccess { .. } => "grant_wallet_access",
Self::ApproveServerUpdate => "approve_server_update",
Self::ReplaceOperator { .. } => "replace_operator",
Self::UpdateShamirParameters { .. } => "update_shamir_parameters",
}
}
@@ -50,6 +52,7 @@ impl ProposalKind {
buf.extend_from_slice(new_pubkey);
buf
}
Self::UpdateShamirParameters { new_n } => vec![*new_n],
}
}
@@ -84,6 +87,12 @@ impl ProposalKind {
new_pubkey: rest[..len].to_vec(),
})
}
"update_shamir_parameters" => {
let &[new_n] = payload else {
return Err("invalid payload for update_shamir_parameters".to_owned());
};
Ok(Self::UpdateShamirParameters { new_n })
}
other => Err(format!("unknown proposal kind: {other}")),
}
}
@@ -415,6 +424,9 @@ impl ProposalManager {
ProposalKind::ReplaceOperator { new_pubkey } => {
self.execute_replace_operator(new_pubkey).await
}
ProposalKind::UpdateShamirParameters { new_n } => {
self.execute_update_shamir_parameters(new_n)
}
}
}
@@ -445,6 +457,16 @@ impl ProposalManager {
Ok(())
}
#[expect(
clippy::unused_self,
clippy::unnecessary_wraps,
reason = "signature must match other execute_* methods"
)]
fn execute_update_shamir_parameters(&self, new_n: u8) -> Result<(), Error> {
warn!(new_n, "UpdateShamirParameters approved; Shamir re-keying must be performed out-of-band");
Ok(())
}
async fn execute_approve_sdk_client(&self, client_id: i32) -> Result<(), Error> {
use arbiter_crypto::authn;
use crate::{

View File

@@ -56,6 +56,10 @@ async fn handle_create(
Some(ProtoKind::ReplaceOperator(p)) => ProposalKind::ReplaceOperator {
new_pubkey: p.new_pubkey,
},
Some(ProtoKind::UpdateShamirParameters(p)) => ProposalKind::UpdateShamirParameters {
#[expect(clippy::cast_possible_truncation, clippy::as_conversions, reason = "new_n is always a small operator count")]
new_n: p.new_n as u8,
},
None => return Err(Status::invalid_argument("Missing proposal kind")),
};
let ttl_secs = req.ttl_secs.map(i64::from);