Package bind
(via abigen
) doesn't create structs used only as constructor parameters
#23939
Labels
bind
(via abigen
) doesn't create structs used only as constructor parameters
#23939
System information
Geth v1.10.12
Should be OS-independent but only tested on Ubuntu
solc 0.8.10+commit.fc410830.Linux.g++
Expected behaviour
Foo.sol
This should produce a valid binding:
$ solc Foo.sol --combined-json abi,bin | abigen --combined-json /dev/stdin --pkg foo --out foo.go
Actual behaviour
Fatal: Failed to generate ABI binding: template: :71:120: executing "" at <bindtype .Type $structs>: error calling bindtype: runtime error: invalid memory address or nil pointer dereference
Steps to reproduce the behaviour
This test case in
bind_test.go
:Suspected cause
The nil-pointer dereference is caused by this line not checking if
StructType
is in thestructs
map:go-ethereum/accounts/abi/bind/bind.go
Line 279 in e761255
I suspect that the root cause is because structs are detected by this loop over all methods, which excludes the constructor:
go-ethereum/accounts/abi/bind/bind.go
Line 91 in e761255
The text was updated successfully, but these errors were encountered: