diff --git a/clarity/Cargo.toml b/clarity/Cargo.toml index 2e35c06473..284e856e49 100644 --- a/clarity/Cargo.toml +++ b/clarity/Cargo.toml @@ -55,3 +55,5 @@ developer-mode = ["stacks_common/developer-mode"] slog_json = ["stacks_common/slog_json"] testing = ["canonical"] devtools = [] +rollback_value_check = [] +disable-costs = [] diff --git a/clarity/src/vm/database/key_value_wrapper.rs b/clarity/src/vm/database/key_value_wrapper.rs index 69eb74b39e..3fd845f92f 100644 --- a/clarity/src/vm/database/key_value_wrapper.rs +++ b/clarity/src/vm/database/key_value_wrapper.rs @@ -31,15 +31,15 @@ use crate::vm::types::{ }; use crate::vm::{StacksEpoch, Value}; -#[cfg(rollback_value_check)] +#[cfg(feature = "rollback_value_check")] type RollbackValueCheck = String; -#[cfg(not(rollback_value_check))] +#[cfg(not(feature = "rollback_value_check"))] type RollbackValueCheck = (); -#[cfg(not(rollback_value_check))] +#[cfg(not(feature = "rollback_value_check"))] fn rollback_value_check(_value: &str, _check: &RollbackValueCheck) {} -#[cfg(not(rollback_value_check))] +#[cfg(not(feature = "rollback_value_check"))] fn rollback_edits_push(edits: &mut Vec<(T, RollbackValueCheck)>, key: T, _value: &str) { edits.push((key, ())); } @@ -47,7 +47,7 @@ fn rollback_edits_push(edits: &mut Vec<(T, RollbackValueCheck)>, key: T, _val // wrapper -- i.e., when committing to the underlying store. for the _unchecked_ implementation // this is used to get the edit _value_ out of the lookupmap, for used in the subsequent `put_all` // command. -#[cfg(not(rollback_value_check))] +#[cfg(not(feature = "rollback_value_check"))] fn rollback_check_pre_bottom_commit( edits: Vec<(T, RollbackValueCheck)>, lookup_map: &mut HashMap>, @@ -71,11 +71,11 @@ where output } -#[cfg(rollback_value_check)] +#[cfg(feature = "rollback_value_check")] fn rollback_value_check(value: &String, check: &RollbackValueCheck) { assert_eq!(value, check) } -#[cfg(rollback_value_check)] +#[cfg(feature = "rollback_value_check")] fn rollback_edits_push(edits: &mut Vec<(T, RollbackValueCheck)>, key: T, value: &String) where T: Eq + Hash + Clone, @@ -84,7 +84,7 @@ where } // this function is used to check the lookup map when committing at the "bottom" of the // wrapper -- i.e., when committing to the underlying store. -#[cfg(rollback_value_check)] +#[cfg(feature = "rollback_value_check")] fn rollback_check_pre_bottom_commit( edits: Vec<(T, RollbackValueCheck)>, lookup_map: &mut HashMap>, diff --git a/stacks-common/Cargo.toml b/stacks-common/Cargo.toml index 57c1407fa8..b91f63ff99 100644 --- a/stacks-common/Cargo.toml +++ b/stacks-common/Cargo.toml @@ -75,6 +75,10 @@ canonical = ["rusqlite"] developer-mode = [] slog_json = ["slog-json"] testing = ["canonical"] +serde = [] +clippy = [] +bech32_std = [] +bech32_strict = [] [target.'cfg(all(any(target_arch = "x86_64", target_arch = "x86", target_arch = "aarch64"), not(any(target_os="windows"))))'.dependencies] sha2 = { version = "0.10", features = ["asm"] } diff --git a/stacks-common/src/deps_common/bech32/mod.rs b/stacks-common/src/deps_common/bech32/mod.rs index 99f95e9cd6..655f2b1a82 100644 --- a/stacks-common/src/deps_common/bech32/mod.rs +++ b/stacks-common/src/deps_common/bech32/mod.rs @@ -30,7 +30,7 @@ //! has more details. //! #![cfg_attr( - feature = "std", + feature = "bech32_std", doc = " # Examples ``` @@ -54,20 +54,20 @@ assert_eq!(variant, Variant::Bech32); #![deny(non_camel_case_types)] #![deny(non_snake_case)] #![deny(unused_mut)] -#![cfg_attr(feature = "strict", deny(warnings))] +#![cfg_attr(feature = "bech32_strict", deny(warnings))] -#[cfg(all(not(feature = "std"), not(test)))] +#[cfg(all(not(feature = "bech32_std"), not(test)))] extern crate alloc; -#[cfg(any(test, feature = "std"))] +#[cfg(any(test, feature = "bech32_std"))] extern crate core; -#[cfg(all(not(feature = "std"), not(test)))] +#[cfg(all(not(feature = "bech32_std"), not(test)))] use alloc::borrow::Cow; -#[cfg(all(not(feature = "std"), not(test)))] +#[cfg(all(not(feature = "bech32_std"), not(test)))] use alloc::{string::String, vec::Vec}; use core::{fmt, mem}; -#[cfg(any(feature = "std", test))] +#[cfg(any(feature = "bech32_std", test))] use std::borrow::Cow; /// Integer in the range `0..32` @@ -690,7 +690,7 @@ impl fmt::Display for Error { } } -#[cfg(any(feature = "std", test))] +#[cfg(any(feature = "bech32_std", test))] impl std::error::Error for Error { fn description(&self) -> &str { match *self { diff --git a/stacks-common/src/deps_common/httparse/mod.rs b/stacks-common/src/deps_common/httparse/mod.rs index 90a08bf2f1..67ca2c52cd 100644 --- a/stacks-common/src/deps_common/httparse/mod.rs +++ b/stacks-common/src/deps_common/httparse/mod.rs @@ -22,7 +22,6 @@ #![cfg_attr(test, deny(warnings))] // we can't upgrade while supporting Rust 1.3 #![allow(deprecated)] -#![cfg_attr(httparse_min_2018, allow(rust_2018_idioms))] //! # httparse //! diff --git a/stackslib/src/clarity_cli.rs b/stackslib/src/clarity_cli.rs index 53b53c36b7..21cf55dea6 100644 --- a/stackslib/src/clarity_cli.rs +++ b/stackslib/src/clarity_cli.rs @@ -106,7 +106,6 @@ macro_rules! panic_test { }; } -#[cfg_attr(tarpaulin, skip)] fn print_usage(invoked_by: &str) { eprintln!( "Usage: {} [command] @@ -129,7 +128,6 @@ where command is one of: panic_test!() } -#[cfg_attr(tarpaulin, skip)] fn friendly_expect(input: Result, msg: &str) -> A { input.unwrap_or_else(|e| { eprintln!("{}\nCaused by: {}", msg, e); @@ -137,7 +135,6 @@ fn friendly_expect(input: Result, msg: &str) -> A }) } -#[cfg_attr(tarpaulin, skip)] fn friendly_expect_opt(input: Option, msg: &str) -> A { input.unwrap_or_else(|| { eprintln!("{}", msg); diff --git a/testnet/stacks-node/Cargo.toml b/testnet/stacks-node/Cargo.toml index ba674dbaac..aa72f814db 100644 --- a/testnet/stacks-node/Cargo.toml +++ b/testnet/stacks-node/Cargo.toml @@ -63,3 +63,4 @@ monitoring_prom = ["stacks/monitoring_prom", "libsigner/monitoring_prom", "stack slog_json = ["stacks/slog_json", "stacks-common/slog_json", "clarity/slog_json"] prod-genesis-chainstate = [] default = [] +testing = []