OpenZeppelin / OpenZeppelin/openzeppelin-upgrades

Document use of retyped comments for incompatible enums

Open
#659 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
658
Forks
286
PR merge metrics
No merged PRs in 30d

Description

When upgrading a "enum" type in my contract, I have these cases:

Base enum
enum MyEnum { AA, BB }

  • Keep enum size the same but change the names.
    Example: new enum: enum MyEnum { AA, BC }
    This is marked as invalid though it should be valid.
  • Shrink enum size.
    Example: new enum: enum MyEnum { AA }
    This is marked as invalid. I "could" be valid
  • Grow enum size.
    Example: new enum: enum MyEnum { AA, BB, CC }
    This is marked as valid.

However, I think that being all uint8 internally, there is no incompatible types, and they should all be valid.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No file or test is named. Start by reviewing the upgrade validation documentation and the enum examples in this issue, then document how retyped comments affect unchanged, shrunk, and grown enums; done means each case has clear validity guidance.

Written by the indexing model from the issue text.

Assessment

Tech stack
solidity
Domain
blockchain, documentation
Issue type
Documentation
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.