Skip to content

Commit eabfa76

Browse files
committed
Gate BLS dependencies behind target triple instead of feature
1 parent a994453 commit eabfa76

File tree

9 files changed

+31
-29
lines changed

9 files changed

+31
-29
lines changed

packages/crypto/Cargo.toml

Lines changed: 10 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -7,39 +7,28 @@ description = "Crypto bindings for cosmwasm contracts"
77
repository = "https://github.com/CosmWasm/cosmwasm/tree/main/packages/crypto"
88
license = "Apache-2.0"
99

10-
[features]
11-
default = []
12-
std = [
13-
"dep:ark-bls12-381",
14-
"dep:ark-ec",
15-
"dep:ark-ff",
16-
"dep:ark-serialize",
17-
"dep:num-traits",
18-
"dep:rayon",
19-
"dep:sha2",
20-
"dep:thiserror"
21-
]
22-
2310
[lib]
2411
# See https://bheisler.github.io/criterion.rs/book/faq.html#cargo-bench-gives-unrecognized-option-errors-for-valid-command-line-options
2512
bench = false
2613

2714
[dependencies]
28-
ark-bls12-381 = { version = "0.4.0", optional = true }
29-
ark-ec = { version = "0.4.2", features = ["parallel"], optional = true }
30-
ark-ff = { version = "0.4.2", features = ["asm", "parallel"], optional = true }
31-
ark-serialize = { version = "0.4.2", optional = true }
3215
cfg-if = "1.0.0"
3316
digest = "0.10"
3417
ecdsa = "0.16.2" # Not used directly, but needed to bump transitive dependency, see: https://github.com/CosmWasm/cosmwasm/pull/1899 for details.
3518
ed25519-zebra = { version = "4.0.3", default-features = false }
3619
k256 = { version = "0.13.3", default-features = false, features = ["ecdsa"] }
37-
num-traits = { version = "0.2.18", optional = true }
3820
p256 = { version = "0.13.2", default-features = false, features = ["ecdsa"] }
3921
rand_core = "0.6"
40-
rayon = { version = "1.9.0", optional = true }
41-
sha2 = { version = "0.10", optional = true }
42-
thiserror = { version = "1.0.26", optional = true }
22+
thiserror = "1.0.26"
23+
24+
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
25+
ark-bls12-381 = "0.4.0"
26+
ark-ec = { version = "0.4.2", features = ["parallel"] }
27+
ark-ff = { version = "0.4.2", features = ["asm", "parallel"] }
28+
ark-serialize = "0.4.2"
29+
num-traits = "0.2.18"
30+
rayon = "1.9.0"
31+
sha2 = "0.10"
4332

4433
[dev-dependencies]
4534
base64 = "0.22.0"

packages/crypto/src/bls12_318/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ pub use self::constants::{
55
};
66

77
cfg_if::cfg_if! {
8-
if #[cfg(feature = "std")] {
8+
if #[cfg(not(target_arch = "wasm32"))] {
99
mod aggregate;
1010
mod hash;
1111
mod pairing;

packages/std/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@ thiserror = "1.0.26"
6565

6666
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
6767
bech32 = "0.11.0"
68-
cosmwasm-crypto = { version = "2.0.1", path = "../crypto", features = ["std"] }
6968
rand_core = { version = "0.6.4", features = ["getrandom"] }
7069

7170
[dev-dependencies]

packages/std/src/addresses.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@ use crate::{HexBinary, __internal::forward_ref_partial_eq};
2626
/// This type is immutable. If you really need to mutate it (Really? Are you sure?), create
2727
/// a mutable copy using `let mut mutable = Addr::to_string()` and operate on that `String`
2828
/// instance.
29-
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, schemars::JsonSchema)]
29+
#[derive(
30+
Serialize, Deserialize, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, schemars::JsonSchema,
31+
)]
3032
pub struct Addr(String);
3133

3234
forward_ref_partial_eq!(Addr, Addr);

packages/std/src/errors/system_error.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@ use crate::Binary;
1212
///
1313
/// Such errors are only created by the VM. The error type is defined in the standard library, to ensure
1414
/// the contract understands the error format without creating a dependency on cosmwasm-vm.
15-
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, schemars::JsonSchema, thiserror::Error)]
15+
#[derive(
16+
Serialize, Deserialize, Clone, Debug, PartialEq, Eq, schemars::JsonSchema, thiserror::Error,
17+
)]
1618
#[serde(rename_all = "snake_case")]
1719
#[non_exhaustive]
1820
pub enum SystemError {

packages/std/src/math/signed_decimal.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3095,7 +3095,6 @@ mod tests {
30953095
}
30963096

30973097
#[test]
3098-
#[cfg(feature = "std")]
30993098
fn signed_decimal_has_defined_json_schema() {
31003099
let schema = schemars::schema_for!(SignedDecimal);
31013100
assert_eq!(

packages/std/src/math/signed_decimal_256.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3268,7 +3268,6 @@ mod tests {
32683268
}
32693269

32703270
#[test]
3271-
#[cfg(feature = "std")]
32723271
fn signed_decimal_256_has_defined_json_schema() {
32733272
let schema = schemars::schema_for!(SignedDecimal256);
32743273
assert_eq!(

packages/std/src/timestamp.rs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,19 @@ use crate::Uint64;
2121
/// assert_eq!(ts.seconds(), 3);
2222
/// assert_eq!(ts.subsec_nanos(), 202);
2323
/// ```
24-
#[derive(Serialize, Deserialize, Copy, Clone, Default, Debug, PartialEq, Eq, PartialOrd, Ord, schemars::JsonSchema)]
24+
#[derive(
25+
Serialize,
26+
Deserialize,
27+
Copy,
28+
Clone,
29+
Default,
30+
Debug,
31+
PartialEq,
32+
Eq,
33+
PartialOrd,
34+
Ord,
35+
schemars::JsonSchema,
36+
)]
2537
pub struct Timestamp(Uint64);
2638

2739
impl Timestamp {

packages/vm/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ crc32fast = "1.3.2"
4646
bech32 = "0.11.0"
4747
# Uses the path when built locally; uses the given version from crates.io when published
4848
cosmwasm-std = { version = "2.0.1", path = "../std", default-features = false, features = ["std"] }
49-
cosmwasm-crypto = { version = "2.0.1", path = "../crypto", features = ["std"] }
49+
cosmwasm-crypto = { version = "2.0.1", path = "../crypto" }
5050
derivative = "2"
5151
hex = "0.4"
5252
rand_core = { version = "0.6", features = ["getrandom"] }

0 commit comments

Comments
 (0)