Skip to content

Commit 84997d3

Browse files
authored
Merge branch 'develop' into feature/inquiry_pagination_for_Proposa_and_exchange
2 parents de6318b + 9bd0523 commit 84997d3

88 files changed

Lines changed: 1151 additions & 1497 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.travis.yml‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ language: java
33
jdk: oraclejdk8
44
addons:
55
ssh_known_hosts:
6-
- 47.93.9.236:22008
6+
- 47.94.231.67:22008
7+
- 47.94.10.122:22008
78
sonarcloud:
89
organization: tron-zhaohong
910
token:
@@ -14,6 +15,11 @@ cache:
1415
script:
1516
- sh tron.sh
1617
- "./gradlew build"
18+
- "./gradlew jacocoTestReport"
19+
- bash deploy.sh
20+
21+
after_success:
22+
- "bash <(curl -s https://codecov.io/bash) -t 060bb400-c6fe-4d5f-a6c8-427105c746ac -s build/reports/jacoco/"
1723

1824
skip_build:
1925
- README.md:

‎README.md‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@
2020
<img src="https://travis-ci.org/tronprotocol/java-tron.svg?branch=develop">
2121
</a>
2222

23+
<a href="https://codecov.io/gh/tronprotocol/java-tron">
24+
<img src="https://codecov.io/gh/tronprotocol/java-tron/branch/develop/graph/badge.svg" />
25+
</a>
26+
2327
<a href="https://github.com/tronprotocol/java-tron/issues">
2428
<img src="https://img.shields.io/github/issues/tronprotocol/java-tron.svg">
2529
</a>

‎build.gradle‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,9 @@ task stest(type: Test) {
269269

270270
useTestNG {
271271
suites(file('src/test/resources/testng.xml'))
272+
parallel 'tests'
273+
threadCount 4
274+
272275
}
273276

274277
testLogging {
@@ -285,7 +288,7 @@ task stest(type: Test) {
285288

286289
jacocoTestReport {
287290
reports {
288-
xml.enabled false
291+
xml.enabled true
289292
csv.enabled false
290293
html.destination file("${buildDir}/jacocoHtml")
291294
}

‎deploy.sh‎

Lines changed: 45 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,63 @@
11
#!/bin/bash
2+
stestlogname="`date +%Y%m%d%H%M%S`_stest.log"
3+
testnet=(
4+
47.94.231.67
5+
47.94.10.122
6+
)
7+
stest_server=""
8+
for i in ${testnet[@]}; do
9+
docker_num=`ssh -p 22008 -t java-tron@$i 'docker ps -a | wc -l'`
10+
echo $docker_num
11+
docker_num=`echo $docker_num | tr -d "\r"`
12+
echo $docker_num
13+
if [[ ${docker_num} -le 4 ]];
14+
then
15+
stest_server=$i
16+
echo $stest_server
17+
break
18+
else
19+
continue
20+
fi
21+
done
22+
if [ "$stest_server" = "" ]
23+
then
24+
echo "All docker server is busy, stest FAILED"
25+
exit 1
26+
fi
27+
28+
229

330
echo "$TRAVIS_BRANCH"
431

5-
if [ "$TRAVIS_BRANCH" = "develop" ];then
32+
if [[ "$TRAVIS_BRANCH" = "develop" || "$TRAVIS_BRANCH" = "master" ]];then
633
echo "init env"
7-
ssh tron@47.93.9.236 -p 22008 sh /home/tron/workspace/deploy_all.sh
34+
ssh java-tron@$stest_server -p 22008 sh /data/workspace/docker_workspace/stest.sh >$stestlogname 2>&1
35+
if [[ `find $stestlogname -type f | xargs grep "Connection refused"` =~ "Connection refused" || `find $stestlogname -type f | xargs grep "stest FAILED"` =~ "stest FAILED" ]];
36+
then
37+
rm -f $stestlogname
38+
echo "first if"
39+
ssh java-tron@$stest_server -p 22008 sh /data/workspace/docker_workspace/stest.sh >$stestlogname 2>&1
40+
fi
41+
if [[ `find $stestlogname -type f | xargs grep "Connection refused"` =~ "Connection refused" || `find $stestlogname -type f | xargs grep "stest FAILED"` =~ "stest FAILED" ]];
42+
then
43+
rm -f $stestlogname
44+
echo "second if"
45+
ssh java-tron@$stest_server -p 22008 sh /data/workspace/docker_workspace/stest.sh >$stestlogname 2>&1
46+
fi
847
echo "stest start"
9-
./gradlew stest | tee stest.log
48+
cat $stestlogname | grep "Stest result is:" -A 10000
1049
echo "stest end"
1150

1251
echo $?
13-
ret=$(cat stest.log | grep "stest FAILED" | wc -l)
52+
ret=$(cat $stestlogname | grep "stest FAILED" | wc -l)
1453

1554
if [ $ret != 0 ];then
1655
echo $ret
56+
rm -f $stestlogname
1757
exit 1
1858
fi
1959

2060
fi
2161
echo "bye bye"
22-
62+
rm -f $stestlogname
2363
exit 0

‎src/main/java/org/tron/common/runtime/Runtime.java‎

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import static java.lang.Math.max;
44
import static java.lang.Math.min;
55
import static org.apache.commons.lang3.ArrayUtils.getLength;
6-
import static org.apache.commons.lang3.ArrayUtils.isEmpty;
76
import static org.apache.commons.lang3.ArrayUtils.isNotEmpty;
87
import static org.tron.common.runtime.utils.MUtil.convertToTronAddress;
98
import static org.tron.common.runtime.utils.MUtil.transfer;
@@ -31,7 +30,6 @@
3130
import org.tron.common.runtime.config.VMConfig;
3231
import org.tron.common.runtime.vm.DataWord;
3332
import org.tron.common.runtime.vm.EnergyCost;
34-
import org.tron.common.runtime.vm.PrecompiledContracts;
3533
import org.tron.common.runtime.vm.VM;
3634
import org.tron.common.runtime.vm.program.InternalTransaction;
3735
import org.tron.common.runtime.vm.program.InternalTransaction.ExecutorType;
@@ -55,9 +53,7 @@
5553
import org.tron.core.config.Parameter.ChainConstant;
5654
import org.tron.core.config.args.Args;
5755
import org.tron.core.db.EnergyProcessor;
58-
import org.tron.core.db.StorageMarket;
5956
import org.tron.core.db.TransactionTrace;
60-
import org.tron.core.exception.BadTransactionException;
6157
import org.tron.core.exception.ContractExeException;
6258
import org.tron.core.exception.ContractValidateException;
6359
import org.tron.core.exception.VMIllegalException;
@@ -310,7 +306,7 @@ private void create()
310306
}
311307
SmartContract newSmartContract = contract.getNewContract();
312308
if (!contract.getOwnerAddress().equals(newSmartContract.getOriginAddress())) {
313-
logger.error("OwnerAddress not equals OriginAddress");
309+
logger.info("OwnerAddress not equals OriginAddress");
314310
throw new VMIllegalException("OwnerAddress is not equals OriginAddress");
315311
}
316312
byte[] code = newSmartContract.getBytecode().toByteArray();
@@ -343,7 +339,7 @@ private void create()
343339
.getAccount(newSmartContract.getOriginAddress().toByteArray());
344340

345341
long MAX_CPU_TIME_OF_ONE_TX = deposit.getDbManager().getDynamicPropertiesStore()
346-
.getMaxCpuTimeOfOneTX() * 1000;
342+
.getMaxCpuTimeOfOneTx() * 1000;
347343

348344
long thisTxCPULimitInUs = (long) (MAX_CPU_TIME_OF_ONE_TX * getThisTxCPULimitInUsRatio());
349345

@@ -352,7 +348,7 @@ private void create()
352348

353349
long feeLimit = trx.getRawData().getFeeLimit();
354350
if (feeLimit < 0 || feeLimit > VMConfig.MAX_FEE_LIMIT) {
355-
logger.warn("invalid feeLimit {}", feeLimit);
351+
logger.info("invalid feeLimit {}", feeLimit);
356352
throw new ContractValidateException(
357353
"feeLimit must be >= 0 and <= " + VMConfig.MAX_FEE_LIMIT);
358354
}
@@ -369,7 +365,7 @@ private void create()
369365
this.program.setRootTransactionId(new TransactionCapsule(trx).getTransactionId().getBytes());
370366
this.program.setRootCallConstant(isCallConstant());
371367
} catch (Exception e) {
372-
logger.error(e.getMessage());
368+
logger.info(e.getMessage());
373369
throw new ContractValidateException(e.getMessage());
374370
}
375371

@@ -397,7 +393,7 @@ private void call()
397393
throws ContractValidateException {
398394

399395
if (!deposit.getDbManager().getDynamicPropertiesStore().supportVM()) {
400-
logger.error("vm work is off, need to be opened by the committee");
396+
logger.info("vm work is off, need to be opened by the committee");
401397
throw new ContractValidateException("VM work is off, need to be opened by the committee");
402398
}
403399

@@ -414,7 +410,7 @@ private void call()
414410

415411
ContractCapsule deployedContract = this.deposit.getContract(contractAddress);
416412
if (null == deployedContract) {
417-
logger.error("No contract or not a smart contract");
413+
logger.info("No contract or not a smart contract");
418414
throw new ContractValidateException("No contract or not a smart contract");
419415
}
420416
byte[] code = this.deposit.getCode(contractAddress);
@@ -426,7 +422,7 @@ private void call()
426422
.getOriginAddress().toByteArray());
427423

428424
long MAX_CPU_TIME_OF_ONE_TX = deposit.getDbManager().getDynamicPropertiesStore()
429-
.getMaxCpuTimeOfOneTX() * 1000;
425+
.getMaxCpuTimeOfOneTx() * 1000;
430426
long thisTxCPULimitInUs =
431427
(long) (MAX_CPU_TIME_OF_ONE_TX * getThisTxCPULimitInUsRatio());
432428

@@ -435,7 +431,7 @@ private void call()
435431

436432
long feeLimit = trx.getRawData().getFeeLimit();
437433
if (feeLimit < 0 || feeLimit > VMConfig.MAX_FEE_LIMIT) {
438-
logger.warn("invalid feeLimit {}", feeLimit);
434+
logger.info("invalid feeLimit {}", feeLimit);
439435
throw new ContractValidateException(
440436
"feeLimit must be >= 0 and <= " + VMConfig.MAX_FEE_LIMIT);
441437
}
@@ -534,26 +530,26 @@ public void go() {
534530
result = program.getResult();
535531
result.setException(e);
536532
runtimeError = result.getException().getMessage();
537-
logger.error("JVMStackOverFlowException: {}", result.getException().getMessage());
533+
logger.info("JVMStackOverFlowException: {}", result.getException().getMessage());
538534
} catch (OutOfResourceException e) {
539535
program.spendAllEnergy();
540536
result = program.getResult();
541537
result.setException(e);
542538
runtimeError = result.getException().getMessage();
543-
logger.error("timeout: {}", result.getException().getMessage());
539+
logger.info("timeout: {}", result.getException().getMessage());
544540
} catch (ContractValidateException e) {
545-
logger.error("when check constant, {}", e.getMessage());
541+
logger.info("when check constant, {}", e.getMessage());
546542
}catch (Throwable e) {
547543
program.spendAllEnergy();
548544
result = program.getResult();
549545
if (Objects.isNull(result.getException())) {
550-
logger.error(e.getMessage(), e);
546+
logger.info(e.getMessage(), e);
551547
result.setException(new RuntimeException("Unknown Throwable"));
552548
}
553549
if (StringUtils.isEmpty(runtimeError)) {
554550
runtimeError = result.getException().getMessage();
555551
}
556-
logger.error("runtime error is :{}", result.getException().getMessage());
552+
logger.info("runtime error is :{}", result.getException().getMessage());
557553
}
558554
trace.setBill(result.getEnergyUsed());
559555
}
@@ -576,7 +572,7 @@ public boolean isCallConstant() throws ContractValidateException {
576572
ContractCapsule contract = deposit
577573
.getContract(triggerContractFromTransaction.getContractAddress().toByteArray());
578574
if (contract == null) {
579-
logger.error("contract: {} is not in contract store", Wallet
575+
logger.info("contract: {} is not in contract store", Wallet
580576
.encode58Check(triggerContractFromTransaction.getContractAddress().toByteArray()));
581577
throw new ContractValidateException("contract: " + Wallet
582578
.encode58Check(triggerContractFromTransaction.getContractAddress().toByteArray())

0 commit comments

Comments
 (0)