Skip to content

Commit

Permalink
Merge pull request #755 from tronprotocol/release_v4.7.6
Browse files Browse the repository at this point in the history
feat(merge): merge release_v4.7.6 into master
  • Loading branch information
lvs007 authored Oct 14, 2024
2 parents e876f25 + 31510b6 commit e8099e3
Show file tree
Hide file tree
Showing 7 changed files with 115 additions and 70 deletions.
95 changes: 50 additions & 45 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,22 @@ sourceCompatibility = 1.8
targetCompatibility = JavaVersion.VERSION_1_8
[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'

compileJava.options*.compilerArgs = [
"-Xlint:serial", "-Xlint:varargs", "-Xlint:classfile", "-Xlint:dep-ann",
"-Xlint:divzero", "-Xlint:empty", "-Xlint:finally", "-Xlint:overrides",
"-Xlint:path", "-Xlint:static", "-Xlint:try", "-Xlint:fallthrough",
"-Xlint:deprecation", "-Xlint:unchecked", "-Xlint:-options"
]
//compileJava.options*.compilerArgs = [
// "-Xlint:serial", "-Xlint:varargs", "-Xlint:classfile", "-Xlint:dep-ann",
// "-Xlint:divzero", "-Xlint:empty", "-Xlint:finally", "-Xlint:overrides",
// "-Xlint:path", "-Xlint:static", "-Xlint:try", "-Xlint:fallthrough",
// "-Xlint:deprecation", "-Xlint:unchecked", "-Xlint:-options"
//]

repositories {
mavenLocal()
mavenCentral()
maven { url 'https://jitpack.io' }
}

def protobufVersion = "3.25.5"
def grpcVersion = "1.60.0"

sourceSets {
main {
proto {
Expand All @@ -33,8 +36,8 @@ sourceSets {
srcDir 'src/main/java'
}
}

}

buildscript {
repositories {
mavenLocal()
Expand All @@ -43,59 +46,57 @@ buildscript {
}
mavenCentral()
}
ext {
projectVersion = '1.3.0-RELEASE'
grpcVersion = '1.60.0'
protobufVersion = '3.21.12'
protobufGradlePluginVersion = '0.8.0'
}

dependencies {
classpath 'com.github.jengelman.gradle.plugins:shadow:2.0.2'
classpath 'com.google.protobuf:protobuf-gradle-plugin:0.8.3'
classpath "gradle.plugin.com.liferay:gradle-plugins-node:4.3.0"
classpath 'com.github.jengelman.gradle.plugins:shadow:5.2.0'
classpath 'com.google.protobuf:protobuf-gradle-plugin:0.8.12'
classpath "gradle.plugin.com.liferay:gradle-plugins-node:7.0.2"
}
}

task wrapper(type: Wrapper) {
gradleVersion = '3.3'
}

dependencies {
compile group: 'junit', name: 'junit', version: '4.13.2'
compile group: 'com.beust', name: 'jcommander', version: '1.82'
implementation group: 'junit', name: 'junit', version: '4.13.2'
implementation group: 'com.beust', name: 'jcommander', version: '1.82'
//compile group: 'org.slf4j', name: 'slf4j-api', version: '1.7.25'
compile group: 'org.slf4j', name: 'jcl-over-slf4j', version: '1.7.25'
compile group: 'ch.qos.logback', name: 'logback-classic', version: '1.2.13'

// google grpc
compile group: 'io.grpc', name: 'grpc-netty', version: "${grpcVersion}"
compile group: 'io.grpc', name: 'grpc-protobuf', version: "${grpcVersion}"
compile group: 'io.grpc', name: 'grpc-stub', version: "${grpcVersion}"

compile group: 'com.googlecode.protobuf-java-format', name: 'protobuf-java-format', version: '1.4'
compile group: 'org.bouncycastle', name: 'bcprov-jdk18on', version: '1.78.1'
compile group: 'com.typesafe', name: 'config', version: '1.3.2'
compile "org.apache.commons:commons-lang3:3.14.0"
compile group: 'com.google.api.grpc', name: 'googleapis-common-protos', version: '0.0.3'
compile 'com.alibaba:fastjson:1.2.83'

compile group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.16.1'
compile group: 'org.projectlombok', name: 'lombok', version: '1.18.2'

compile group: 'org.jline', name: 'jline', version: '3.25.0'
compile 'io.github.tronprotocol:zksnark-java-sdk:1.0.0'
implementation group: 'org.slf4j', name: 'jcl-over-slf4j', version: '1.7.25'
implementation group: 'ch.qos.logback', name: 'logback-classic', version: '1.2.13'

// grpc
implementation group: 'io.grpc', name: 'grpc-netty', version: grpcVersion
implementation group: 'io.grpc', name: 'grpc-protobuf', version: grpcVersion
implementation group: 'io.grpc', name: 'grpc-stub', version: grpcVersion

// google protobuf
implementation group: 'com.google.protobuf', name: 'protobuf-java', version: protobufVersion
implementation group: 'com.google.protobuf', name: 'protobuf-java-util', version: protobufVersion

implementation group: 'com.google.code.gson', name: 'gson', version: '2.11.0'

implementation group: 'com.googlecode.protobuf-java-format', name: 'protobuf-java-format', version: '1.4'
implementation group: 'org.bouncycastle', name: 'bcprov-jdk18on', version: '1.78.1'
implementation group: 'com.typesafe', name: 'config', version: '1.3.2'
implementation group: 'org.apache.commons', name: 'commons-lang3', version: '3.14.0'
implementation group: 'com.alibaba', name: 'fastjson', version: '1.2.83'
implementation group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.16.1'

compileOnly 'org.projectlombok:lombok:1.18.24'
annotationProcessor 'org.projectlombok:lombok:1.18.24'
testCompileOnly 'org.projectlombok:lombok:1.18.24'
testAnnotationProcessor 'org.projectlombok:lombok:1.18.24'

implementation group: 'org.jline', name: 'jline', version: '3.25.0'
implementation group: 'io.github.tronprotocol', name: 'zksnark-java-sdk', version: '1.0.0'
}

protobuf {
generatedFilesBaseDir = "$projectDir/src/"
generatedFilesBaseDir = "$projectDir/src"
protoc {
artifact = "com.google.protobuf:protoc:${protobufVersion}"

artifact = "com.google.protobuf:protoc:$protobufVersion"
}
plugins {
grpc {
artifact = "io.grpc:protoc-gen-grpc-java:${grpcVersion}"
artifact = "io.grpc:protoc-gen-grpc-java:$grpcVersion"
}
}
generateProtoTasks {
Expand All @@ -114,6 +115,10 @@ protobuf {
}
}

clean.doFirst {
delete "src/main/gen"
}

run {
standardInput = System.in
mainClassName = 'org.tron.walletcli.Client'
Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
3 changes: 1 addition & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#Tue Mar 06 21:13:26 CST 2018
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.0-all.zip
51 changes: 31 additions & 20 deletions gradlew
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
#!/usr/bin/env sh

#
# Copyright 2015 the original author or authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

##############################################################################
##
## Gradle start up script for UN*X
Expand Down Expand Up @@ -28,7 +44,7 @@ APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`

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

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

# For Cygwin, switch paths to Windows format before running java
if $cygwin ; then
# For Cygwin or MSYS, switch paths to Windows format before running java
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
Expand Down Expand Up @@ -138,19 +154,19 @@ if $cygwin ; then
else
eval `echo args$i`="\"$arg\""
fi
i=$((i+1))
i=`expr $i + 1`
done
case $i in
(0) set -- ;;
(1) set -- "$args0" ;;
(2) set -- "$args0" "$args1" ;;
(3) set -- "$args0" "$args1" "$args2" ;;
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
0) set -- ;;
1) set -- "$args0" ;;
2) set -- "$args0" "$args1" ;;
3) set -- "$args0" "$args1" "$args2" ;;
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi

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

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

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

exec "$JAVACMD" "$@"
21 changes: 20 additions & 1 deletion gradlew.bat
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem

@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
Expand All @@ -13,8 +29,11 @@ if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%

@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi

@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"

@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
Expand Down
5 changes: 3 additions & 2 deletions src/main/java/org/tron/keystore/StringUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,11 @@ public static boolean isContains(char[] a, char[] b) {
if (ArrayUtils.isEmpty(a) || ArrayUtils.isEmpty(b)) {
return false;
}

int alen = a.length;
int blen = b.length;

if (alen < blen) {
return false;
}
for (int i = 0; i < alen; i++) {
if (alen - i < blen) {
return false;
Expand Down
10 changes: 10 additions & 0 deletions src/test/java/org/tron/keystore/StringUtilsTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,16 @@ public void isContains() {
char[] b = "ghijkl".toCharArray();
char[] c = "defghi".toCharArray();
char[] d = "abcdefghijkl".toCharArray();
char[] empty = "".toCharArray();

char[] longarr = "xxxxxxxx123xxxxxxxxx".toCharArray();
char[] shortarr = "123".toCharArray();
Assert.assertFalse(StringUtils.isContains(shortarr, longarr));
Assert.assertTrue(StringUtils.isContains(longarr, shortarr));

Assert.assertFalse(StringUtils.isContains(empty, d));
Assert.assertFalse(StringUtils.isContains(d, empty));

Assert.assertTrue(StringUtils.isContains(d, d));
Assert.assertTrue(StringUtils.isContains(d, a));
Assert.assertTrue(StringUtils.isContains(d, b));
Expand Down

0 comments on commit e8099e3

Please sign in to comment.