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: Make the type argument in method_id optional #1980

Closed
iamdefinitelyahuman opened this issue May 18, 2020 · 3 comments · Fixed by #2035
Closed

VIP: Make the type argument in method_id optional #1980

iamdefinitelyahuman opened this issue May 18, 2020 · 3 comments · Fixed by #2035
Labels
VIP: Approved VIP Approved

Comments

@iamdefinitelyahuman
Copy link
Contributor

Simple Summary

method_id's second argument (the output type) should be optional with a default of bytes[4].

Motivation

  • Generating a 4 byte function selector is by far the most common use-case for this method
  • The 32 byte flavor is just as easily achieved using keccak256

Specification

method_id(method, output_type=bytes[4]) → Union[bytes[4], bytes32]

output_type may still be given as a positional arg so that this is not a breaking change.

Backwards Compatibility

No issues.

Copyright

Copyright and related rights waived via CC0

@fubuloubu
Copy link
Member

I was thinking to remove output_type entirely, and figure out bytes[4] or bytes32 based on context (calls or events)

@iamdefinitelyahuman
Copy link
Contributor Author

That sounds pretty magical.

@fubuloubu
Copy link
Member

Not really, it should be obvious because it is only useful as bytes[4] for calls, and only useful as bytes32 for events. I don't think the user needs to know this detail.

@fubuloubu fubuloubu mentioned this issue May 18, 2020
5 tasks
@iamdefinitelyahuman iamdefinitelyahuman added the VIP: Approved VIP Approved label 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