FISCO-BCOS / FISCO-BCOS/web3sdk
Solc生成的合约EventValues对象类型映射错误
- Dominant language
- Java
- Stars
- 122
- Forks
- 81
- PR merge metrics
- No merged PRs in 30d
Description
在solc中,会自动生成Java代码,其中每个event会生成一个对应的内部类PO,以EventResponse结尾,例如存在合约:
```
event LogSetSArray(uint256[2] o, uint256[2] n);
```
对应的java代码为:
```
public static class LogSetSArrayEventResponse {
public Log log;
public List o;
public List n;
}
```
但是,在最新的版本中,如果event中存在动态或静态数字的数组,会统一映射为 List,但是实际上的类型并非 List。
以上述类型为例,当调用时,实际的类型为原版本的映射类型,
```
List LogSetSArrayEventResponseList = contract.getLogSetSArrayEvents(receipt);
```
实际的类型为List:
```
[{"value":1,"typeAsString":"uint256"},{"value":2,"typeAsString":"uint256"}]
```
这个问题会导致下游系统对数据的解析产生错误。
Contributor guide
Research direction
Start by tracing the solc-generated Java EventResponse mapping and the event-decoding path for the uint256[2] example. Compare the generated field type with the runtime List value; done means static and dynamic numeric arrays have consistent generated and decoded types.】【。} imuhamed 天天中彩票追号ҵан? Wait invalid extra? Need JSON no weird. The above includes
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, solidity
- Domain
- backend, blockchain
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100