Skip to content
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
5 changes: 5 additions & 0 deletions willow/proto/willow/messages.proto
Original file line number Diff line number Diff line change
Expand Up @@ -127,3 +127,8 @@ message RecoveryResponse {
message VerifyKeyContributionsRequest {
repeated KeyContribution key_contributions = 1;
}

// Finalized partial decryption after aggregating responses from decryptors.
message FinalizedPartialDecryption {
ShellAhePartialDecryption partial_decryption_sum = 1;
}
39 changes: 39 additions & 0 deletions willow/protocol/messages.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ use messages_rust_proto::{
CiphertextContribution as CiphertextContributionProto, ClientMessage as ClientMessageProto,
DPSetupContribution as DPSetupContributionProto,
DecryptionRequestContribution as DecryptionRequestContributionProto,
FinalizedPartialDecryption as FinalizedPartialDecryptionProto,
KeyContribution as KeyContributionProto,
PartialDecryptionRequest as PartialDecryptionRequestProto,
PartialDecryptionResponse as PartialDecryptionResponseProto,
Expand Down Expand Up @@ -713,6 +714,44 @@ where
}
}

impl<'a, C, Vahe> ToProto<&'a C> for FinalizedPartialDecryption<Vahe>
where
C: HasVahe<Vahe = Vahe>,
Vahe: VaheBase + 'a,
Vahe::PartialDecryption: ToProto<&'a Vahe, Proto = ShellAhePartialDecryption>,
{
type Proto = FinalizedPartialDecryptionProto;

fn to_proto(&self, context: &'a C) -> Result<Self::Proto, StatusError> {
let vahe = context.vahe();
Ok(proto!(FinalizedPartialDecryptionProto {
partial_decryption_sum: self.partial_decryption_sum.to_proto(vahe)?,
}))
}
}

impl<'a, C, Vahe> FromProto<&'a C> for FinalizedPartialDecryption<Vahe>
where
C: HasVahe<Vahe = Vahe>,
Vahe: VaheBase + 'a,
Vahe::PartialDecryption: FromProto<&'a Vahe, Proto = ShellAhePartialDecryption>,
{
type Proto = FinalizedPartialDecryptionProto;

fn from_proto(
proto: impl AsView<Proxied = Self::Proto>,
context: &'a C,
) -> Result<Self, StatusError> {
let proto = proto.as_view();
Ok(FinalizedPartialDecryption {
partial_decryption_sum: Vahe::PartialDecryption::from_proto(
proto.partial_decryption_sum(),
context.vahe(),
)?,
})
}
}

/// Tracks a multi-decryptor's progress through the protocol.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
pub enum DecryptorStatus {
Expand Down