You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Geth version: geth version 1.8.18 or later
OS & Version: Windows/Linux/OSX
Commit hash : (if develop)
Expected behaviour
I use the accounts/abi unpack function to unpack bytes like "0x0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000014000000000000000000000000000000000000000000000000000000000000000077765696d756d7500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a7765696d756d753132330000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000077765696d756d7500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a7765696d756d7531323300000000000000000000000000000000000000000000" to go variable [4]string. The right answer shoule be ['weimumu', 'weimumu123', 'weimumu', 'weimumu123'] which the web3.js can rightly decode.
Actual behaviour
But I got an error from the unpack function like "cannot marshal in to go type: length insufficient 416 require 480"
Hi there,
please note that this is an issue tracker reserved for bug reports and feature requests.
For general questions please use the gitter channel or the Ethereum stack exchange at https://ethereum.stackexchange.com.
System information
Geth version:
geth version 1.8.18 or later
OS & Version: Windows/Linux/OSX
Commit hash : (if
develop
)Expected behaviour
I use the accounts/abi unpack function to unpack bytes like "0x0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000014000000000000000000000000000000000000000000000000000000000000000077765696d756d7500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a7765696d756d753132330000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000077765696d756d7500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a7765696d756d7531323300000000000000000000000000000000000000000000" to go variable [4]string. The right answer shoule be ['weimumu', 'weimumu123', 'weimumu', 'weimumu123'] which the web3.js can rightly decode.
Actual behaviour
But I got an error from the unpack function like "cannot marshal in to go type: length insufficient 416 require 480"
Steps to reproduce the behaviour
The main code I right can be show as follows:
func main() {
ggtest :=
[ { "inputs": [], "payable": false, "stateMutability": "nonpayable", "type": "constructor" }, { "constant": true, "inputs": [ { "name": "", "type": "uint256" } ], "name": "g", "outputs": [ { "name": "", "type": "string" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": true, "inputs": [], "name": "get", "outputs": [ { "name": "", "type": "string[4]" } ], "payable": false, "stateMutability": "view", "type": "function" } ]
testABI, err := abi.JSON(strings.NewReader(ggtest))
if err != nil {
fmt.Println("GG")
}
testOutput, _ := hex.DecodeString("0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000014000000000000000000000000000000000000000000000000000000000000000077765696d756d7500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a7765696d756d753132330000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000077765696d756d7500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a7765696d756d7531323300000000000000000000000000000000000000000000")
//fmt.Println(testOutput)
ret := [4]string{}
if err := testABI.Unpack(&ret,"get", testOutput); err != nil {
fmt.Println(err)
}
}
Backtrace
The text was updated successfully, but these errors were encountered: