platform icon indicating copy to clipboard operation
platform copied to clipboard

Missing generics for trait `Decode` when any Rust SDK used as dependency

Open pshenmic opened this issue 6 months ago • 1 comments

Expected Behavior

Rust project successfully builds when any of the Rust SDK components are imported as modules (dapi-grpc,rs-sdk, rs-dpp)

Current Behavior

Bincode library was updated few month ago, and it caused all of the projects who are using Rust SDK or its components, to start receiving Missing generics for trait Decode` error, which happens because of the incorrect bincode version being pulled by default.

It is easily fixed by fixing bincode and bincode_derive in the Cargo.toml in your project like this:

bincode = "=2.0.0-rc.3"
bincode_derive = "=2.0.0-rc.3"

But its best to fix it so people could use Rust sdk without adding and prefixing external dependencies

Possible Solution

Fix Rust project's dependency tree to override this problem, or update the documentation about it

Error

error[E0107]: missing generics for trait `Decode`
   --> /Users/pshenmic/RustroverProjects/platform/packages/rs-platform-serialization/src/features/impl_std.rs:32:51
    |
32  | pub fn platform_versioned_decode_from_std_read<D: Decode, C: Config, R: std::io::Read>(
    |                                                   ^^^^^^ expected 1 generic argument
    |
note: trait defined here, with 1 generic parameter: `Context`
   --> /Users/pshenmic/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bincode-2.0.1/src/de/mod.rs:103:11
    |
103 | pub trait Decode<Context>: Sized {
    |           ^^^^^^ -------
help: add missing generic argument
    |
32  | pub fn platform_versioned_decode_from_std_read<D: Decode<Context>, C: Config, R: std::io::Read>(

Your Environment

  • Version used:
  • Environment name and version (e.g. Chrome 39, node.js 5.4):
  • Operating System and version (desktop, server, or mobile):
  • Link to your project:

pshenmic avatar Jun 11 '25 18:06 pshenmic

This is a known issue that won't be fixed for a while

QuantumExplorer avatar Jun 15 '25 13:06 QuantumExplorer