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

VIP: Use uint256 for public array getters #1983

Closed
iamdefinitelyahuman opened this issue May 19, 2020 · 2 comments · Fixed by #2037
Closed

VIP: Use uint256 for public array getters #1983

iamdefinitelyahuman opened this issue May 19, 2020 · 2 comments · Fixed by #2037
Labels
VIP: Approved VIP Approved

Comments

@iamdefinitelyahuman
Copy link
Contributor

Simple Summary

When an array is declared public, the generated getter should accept uint256 instead of int128 in order to handle the lookups.

Motivation

We do not allow array lookups with negative numbers, so the use of int128 is unintuitive.

Specification

As an example, the following variable:

foo: public(address[3])

Should produce a getter with the following signature:

def foo(arg0: uint256) -> address: constant

Backwards Compatibility

This is not a breaking change, but it does amount to a deviation in expected behavior.

Dependencies

Not dependent, but related to #1979

Copyright

Copyright and related rights waived via CC0

@fubuloubu
Copy link
Member

It actually is a breaking change, because it changes the Method ID of the getter function. I think this is a good thing though, as it will match the Solidity implementation.

@iamdefinitelyahuman
Copy link
Contributor Author

Ahh, I forgot about interfaces we generate from other contracts. Was thinking it wasn't breaking since it would only affect newly compiled contracts. Good call.

@iamdefinitelyahuman iamdefinitelyahuman added the VIP: Discussion Used to denote VIPs and more complex issues that are waiting discussion in a meeting label May 21, 2020
@fubuloubu fubuloubu mentioned this issue May 21, 2020
5 tasks
@iamdefinitelyahuman iamdefinitelyahuman added VIP: Approved VIP Approved and removed VIP: Discussion Used to denote VIPs and more complex issues that are waiting discussion in a meeting labels May 26, 2020
@fubuloubu fubuloubu added this to the v0.2 Release milestone Jun 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
VIP: Approved VIP Approved
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants