Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
This repository was archived by the owner on Nov 15, 2023. It is now read-only.

Serde serialization of empty StorageKey panics #3946

@geigerzaehler

Description

@geigerzaehler

Serializing and empty StorageKey with serde panics.

serde_json::to_vec(substrate_primitives_storage::StorageKey(Vec::new()));

This is the backtrace

11: impl_serde::serialize::to_hex
             at /home/thomas/.cargo/registry/src/github.com-1ecc6299db9ec823/impl-serde-0.2.1/src/serialize.rs:21
  12: impl_serde::serialize::serialize
             at /home/thomas/.cargo/registry/src/github.com-1ecc6299db9ec823/impl-serde-0.2.1/src/serialize.rs:51
  13: <substrate_primitives_storage::_IMPL_SERIALIZE_FOR_StorageKey::<impl serde::ser::Serialize for substrate_primitives_storage::StorageKey>::serialize::__SerializeWith as serde::ser::Serialize>::serialize
             at /home/thomas/.cargo/git/checkouts/substrate-7e08433d4c370a21/acf86cd/core/primitives/storage/src/lib.rs:29
  14: <&mut serde_json::ser::Serializer<W,F> as serde::ser::Serializer>::serialize_newtype_struct
             at /home/thomas/.cargo/registry/src/github.com-1ecc6299db9ec823/serde_json-1.0.41/src/ser.rs:268
  15: substrate_primitives_storage::_IMPL_SERIALIZE_FOR_StorageKey::<impl serde::ser::Serialize for substrate_primitives_storage::StorageKey>::serialize
             at /home/thomas/.cargo/git/checkouts/substrate-7e08433d4c370a21/acf86cd/core/primitives/storage/src/lib.rs:29
  16: serde_json::ser::to_writer
             at /home/thomas/.cargo/registry/src/github.com-1ecc6299db9ec823/serde_json-1.0.41/src/ser.rs:2161
  17: serde_json::ser::to_vec
             at /home/thomas/.cargo/registry/src/github.com-1ecc6299db9ec823/serde_json-1.0.41/src/ser.rs:2195

What I want to do is get all child storage keys through the JSON RPC API using an empty prefix.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions