diff --git a/Cargo.lock b/Cargo.lock index f648e379b97..bdbbedece64 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4512,7 +4512,7 @@ dependencies = [ [[package]] name = "mithril-stm" -version = "0.5.4" +version = "0.5.5" dependencies = [ "blake2 0.10.6", "blst", diff --git a/mithril-stm/CHANGELOG.md b/mithril-stm/CHANGELOG.md index 4fe9c44914c..4f2ba827bdb 100644 --- a/mithril-stm/CHANGELOG.md +++ b/mithril-stm/CHANGELOG.md @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## 0.5.5 (10-13-2025) + +### Fixed + +- Fixed compilation issues with `rug` when targeting `musl` environment. + ## 0.5.4 (10-07-2025) ### Added diff --git a/mithril-stm/Cargo.toml b/mithril-stm/Cargo.toml index 51e4f4fe39d..605270f49ad 100644 --- a/mithril-stm/Cargo.toml +++ b/mithril-stm/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "mithril-stm" -version = "0.5.4" +version = "0.5.5" edition = { workspace = true } authors = { workspace = true } homepage = { workspace = true } @@ -30,13 +30,13 @@ rayon = { workspace = true } serde = { workspace = true } thiserror = { workspace = true } -[target.'cfg(any(target_family = "wasm", windows))'.dependencies] +[target.'cfg(any(target_family = "wasm", target_env = "musl", windows))'.dependencies] # WASM and Windows don't support rug backend, fallback to num-integer only num-bigint = { version = "0.4.6" } num-rational = { version = "0.4.2" } num-traits = { version = "0.2.19" } -[target.'cfg(not(any(target_family = "wasm", windows)))'.dependencies] +[target.'cfg(not(any(target_family = "wasm", target_env = "musl", windows)))'.dependencies] num-bigint = { version = "0.4.6", optional = true } num-rational = { version = "0.4.2", optional = true } num-traits = { version = "0.2.19", optional = true } diff --git a/mithril-stm/src/eligibility_check.rs b/mithril-stm/src/eligibility_check.rs index bf51d690054..9c4f721a8e0 100644 --- a/mithril-stm/src/eligibility_check.rs +++ b/mithril-stm/src/eligibility_check.rs @@ -7,7 +7,12 @@ use { std::ops::Neg, }; -#[cfg(any(feature = "num-integer-backend", target_family = "wasm", windows))] +#[cfg(any( + feature = "num-integer-backend", + target_family = "wasm", + target_env = "musl", + windows +))] /// Checks that ev is successful in the lottery. In particular, it compares the output of `phi` /// (a real) to the output of `ev` (a hash). It uses the same technique used in the /// [Cardano ledger](https://github.com/input-output-hk/cardano-ledger/). In particular, @@ -49,7 +54,12 @@ pub(crate) fn is_lottery_won(phi_f: f64, ev: [u8; 64], stake: Stake, total_stake taylor_comparison(1000, q, x) } -#[cfg(any(feature = "num-integer-backend", target_family = "wasm", windows))] +#[cfg(any( + feature = "num-integer-backend", + target_family = "wasm", + target_env = "musl", + windows +))] /// Checks if cmp < exp(x). Uses error approximation for an early stop. Whenever the value being /// compared, `cmp`, is smaller (or greater) than the current approximation minus an `error_term` /// (plus an `error_term` respectively), then we stop approximating. The choice of the `error_term` @@ -82,7 +92,12 @@ fn taylor_comparison(bound: usize, cmp: Ratio, x: Ratio) -> bool false } -#[cfg(not(any(feature = "num-integer-backend", target_family = "wasm", windows)))] +#[cfg(not(any( + feature = "num-integer-backend", + target_family = "wasm", + target_env = "musl", + windows +)))] /// The crate `rug` has sufficient optimizations to not require a taylor approximation with early /// stop. The difference between the current implementation and the one using the optimization /// above is around 10% faster. We perform the computations with 117 significant bits of