Skip to content

Commit

Permalink
feat: enable no_std support for pbjson (#158)
Browse files Browse the repository at this point in the history
Closes: #156

Addresses the `no_std` compatibility issue with `serde` feature in `ibc-rs`. This is caused by the recent implementation of ProtoJSON serialization and deserialization [0] for the `ics23` Protobuf definitions using `pbjson`, and then re-exporting the ics23 type [1] in `ibc-proto-rs`. Some of our users by then (starting from IBC-rs v0.41.0) are experiencing compilation errors. [2]

To meet this immediate need [3] and the lack of activity in the `pbjson` crate for months, we have taken the initiative to feature `no_std` support in the `informalsystems-pbjson` crate and have it published.

[0] #146
[1] cosmos/ibc-proto-rs#92
[2] cosmos/ibc-rs#741
[3] cosmos/ibc-proto-rs#98 (comment)

---

* feat: enable no_std support for pbjson

* fix: get serde feature work with no-std

* deps: use informalsystems-pbjson v0.6.0

* deps: use informalsystems-pbjson v0.6.0
  • Loading branch information
Farhad-Shabani authored Aug 16, 2023
1 parent daa1760 commit 864b821
Show file tree
Hide file tree
Showing 3 changed files with 128 additions and 128 deletions.
8 changes: 4 additions & 4 deletions rust/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ ripemd = {version = "0.1.1", optional = true, default-features = false}
sha2 = {version = "0.10.2", optional = true, default-features = false}
sha3 = {version = "0.10.2", optional = true, default-features = false}
serde = {version = "1.0", optional = true, default-features = false}
pbjson = {version = "0.5.1", optional = true}
informalsystems-pbjson = { version = "0.6.0", optional = true, default-features = false }

[dev-dependencies]
ripemd = {version = "0.1.1"}
Expand All @@ -32,10 +32,10 @@ sha2 = {version = "0.10.2"}
sha3 = {version = "0.10.2"}

[features]
default = ["std", "host-functions", "serde"]
default = ["std", "host-functions"]

std = ["prost/std", "bytes/std", "hex/std", "anyhow/std"]
std = ["prost/std", "bytes/std", "hex/std", "anyhow/std", "informalsystems-pbjson/std", "serde/std"]

host-functions = ["sha2", "sha3", "ripemd"]

serde = ["serde/std", "dep:pbjson"]
serde = ["dep:serde", "informalsystems-pbjson"]
2 changes: 1 addition & 1 deletion rust/codegen/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ edition = "2018"
bytes = "1.0.1"
prost = "0.11"
prost-build = "0.11"
pbjson-build = "0.5.1"
informalsystems-pbjson-build = "0.6.0"
Loading

0 comments on commit 864b821

Please sign in to comment.