智能合约调用传入字符串数组报错
wenpengwu opened this issue · comments
wenpeng commented
Brief of the issue
solidity 合约,,调用接受字符串数组的合约方法时报错
Your environment
XuperChain 版本 v5.1.0 OS:10.14.6
Repo steps
合约代码如下
// SPDX-License-Identifier: MIT
pragma solidity >=0.8;
contract Test{
constructor(){
}
function setBool(bool t) public pure returns (uint8){
if (t){
return 1;
}
return 0;
}
function setArr( uint[] calldata arr) public pure returns (uint[] calldata){
return arr;
}
function setStr( string[] calldata strs) public pure returns (string[] calldata){
return strs;
}
}
部署好后,调用如下
./bin/xchain-cli evm invoke --method setStr -a '{"strs":"[\"abc\"]"}' test_val
Expected behaviours
期望能返回调用设置的字符串数组
What actually happened
实际报错如下:
PreExe contract response : rpc error: code = Unknown desc = Err:500-50501-contract invoke failed+error 17 - Error 17: execution reverted: execution reverted, logid:1652980038_3803293271302720
Additional information
如果是我的传值方式有问题的话。我该如何传入字符串数组呢?
litian commented
暂时不支持传入字符串数组类型参数,后续会进行优化。