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

Assigned operations to constant variables #111

Open
code423n4 opened this issue Nov 18, 2021 · 3 comments
Open

Assigned operations to constant variables #111

code423n4 opened this issue Nov 18, 2021 · 3 comments
Labels
bug Something isn't working G (Gas Optimization) sponsor disputed Sponsor cannot duplicate the issue, or otherwise disagrees this is an issue wont fix

Comments

@code423n4
Copy link
Contributor

Handle

pauliax

Vulnerability details

Impact

Assigned operations to constant variables are re-evalueted every time.

    bytes32 public constant ADMIN_ROLE = keccak256('ADMIN');
    bytes32 public constant SENTINEL_ROLE = keccak256('SENTINEL');

See ethereum/solidity#9232

Change from 'constant' to 'immutable'.

@code423n4 code423n4 added bug Something isn't working G (Gas Optimization) labels Nov 18, 2021
code423n4 added a commit that referenced this issue Nov 18, 2021
@Xuefeng-Zhu Xuefeng-Zhu added sponsor confirmed Sponsor agrees this is a problem and intends to fix it (OK to use w/ "disagree with severity") sponsor disputed Sponsor cannot duplicate the issue, or otherwise disagrees this is an issue and removed sponsor confirmed Sponsor agrees this is a problem and intends to fix it (OK to use w/ "disagree with severity") labels Nov 23, 2021
@Xuefeng-Zhu
Copy link
Collaborator

change to immutable will result in compile error

@0xleastwood
Copy link
Collaborator

Marking this as a valid finding.

@0xleastwood
Copy link
Collaborator

Tested this in remix, doesn't seem to cause compiler errors.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working G (Gas Optimization) sponsor disputed Sponsor cannot duplicate the issue, or otherwise disagrees this is an issue wont fix
Projects
None yet
Development

No branches or pull requests

3 participants