Skip to content

Commit e8099e3

Browse files
authored
Merge pull request #755 from tronprotocol/release_v4.7.6
feat(merge): merge release_v4.7.6 into master
2 parents e876f25 + 31510b6 commit e8099e3

File tree

7 files changed

+115
-70
lines changed

7 files changed

+115
-70
lines changed

build.gradle

Lines changed: 50 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,22 @@ sourceCompatibility = 1.8
1010
targetCompatibility = JavaVersion.VERSION_1_8
1111
[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
1212

13-
compileJava.options*.compilerArgs = [
14-
"-Xlint:serial", "-Xlint:varargs", "-Xlint:classfile", "-Xlint:dep-ann",
15-
"-Xlint:divzero", "-Xlint:empty", "-Xlint:finally", "-Xlint:overrides",
16-
"-Xlint:path", "-Xlint:static", "-Xlint:try", "-Xlint:fallthrough",
17-
"-Xlint:deprecation", "-Xlint:unchecked", "-Xlint:-options"
18-
]
13+
//compileJava.options*.compilerArgs = [
14+
// "-Xlint:serial", "-Xlint:varargs", "-Xlint:classfile", "-Xlint:dep-ann",
15+
// "-Xlint:divzero", "-Xlint:empty", "-Xlint:finally", "-Xlint:overrides",
16+
// "-Xlint:path", "-Xlint:static", "-Xlint:try", "-Xlint:fallthrough",
17+
// "-Xlint:deprecation", "-Xlint:unchecked", "-Xlint:-options"
18+
//]
1919

2020
repositories {
2121
mavenLocal()
2222
mavenCentral()
2323
maven { url 'https://jitpack.io' }
2424
}
2525

26+
def protobufVersion = "3.25.5"
27+
def grpcVersion = "1.60.0"
28+
2629
sourceSets {
2730
main {
2831
proto {
@@ -33,8 +36,8 @@ sourceSets {
3336
srcDir 'src/main/java'
3437
}
3538
}
36-
3739
}
40+
3841
buildscript {
3942
repositories {
4043
mavenLocal()
@@ -43,59 +46,57 @@ buildscript {
4346
}
4447
mavenCentral()
4548
}
46-
ext {
47-
projectVersion = '1.3.0-RELEASE'
48-
grpcVersion = '1.60.0'
49-
protobufVersion = '3.21.12'
50-
protobufGradlePluginVersion = '0.8.0'
51-
}
5249

5350
dependencies {
54-
classpath 'com.github.jengelman.gradle.plugins:shadow:2.0.2'
55-
classpath 'com.google.protobuf:protobuf-gradle-plugin:0.8.3'
56-
classpath "gradle.plugin.com.liferay:gradle-plugins-node:4.3.0"
51+
classpath 'com.github.jengelman.gradle.plugins:shadow:5.2.0'
52+
classpath 'com.google.protobuf:protobuf-gradle-plugin:0.8.12'
53+
classpath "gradle.plugin.com.liferay:gradle-plugins-node:7.0.2"
5754
}
5855
}
5956

60-
task wrapper(type: Wrapper) {
61-
gradleVersion = '3.3'
62-
}
6357

6458
dependencies {
65-
compile group: 'junit', name: 'junit', version: '4.13.2'
66-
compile group: 'com.beust', name: 'jcommander', version: '1.82'
59+
implementation group: 'junit', name: 'junit', version: '4.13.2'
60+
implementation group: 'com.beust', name: 'jcommander', version: '1.82'
6761
//compile group: 'org.slf4j', name: 'slf4j-api', version: '1.7.25'
68-
compile group: 'org.slf4j', name: 'jcl-over-slf4j', version: '1.7.25'
69-
compile group: 'ch.qos.logback', name: 'logback-classic', version: '1.2.13'
70-
71-
// google grpc
72-
compile group: 'io.grpc', name: 'grpc-netty', version: "${grpcVersion}"
73-
compile group: 'io.grpc', name: 'grpc-protobuf', version: "${grpcVersion}"
74-
compile group: 'io.grpc', name: 'grpc-stub', version: "${grpcVersion}"
75-
76-
compile group: 'com.googlecode.protobuf-java-format', name: 'protobuf-java-format', version: '1.4'
77-
compile group: 'org.bouncycastle', name: 'bcprov-jdk18on', version: '1.78.1'
78-
compile group: 'com.typesafe', name: 'config', version: '1.3.2'
79-
compile "org.apache.commons:commons-lang3:3.14.0"
80-
compile group: 'com.google.api.grpc', name: 'googleapis-common-protos', version: '0.0.3'
81-
compile 'com.alibaba:fastjson:1.2.83'
82-
83-
compile group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.16.1'
84-
compile group: 'org.projectlombok', name: 'lombok', version: '1.18.2'
85-
86-
compile group: 'org.jline', name: 'jline', version: '3.25.0'
87-
compile 'io.github.tronprotocol:zksnark-java-sdk:1.0.0'
62+
implementation group: 'org.slf4j', name: 'jcl-over-slf4j', version: '1.7.25'
63+
implementation group: 'ch.qos.logback', name: 'logback-classic', version: '1.2.13'
64+
65+
// grpc
66+
implementation group: 'io.grpc', name: 'grpc-netty', version: grpcVersion
67+
implementation group: 'io.grpc', name: 'grpc-protobuf', version: grpcVersion
68+
implementation group: 'io.grpc', name: 'grpc-stub', version: grpcVersion
69+
70+
// google protobuf
71+
implementation group: 'com.google.protobuf', name: 'protobuf-java', version: protobufVersion
72+
implementation group: 'com.google.protobuf', name: 'protobuf-java-util', version: protobufVersion
73+
74+
implementation group: 'com.google.code.gson', name: 'gson', version: '2.11.0'
75+
76+
implementation group: 'com.googlecode.protobuf-java-format', name: 'protobuf-java-format', version: '1.4'
77+
implementation group: 'org.bouncycastle', name: 'bcprov-jdk18on', version: '1.78.1'
78+
implementation group: 'com.typesafe', name: 'config', version: '1.3.2'
79+
implementation group: 'org.apache.commons', name: 'commons-lang3', version: '3.14.0'
80+
implementation group: 'com.alibaba', name: 'fastjson', version: '1.2.83'
81+
implementation group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.16.1'
82+
83+
compileOnly 'org.projectlombok:lombok:1.18.24'
84+
annotationProcessor 'org.projectlombok:lombok:1.18.24'
85+
testCompileOnly 'org.projectlombok:lombok:1.18.24'
86+
testAnnotationProcessor 'org.projectlombok:lombok:1.18.24'
87+
88+
implementation group: 'org.jline', name: 'jline', version: '3.25.0'
89+
implementation group: 'io.github.tronprotocol', name: 'zksnark-java-sdk', version: '1.0.0'
8890
}
8991

9092
protobuf {
91-
generatedFilesBaseDir = "$projectDir/src/"
93+
generatedFilesBaseDir = "$projectDir/src"
9294
protoc {
93-
artifact = "com.google.protobuf:protoc:${protobufVersion}"
94-
95+
artifact = "com.google.protobuf:protoc:$protobufVersion"
9596
}
9697
plugins {
9798
grpc {
98-
artifact = "io.grpc:protoc-gen-grpc-java:${grpcVersion}"
99+
artifact = "io.grpc:protoc-gen-grpc-java:$grpcVersion"
99100
}
100101
}
101102
generateProtoTasks {
@@ -114,6 +115,10 @@ protobuf {
114115
}
115116
}
116117

118+
clean.doFirst {
119+
delete "src/main/gen"
120+
}
121+
117122
run {
118123
standardInput = System.in
119124
mainClassName = 'org.tron.walletcli.Client'

gradle/wrapper/gradle-wrapper.jar

3.89 KB
Binary file not shown.
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
#Tue Mar 06 21:13:26 CST 2018
21
distributionBase=GRADLE_USER_HOME
32
distributionPath=wrapper/dists
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-bin.zip
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-4.0-all.zip

gradlew

Lines changed: 31 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,21 @@
11
#!/usr/bin/env sh
22

3+
#
4+
# Copyright 2015 the original author or authors.
5+
#
6+
# Licensed under the Apache License, Version 2.0 (the "License");
7+
# you may not use this file except in compliance with the License.
8+
# You may obtain a copy of the License at
9+
#
10+
# https://www.apache.org/licenses/LICENSE-2.0
11+
#
12+
# Unless required by applicable law or agreed to in writing, software
13+
# distributed under the License is distributed on an "AS IS" BASIS,
14+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
# See the License for the specific language governing permissions and
16+
# limitations under the License.
17+
#
18+
319
##############################################################################
420
##
521
## Gradle start up script for UN*X
@@ -28,7 +44,7 @@ APP_NAME="Gradle"
2844
APP_BASE_NAME=`basename "$0"`
2945

3046
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
31-
DEFAULT_JVM_OPTS=""
47+
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
3248

3349
# Use the maximum available, or set MAX_FD != -1 to use that value.
3450
MAX_FD="maximum"
@@ -109,8 +125,8 @@ if $darwin; then
109125
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
110126
fi
111127

112-
# For Cygwin, switch paths to Windows format before running java
113-
if $cygwin ; then
128+
# For Cygwin or MSYS, switch paths to Windows format before running java
129+
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
114130
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
115131
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
116132
JAVACMD=`cygpath --unix "$JAVACMD"`
@@ -138,19 +154,19 @@ if $cygwin ; then
138154
else
139155
eval `echo args$i`="\"$arg\""
140156
fi
141-
i=$((i+1))
157+
i=`expr $i + 1`
142158
done
143159
case $i in
144-
(0) set -- ;;
145-
(1) set -- "$args0" ;;
146-
(2) set -- "$args0" "$args1" ;;
147-
(3) set -- "$args0" "$args1" "$args2" ;;
148-
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
149-
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
150-
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
151-
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
152-
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
153-
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
160+
0) set -- ;;
161+
1) set -- "$args0" ;;
162+
2) set -- "$args0" "$args1" ;;
163+
3) set -- "$args0" "$args1" "$args2" ;;
164+
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
165+
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
166+
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
167+
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
168+
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
169+
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
154170
esac
155171
fi
156172

@@ -159,14 +175,9 @@ save () {
159175
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
160176
echo " "
161177
}
162-
APP_ARGS=$(save "$@")
178+
APP_ARGS=`save "$@"`
163179

164180
# Collect all arguments for the java command, following the shell quoting and substitution rules
165181
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
166182

167-
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
168-
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
169-
cd "$(dirname "$0")"
170-
fi
171-
172183
exec "$JAVACMD" "$@"

gradlew.bat

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
@rem
2+
@rem Copyright 2015 the original author or authors.
3+
@rem
4+
@rem Licensed under the Apache License, Version 2.0 (the "License");
5+
@rem you may not use this file except in compliance with the License.
6+
@rem You may obtain a copy of the License at
7+
@rem
8+
@rem https://www.apache.org/licenses/LICENSE-2.0
9+
@rem
10+
@rem Unless required by applicable law or agreed to in writing, software
11+
@rem distributed under the License is distributed on an "AS IS" BASIS,
12+
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
@rem See the License for the specific language governing permissions and
14+
@rem limitations under the License.
15+
@rem
16+
117
@if "%DEBUG%" == "" @echo off
218
@rem ##########################################################################
319
@rem
@@ -13,8 +29,11 @@ if "%DIRNAME%" == "" set DIRNAME=.
1329
set APP_BASE_NAME=%~n0
1430
set APP_HOME=%DIRNAME%
1531

32+
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
33+
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
34+
1635
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
17-
set DEFAULT_JVM_OPTS=
36+
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
1837

1938
@rem Find java.exe
2039
if defined JAVA_HOME goto findJavaFromJavaHome

src/main/java/org/tron/keystore/StringUtils.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,11 @@ public static boolean isContains(char[] a, char[] b) {
5757
if (ArrayUtils.isEmpty(a) || ArrayUtils.isEmpty(b)) {
5858
return false;
5959
}
60-
6160
int alen = a.length;
6261
int blen = b.length;
63-
62+
if (alen < blen) {
63+
return false;
64+
}
6465
for (int i = 0; i < alen; i++) {
6566
if (alen - i < blen) {
6667
return false;

src/test/java/org/tron/keystore/StringUtilsTest.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,16 @@ public void isContains() {
3030
char[] b = "ghijkl".toCharArray();
3131
char[] c = "defghi".toCharArray();
3232
char[] d = "abcdefghijkl".toCharArray();
33+
char[] empty = "".toCharArray();
34+
35+
char[] longarr = "xxxxxxxx123xxxxxxxxx".toCharArray();
36+
char[] shortarr = "123".toCharArray();
37+
Assert.assertFalse(StringUtils.isContains(shortarr, longarr));
38+
Assert.assertTrue(StringUtils.isContains(longarr, shortarr));
39+
40+
Assert.assertFalse(StringUtils.isContains(empty, d));
41+
Assert.assertFalse(StringUtils.isContains(d, empty));
42+
3343
Assert.assertTrue(StringUtils.isContains(d, d));
3444
Assert.assertTrue(StringUtils.isContains(d, a));
3545
Assert.assertTrue(StringUtils.isContains(d, b));

0 commit comments

Comments
 (0)