Skip to content

Small loop refactor to make Slither happier#90

Merged
Shadowfiend merged 2 commits into
masterfrom
slither
Aug 24, 2020
Merged

Small loop refactor to make Slither happier#90
Shadowfiend merged 2 commits into
masterfrom
slither

Conversation

@pdyraga

@pdyraga pdyraga commented Aug 21, 2020

Copy link
Copy Markdown
Member

Addressing two issues reported by Slither:

RNG.bitsRequired(uint256) (RNG.sol#137-155) contains a tautology or contradiction:
        - bits >= 0 (RNG.sol#140)
Reference: https://github.com/crytic/slither/wiki/Detector-Documentation#tautology-or-contradiction

Addressed in d7025e2 by refacoring the loop. The loop should work exactly the same as before except that we avoid the
comparison of bits >= 0 which is always true because bits is an uint.

RNG.getIndex(uint256,bytes32).index (RNG.sol#200) is a local variable never initialized
Reference: https://github.com/crytic/slither/wiki/Detector-Documentation#uninitialized-local-variables

Addressed in 5588f31 by initializing the index. It does not change how the function works and, in
fact, index, when not initialized, is initialized to the default - 0 value. We can however make this code a little cleaner and Slither happier.

The loop should work exactly the same as before except that we avoid the
comparison of bits >= 0 which is always true because bits is an uint.
Initializing the index does not change how the function works and, in
fact, index when not initialized is initialized to the default - 0
value. We can however make this code a little cleaner and Slither
happier.
@pdyraga pdyraga requested review from Shadowfiend and eth-r August 21, 2020 13:23

@Shadowfiend Shadowfiend left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good here, let's do it.

@Shadowfiend Shadowfiend merged commit bb203a2 into master Aug 24, 2020
@Shadowfiend Shadowfiend deleted the slither branch August 24, 2020 17:09
@pdyraga pdyraga added this to the v1.1.1 milestone Aug 28, 2020
nkuba added a commit that referenced this pull request Aug 28, 2020
Bumping up version to 1.1.1 for a new release

The new release will contain no functionality changes but will re-organize the code based on Linter and Slither suggestions:
- Update linting configuration #87
- Small loop refactor to make Slither happier #90
- Renamed input parameters to Leaf.make function to avoid shadowing #91

See https://github.com/keep-network/sortition-pools/milestone/4?closed=1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants