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

Possible fresh variable name collisions #5

Open
cameel opened this issue Aug 16, 2020 · 0 comments
Open

Possible fresh variable name collisions #5

cameel opened this issue Aug 16, 2020 · 0 comments

Comments

@cameel
Copy link
Collaborator

cameel commented Aug 16, 2020

Currently Prolog.rewriteVariable() works with the assumption that hashing a variable name together with an integer won't ever produce a collision with an existing variable:

function rewriteVariable(uint _symbol, uint _uniqueContext) private pure returns (uint) {
bytes32[] memory input = new bytes32[](2);
input[0] = bytes32(_symbol);
input[1] = bytes32(_uniqueContext);
return uint(keccak256(abi.encodePacked(input)));
}

A collision unlikely but not impossible. We may want to use a safer method of obtaining fresh variable names.

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

No branches or pull requests

1 participant