FISCO-BCOS / FISCO-BCOS/java-sdk
3.0版本solidity转java不支持结构体
- Dominant language
- Java
- Stars
- 58
- Forks
- 62
- PR merge metrics
- No merged PRs in 30d
Description
在2.9.0版本,不管是java-sdk,console控制台以及java-sdk-demo都是可以将合约中的结构体转为java对象。升级到3.0后,再转换的过程中会出现集合索引越界的异常Index: 0, Size: 0。断点定位到出现问题的代码在如图位置
下面是我合约的部分代码
import "./Utils.sol";
contract InnerProductVerifier {
using Utils for uint256;
using Utils for Utils.G1Point;
struct InnerProductStatement {
Utils.G1Point[] hs; // "overridden" parameters.
Utils.G1Point u;
Utils.G1Point P;
}
struct InnerProductProof {
Utils.G1Point[] ls;
Utils.G1Point[] rs;
uint256 a;
uint256 b;
}
function verifyInnerProduct(Utils.G1Point[] memory hs, Utils.G1Point memory u, Utils.G1Point memory P, InnerProductProof memory proof, uint256 salt) public view returns (bool) {
InnerProductStatement memory statement;
statement.hs = hs;
statement.u = u;
statement.P = P;
return verify(statement, proof, salt);
}
}
pragma solidity ^0.5.0;
pragma experimental ABIEncoderV2;
library Utils {
struct G1Point {
bytes32 x;
bytes32 y;
}
}
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reproducing the Solidity-to-Java conversion with the InnerProductStatement and InnerProductProof structs from the issue under version 3.0, then compare the same contract’s behavior in 2.9.0. Inspect the Java SDK, console, and java-sdk-demo conversion paths around the reported collection index failure. Done means nested structs and arrays convert to Java objects without the Index: 0, Size: 0 exception.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, solidity
- Domain
- backend-api-design, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100