From e77b4a75d7dc6f287413ee522d8dd449cbfca11a Mon Sep 17 00:00:00 2001 From: NathanosDev Date: Wed, 11 Sep 2024 12:14:42 +0200 Subject: [PATCH] feat(ic-response-verification): remove unused debug feature BREAKING CHANGE: --- Cargo.toml | 2 +- packages/ic-response-verification-tests/src/main.rs | 1 - packages/ic-response-verification-wasm/Cargo.toml | 3 --- packages/ic-response-verification-wasm/src/lib.rs | 2 +- packages/ic-response-verification/Cargo.toml | 3 +-- packages/ic-response-verification/src/cel/parser.rs | 10 ---------- scripts/package.sh | 4 ++-- 7 files changed, 5 insertions(+), 20 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 1197b93f..3b91fc30 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -131,5 +131,5 @@ features = ["derive"] [workspace.dependencies.miracl_core_bls12381] version = "4.2" -default_features = false +default-features = false features = ["std", "allow_alt_compress"] diff --git a/packages/ic-response-verification-tests/src/main.rs b/packages/ic-response-verification-tests/src/main.rs index ecd8c6a2..955bf0af 100644 --- a/packages/ic-response-verification-tests/src/main.rs +++ b/packages/ic-response-verification-tests/src/main.rs @@ -1,6 +1,5 @@ use crate::agent::create_agent; use anyhow::{anyhow, Result}; -use core::panic; use ic_agent::export::Principal; use ic_agent::Agent; use ic_http_certification::{HttpRequest, HttpResponse}; diff --git a/packages/ic-response-verification-wasm/Cargo.toml b/packages/ic-response-verification-wasm/Cargo.toml index 8ba27ce3..60341940 100644 --- a/packages/ic-response-verification-wasm/Cargo.toml +++ b/packages/ic-response-verification-wasm/Cargo.toml @@ -11,9 +11,6 @@ repository.workspace = true license.workspace = true homepage.workspace = true -[features] -debug = ["ic-response-verification/debug"] - [lib] crate-type = ["cdylib", "rlib"] diff --git a/packages/ic-response-verification-wasm/src/lib.rs b/packages/ic-response-verification-wasm/src/lib.rs index 2ff004f3..6c197905 100644 --- a/packages/ic-response-verification-wasm/src/lib.rs +++ b/packages/ic-response-verification-wasm/src/lib.rs @@ -51,7 +51,7 @@ pub fn verify_request_response_pair( max_cert_time_offset_ns: u64, ic_public_key: &[u8], min_requested_verification_version: u8, -) -> Result { +) -> Result { let request = request_from_js(JsValue::from(request)); let response = response_from_js(JsValue::from(response)); diff --git a/packages/ic-response-verification/Cargo.toml b/packages/ic-response-verification/Cargo.toml index ecef5b39..a71fff3b 100644 --- a/packages/ic-response-verification/Cargo.toml +++ b/packages/ic-response-verification/Cargo.toml @@ -15,7 +15,6 @@ license.workspace = true homepage.workspace = true [features] -debug = ["log/max_level_trace", "log/release_max_level_trace"] js = ["dep:wasm-bindgen", "dep:js-sys"] [lib] @@ -37,7 +36,7 @@ ic-certificate-verification.workspace = true flate2.workspace = true leb128.workspace = true candid.workspace = true -log = { workspace = true, features = ["max_level_off", "release_max_level_off"] } +log.workspace = true hex.workspace = true urlencoding.workspace = true diff --git a/packages/ic-response-verification/src/cel/parser.rs b/packages/ic-response-verification/src/cel/parser.rs index 5a3b54b1..80ec8090 100644 --- a/packages/ic-response-verification/src/cel/parser.rs +++ b/packages/ic-response-verification/src/cel/parser.rs @@ -162,19 +162,9 @@ fn cel_value<'a, E: ParseError<&'a str> + ContextError<&'a str>>( } pub(crate) fn parse_cel_expression(i: &str) -> CelParserResult { - #[cfg(feature = "debug")] - let result = cel_value::>(i); - - #[cfg(not(feature = "debug"))] let result = cel_value::>(i); match result { - #[cfg(feature = "debug")] - Err(nom::Err::Error(e)) | Err(nom::Err::Failure(e)) => { - let stacktrace = nom::error::convert_error(i, e); - - Err(CelParserError::CelSyntaxException(stacktrace)) - } Err(e) => Err(CelParserError::CelSyntaxException(e.to_string())), Ok((_remaining, result)) => Ok(result), } diff --git a/scripts/package.sh b/scripts/package.sh index c054a132..a7893eb7 100755 --- a/scripts/package.sh +++ b/scripts/package.sh @@ -13,8 +13,8 @@ build_release_packages() { } build_debug_packages() { - wasm-pack build --target web --out-name web --out-dir $OUT_DIR/debug/dist/web --dev $PKG_ROOT -- --features "debug" || early_exit - wasm-pack build --target nodejs --out-name nodejs --out-dir $OUT_DIR/debug/dist/nodejs --dev $PKG_ROOT -- --features "debug" || early_exit + wasm-pack build --target web --out-name web --out-dir $OUT_DIR/debug/dist/web --dev $PKG_ROOT -- || early_exit + wasm-pack build --target nodejs --out-name nodejs --out-dir $OUT_DIR/debug/dist/nodejs --dev $PKG_ROOT -- || early_exit } delete_generated_files() {