-
Notifications
You must be signed in to change notification settings - Fork 20.2k
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
abigen: Does not include all structs in binding #20148
Comments
I observe a similar issue when attempting to create bindings for https://github.com/omisego/plasma-contracts. Solidity version:
|
@jeffprestes ABIEncoderV2 is still an experimental feature and needs to be turned on via a pragma statement, but usage is becoming increasingly common. Some examples:
|
@yondonfu Basically This is the compiler output for abi
You can find the description of return parameter type is So only |
For user experience wise, maybe it's not enough since user needs to convert |
When compiling using solc 0.5.11, the ABI output is:
Since each function output now also includes the |
@yondonfu Wow, this is wonderful. Haven't tried the new version compiler before. With Thanks for the report! |
@rjl493456442 The binding generated for the example contract
Having struct names derived from the contract instead of |
Fixed by #20179 |
System information
OS & Version: OSX
Commit hash : df89233
I installed
abigen
by cloninggo-ethereum
at the above commit hash and runningmake devtools
.Expected behaviour
This is the relevant contract code:
The Go binding should contain:
Apple
typePear
typeTest()
method that returns an anonymous struct that wraps the Go struct corresponding to the SolidityApple
type and the Go struct corresponding to the SolidityPear
typeActual behaviour
The generated Go binding contains:
Struct0
corresponding to the SolidityApple
typeTest()
method that returns an anonymous struct that includesStruct0
twiceThe binding is missing a Go struct corresponding to the Solidity
Pear
type and the anonymous struct returned by theTest()
method does not contain the correct fields.This is what the Go binding looks like in the section of the code with struct definitions and the
Test()
method:I suspect this behavior is because
abigen
is not able to handle the internal types introduced into tuple types of contract ABIs as of solc 0.5.11.Steps to reproduce the behaviour
Foo.sol
using solc 0.5.11 and store the ABI inFoo.json
abigen --abi Foo.json --pkg main --type Foo --out foo.go
Struct0
that corresponds to the Solidity typeApple
, but it does not include a Go struct that corresponds to the Solidity typePear
. Also, observe that theTest()
method in the binding returns an anonymous struct withStruct0
nested inside twice.The text was updated successfully, but these errors were encountered: