vyperlang / vyper

Pythonic Smart Contract Language for the EVM
https://vyperlang.org
Other
4.84k stars 788 forks source link

vyper produces unparseable external interface for structs #3310

Open xrchz opened 1 year ago

xrchz commented 1 year ago

Version Information

What's your issue about?

> cat bug0.vy
struct Str:
  fld: uint256

@external
def foo() -> Str:
  return Str({fld: 42})
> vyper -f external_interface bug0.vy

# External Interfaces
interface Bug0:
    def foo() -> Str declaration object: nonpayable

The above output is not valid Vyper syntax.

How can it be fixed?

I do not know. Probably related to #2670.

fubuloubu commented 1 year ago

I think Str may not be a valid name

xrchz commented 1 year ago

Replace it with any valid name then. The error is the same.

fubuloubu commented 1 year ago

Okay, just making sure you tested with a different name and got the same result

z80dev commented 1 year ago

@charles-cooper what would a valid interface look like here? tuple encoded fields from the struct body? or just the struct name?

charles-cooper commented 1 year ago

At first glance I think the interface output should include the struct definition, and just the name of the struct (as usual) in the function signature.