paritytech / paritytech/frame-decode
Track storage items with mixed data formats within the same spec version
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 8
- Forks
- 2
- PR merge metrics
- No merged PRs in 30d
Description
Summary
During testing of historical Kusama Relay Chain storage decoding, we've identified several storage items where different entries have different shapes/formats within the same spec version. These stem from lazy runtime migrations where old and new data formats coexist in the same storage — a single YAML type definition per spec version cannot handle both.
Affected Storage Items
1. Staking.Ledger
| Attribute | Value |
|---|---|
| Spec Versions | 1050, 1051, 1052, 1053, 1054, 1055 |
| Example Blocks | 1445458, 1445459-1445462, 1472960-1472964, 1475648-1475652, 1491596, 1574412, 2064961 |
| Errors | 1 leftover bytes, 5 leftover bytes, Not enough data at .claimed_rewards.[0] |
| Total Occurrences | 38 |
| Cause | Lazy migration of claimed_rewards field — some entries retain old format, others have new format |
| PJS Behavior | TBD |
2. Staking.SlashingSpans
| Attribute | Value |
|---|---|
| Spec Version | 1045 |
| Example Blocks | 901443, 901444, 901445, 901446 |
| Error | 4 leftover bytes after decoding storage Staking.SlashingSpans value |
| Total Occurrences | 8 |
| Cause | Old format (without last_nonzero_slash) and new format coexist at same spec |
| PJS Behavior | TBD |
3. Balances.Locks
| Attribute | Value |
|---|---|
| Spec Version | 1050 |
| Example Blocks | 1375087, 1375088, 1375089, 1375090 |
| Errors | 4 leftover bytes, 12 leftover bytes |
| Total Occurrences | 20 |
| Cause | Lazy migration — lock entries have varying trailing data |
| PJS Behavior | TBD |
4. Democracy.PublicProps
| Attribute | Value |
|---|---|
| Spec Version | 1022 |
| Example Blocks | 38245, 38246, 38247, 38248 |
| Error | 17 leftover bytes after decoding storage Democracy.PublicProps value |
| Total Occurrences | 4 |
| Cause | Lazy migration |
| PJS Behavior | TBD |
5. Democracy.Preimages
| Attribute | Value |
|---|---|
| Spec Version | 1058 |
| Example Block | 2201991 |
| Errors | Not enough data at .[0].[87], Not enough data at .[0].[57], 23121 leftover bytes |
| Total Occurrences | 3 |
| Cause | Different preimage statuses have different shapes |
| PJS Behavior | TBD |
6. System.Events (Different Issue)
| Attribute | Value |
|---|---|
| Spec Versions | 1058, 1062 |
| Example Blocks | 2064962-2064965, 2201991-2201995, 2671528 |
| Errors | Not enough data, VariantNotFound(72) |
| Total Occurrences | 10 |
| Cause | Note: This may be V11/V12 metadata pallet index incompatibility rather than a lazy migration issue |
| PJS Behavior | TBD |
Potential Solutions
- Fallback types — For a given type ID, return a list of potential types to try one after the other
- Block number resolution — Include block number (not just spec version) when resolving types
- Lenient decoding — Define a type that decodes until it runs out of bytes
- Minimum changes — The minimum that can be done is ideal
TODO
- Check PJS behavior for each case — does it error or decode successfully?
- Investigate root cause of each migration
- Determine minimal fix approach for each case
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the listed decoding failures for the affected storage items and example blocks, then check PJS behavior for each case. Compare fallback types, block-number resolution, and lenient decoding against the minimum-change goal; done means the mixed-format entries decode correctly without regressing the separate System.Events case.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100