feat(server): key-rotation proposals require full quorum (§3.3)
Some checks failed
ci/woodpecker/pr/server-audit Pipeline was successful
ci/woodpecker/pr/server-lint Pipeline failed
ci/woodpecker/pr/server-vet Pipeline failed
ci/woodpecker/pr/server-test Pipeline was successful

This commit is contained in:
CleverWild
2026-06-13 22:20:48 +02:00
parent f8c621b20e
commit 2fda0484fc
2 changed files with 60 additions and 1 deletions

View File

@@ -64,6 +64,12 @@ impl ProposalKind {
}
}
/// Key-rotation proposals require every operator to approve (§3.3).
#[must_use]
pub fn requires_full_quorum(kind: &str) -> bool {
matches!(kind, "replace_operator" | "update_shamir_parameters")
}
pub fn decode(kind: &str, payload: &[u8]) -> Result<Self, String> {
match kind {
"approve_sdk_client" => {
@@ -379,7 +385,12 @@ impl ProposalManager {
clippy::as_conversions,
reason = "operator count is always a small positive integer"
)]
let threshold = crate::crypto::shamir::shamir_threshold(total_operators as usize);
let threshold = if ProposalKind::requires_full_quorum(&proposal.kind) {
// §3.3: key-rotation proposals require every operator to approve
total_operators as usize
} else {
crate::crypto::shamir::shamir_threshold(total_operators as usize)
};
let approve_count: i64 = schema::proposal_vote::table
.filter(schema::proposal_vote::proposal_id.eq(proposal_id))