Skip to content

Expose interfaces via a separate RuntimeApi #237

Description

@ilchu

There's some generated code across provider and client that does things like:

// DoubleMap key layout:
//   16 (pallet hash) + 16 (storage hash)
//   + 16 (blake2_128 of deadline) + 4 (BlockNumber u32 LE)
//   + 8 (twox64 of index)         + 2 (u16 index LE)
//   = 62 bytes total.
let key_bytes = &kv.key_bytes;
if key_bytes.len() < 62 {
    continue;
}
let deadline = u32::from_le_bytes(key_bytes[48..52].try_into().unwrap_or([0; 4]));
let index = u16::from_le_bytes(key_bytes[60..62].try_into().unwrap_or([0; 2]));

So it's better if we address it:

hmm, this direct storage key parsing is kind of weak and fragile, for example what if the pallet changes the format.

I would do this call over RuntimeApi - expose versioned runtime api, if the format or struct changes, we just bump runtime api and the provider will fail here - please fix or create follow-up issue, do we use this storage item in provider anywhere else?

Originally posted by @bkontur in #125 (comment)

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Fields

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