vyper icon indicating copy to clipboard operation
vyper copied to clipboard

Struct getters different from solidity

Open AntonD3 opened this issue 2 years ago • 0 comments

Version Information

  • vyper Version (output of vyper --version): 0.3.3

What's your issue about?

Example of contracts

Solidity:

// For accessors, the dynamic types are already removed in the external signature itself.
contract C {
    struct S {
        uint256 x;
        string a; // this is present in the accessor
        uint256[] b; // this is not present
        uint256 y;
    }
    S public s;
}

Vyper:

struct S:
    x: uint256
    a: String[100] #this is present in the accessor
    b: DynArray[uint256, 3] # this is present
    y: uint256
s: public(S)

Return data for solidity:

0x0000000000000000000000000000000000000000000000000000000000000000
    0000000000000000000000000000000000000000000000000000000000000060
    0000000000000000000000000000000000000000000000000000000000000000
    0000000000000000000000000000000000000000000000000000000000000000

For vyper:

0x0000000000000000000000000000000000000000000000000000000000000020
    0000000000000000000000000000000000000000000000000000000000000000
    0000000000000000000000000000000000000000000000000000000000000080
    00000000000000000000000000000000000000000000000000000000000000a0
    0000000000000000000000000000000000000000000000000000000000000000
    0000000000000000000000000000000000000000000000000000000000000000
    0000000000000000000000000000000000000000000000000000000000000000

Is such behavior expected?

AntonD3 avatar Aug 08 '22 17:08 AntonD3