Skip to content

Commit

Permalink
ergotree-ir, ergotree-interpreter: Fix serde support for no_std
Browse files Browse the repository at this point in the history
  • Loading branch information
SethDusek committed Nov 26, 2024
1 parent 4a2db23 commit 51c632d
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 17 deletions.
18 changes: 10 additions & 8 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ ergotree-ir = { version = "^0.28.0", path = "./ergotree-ir", default-features =
ergo-chain-types = { version = "^0.15.0", path = "./ergo-chain-types", default-features = false }
sigma-test-util = { version = "^0.3.0", path = "./sigma-test-util" }
ergoscript-compiler = { version = "^0.24.0", path = "./ergoscript-compiler" }
ergotree-interpreter = { version = "^0.28.0", path = "./ergotree-interpreter" }
ergotree-interpreter = { version = "^0.28.0", path = "./ergotree-interpreter", default-features = false }
ergo-nipopow = { version = "^0.15", path = "./ergo-nipopow" }
ergo-merkle-tree = { version = "^0.15.0", path = "./ergo-merkle-tree" }
ergo-merkle-tree = { version = "^0.15.0", path = "./ergo-merkle-tree", default-features = false }
ergo-rest = { version = "^0.13.0", path = "./ergo-rest" }
ergo-lib = { version = "^0.28.0", path = "./ergo-lib" }
k256 = { version = "0.13.1", default-features = false, features = [
Expand Down Expand Up @@ -66,13 +66,15 @@ lazy_static = { version = "1.4", features = ["spin_no_std"] }
bs58 = { version = "0.4.0", default-features = false, features = ["alloc"] }
base16 = { version = "0.2.1", default-features = false, features = ["alloc"] }
base64 = { version = "0.13.0", default-features = false, features = ["alloc"] }
indexmap = { version = "2.6.0", default-features = false } #TODO: enable std conditionally
serde = { version = "1.0", features = ["derive"] }
serde_json = { version = "1.0", features = [
indexmap = { version = "2.6.0", default-features = false }
serde = { version = "1.0", default-features = false, features = ["derive"] }
serde_json = { version = "1.0", default-features = false, features = [
"arbitrary_precision",
"preserve_order",
] }
serde_with = { version = "1.9.1", features = ["json"] }
serde_with = { version = "3.11.0", default-features = false, features = [
"json",
"macros",
] }
rand = "0.8.5"
bytes = { version = "1.1", default-features = false }
byteorder = "1"
Expand All @@ -83,7 +85,7 @@ tokio-util = { version = "0.6.9", features = ["codec"] }
bounded-integer = { version = "^0.5", features = ["types"] }
url = "~2.2"
getrandom = { version = "0.2.7" }
itertools = "0.10.3"
itertools = { version = "0.10.3", default-features = false }
miette = { version = "5", features = ["fancy"] }
hashbrown = { version = "0.14.3", features = ["serde"] }
core2 = { version = "0.4.0", default-features = false, features = ["alloc"] }
Expand Down
4 changes: 2 additions & 2 deletions ergo-chain-types/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ core2 = { workspace = true }
[features]
default = ["std", "json"]
arbitrary = ["proptest", "proptest-derive", "std"]
json = ["serde", "serde_json", "serde_with", "std"]
std = ["dep:url", "base16/std", "base64/std"]
json = ["serde", "serde_json", "serde_with"]
std = ["dep:url", "base16/std", "base64/std", "serde/std"]

[dev-dependencies]
5 changes: 4 additions & 1 deletion ergo-chain-types/src/json/autolykos_solution.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
//! Code to implement `AutolykosSolution` JSON encoding
use std::str::FromStr;
use alloc::string::String;
use alloc::string::ToString;
use alloc::vec::Vec;
use core::str::FromStr;

use num_bigint::BigInt;
use num_traits::FromPrimitive;
Expand Down
3 changes: 2 additions & 1 deletion ergo-chain-types/src/json/votes.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
//! Code to implement `Votes` JSON encoding
use std::convert::{TryFrom, TryInto};
use alloc::vec::Vec;
use core::convert::{TryFrom, TryInto};

use crate::votes::{Votes, VotesError};
use crate::Base16DecodedBytes;
Expand Down
2 changes: 1 addition & 1 deletion ergotree-interpreter/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ json = [
"ergo-chain-types/json",
]
default = ["json", "std"]
std = ["rand", "miette"]
std = ["rand", "miette", "ergotree-ir/std"]
arbitrary = [
"std",
"proptest",
Expand Down
7 changes: 5 additions & 2 deletions ergotree-interpreter/src/json/hint.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
use alloc::string::String;
use alloc::string::ToString;
use alloc::vec::Vec;
use core::convert::TryFrom;
use std::num::ParseIntError;
use std::str::FromStr;
use core::num::ParseIntError;
use core::str::FromStr;

use ergo_chain_types::Base16DecodedBytes;
use ergotree_ir::sigma_protocol::sigma_boolean::SigmaBoolean;
Expand Down
1 change: 0 additions & 1 deletion ergotree-ir/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ json = [
"serde_json",
"serde_with",
"bounded-vec/serde",
"std",
"ergo-chain-types/json",
"indexmap/serde",
]
Expand Down
2 changes: 1 addition & 1 deletion ergotree-ir/src/chain/context_extension.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ use super::IndexMap;
#[cfg_attr(
feature = "json",
derive(serde::Deserialize),
serde(try_from = "indexmap::IndexMap<String, String>")
serde(try_from = "IndexMap<String, String>")
)]
pub struct ContextExtension {
/// key-value pairs of variable id and it's value
Expand Down

0 comments on commit 51c632d

Please sign in to comment.