Skip to content
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

控制台调用预编译合约报错cannot decode in in decodeMethodToObject with appropriate interface ABI #598

Open
imtypist opened this issue Apr 1, 2022 · 0 comments

Comments

@imtypist
Copy link

imtypist commented Apr 1, 2022

使用的console版本是2.8,fisco-bcos的版本也是2.8,自己编写了一个预编译合约,编译通过,然后在控制台调用报错cannot decode in in decodeMethodToObject with appropriate interface ABI,复现步骤如下:

[group:1]> call InferencePrecompiled.sol 0x5002 inference "test" "test"
 cannot decode in decodeMethodToObject with appropriate interface ABI

预编译合约接口如下:

pragma solidity ^0.4.24;

contract InferencePrecompiled {
    function inference(string exec, string resPath) public view returns(string){}
}

控制台的log信息如下:

[DEBUG] [2022-04-01 18:44:50] ConsoleContractImpl.callContract(441) | sendCall request, params: [test, test], contractAddress: 0x0000000000000000000000000000000000005002, contractName: InferencePrecompiled, functionName:inference, paramSize: 2
[INFO] [2022-04-01 18:44:50] ContractABIDefinition.addFunction(84) |  name: inference, methodId: 0x1d240d39, methodSignature: inference(string,string), abi: org.fisco.bcos.sdk.abi.wrapper.ABIDefinition@7aae184e
[INFO] [2022-04-01 18:44:50] ABIDefinitionFactory.loadABI(42) |  abiDefinition: org.fisco.bcos.sdk.abi.wrapper.ABIDefinition@7aae184e
[INFO] [2022-04-01 18:44:50] ABIDefinitionFactory.loadABI(49) |  contractABIDefinition org.fisco.bcos.sdk.abi.wrapper.ContractABIDefinition@2c6ee758 
[INFO] [2022-04-01 18:44:50] ABIObjectFactory.createObject(32) |  name: inference
[DEBUG] [2022-04-01 18:44:50] ChannelMsgHandler.onMessage(123) | onMessage in ChannelMsgHandler called, host : 127.0.0.1:20200, seq : ebbda4bbfb3540b28a58e7c5c50324db, msgType : 18
[INFO] [2022-04-01 18:44:50] ContractABIDefinition.addFunction(84) |  name: inference, methodId: 0x1d240d39, methodSignature: inference(string,string), abi: org.fisco.bcos.sdk.abi.wrapper.ABIDefinition@7aae184e
[INFO] [2022-04-01 18:44:50] ABIDefinitionFactory.loadABI(42) |  abiDefinition: org.fisco.bcos.sdk.abi.wrapper.ABIDefinition@7aae184e
[INFO] [2022-04-01 18:44:50] ABIDefinitionFactory.loadABI(49) |  contractABIDefinition org.fisco.bcos.sdk.abi.wrapper.ContractABIDefinition@640dc4c6 
[INFO] [2022-04-01 18:44:50] ABIObjectFactory.createObject(32) |  name: inference
[ERROR] [2022-04-01 18:44:50] ABICodec.decodeMethodAndGetOutputObject(288) |  exception in decodeMethodToObject : arraycopy: last source index 32 out of bounds for byte[0]
[ERROR] [2022-04-01 18:44:50] ABICodec.decodeMethodAndGetOutputObject(293) |  cannot decode in decodeMethodToObject with appropriate interface ABI
[ERROR] [2022-04-01 18:44:50] Console.main(177) |  message:  cannot decode in decodeMethodToObject with appropriate interface ABI, e: {}
org.fisco.bcos.sdk.abi.ABICodecException:  cannot decode in decodeMethodToObject with appropriate interface ABI
	at org.fisco.bcos.sdk.abi.ABICodec.decodeMethodAndGetOutputObject(ABICodec.java:294)
	at org.fisco.bcos.sdk.transaction.manager.AssembleTransactionProcessor.callAndGetResponse(AssembleTransactionProcessor.java:319)
	at org.fisco.bcos.sdk.transaction.manager.AssembleTransactionProcessor.sendCallWithStringParams(AssembleTransactionProcessor.java:310)
	at console.contract.ConsoleContractImpl.callContract(ConsoleContractImpl.java:450)
	at console.contract.ConsoleContractImpl.call(ConsoleContractImpl.java:402)
	at console.command.SupportedCommand$72.call(SupportedCommand.java:728)
	at console.command.model.CommandInfo.callCommand(CommandInfo.java:270)
	at console.Console.main(Console.java:105)

不知道为什么报exception in decodeMethodToObject : arraycopy: last source index 32 out of bounds for byte[0],看起来参数的长度并没有超过32字节,另外我还想问一下solidity对于string传参的长度有限制吗?

感谢解答!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant