Skip to content

Commit

Permalink
Merge pull request #250 from JimmyShi22/release-2.0.0-rc2
Browse files Browse the repository at this point in the history
Release 2.0.0 rc2
  • Loading branch information
fqliao authored Apr 30, 2019
2 parents e9dad53 + 613f1a5 commit 914e8de
Show file tree
Hide file tree
Showing 60 changed files with 4,908 additions and 167 deletions.
21 changes: 21 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,24 @@
### v2.0.0-rc2

(2019-04-25)

* Add

1. 可并行合约开发框架ParallelContract.sol
2. 并行预编译转账合约DagTransferPrecompiled的压测程序
3. 并行solidity转账合约parallelOk的压测程序
4. CRUD合约的压测程序
5. 回滚合约的压测程序

* Update

1. 在交易编码中加入chainID和groupID,以支持rc2节点的交易格式
2. sol转java,在java文件中增加了abi字段。

* Compatibility

1. 兼容rc1,rc2的节点

### v2.0.0-rc1

(2019-03-18)
Expand Down
6 changes: 1 addition & 5 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,14 @@ def spring_version="4.3.18.RELEASE"

List logger = [
'org.slf4j:slf4j-log4j12:1.7.25'
// 'org.slf4j:slf4j-api:1.7.25'
//'org.slf4j:slf4j-api:1.7.25'
]

List spring =[
"org.springframework:spring-core:$spring_version",
"org.springframework:spring-beans:$spring_version",
"org.springframework:spring-context:$spring_version",
"org.springframework:spring-tx:$spring_version",
"org.springframework:spring-jdbc:$spring_version",
"org.springframework:spring-test:$spring_version"
]

List alibaba = [
Expand All @@ -56,7 +54,6 @@ dependencies {
compile 'io.netty:netty-tcnative:2.0.20.Final'
compile 'io.netty:netty-tcnative-boringssl-static:2.0.20.Final'
compile 'com.google.guava:guava:19.0'
compile 'org.jline:jline:3.9.0'
compile 'commons-configuration:commons-configuration:1.10'

// web3j
Expand All @@ -72,7 +69,6 @@ dependencies {
"org.apache.commons:commons-collections4:4.0",
"commons-io:commons-io:2.4",
'com.github.stefanbirkner:system-rules:1.18.0',
'io.bretty:console-table-builder:1.2',
'junit:junit:4.12',
'org.mockito:mockito-core:2.23.0'
}
Expand Down
2 changes: 1 addition & 1 deletion release_note.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v2.0.0-rc1
v2.0.0-rc2
2 changes: 1 addition & 1 deletion src/main/java/org/fisco/bcos/channel/client/Service.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public class Service {
private GroupChannelConnectionsConfig allChannelConnections;
private ChannelPushCallback pushCallback;
private Map<String, Object> seq2Callback = new ConcurrentHashMap<String, Object>();
private static int groupId;
private int groupId;
private static ObjectMapper objectMapper = new ObjectMapper();
private BigInteger number = BigInteger.valueOf(0);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ public void initChannel(SocketChannel ch) throws Exception {
ch.pipeline()
.addLast(
sslCtx.newHandler(ch.alloc()),
new LengthFieldBasedFrameDecoder(1024 * 1024 * 4, 0, 4, -4, 0),
new LengthFieldBasedFrameDecoder(Integer.MAX_VALUE, 0, 4, -4, 0),
new IdleStateHandler(
idleTimeout, idleTimeout, idleTimeout, TimeUnit.MILLISECONDS),
handler);
Expand Down Expand Up @@ -298,7 +298,7 @@ public void initChannel(SocketChannel ch) throws Exception {
ch.pipeline()
.addLast(
sslCtx.newHandler(ch.alloc()),
new LengthFieldBasedFrameDecoder(1024 * 1024 * 4, 0, 4, -4, 0),
new LengthFieldBasedFrameDecoder(Integer.MAX_VALUE, 0, 4, -4, 0),
new IdleStateHandler(
idleTimeout, idleTimeout, idleTimeout, TimeUnit.MILLISECONDS),
handler);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -680,19 +680,19 @@ static TypeName getNativeType(TypeName typeName) {

String simpleName = ((ClassName) typeName).simpleName();

if (simpleName.equals(Address.class.getSimpleName())) {
if (simpleName.startsWith(Address.class.getSimpleName())) {
return TypeName.get(String.class);
} else if (simpleName.startsWith("Uint")) {
return TypeName.get(BigInteger.class);
} else if (simpleName.startsWith("Int")) {
return TypeName.get(BigInteger.class);
} else if (simpleName.equals(Utf8String.class.getSimpleName())) {
} else if (simpleName.startsWith(Utf8String.class.getSimpleName())) {
return TypeName.get(String.class);
} else if (simpleName.startsWith("Bytes")) {
return TypeName.get(byte[].class);
} else if (simpleName.equals(DynamicBytes.class.getSimpleName())) {
} else if (simpleName.startsWith(DynamicBytes.class.getSimpleName())) {
return TypeName.get(byte[].class);
} else if (simpleName.equals(Bool.class.getSimpleName())) {
} else if (simpleName.startsWith(Bool.class.getSimpleName())) {
return TypeName.get(Boolean.class); // boolean cannot be a parameterized type
} else {
throw new UnsupportedOperationException(
Expand Down
152 changes: 152 additions & 0 deletions src/main/java/org/fisco/bcos/web3j/crypto/ExtendedRawTransaction.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
package org.fisco.bcos.web3j.crypto;

import org.fisco.bcos.web3j.tx.TransactionConstant;
import org.fisco.bcos.web3j.utils.Numeric;

import java.io.Serializable;
import java.math.BigInteger;

/**
* Transaction class used for signing transactions locally.<br>
* For the specification, refer to p4 of the <a href="http://gavwood.com/paper.pdf">yellow
* paper</a>.
*/
public class ExtendedRawTransaction implements Serializable {

private static final long serialVersionUID = -5580814755985097996L;
private BigInteger randomid;
private BigInteger gasPrice;
private BigInteger gasLimit;
private BigInteger blockLimit;
private String to;
private BigInteger value;
private String data;
private BigInteger fiscoChainId;
private BigInteger groupId;
private String extraData;
private BigInteger version = TransactionConstant.version;

protected ExtendedRawTransaction(
BigInteger randomid,
BigInteger gasPrice,
BigInteger gasLimit,
BigInteger blockLimit,
String to,
BigInteger value,
String data,
BigInteger fiscoChainId,
BigInteger groupId,
String extraData) {
this.randomid = randomid;
this.gasPrice = gasPrice;
this.gasLimit = gasLimit;
this.blockLimit = blockLimit;
this.fiscoChainId = fiscoChainId;
this.groupId = groupId;
this.extraData = extraData;
this.to = to;

this.value = value;

if (data != null) {
this.data = Numeric.cleanHexPrefix(data);
}
}

public static ExtendedRawTransaction createContractTransaction(
BigInteger randomid,
BigInteger gasPrice,
BigInteger gasLimit,
BigInteger blockLimit,
BigInteger value,
String init,
BigInteger chainId,
BigInteger groupId,
String extraData) {

return new ExtendedRawTransaction(randomid, gasPrice, gasLimit, blockLimit, "", value, init,chainId,groupId,extraData);
}
//
//
// public static ExtendedRawTransaction createTransaction(
// BigInteger randomid,
// BigInteger gasPrice,
// BigInteger gasLimit,
// BigInteger blockLimit,
// String to,
// String data) {
// return createTransaction(randomid, gasPrice, gasLimit, blockLimit, to, BigInteger.ZERO, data);
// }

public static ExtendedRawTransaction createTransaction(
BigInteger randomid,
BigInteger gasPrice,
BigInteger gasLimit,
BigInteger blockLimit,
String to,
BigInteger value,
String data,
BigInteger chainId,
BigInteger groupId,
String extraData) {

return new ExtendedRawTransaction(randomid, gasPrice, gasLimit, blockLimit, to, value, data,chainId, groupId, extraData);
}

public BigInteger getRandomid() {
return randomid;
}

public BigInteger getGasPrice() {
return gasPrice;
}

public BigInteger getGasLimit() {
return gasLimit;
}

public BigInteger getBlockLimit() {
return blockLimit;
}

public String getTo() {
return to;
}

public BigInteger getValue() {
return value;
}

public String getData() {
return data;
}

public BigInteger getVersion() {
return version;
}
public BigInteger getGroupId() {
return groupId;
}

public void setGroupId(BigInteger groupId) {
this.groupId = groupId;
}


public String getExtraData() {
return extraData;
}

public void setExtraData(String extraData) {
this.extraData = extraData;
}

public BigInteger getFiscoChainId() {
return fiscoChainId;
}

public void setFiscoChainId(BigInteger fiscoChainId) {
this.fiscoChainId = fiscoChainId;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
package org.fisco.bcos.web3j.crypto;

import org.fisco.bcos.web3j.rlp.RlpDecoder;
import org.fisco.bcos.web3j.rlp.RlpList;
import org.fisco.bcos.web3j.rlp.RlpString;
import org.fisco.bcos.web3j.utils.Numeric;

import java.math.BigInteger;

public class ExtendedTransactionDecoder {

public static ExtendedRawTransaction decode(String hexTransaction) {
byte[] transaction = Numeric.hexStringToByteArray(hexTransaction);
RlpList rlpList = RlpDecoder.decode(transaction);
RlpList values = (RlpList) rlpList.getValues().get(0);
BigInteger randomid = ((RlpString) values.getValues().get(0)).asPositiveBigInteger();
BigInteger gasPrice = ((RlpString) values.getValues().get(1)).asPositiveBigInteger();
BigInteger gasLimit = ((RlpString) values.getValues().get(2)).asPositiveBigInteger();
BigInteger blockLimit = ((RlpString) values.getValues().get(3)).asPositiveBigInteger();
String to = ((RlpString) values.getValues().get(4)).asString();
BigInteger value = ((RlpString) values.getValues().get(5)).asPositiveBigInteger();
String data = ((RlpString) values.getValues().get(6)).asString();

//add extra data
BigInteger chainId = ((RlpString) values.getValues().get(7)).asPositiveBigInteger();
BigInteger groupId = ((RlpString) values.getValues().get(8)).asPositiveBigInteger();
String extraData = ((RlpString) values.getValues().get(9)).asString();
if (values.getValues().size() > 9) {
byte v = ((RlpString) values.getValues().get(10)).getBytes()[0];
byte[] r =
Numeric.toBytesPadded(
Numeric.toBigInt(((RlpString) values.getValues().get(11)).getBytes()), 32);
byte[] s =
Numeric.toBytesPadded(
Numeric.toBigInt(((RlpString) values.getValues().get(12)).getBytes()), 32);
Sign.SignatureData signatureData = new Sign.SignatureData(v, r, s);
return new SignedExtendedRawTransaction(
randomid, gasPrice, gasLimit, blockLimit, to, value, data,chainId, groupId, extraData, signatureData);
} else {
return ExtendedRawTransaction.createTransaction(
randomid, gasPrice, gasLimit, blockLimit, to, value, data,chainId, groupId, extraData);
}
}
}
Loading

0 comments on commit 914e8de

Please sign in to comment.