question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

False Positive on Public Enums

See original GitHub issue

Mythril 0.18.4 reports false positive on public enum storage variables.

pragma solidity ^0.4.19;

contract Benchmark {
    enum State {
        s1
    }
    State public state;
}
==== Exception state ====
Type: Informational
Contract: Unknown
Function name: _function_0xc19d93fb
PC address: 100
A reachable exception (opcode 0xfe) has been detected. This can be caused by type errors, division by zero, out-of-bounds array access, or assert violations. This is acceptable in most situations. Note however that `assert()` should only be used to check invariants. Use `require()` for regular input checking. 
--------------------
In file: public_storage_enum.sol:7

State public state

--------------------
```

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
rockycommented, Jul 18, 2018

Here is a related thought regarding this. With interaction with static analysis we can know this is an enum and adjust severity. The ethereum best practices guide says that smaller datatypes like int8’s are more vulnerable than int256’s. But on the other hand, if we can do some static analysis and determine this is boilerplate code, that might change things drastically. Dunno yet.

Of course, the false positive should get tracked down.

1reaction
JoranHonigcommented, Jun 23, 2018

@chronaeon I’m not sure about that. The different false positives might be caused by different aspects in mythril. So we’d need to validate/triage them first to see if they are the same false positive. If two false positives have the same root cause, I’m fine with merging them

Read more comments on GitHub >

github_iconTop Results From Across the Web

False positive 'Enums may not include properties' if constant ...
False positive 'Enums may not include properties' if constant references to enum's case ; Project, PhpStorm ; Priority, Normal N ; Type, Bug...
Read more >
Enum assignability false positive · Issue #29879 - GitHub
No compiler error. The pattern seems to be that the enum will be assignable if: Both enum types have the same name ("Color"...
Read more >
CA1027: Mark enums with FlagsAttribute (code analysis) - .NET
To reduce false positives, this rule does not report a violation for enumerations that have contiguous values.
Read more >
Enum.name() should be an exception to S2629
In the specific case of an enum name, this is a false positive. The enum name is stored in the implicit parent class...
Read more >
1480 [java] UnusedModifier - PMD Issues - SourceForge
#1480 [java] UnusedModifier: false positive on public modifier used with inner interface in enum ; Priority: 3-Major ; Type: Bug ; Ruleset /...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found