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

ZERO_WEI constant can be defined with no effect #1697

Closed
smarx opened this issue Nov 9, 2019 · 1 comment · Fixed by #1715
Closed

ZERO_WEI constant can be defined with no effect #1697

smarx opened this issue Nov 9, 2019 · 1 comment · Fixed by #1715
Labels
bug Bug that shouldn't change language semantics when fixed. Easy Pickings Used to denote issues that should be easy to implement

Comments

@smarx
Copy link
Contributor

smarx commented Nov 9, 2019

ZERO_WEI is a built-in constant, so it shouldn't be allowed as a user-defined constant:

ZERO_WEI: constant(uint256(wei)) = 3
ONE_WEI: constant(uint256(wei)) = 5

@public
@constant
def zero() -> uint256(wei):
    return ZERO_WEI # returns 0, not 3

@public
@constant
def one() -> uint256(wei):
    return ONE_WEI # returns 5, as expected
@fubuloubu
Copy link
Member

fubuloubu commented Nov 10, 2019

Easy fix: disallow built-in constants from userland

Eventually consider namespacing? (Via #1347)

@fubuloubu fubuloubu added bug Bug that shouldn't change language semantics when fixed. Easy Pickings Used to denote issues that should be easy to implement VIP: Discussion Used to denote VIPs and more complex issues that are waiting discussion in a meeting labels Nov 10, 2019
@fubuloubu fubuloubu removed the VIP: Discussion Used to denote VIPs and more complex issues that are waiting discussion in a meeting label Nov 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bug that shouldn't change language semantics when fixed. Easy Pickings Used to denote issues that should be easy to implement
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants