Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#wip #draft [2.0] no_std support #1931

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,7 @@ artifacts/

# Log files (e.g. memory profiling)
*.log


rust-toolchain.toml
shell.nix
12 changes: 6 additions & 6 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 6 additions & 3 deletions packages/std/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ readme = "README.md"
features = ["abort", "stargate", "staking", "ibc3", "cosmwasm_1_4"]

[features]
default = ["iterator", "abort"]
default = ["iterator", "abort", "std"]
abort = []
# iterator allows us to iterate over all DB items in a given range
# optional as some merkle stores (like tries) don't support this
Expand Down Expand Up @@ -49,6 +49,9 @@ cosmwasm_1_3 = ["cosmwasm_1_2"]
# It requires the host blockchain to run CosmWasm `1.4.0` or higher.
cosmwasm_1_4 = ["cosmwasm_1_3"]

unstable = ["serde/unstable", "serde-json-wasm/unstable"]
std = ["serde/std","serde-json-wasm/std"]

[dependencies]
base64 = "0.21.0"
cosmwasm-derive = { path = "../derive", version = "1.5.0-rc.0" }
Expand All @@ -57,11 +60,11 @@ forward_ref = "1"
hex = "0.4"
schemars = "0.8.3"
sha2 = "0.10.3"
serde = { version = "1.0.103", default-features = false, features = [
serde = { version = "^1.0.181", default-features = false, features = [
"derive",
"alloc",
] }
serde-json-wasm = { version = "0.5.0" }
serde-json-wasm = { version = "1.0.0", default-features = false}
thiserror = "1.0.26"
bnum = "0.8.0"
static_assertions = "1.1.0"
Expand Down
3 changes: 3 additions & 0 deletions packages/std/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
#![cfg_attr(feature = "backtraces", feature(error_generic_member_access))]
#![cfg_attr(feature = "backtraces", feature(provide_any))]
#![no_std]

extern crate alloc;
#[cfg(test)]
extern crate std;

// Exposed on all platforms

Expand Down
1 change: 1 addition & 0 deletions packages/std/src/sections.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use alloc::vec::Vec;
use crate::conversion::force_to_u32;

/// A sections decoder for the special case of two elements
Expand Down
1 change: 1 addition & 0 deletions packages/std/src/storage.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use alloc::collections::BTreeMap;
use core::fmt;
use alloc::vec::Vec;
#[cfg(feature = "iterator")]
use core::iter;
#[cfg(feature = "iterator")]
Expand Down
1 change: 1 addition & 0 deletions packages/std/src/testing/shuffle.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use alloc::vec::Vec;
/// Performs a perfect shuffle (in shuffle)
///
/// https://en.wikipedia.org/wiki/Riffle_shuffle_permutation#Perfect_shuffles
Expand Down
1 change: 1 addition & 0 deletions packages/std/src/traits.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use core::marker::PhantomData;
use core::ops::Deref;
use alloc::vec::Vec;
use serde::{de::DeserializeOwned, Serialize};

use crate::addresses::{Addr, CanonicalAddr};
Expand Down
1 change: 1 addition & 0 deletions packages/std/src/types.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};

use alloc::vec::Vec;
use crate::addresses::Addr;
use crate::coin::Coin;
use crate::timestamp::Timestamp;
Expand Down
Loading