Skip to content

Commit 9a8d28f

Browse files
committed
fix cargo test-all-features
1 parent 9799754 commit 9a8d28f

File tree

6 files changed

+20
-32
lines changed

6 files changed

+20
-32
lines changed

Cargo.toml

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,21 @@ repository = "https://github.com/iron-fish/ironfish-frost"
1212
blake3 = { version = "1.5.0", optional = true }
1313
chacha20 = "0.9.1"
1414
chacha20poly1305 = "0.10.1"
15-
ed25519-dalek = { version = "2.1.0", features = ["rand_core"] }
15+
ed25519-dalek = { version = "2.1.0", default-features = false, features = ["rand_core", "alloc"] }
1616
rand_chacha = { version = "0.3.1", optional = true }
17-
rand_core = "0.6.4"
18-
reddsa = { git = "https://github.com/ZcashFoundation/reddsa.git", rev = "311baf8865f6e21527d1f20750d8f2cf5c9e531a", features = ["frost", "frost-rerandomized"] }
19-
siphasher = { version = "1.0.0", features =["serde_no_std"] }
20-
x25519-dalek = { version = "2.0.0", features = ["reusable_secrets", "static_secrets"] }
17+
rand_core = { version = "0.6.4", default-features = false, features = ["alloc"] }
18+
reddsa = { path = "../reddsa", default-features = false, features = ["frost", "alloc"]}
19+
frost-core = { git = "https://github.com/ZcashFoundation/frost.git", package = "frost-core", default-features = false, features = ["serialization", "serde", "cheater-detection"] }
20+
frost-rerandomized = { git = "https://github.com/ZcashFoundation/frost.git", package = "frost-rerandomized", default-features = false }
21+
siphasher = { version = "1.0.0", default-features = false }
22+
x25519-dalek = { version = "2.0.0", default-features = false, features = ["reusable_secrets", "static_secrets"] }
2123

2224
[dev-dependencies]
2325
hex-literal = "0.4.1"
2426
rand = "0.8.5"
2527

2628
[features]
27-
default = ["signing"]
29+
default = ["dkg"]
2830

2931
std = []
3032
signing = ["dep:blake3", "dep:rand_chacha", "std"]

src/checksum.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,3 @@ impl fmt::Display for ChecksumError {
3030
}
3131
}
3232
}
33-
34-
#[cfg(feature = "std")]
35-
use std::error;
36-
#[cfg(feature = "std")]
37-
impl error::Error for ChecksumError {}

src/dkg/round1.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ use crate::frost::Identifier;
1616
use crate::frost::JubjubScalarField;
1717
use crate::io;
1818
use crate::multienc;
19+
use crate::multienc::read_encrypted_blob;
1920
use crate::participant;
2021
use crate::participant::Identity;
2122
use crate::serde::read_u16;
@@ -34,8 +35,6 @@ use core::mem;
3435
#[cfg(not(feature = "std"))]
3536
extern crate alloc;
3637
#[cfg(not(feature = "std"))]
37-
use alloc::string::ToString;
38-
#[cfg(not(feature = "std"))]
3938
use alloc::vec::Vec;
4039

4140
type Scalar = <JubjubScalarField as Field>::Scalar;

src/dkg/round2.rs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -329,18 +329,19 @@ impl CombinedPublicPackage {
329329
Ok(write_variable_length(
330330
writer,
331331
&self.packages,
332-
|writer, pkg| Ok(pkg.serialize_without_sender_into(writer)?),
332+
|writer, pkg| {
333+
pkg.serialize_without_sender_into(writer)
334+
.map_err(|_| io::Error::other("serialize_into failed"))
335+
},
333336
)?)
334337
}
335338

336-
pub fn deserialize_from<R: io::Read>(mut reader: R) -> io::Result<Self> {
339+
pub fn deserialize_from<R: io::Read>(mut reader: R) -> Result<Self, IronfishFrostError> {
337340
let sender_identity = Identity::deserialize_from(&mut reader)?;
338341

339342
let packages = read_variable_length(reader, move |reader| {
340-
Ok(PublicPackage::deserialize_without_sender_from(
341-
reader,
342-
sender_identity.clone(),
343-
)?)
343+
PublicPackage::deserialize_without_sender_from(reader, sender_identity.clone())
344+
.map_err(|_| io::Error::other("deserialization failed"))
344345
})?;
345346

346347
Ok(Self { packages })

src/dkg/round3.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,6 @@ impl PublicKeyPackage {
8383
bytes
8484
}
8585

86-
#[cfg(feature = "std")]
8786
pub fn serialize_into<W: io::Write>(&self, mut writer: W) -> Result<(), IronfishFrostError> {
8887
let frost_public_key_package = self.frost_public_key_package.serialize()?;
8988
write_variable_length_bytes(&mut writer, &frost_public_key_package)?;

src/error.rs

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,13 @@ use reddsa::frost::redjubjub::frost::Error as FrostError;
66
use reddsa::frost::redjubjub::JubjubBlake2b512;
77

88
use crate::checksum::ChecksumError;
9+
use crate::io;
910

1011
#[derive(Debug)]
1112
pub enum IronfishFrostError {
1213
InvalidInput,
1314
StdError,
14-
IoError(std::io::Error),
15+
IoError(io::Error),
1516
FrostError(FrostError<JubjubBlake2b512>),
1617
SignatureError(ed25519_dalek::SignatureError),
1718
ChecksumError(ChecksumError),
@@ -23,8 +24,8 @@ impl From<FrostError<JubjubBlake2b512>> for IronfishFrostError {
2324
}
2425
}
2526

26-
impl From<std::io::Error> for IronfishFrostError {
27-
fn from(error: std::io::Error) -> Self {
27+
impl From<io::Error> for IronfishFrostError {
28+
fn from(error: io::Error) -> Self {
2829
IronfishFrostError::IoError(error)
2930
}
3031
}
@@ -34,12 +35,3 @@ impl From<ed25519_dalek::SignatureError> for IronfishFrostError {
3435
IronfishFrostError::SignatureError(error)
3536
}
3637
}
37-
38-
impl From<IronfishFrostError> for std::io::Error {
39-
fn from(error: IronfishFrostError) -> Self {
40-
match error {
41-
IronfishFrostError::IoError(e) => e,
42-
_ => std::io::Error::new(std::io::ErrorKind::Other, format!("{:?}", error)),
43-
}
44-
}
45-
}

0 commit comments

Comments
 (0)