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: Structs as arguments #1019

Closed
fubuloubu opened this issue Sep 14, 2018 · 7 comments
Closed

VIP: Structs as arguments #1019

fubuloubu opened this issue Sep 14, 2018 · 7 comments
Labels
VIP: Approved VIP Approved

Comments

@fubuloubu
Copy link
Member

fubuloubu commented Sep 14, 2018

Simple Summary

Accept Structs are args.
Depends on #300

Abstract

It would be way easier to operate with different datatypes if we had better ways of interacting with more complex types like structs.

Motivation

Solidity allows accepting structs as arguments via their experimental ABIEncoderV2 pragma.
I believe v0.5 will allow this without an experimental pragma, and it will come out soon.
We should adopt this standard to make it easier to work with structs in different ways.

Specification

# MyStruct is a struct type as defined in #300
def accepts_struct(a: MyStruct):
    ...

(Optional) allow structs to be returned as outputs.

def returns_struct() -> MyStruct:
    ...

Backwards Compatibility

No modifications of existing syntax
ABI Encoder will need to be modified, but should be backwards compatible

Copyright

Copyright and related rights waived via CC0

@jacqueswww jacqueswww added VIP: Discussion Used to denote VIPs and more complex issues that are waiting discussion in a meeting VIP: Approved VIP Approved labels Sep 19, 2018
@jacqueswww
Copy link
Contributor

Approved, dependency on #300.

@charles-cooper
Copy link
Member

Remaining stuff after #1115 is merged

  • Pass in structs to public functions (requires eth-abi updates to test)
  • Return nested structs from functions (requires eth-abi updates to test)
  • Pass nested structs as args
  • Pass/return structs with dynamic data

@jacqueswww
Copy link
Contributor

Meeting Note: When eth-tester relase gets cut, we can look at implementing the final steps listed by Charles.

@fubuloubu fubuloubu removed the VIP: Discussion Used to denote VIPs and more complex issues that are waiting discussion in a meeting label Aug 8, 2019
@fubuloubu
Copy link
Member Author

We should be able to finish the work suggested as remaining in this PR at this point.

@fubuloubu
Copy link
Member Author

As per this comment, @charles-cooper says there are a few things left to do to complete this VIP. I think we could punt on the last three of his suggestions to another issue, and I'd also like to note that passing structs to public functions works in master

Motion to close?

@charles-cooper
Copy link
Member

yeah we could punt to another issue

@fubuloubu
Copy link
Member Author

Closing as the majority of this functionality was implemented in #1115

Note that some corner cases exist, whose progress is now being tracked in #955/#1200 (same resolution), #1170, and #1648

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

No branches or pull requests

3 participants