Skip to content

Commit a6a2efd

Browse files
committed
fix cargo test-all-features
1 parent ce5dae2 commit a6a2efd

File tree

6 files changed

+12
-22
lines changed

6 files changed

+12
-22
lines changed

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ ed25519-dalek = { version = "2.1.0", features = ["rand_core"] }
1616
rand_chacha = { version = "0.3.1", optional = true }
1717
rand_core = "0.6.4"
1818
reddsa = { git = "https://github.com/ZcashFoundation/reddsa.git", rev = "b9c3107e6ec5333a89a7fa064f2d10f749a90cce", features = ["frost", "frost-rerandomized"] }
19-
siphasher = { version = "1.0.0", optional = true }
19+
siphasher = { version = "1.0.0" }
2020
x25519-dalek = { version = "2.0.0", features = ["reusable_secrets", "static_secrets"] }
2121

2222
[dev-dependencies]
@@ -27,5 +27,5 @@ rand = "0.8.5"
2727
default = ["std", "signing", "dkg"]
2828

2929
std = []
30-
signing = ["dep:blake3", "dep:rand_chacha", "dep:siphasher", "std"]
30+
signing = ["dep:blake3", "dep:rand_chacha", "std"]
3131
dkg = ["std", "signing"]

src/checksum.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22
* License, v. 2.0. If a copy of the MPL was not distributed with this
33
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
44

5-
use std::error;
6-
use std::fmt;
5+
use core::fmt;
76

87
use siphasher::sip::SipHasher24;
98

@@ -32,5 +31,3 @@ impl fmt::Display for ChecksumError {
3231
}
3332
}
3433
}
35-
36-
impl error::Error for ChecksumError {}

src/dkg/round2.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -319,18 +319,18 @@ impl CombinedPublicPackage {
319319
Ok(write_variable_length(
320320
writer,
321321
&self.packages,
322-
|writer, pkg| Ok(pkg.serialize_without_sender_into(writer)?),
322+
|writer, pkg| Ok(pkg.serialize_without_sender_into(writer).map_err(|_| io::Error::other("serialize_into failed"))?),
323323
)?)
324324
}
325325

326-
pub fn deserialize_from<R: io::Read>(mut reader: R) -> io::Result<Self> {
326+
pub fn deserialize_from<R: io::Read>(mut reader: R) -> Result<Self, IronfishFrostError> {
327327
let sender_identity = Identity::deserialize_from(&mut reader)?;
328328

329329
let packages = read_variable_length(reader, move |reader| {
330330
Ok(PublicPackage::deserialize_without_sender_from(
331331
reader,
332332
sender_identity.clone(),
333-
)?)
333+
).map_err(|_| io::Error::other("deserialization failed"))?)
334334
})?;
335335

336336
Ok(Self { packages })

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-
}

src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111

1212
mod serde;
1313

14-
#[cfg(feature = "signing")]
1514
mod checksum;
1615

1716
pub mod error;

src/serde.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
77
use crate::io;
88

9+
910
#[inline]
1011
#[cfg(feature = "dkg")]
1112
pub(crate) fn write_u16<W: io::Write>(mut writer: W, value: u16) -> io::Result<()> {
@@ -79,6 +80,7 @@ where
7980
R: io::Read,
8081
F: Fn(&mut R) -> io::Result<T>,
8182
{
83+
8284
let len = read_usize(&mut reader)?;
8385
let mut items = Vec::with_capacity(len);
8486
for _ in 0..len {

0 commit comments

Comments
 (0)