paritytech / paritytech/parity-scale-codec
More `codec` edge cases
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 287
- Forks
- 103
- Avg merge
- 6d 13h
- Merged PRs (30d)
- 1
Description
https://github.com/paritytech/parity-scale-codec/issues/507 covers one but there are two more:
- Two
codecattributes can be applied to the same variant with no warning, - meanwhile a variant can have no
codecattribute and there is no warning.
For example:
enum Foo {
#[codec(index = 0)]
#[codec(index = 1)]
A,
B,
}
This kind of bug can happen due to a copy/paste mistake or a mistake when resolving a merge conflict (as it did to me). When there are many attributes this kind of mistake can be hard to spot. In my case it resulted in the decoded value being different from the original value before encoding, which made for a fun debugging session.
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 reviewing the linked issue 507 and reproducing the enum example with duplicate and missing codec attributes. The work is done when both invalid cases produce warnings and the existing codec behavior remains covered by appropriate tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100