Skip to content

Commit

Permalink
Merge pull request #932 from plebhash/feat-optional-no-std
Browse files Browse the repository at this point in the history
make `no_std` into an optional feature on `protocols` crates
  • Loading branch information
plebhash authored Aug 9, 2024
2 parents 61b5cf0 + f7ef878 commit c428ea8
Show file tree
Hide file tree
Showing 16 changed files with 20 additions and 8 deletions.
3 changes: 3 additions & 0 deletions protocols/v2/binary-sv2/serde-sv2/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,6 @@ repository = "https://github.com/stratum-mining/stratum"
[dependencies]
serde = { version = "1.0.89", features = ["derive", "alloc"], default-features = false }
buffer_sv2 = {version = "^1.0.0", path = "../../../../utils/buffer"}

[features]
no_std = []
2 changes: 1 addition & 1 deletion protocols/v2/binary-sv2/serde-sv2/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
//! [rkyv1]: https://docs.rs/rkyv/0.4.3/rkyv
//! [rkyv2]: https://davidkoloski.me/blog/rkyv-is-faster-than/

#![no_std]
#![cfg_attr(feature = "no_std", no_std)]

#[macro_use]
extern crate alloc;
Expand Down
1 change: 1 addition & 0 deletions protocols/v2/codec-sv2/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,4 @@ tracing = { version = "0.1"}
[features]
with_serde = ["binary_sv2/with_serde", "serde", "framing_sv2/with_serde", "buffer_sv2/with_serde"]
with_buffer_pool = ["framing_sv2/with_buffer_pool"]
no_std = []
2 changes: 1 addition & 1 deletion protocols/v2/codec-sv2/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#![no_std]
#![cfg_attr(feature = "no_std", no_std)]

extern crate alloc;

Expand Down
3 changes: 3 additions & 0 deletions protocols/v2/const-sv2/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,6 @@ secp256k1 = { version = "0.28.2", default-features = false, features =["hashes",

#[dev-dependencies]
#cbindgen = "0.16.0"

[features]
no_std = []
2 changes: 1 addition & 1 deletion protocols/v2/const-sv2/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//! Central repository for all the sv2 constants
#![no_std]
#![cfg_attr(feature = "no_std", no_std)]

pub const EXTENSION_TYPE_NO_EXTENSION: u16 = 0;

Expand Down
1 change: 1 addition & 0 deletions protocols/v2/framing-sv2/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,6 @@ binary_sv2 = { version = "^1.0.0", path = "../../../protocols/v2/binary-sv2/bina
buffer_sv2 = { version = "^1.0.0", path = "../../../utils/buffer", optional=true }

[features]
no_std = []
with_serde = ["binary_sv2/with_serde", "serde", "buffer_sv2/with_serde"]
with_buffer_pool = ["binary_sv2/with_buffer_pool", "buffer_sv2"]
2 changes: 1 addition & 1 deletion protocols/v2/framing-sv2/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
//!
//! The `with_serde` feature flag is only used for the Message Generator, and deprecated for any other kind of usage. It will likely be fully deprecated in the future.

#![no_std]
#![cfg_attr(feature = "no_std", no_std)]
extern crate alloc;

/// SV2 framing types
Expand Down
1 change: 1 addition & 0 deletions protocols/v2/subprotocols/common-messages/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,6 @@ quickcheck_macros = { version = "1", optional=true }
serde_repr = {version= "0.1.10", optional=true}

[features]
no_std = []
with_serde = ["binary_sv2/with_serde", "serde", "serde_repr"]
prop_test = ["quickcheck"]
2 changes: 1 addition & 1 deletion protocols/v2/subprotocols/common-messages/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#![no_std]
#![cfg_attr(feature = "no_std", no_std)]

//! Common messages for [stratum v2][Sv2]
//! The following protocol messages are common across all of the sv2 (sub)protocols.
Expand Down
1 change: 1 addition & 0 deletions protocols/v2/subprotocols/job-declaration/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@ binary_sv2 = {version = "^1.0.0", path = "../../../../protocols/v2/binary-sv2/bi
const_sv2 = {version = "^1.0.0", path = "../../../../protocols/v2/const-sv2"}

[features]
no_std = []
with_serde = ["binary_sv2/with_serde", "serde"]
2 changes: 1 addition & 1 deletion protocols/v2/subprotocols/job-declaration/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#![no_std]
#![cfg_attr(feature = "no_std", no_std)]

//! # Job Declaration Protocol
//!
Expand Down
1 change: 1 addition & 0 deletions protocols/v2/subprotocols/mining/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,5 @@ quickcheck = "1.0.3"
quickcheck_macros = "1"

[features]
no_std = []
with_serde = ["binary_sv2/with_serde", "serde"]
2 changes: 1 addition & 1 deletion protocols/v2/subprotocols/mining/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#![no_std]
#![cfg_attr(feature = "no_std", no_std)]

//! # Mining Protocol
//! ## Channels
Expand Down
1 change: 1 addition & 0 deletions protocols/v2/subprotocols/template-distribution/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,6 @@ quickcheck = { version = "1.0.3", optional=true }
quickcheck_macros = { version = "1", optional=true }

[features]
no_std = []
with_serde = ["binary_sv2/with_serde", "serde"]
prop_test = ["quickcheck"]
2 changes: 1 addition & 1 deletion protocols/v2/subprotocols/template-distribution/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#![no_std]
#![cfg_attr(feature = "no_std", no_std)]

//! # Template Distribution Protocol
//! The Template Distribution protocol is used to receive updates of the block template to use in
Expand Down

0 comments on commit c428ea8

Please sign in to comment.