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

TransactionDecoder解析带有数值类型的定长数组的参数错误Bug #568

Open
rainy-wind opened this issue Apr 20, 2020 · 0 comments

Comments

@rainy-wind
Copy link

rainy-wind commented Apr 20, 2020

在使用TransactionDecoder解析event的时候,当解析带有数值类型的定长数组的参数错误Bug。

例如,定义如下函数:

 event LogSetSArray(uint8[2] o, uint8[2] n);

function getSArray() public returns (uint8[2]){
            uint8[2] memory arr = [uint8(1),2];
            emit LogSetSArray(arr, _uint8SArray);
            return arr;
}

执行以后,会发现events解析为空,从控制台运行的结果就能看出来:


=============================================================================================
[group:1]> deploy ComplexSol 1 "1"
contract address: 0xec839b4a14c00ff2d002450599efd36e4819313d

[group:1]> call ComplexSol 0xec839b4a14c00ff2d002450599efd36e4819313d getSArray
transaction hash: 0xd65aa1a00ff469c158b8559d2d7e67673c7bc7dda86778a0fc3dabcd3db3ba8f
---------------------------------------------------------------------------------------------
Output
function: getSArray()
return type: (uint8[2])
return value: ([1, 2])
---------------------------------------------------------------------------------------------
Event logs
---------------------------------------------------------------------------------------------

查看web3sdk代码,发现问题的原因出在StaticArrayReference的create2函数,里面只支持转换为256类的数值类型。这会导致event所build的method id与event logs里面的topic内容不一致,造成无法解析event的错误。

相反,在js版本的web3j里,不存在同样的bug。

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