FISCO-BCOS / go-sdk

golang SDK of FISCO BCOS
Apache License 2.0
74 stars 58 forks source link

abi: length larger than int64: #274

Open abing258 opened 7 months ago

abing258 commented 7 months ago
image

I called the query method and obtained the following result.

bxq2011hust commented 7 months ago

The error is because the output mismatches the method return value. You should check if the method abi matches with the contract code or maybe the call request has failed

abing258 commented 7 months ago

该错误是因为输出与方法返回值不匹配。您应该检查方法abi是否与合约代码匹配或者调用请求失败

image

After checking, I found that this method added some garbled characters to the input parameters

bxq2011hust commented 7 months ago

length larger than int64 possible reasons:

  1. expect int64, but return exceeds the range of int64. maybe you get uint64 as return but use int64 to Unpack
  2. the call request is failed because the logic of contract, you should check if call return error, if it is the output is the encoded bytes of "Error(string)", doc is here
  3. the method you used to Unpack is mismatch the call request, for example call a method get() returns string and use get() returns int64 to Unpack
abing258 commented 7 months ago

length larger than int64可能的原因:

  1. 期望int64,但返回超出了int64的范围。也许你得到 uint64 作为返回,但使用 int64 来解压
  2. 由于合约逻辑,调用请求失败,您应该检查调用是否返回错误,如果是输出是“Error(string)”的编码字节,文档在这里
  3. 您用于 Unpack 的方法与调用请求不匹配,例如调用一个方法get() returns string并用于get() returns int64 Unpack
  1. There is no problem with the contract logic. I can get the result by calling it with webase
  2. I generated the SDK file using Abigen and did not make any individual changes
bxq2011hust commented 7 months ago

It doesn't sound very reasonable. Please provide the code, environment information, and reproduction method so that we can track it @abing258