Skip to content

Commit 799953e

Browse files
authored
Merge pull request #6340 from hugoclrd/fix/remove-serde-stacker-for-wasm-target
fix: remove serde stacker for wasm target
2 parents e219173 + 834842c commit 799953e

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

clarity/Cargo.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ path = "./src/libclarity.rs"
2020
[dependencies]
2121
serde = "1"
2222
serde_derive = "1"
23-
serde_stacker = "0.1"
2423
regex = "1"
2524
lazy_static = "1.4.0"
2625
integer-sqrt = "0.1.3"
@@ -44,6 +43,9 @@ rstest_reuse = { version = "0.5.0" }
4443
# but it isn't necessary for tests: only benchmarks. therefore, commenting out for now.
4544
# criterion = "0.3"
4645

46+
[target.'cfg(not(target_family = "wasm"))'.dependencies]
47+
serde_stacker = "0.1"
48+
4749
[features]
4850
default = ["rusqlite"]
4951
developer-mode = ["stacks_common/developer-mode"]

clarity/src/vm/database/structures.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ macro_rules! clarity_serializable {
5353
}
5454
}
5555
impl ClarityDeserializable<$Name> for $Name {
56+
#[cfg(not(target_family = "wasm"))]
5657
fn deserialize(json: &str) -> Result<Self> {
5758
let mut deserializer = serde_json::Deserializer::from_str(&json);
5859
// serde's default 128 depth limit can be exhausted
@@ -65,6 +66,12 @@ macro_rules! clarity_serializable {
6566
InterpreterError::Expect("Failed to deserialize vm.Value".into()).into()
6667
})
6768
}
69+
#[cfg(target_family = "wasm")]
70+
fn deserialize(json: &str) -> Result<Self> {
71+
serde_json::from_str(json).map_err(|_| {
72+
InterpreterError::Expect("Failed to deserialize vm.Value".into()).into()
73+
})
74+
}
6875
}
6976
};
7077
}

0 commit comments

Comments
 (0)