Skip to content

Commit a7e3770

Browse files
authored
Merge pull request #15 from LFDT-Lockness/no_std
Use `core::error::Error`
2 parents c0053fb + 36d8875 commit a7e3770

File tree

5 files changed

+20
-19
lines changed

5 files changed

+20
-19
lines changed

CHANGELOG.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
# hd-wallet crate changelog
22

33
## v0.6.0
4-
* Remove slip10-like derivation that can be instantiated with any curve: it is very inefficient
4+
* BREAKING: Remove slip10-like derivation that can be instantiated with any curve: it is very inefficient
55
when instantiated with certain curves, and may also enable attacker to perform DoS attack by
66
finding derivation path that results into very long computation [#14]
77
* Add stark-specific derivation: secure and efficient derivation for stark curve [#14]
8+
* Use `Error` trait from `core` instead of `std` [#15]
9+
* BREAKING: remove `std` feature as the lib is fully no_std now
810

911
[#14]: https://github.com/LFDT-Lockness/hd-wallet/pull/14
12+
[#15]: https://github.com/LFDT-Lockness/hd-wallet/pull/15
1013

1114
## v0.5.1
1215
* Update docs and repo link [#11]

Cargo.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ generic-ec = { version = "0.4", default-features = false, features = ["curve-sta
2828

2929
[features]
3030
default = []
31-
std = []
3231
# Adds support of secp256k1 curve to slip10 derivation
3332
curve-secp256k1 = ["generic-ec/curve-secp256k1", "slip10"]
3433
# Adds support of secp256r1 curve to slip10 derivation
@@ -37,7 +36,7 @@ curve-secp256r1 = ["generic-ec/curve-secp256r1", "slip10"]
3736
curve-ed25519 = ["generic-ec/curve-ed25519", "edwards"]
3837
# Enables Stark-specific derivation
3938
curve-stark = ["generic-ec/curve-stark", "stark"]
40-
all-curves = ["curve-secp256k1", "curve-secp256r1", "curve-ed25519"]
39+
all-curves = ["curve-secp256k1", "curve-secp256r1", "curve-ed25519", "curve-stark"]
4140
serde = ["dep:serde", "generic-ec/serde"]
4241

4342
# Enables Slip10 derivation

README.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,11 @@ let child_key = derive_using_generic_algo::<Secp256r1, Slip10>(master_key_pair);
5252
```
5353

5454
### Features
55-
* `std`: enables std library support (mainly, it just implements `Error`
56-
trait for the error types)
57-
* `curve-secp256k1`, `curve-secp256r1`, `curve-ed25519` add curve implementation into the crate
58-
curves module
55+
* `curve-secp256k1`, `curve-secp256r1`, `curve-ed25519`, `curve-stark` add curve implementation
56+
into the crate curves module
57+
* `all-curves` adds all curves listed above
58+
* `slip10`, `edwards`, `stark` add `slip10`, `edwards`, and `stark` HD derivations respectively
59+
* `serde` adds `serde::{Serialize, Deserialize}` traits implementation to the types in the library
5960

6061
## Join us in Discord!
6162
Feel free to reach out to us [in Discord](https://discordapp.com/channels/905194001349627914/1285268686147424388)!

src/errors.rs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@ impl fmt::Display for InvalidLength {
1212
}
1313
}
1414

15-
#[cfg(feature = "std")]
16-
impl std::error::Error for InvalidLength {}
15+
impl core::error::Error for InvalidLength {}
1716

1817
/// Value was out of range
1918
#[derive(Debug)]
@@ -25,8 +24,7 @@ impl fmt::Display for OutOfRange {
2524
}
2625
}
2726

28-
#[cfg(feature = "std")]
29-
impl std::error::Error for OutOfRange {}
27+
impl core::error::Error for OutOfRange {}
3028

3129
/// Error returned by parsing child index
3230
#[derive(Debug)]
@@ -46,9 +44,8 @@ impl fmt::Display for ParseChildIndexError {
4644
}
4745
}
4846

49-
#[cfg(feature = "std")]
50-
impl std::error::Error for ParseChildIndexError {
51-
fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
47+
impl core::error::Error for ParseChildIndexError {
48+
fn source(&self) -> Option<&(dyn core::error::Error + 'static)> {
5249
match self {
5350
ParseChildIndexError::ParseInt(e) => Some(e),
5451
ParseChildIndexError::IndexNotInRange(e) => Some(e),

src/lib.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,18 +54,19 @@
5454
//! ```
5555
//!
5656
//! ### Features
57-
//! * `std`: enables std library support (mainly, it just implements [`Error`](std::error::Error)
58-
//! trait for the error types)
59-
//! * `curve-secp256k1`, `curve-secp256r1`, `curve-ed25519` add curve implementation into the crate
60-
//! [curves] module
57+
//! * `curve-secp256k1`, `curve-secp256r1`, `curve-ed25519`, `curve-stark` add curve implementation
58+
//! into the crate [curves] module
59+
//! * `all-curves` adds all curves listed above
60+
//! * `slip10`, `edwards`, `stark` add [`slip10`], [`edwards`], and [`stark`] HD derivations respectively
61+
//! * `serde` adds `serde::{Serialize, Deserialize}` traits implementation to the types in the library
6162
//!
6263
//! ## Join us in Discord!
6364
//! Feel free to reach out to us [in Discord](https://discordapp.com/channels/905194001349627914/1285268686147424388)!
6465
//!
6566
//! [slip10-spec]: https://github.com/satoshilabs/slips/blob/master/slip-0010.md
6667
//! [bip32-spec]: https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki
6768
68-
#![cfg_attr(not(feature = "std"), no_std)]
69+
#![no_std]
6970
#![forbid(missing_docs, unsafe_code)]
7071
#![cfg_attr(not(test), forbid(unused_crate_dependencies))]
7172

0 commit comments

Comments
 (0)