go-ethereum
go-ethereum copied to clipboard
accounts/abi: fix set function
Without this patch, this test will report abi: cannot unmarshal string in to string:
After this patch, the above test will pass.
After all, there's no point to call set on dst.Elem() if dst.Elem() can not be set (CanSet returns false)
Could you please:
- [x] Fix the geth test that this PR breaks
- [x] Add a simpler test into this PR that reproduces the issue. The test you provided belongs to a different repository, and does way more things than needed to reproduce the issue.
Done. Basically now you can unpack a solidity string into both []interface{}{""} and []interface{}{new(string)}, previously you can only unpack it into []interface{}{new(string)}(the indirection is mandated,or you'll get an error like "abi: cannot unmarshal string in to string", which is technically unnecessary).
The same for other types like uint8 etc.
@gballet lgty ?