You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It looks like the code generated by the buf.build/community/neoeinstein-prost-serde:v0.3.0 is not usable in no_std context:
$ git clone [email protected]:cosmos/cosmos-rust
$ cd cosmos-rust/cosmos-sdk-proto
$ git checkout cosmos-sdk-proto/v0.25.0-pre.0
$ cargo check --no-default-features --features serde
(...)
error[E0433]: failed to resolve: use of undeclared crate or module `std`
--> cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.auth.v1beta1.serde.rs:5:46
|
5 | fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
| ^^^ use of undeclared crate or module `std`
(...)
error[E0433]: failed to resolve: use of undeclared type `ToString`
--> cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.vesting.v1beta1.serde.rs:1191:50
|
1191 | struct_ser.serialize_field("length", ToString::to_string(&self.length).as_str())?;
| ^^^^^^^^ use of undeclared type `ToString`
|
help: consider importing one of these items
--> cosmos-sdk-proto/src/lib.rs:221:13
|
221 + use alloc::string::ToString;
--> |cosmos-sdk-proto/src/lib.rs:221:13
|
221 + use serde::__private::ToString;
(...)
To fix this, we should attempt to make the generated code work with no_std, either by patching the output, or by using informal-pbjson to generate the serialization code, like we do in ibc-proto-rs.
Just enabling the std feature when serde is enabled is unfortunately not really an option, as ibc-proto has downstream users which depend on the serde feature but not std.
romac
changed the title
cosmos-sdk-proto: Fails to compile with --no-default-features --features serde
cosmos-sdk-proto: Generated serde serialization code is not usable in no_std context
Sep 4, 2024
Adds some transforms which enable the generated PBJSON-related code to
be usable in `no_std` environments.
This is a workaround until such a time as it can be implemented natively
in `neoeinstein-prost-serde`. See neoeinstein/protoc-gen-prost#102.
Closes#499
Adds some transforms which enable the generated PBJSON-related code to
be usable in `no_std` environments.
This is a workaround until such a time as it can be implemented natively
in `neoeinstein-prost-serde`. See neoeinstein/protoc-gen-prost#102.
Closes#499
It looks like the code generated by the
buf.build/community/neoeinstein-prost-serde:v0.3.0
is not usable inno_std
context:To fix this, we should attempt to make the generated code work with
no_std
, either by patching the output, or by usinginformal-pbjson
to generate the serialization code, like we do inibc-proto-rs
.Just enabling the
std
feature whenserde
is enabled is unfortunately not really an option, asibc-proto
has downstream users which depend on theserde
feature but notstd
.As such it is currently blocking cosmos/ibc-proto-rs#187
The text was updated successfully, but these errors were encountered: