OpenZeppelin / OpenZeppelin/openzeppelin-upgrades
Only consider errors from modifiers in use
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 658
- Forks
- 286
- PR merge metrics
- No merged PRs in 30d
Description
Related to https://github.com/OpenZeppelin/openzeppelin-upgrades/pull/702
Modifiers with unsafe opcodes in parent contracts are reported, but even if those modifiers are not used. This is because in https://github.com/OpenZeppelin/openzeppelin-upgrades/blob/master/packages/core/src/validate/run.ts, getDirectFunctionOpcodeErrors finds the modifier's FunctionCall containing the unsafe opcode, although the NodeType is a ModifierDefinition rather than a FunctionDefinition. Therefore isInternalFunction evaluates to false since this is not a FunctionDefinition, and the check is not skipped.
Instead, the above should skip modifiers (which are internal), but getReferencedFunctionOpcodeErrors should also look for ModifierInvocation nodes and dereference those.
Contributor guide
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 in packages/core/src/validate/run.ts and trace getDirectFunctionOpcodeErrors and getReferencedFunctionOpcodeErrors. Check how ModifierDefinition, FunctionDefinition, and ModifierInvocation nodes are handled. Done means unused parent modifiers with unsafe opcodes are not reported, while invoked modifiers are dereferenced and checked.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- blockchain
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 48/100