OpenZeppelin / OpenZeppelin/openzeppelin-upgrades

Only consider errors from modifiers in use

Open
#714 0 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

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

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

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.