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

Bump Synedrion to latest master #946

Merged
merged 15 commits into from
Jul 18, 2024
Merged
Show file tree
Hide file tree
Changes from 13 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
52 changes: 44 additions & 8 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion crates/client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ x25519-dalek ={ version="2.0.1", features=["static_secrets"], optional=true }
entropy-protocol={ version="0.2.0", path="../protocol", optional=true, default-features=false }
reqwest ={ version="0.12.5", features=["json", "stream"], optional=true }
base64 ={ version="0.22.0", optional=true }
synedrion ={ git="https://github.com/entropyxyz/synedrion", rev="25373111cbb01e1a25d8a5c5bb8f4652c725b3f1", optional=true }
synedrion ={ git="https://github.com/entropyxyz/synedrion", rev="3bd9680dafc692b103fcb9c4b750fb1c6932b956", optional=true }
hex ={ version="0.4.3", optional=true }
anyhow ="1.0.86"

Expand Down
2 changes: 1 addition & 1 deletion crates/kvdb/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ zeroize ={ version="1.8", features=["zeroize_derive"], default-features=
rpassword ={ version="7.3.1", default-features=false }
scrypt ={ version="0.11.0", default-features=false, features=["std"] }
chacha20poly1305={ version="0.9", features=["alloc"], default-features=false }
synedrion ={ git="https://github.com/entropyxyz/synedrion", rev="25373111cbb01e1a25d8a5c5bb8f4652c725b3f1" }
synedrion ={ git="https://github.com/entropyxyz/synedrion", rev="3bd9680dafc692b103fcb9c4b750fb1c6932b956" }

# Async
tokio ={ version="1.38", features=["macros", "sync", "fs", "rt-multi-thread", "io-util"] }
Expand Down
2 changes: 1 addition & 1 deletion crates/protocol/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ edition ='2021'
[dependencies]
async-trait ="0.1.81"
entropy-shared ={ version="0.2.0", path="../shared", default-features=false }
synedrion ={ git="https://github.com/entropyxyz/synedrion", rev="25373111cbb01e1a25d8a5c5bb8f4652c725b3f1" }
synedrion ={ git="https://github.com/entropyxyz/synedrion", branch="hc/impl-serde-for-cggmp21-params" }
serde ={ version="1.0", features=["derive"], default-features=false }
subxt ={ version="0.35.3", default-features=false }
sp-core ={ version="31.0.0", default-features=false, features=["full_crypto", "serde"] }
Expand Down
40 changes: 21 additions & 19 deletions crates/protocol/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@

use synedrion::{
sessions, AuxGenResult, InteractiveSigningResult, KeyInitResult, KeyResharingResult,
MappedResult,
ProtocolResult,
};
use thiserror::Error;

use crate::{protocol_message::ProtocolMessage, KeyParams, PartyId};

#[derive(Debug, Error)]
pub enum GenericProtocolError<Res: MappedResult<PartyId>> {
pub enum GenericProtocolError<Res: ProtocolResult> {
#[error("Synedrion session error {0}")]
Joined(Box<sessions::Error<Res, PartyId>>),
#[error("Incoming message stream error: {0}")]
Expand All @@ -33,28 +33,28 @@ pub enum GenericProtocolError<Res: MappedResult<PartyId>> {
Mpsc(#[from] tokio::sync::mpsc::error::SendError<ProtocolMessage>),
}

impl<Res: MappedResult<PartyId>> From<sessions::LocalError> for GenericProtocolError<Res> {
impl<Res: ProtocolResult> From<sessions::LocalError> for GenericProtocolError<Res> {
fn from(err: sessions::LocalError) -> Self {
Self::Joined(Box::new(sessions::Error::Local(err)))
}
}

impl<Res: MappedResult<PartyId>> From<sessions::RemoteError<PartyId>>
for GenericProtocolError<Res>
{
impl<Res: ProtocolResult> From<sessions::RemoteError<PartyId>> for GenericProtocolError<Res> {
fn from(err: sessions::RemoteError<PartyId>) -> Self {
Self::Joined(Box::new(sessions::Error::Remote(err)))
}
}

impl<Res: MappedResult<PartyId>> From<sessions::Error<Res, PartyId>> for GenericProtocolError<Res> {
impl<Res: ProtocolResult> From<sessions::Error<Res, PartyId>> for GenericProtocolError<Res> {
fn from(err: sessions::Error<Res, PartyId>) -> Self {
Self::Joined(Box::new(err))
}
}

impl From<GenericProtocolError<InteractiveSigningResult<KeyParams>>> for ProtocolExecutionErr {
fn from(err: GenericProtocolError<InteractiveSigningResult<KeyParams>>) -> Self {
impl From<GenericProtocolError<InteractiveSigningResult<KeyParams, PartyId>>>
for ProtocolExecutionErr
{
fn from(err: GenericProtocolError<InteractiveSigningResult<KeyParams, PartyId>>) -> Self {
tracing::error!("{:?}", err);
match err {
GenericProtocolError::Joined(err) => ProtocolExecutionErr::SigningProtocolError(err),
Expand All @@ -65,8 +65,8 @@ impl From<GenericProtocolError<InteractiveSigningResult<KeyParams>>> for Protoco
}
}

impl From<GenericProtocolError<KeyInitResult<KeyParams>>> for ProtocolExecutionErr {
fn from(err: GenericProtocolError<KeyInitResult<KeyParams>>) -> Self {
impl From<GenericProtocolError<KeyInitResult<KeyParams, PartyId>>> for ProtocolExecutionErr {
fn from(err: GenericProtocolError<KeyInitResult<KeyParams, PartyId>>) -> Self {
tracing::error!("{:?}", err);
match err {
GenericProtocolError::Joined(err) => ProtocolExecutionErr::KeyInitProtocolError(err),
Expand All @@ -77,8 +77,8 @@ impl From<GenericProtocolError<KeyInitResult<KeyParams>>> for ProtocolExecutionE
}
}

impl From<GenericProtocolError<KeyResharingResult<KeyParams>>> for ProtocolExecutionErr {
fn from(err: GenericProtocolError<KeyResharingResult<KeyParams>>) -> Self {
impl From<GenericProtocolError<KeyResharingResult<KeyParams, PartyId>>> for ProtocolExecutionErr {
fn from(err: GenericProtocolError<KeyResharingResult<KeyParams, PartyId>>) -> Self {
tracing::error!("{:?}", err);
match err {
GenericProtocolError::Joined(err) => ProtocolExecutionErr::KeyReshareProtocolError(err),
Expand All @@ -89,8 +89,8 @@ impl From<GenericProtocolError<KeyResharingResult<KeyParams>>> for ProtocolExecu
}
}

impl From<GenericProtocolError<AuxGenResult<KeyParams>>> for ProtocolExecutionErr {
fn from(err: GenericProtocolError<AuxGenResult<KeyParams>>) -> Self {
impl From<GenericProtocolError<AuxGenResult<KeyParams, PartyId>>> for ProtocolExecutionErr {
fn from(err: GenericProtocolError<AuxGenResult<KeyParams, PartyId>>) -> Self {
tracing::error!("{:?}", err);
match err {
GenericProtocolError::Joined(err) => ProtocolExecutionErr::AuxGenProtocolError(err),
Expand All @@ -109,13 +109,15 @@ pub enum ProtocolExecutionErr {
#[error("Synedrion session creation error: {0}")]
SessionCreation(sessions::LocalError),
#[error("Synedrion signing session error")]
SigningProtocolError(Box<sessions::Error<InteractiveSigningResult<KeyParams>, PartyId>>),
SigningProtocolError(
Box<sessions::Error<InteractiveSigningResult<KeyParams, PartyId>, PartyId>>,
),
#[error("Synedrion key init session error")]
KeyInitProtocolError(Box<sessions::Error<KeyInitResult<KeyParams>, PartyId>>),
KeyInitProtocolError(Box<sessions::Error<KeyInitResult<KeyParams, PartyId>, PartyId>>),
#[error("Synedrion key reshare session error")]
KeyReshareProtocolError(Box<sessions::Error<KeyResharingResult<KeyParams>, PartyId>>),
KeyReshareProtocolError(Box<sessions::Error<KeyResharingResult<KeyParams, PartyId>, PartyId>>),
#[error("Synedrion aux generation session error")]
AuxGenProtocolError(Box<sessions::Error<AuxGenResult<KeyParams>, PartyId>>),
AuxGenProtocolError(Box<sessions::Error<AuxGenResult<KeyParams, PartyId>, PartyId>>),
#[error("Broadcast error: {0}")]
Broadcast(#[from] Box<tokio::sync::broadcast::error::SendError<ProtocolMessage>>),
#[error("Mpsc send error: {0}")]
Expand Down
Loading