Skip to content

Commit

Permalink
Split std feature into std and host-functions
Browse files Browse the repository at this point in the history
  • Loading branch information
romac committed Aug 8, 2022
1 parent a759c69 commit a5dcb65
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 4 deletions.
5 changes: 4 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -119,11 +119,14 @@ jobs:
name: Check formatting of workspace
command: cargo fmt -- --check
- run:
name: Clippy linting on workspace
name: Clippy linting on workspace (host-functions + std)
command: cargo clippy --tests -- -D warnings
- run:
name: Clippy linting on workspace (no-std)
command: cargo clippy --tests --no-default-features -- -D warnings
- run:
name: Clippy linting on workspace (host functions only)
command: cargo clippy --tests --no-default-features --features host-functions -- -D warnings
- save_cache:
paths:
- /usr/local/cargo/registry
Expand Down
4 changes: 3 additions & 1 deletion rust/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,14 @@ serde = { version = "1.0.125", features = ["derive"] }
serde_json = { version = "1.0.64" }

[features]
default = ["std"]
default = ["std", "host-functions"]
std = [
"prost/std",
"bytes/std",
"hex/std",
"anyhow/std",
]
host-functions = [
"sha2",
"sha3",
"ripemd",
Expand Down
2 changes: 1 addition & 1 deletion rust/src/host_functions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ pub trait HostFunctionsProvider {
fn ripemd160(message: &[u8]) -> [u8; 20];
}

#[cfg(any(feature = "std", test))]
#[cfg(any(feature = "host-functions", test))]
pub mod host_functions_impl {
use crate::host_functions::HostFunctionsProvider;
use ripemd::Ripemd160;
Expand Down
2 changes: 1 addition & 1 deletion rust/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@ pub use helpers::{Hash, Result};
pub use host_functions::HostFunctionsProvider;
pub use verify::calculate_existence_root;

#[cfg(feature = "std")]
#[cfg(feature = "host-functions")]
pub use host_functions::host_functions_impl::HostFunctionsManager;

0 comments on commit a5dcb65

Please sign in to comment.