Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(Fix) Replace abi.encodePacked with abi.encode #159

Merged
merged 2 commits into from Aug 8, 2018

Conversation

varasev
Copy link
Contributor

@varasev varasev commented Aug 8, 2018

  • (Mandatory) Description
    abi.encodePacked function has been replaced with abi.encode to make bytes sequences for keccak256 more unique and to reduce hash collision probability.

  • (Mandatory) What is it: (Fix), (Feature), or (Refactor)
    (Fix)

@varasev varasev merged commit 017bda0 into poanetwork:security-audit Aug 8, 2018
for (uint8 thresholdType = uint8(ThresholdTypes.Keys); thresholdType <= _thresholds.length; thresholdType++) {
uint256 thresholdValue = _thresholds[thresholdType - 1];
uint256 thresholdValue = _thresholds[thresholdType - uint8(ThresholdTypes.Keys)];
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this won't help much: we're still assuming that ThresholdTypes.Keys is 1 and we still don't have guarantees from solidity on order and numeric values of enum members.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@Eenae Maybe it is better for us not to use enums?

Copy link
Contributor

Choose a reason for hiding this comment

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

It's up to you. I'm just saying that this particular change does't help much.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@Eenae Solidity docs tell that valid values for enum of n members are 0 until n - 1: https://solidity.readthedocs.io/en/v0.4.24/miscellaneous.html#internals-cleaning-up-variables - so, enum in Solidity seems to be the same as in other programming languages. That still doesn't guarantee the order of enum values, but I think everything is ok with it because unit tests show that.

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.

None yet

2 participants