diff --git a/build.gradle b/build.gradle
index 65e72c0fb73..04dee79fbae 100644
--- a/build.gradle
+++ b/build.gradle
@@ -6,7 +6,7 @@ plugins {
}
ext {
- grpcVersion = "1.83.0"
+ grpcVersion = "1.83.1"
}
allprojects {
@@ -91,16 +91,14 @@ subprojects {
}
dependencies {
- implementation group: 'org.slf4j', name: 'slf4j-api', version: '1.7.36'
- implementation group: 'org.slf4j', name: 'jcl-over-slf4j', version: '1.7.36'
- implementation group: 'org.slf4j', name: 'jul-to-slf4j', version: '1.7.36'
- implementation group: 'ch.qos.logback', name: 'logback-classic', version: '1.2.13'
+ implementation group: 'org.slf4j', name: 'slf4j-api', version: '2.0.17'
+ implementation group: 'org.slf4j', name: 'jcl-over-slf4j', version: '2.0.17'
+ implementation group: 'org.slf4j', name: 'jul-to-slf4j', version: '2.0.17'
+ implementation group: 'ch.qos.logback', name: 'logback-classic', version: '1.3.16'
implementation "com.google.code.findbugs:jsr305:3.0.0"
implementation group: 'org.springframework', name: 'spring-context', version: "${springVersion}"
- implementation "org.apache.commons:commons-lang3:3.4"
- implementation group: 'org.apache.commons', name: 'commons-math', version: '2.2'
- implementation "org.apache.commons:commons-collections4:4.1"
- implementation group: 'joda-time', name: 'joda-time', version: '2.3'
+ implementation "org.apache.commons:commons-lang3:3.20.0"
+ implementation "org.apache.commons:commons-collections4:4.6.0"
implementation group: 'org.bouncycastle', name: 'bcprov-jdk18on', version: '1.84'
compileOnly 'org.projectlombok:lombok:1.18.34'
diff --git a/chainbase/src/main/java/org/tron/core/store/DynamicPropertiesStore.java b/chainbase/src/main/java/org/tron/core/store/DynamicPropertiesStore.java
index 0f74f20d379..33bbaa4a362 100644
--- a/chainbase/src/main/java/org/tron/core/store/DynamicPropertiesStore.java
+++ b/chainbase/src/main/java/org/tron/core/store/DynamicPropertiesStore.java
@@ -12,13 +12,13 @@
import java.util.stream.IntStream;
import lombok.Getter;
import lombok.extern.slf4j.Slf4j;
-import org.joda.time.DateTime;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import org.tron.common.parameter.CommonParameter;
import org.tron.common.utils.ByteArray;
import org.tron.common.utils.Sha256Hash;
+import org.tron.common.utils.Time;
import org.tron.core.capsule.BytesCapsule;
import org.tron.core.config.Parameter.ChainConstant;
import org.tron.core.db.TronStoreWithRevoking;
@@ -2261,8 +2261,8 @@ public void updateNextMaintenanceTime(long blockTime) {
logger.info(
"Do update nextMaintenanceTime, currentMaintenanceTime: {}, blockTime: {}, "
+ "nextMaintenanceTime: {}.",
- new DateTime(currentMaintenanceTime), new DateTime(blockTime),
- new DateTime(nextMaintenanceTime)
+ Time.getIsoTimeString(currentMaintenanceTime), Time.getIsoTimeString(blockTime),
+ Time.getIsoTimeString(nextMaintenanceTime)
);
}
diff --git a/common/build.gradle b/common/build.gradle
index 14d3eb4e637..4b36d067b70 100644
--- a/common/build.gradle
+++ b/common/build.gradle
@@ -8,7 +8,9 @@ sourceCompatibility = 1.8
dependencies {
- api group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.18.6' // https://github.com/FasterXML/jackson-databind/issues/3627
+ // avoid x.y.z.w micro-patches, they may ship broken Gradle module metadata:
+ // https://github.com/FasterXML/jackson-databind/issues/3627
+ api group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.18.10'
api "com.cedarsoftware:java-util:3.2.0"
api group: 'org.apache.httpcomponents', name: 'httpasyncclient', version: '4.1.1'
api group: 'commons-codec', name: 'commons-codec', version: '1.11'
diff --git a/common/src/main/java/org/tron/common/utils/Time.java b/common/src/main/java/org/tron/common/utils/Time.java
index fdbfcb5f283..15e9d3d4b55 100644
--- a/common/src/main/java/org/tron/common/utils/Time.java
+++ b/common/src/main/java/org/tron/common/utils/Time.java
@@ -1,9 +1,17 @@
package org.tron.common.utils;
import java.sql.Timestamp;
+import java.time.Instant;
+import java.time.ZoneId;
+import java.time.format.DateTimeFormatter;
public class Time {
+ // Matches joda-time's DateTime.toString() output, byte for byte: fixed
+ // 3-digit millis, offset as +08:00, and Z when the system zone is UTC.
+ private static final DateTimeFormatter ISO_MILLIS_FORMAT =
+ DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss.SSSXXX");
+
public static long getCurrentMillis() {
return System.currentTimeMillis();
}
@@ -11,4 +19,8 @@ public static long getCurrentMillis() {
public static String getTimeString(long time) {
return new Timestamp(time).toString();
}
+
+ public static String getIsoTimeString(long time) {
+ return Instant.ofEpochMilli(time).atZone(ZoneId.systemDefault()).format(ISO_MILLIS_FORMAT);
+ }
}
diff --git a/consensus/src/main/java/org/tron/consensus/dpos/DposService.java b/consensus/src/main/java/org/tron/consensus/dpos/DposService.java
index 397c9d0835c..0a40ec8e076 100644
--- a/consensus/src/main/java/org/tron/consensus/dpos/DposService.java
+++ b/consensus/src/main/java/org/tron/consensus/dpos/DposService.java
@@ -14,12 +14,12 @@
import lombok.Getter;
import lombok.Setter;
import lombok.extern.slf4j.Slf4j;
-import org.joda.time.DateTime;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.tron.common.args.GenesisBlock;
import org.tron.common.parameter.CommonParameter;
import org.tron.common.utils.ByteArray;
+import org.tron.common.utils.Time;
import org.tron.consensus.ConsensusDelegate;
import org.tron.consensus.base.BlockHandle;
import org.tron.consensus.base.ConsensusInterface;
@@ -134,14 +134,14 @@ public boolean validBlock(BlockCapsule blockCapsule) {
if (slot == 0
&& consensusDelegate.getDynamicPropertiesStore().allowConsensusLogicOptimization()) {
logger.warn("ValidBlock failed: slot error, witness: {}, timeStamp: {}",
- ByteArray.toHexString(witnessAddress.toByteArray()), new DateTime(timeStamp));
+ ByteArray.toHexString(witnessAddress.toByteArray()), Time.getIsoTimeString(timeStamp));
return false;
}
final ByteString scheduledWitness = dposSlot.getScheduledWitness(slot);
if (!scheduledWitness.equals(witnessAddress)) {
logger.warn("ValidBlock failed: sWitness: {}, bWitness: {}, bTimeStamp: {}, slot: {}",
ByteArray.toHexString(scheduledWitness.toByteArray()),
- ByteArray.toHexString(witnessAddress.toByteArray()), new DateTime(timeStamp), slot);
+ ByteArray.toHexString(witnessAddress.toByteArray()), Time.getIsoTimeString(timeStamp), slot);
return false;
}
diff --git a/consensus/src/main/java/org/tron/consensus/dpos/DposTask.java b/consensus/src/main/java/org/tron/consensus/dpos/DposTask.java
index 9e42552c80f..38f5614e571 100644
--- a/consensus/src/main/java/org/tron/consensus/dpos/DposTask.java
+++ b/consensus/src/main/java/org/tron/consensus/dpos/DposTask.java
@@ -6,7 +6,6 @@
import java.util.concurrent.ExecutorService;
import lombok.Setter;
import lombok.extern.slf4j.Slf4j;
-import org.joda.time.DateTime;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.util.ObjectUtils;
@@ -15,6 +14,7 @@
import org.tron.common.parameter.CommonParameter;
import org.tron.common.utils.ByteArray;
import org.tron.common.utils.Sha256Hash;
+import org.tron.common.utils.Time;
import org.tron.consensus.ConsensusDelegate;
import org.tron.consensus.base.Param.Miner;
import org.tron.consensus.base.State;
@@ -123,7 +123,7 @@ private State produceBlock() {
BlockHeader.raw raw = blockCapsule.getInstance().getBlockHeader().getRawData();
logger.info("Produce block successfully, num: {}, time: {}, witness: {}, ID:{}, parentID:{}",
raw.getNumber(),
- new DateTime(raw.getTimestamp()),
+ Time.getIsoTimeString(raw.getTimestamp()),
ByteArray.toHexString(raw.getWitnessAddress().toByteArray()),
new Sha256Hash(raw.getNumber(), Sha256Hash.of(CommonParameter
.getInstance().isECKeyCryptoEngine(), raw.toByteArray())),
diff --git a/framework/src/main/java/org/tron/common/application/GrpcNettyMaxConcurrentStreamsLimiter.java b/framework/src/main/java/org/tron/common/application/GrpcNettyMaxConcurrentStreamsLimiter.java
deleted file mode 100644
index cdd71ffee3c..00000000000
--- a/framework/src/main/java/org/tron/common/application/GrpcNettyMaxConcurrentStreamsLimiter.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * java-tron is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * java-tron is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with java-tron. If not, see .
- */
-
-package org.tron.common.application;
-
-import static com.google.common.base.Preconditions.checkArgument;
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import io.grpc.netty.GrpcHttp2ConnectionHandler;
-import io.grpc.netty.InternalProtocolNegotiator;
-import io.grpc.netty.InternalProtocolNegotiators;
-import io.grpc.netty.NettyServerBuilder;
-import io.netty.channel.ChannelHandler;
-import io.netty.util.AsciiString;
-
-/** Enforces the advertised HTTP/2 concurrent stream limit for grpc-netty servers. */
-final class GrpcNettyMaxConcurrentStreamsLimiter {
-
- private GrpcNettyMaxConcurrentStreamsLimiter() {
- }
-
- static NettyServerBuilder configurePlaintext(
- NettyServerBuilder builder, int maxConcurrentStreams) {
- checkNotNull(builder, "builder");
- checkArgument(maxConcurrentStreams > 0, "maxConcurrentStreams must be positive");
- builder.maxConcurrentCallsPerConnection(maxConcurrentStreams);
- // TODO: Remove this shim after https://github.com/grpc/grpc-java/issues/12930 is fixed.
- return builder.protocolNegotiator(newPlaintextNegotiator(maxConcurrentStreams));
- }
-
- static InternalProtocolNegotiator.ProtocolNegotiator newPlaintextNegotiator(
- int maxConcurrentStreams) {
- checkArgument(maxConcurrentStreams > 0, "maxConcurrentStreams must be positive");
- return new EnforcingProtocolNegotiator(
- InternalProtocolNegotiators.serverPlaintext(), maxConcurrentStreams);
- }
-
- private static final class EnforcingProtocolNegotiator
- implements InternalProtocolNegotiator.ProtocolNegotiator {
-
- private final InternalProtocolNegotiator.ProtocolNegotiator delegate;
- private final int maxConcurrentStreams;
-
- private EnforcingProtocolNegotiator(
- InternalProtocolNegotiator.ProtocolNegotiator delegate, int maxConcurrentStreams) {
- this.delegate = checkNotNull(delegate, "delegate");
- this.maxConcurrentStreams = maxConcurrentStreams;
- }
-
- @Override
- public AsciiString scheme() {
- return delegate.scheme();
- }
-
- @Override
- public ChannelHandler newHandler(GrpcHttp2ConnectionHandler grpcHandler) {
- // grpc-java builds the connection directly, bypassing Netty's builder-side enforcement.
- grpcHandler.connection().remote().maxActiveStreams(maxConcurrentStreams);
- return delegate.newHandler(grpcHandler);
- }
-
- @Override
- public void close() {
- delegate.close();
- }
- }
-}
diff --git a/framework/src/main/java/org/tron/common/application/RpcService.java b/framework/src/main/java/org/tron/common/application/RpcService.java
index 27fcc479f4e..c398b71ae41 100644
--- a/framework/src/main/java/org/tron/common/application/RpcService.java
+++ b/framework/src/main/java/org/tron/common/application/RpcService.java
@@ -100,9 +100,8 @@ protected NettyServerBuilder initServerBuilder() {
serverBuilder = serverBuilder.executor(this.executorService);
}
// Set configs from config.conf or default value
- serverBuilder = GrpcNettyMaxConcurrentStreamsLimiter.configurePlaintext(
- serverBuilder, parameter.getMaxConcurrentCallsPerConnection());
serverBuilder
+ .maxConcurrentCallsPerConnection(parameter.getMaxConcurrentCallsPerConnection())
.flowControlWindow(parameter.getFlowControlWindow())
.maxConnectionIdle(parameter.getMaxConnectionIdleInMillis(), TimeUnit.MILLISECONDS)
.maxConnectionAge(parameter.getMaxConnectionAgeInMillis(), TimeUnit.MILLISECONDS)
diff --git a/framework/src/test/java/org/tron/common/application/GrpcNettyMaxConcurrentStreamsLimiterTest.java b/framework/src/test/java/org/tron/common/application/GrpcNettyMaxConcurrentStreamsLimiterTest.java
deleted file mode 100644
index fc578ca7947..00000000000
--- a/framework/src/test/java/org/tron/common/application/GrpcNettyMaxConcurrentStreamsLimiterTest.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * java-tron is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * java-tron is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with java-tron. If not, see .
- */
-
-package org.tron.common.application;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertThrows;
-
-import io.grpc.ChannelLogger;
-import io.grpc.ChannelLogger.ChannelLogLevel;
-import io.grpc.netty.GrpcHttp2ConnectionHandler;
-import io.grpc.netty.InternalProtocolNegotiator;
-import io.netty.channel.ChannelHandler;
-import io.netty.handler.codec.http2.DefaultHttp2Connection;
-import io.netty.handler.codec.http2.DefaultHttp2ConnectionDecoder;
-import io.netty.handler.codec.http2.DefaultHttp2ConnectionEncoder;
-import io.netty.handler.codec.http2.DefaultHttp2FrameReader;
-import io.netty.handler.codec.http2.DefaultHttp2FrameWriter;
-import io.netty.handler.codec.http2.Http2Connection;
-import io.netty.handler.codec.http2.Http2ConnectionDecoder;
-import io.netty.handler.codec.http2.Http2ConnectionEncoder;
-import io.netty.handler.codec.http2.Http2Error;
-import io.netty.handler.codec.http2.Http2Exception;
-import io.netty.handler.codec.http2.Http2FrameWriter;
-import io.netty.handler.codec.http2.Http2Settings;
-import org.junit.Test;
-
-public class GrpcNettyMaxConcurrentStreamsLimiterTest {
-
- private static final ChannelLogger NOOP_LOGGER = new ChannelLogger() {
- @Override
- public void log(ChannelLogLevel level, String message) {
- }
-
- @Override
- public void log(ChannelLogLevel level, String messageFormat, Object... args) {
- }
- };
-
- @Test
- public void shouldEnforceMaxStreamsBeforeSettingsAck() throws Exception {
- Http2Connection connection = new DefaultHttp2Connection(true);
- GrpcHttp2ConnectionHandler grpcHandler = newGrpcHandler(connection);
- InternalProtocolNegotiator.ProtocolNegotiator negotiator =
- GrpcNettyMaxConcurrentStreamsLimiter.newPlaintextNegotiator(2);
-
- ChannelHandler negotiationHandler = negotiator.newHandler(grpcHandler);
-
- assertNotNull(negotiationHandler);
- assertEquals(2, connection.remote().maxActiveStreams());
- connection.remote().createStream(1, true);
- connection.remote().createStream(3, true);
- Http2Exception exception = assertThrows(
- Http2Exception.class, () -> connection.remote().createStream(5, true));
- assertEquals(Http2Error.REFUSED_STREAM, exception.error());
- negotiator.close();
- }
-
- @Test
- public void shouldIgnoreClientMaxHeaderListSizeOnServer() throws Exception {
- Http2Connection connection = new DefaultHttp2Connection(true);
- Http2FrameWriter frameWriter = new DefaultHttp2FrameWriter();
- Http2ConnectionEncoder encoder =
- new DefaultHttp2ConnectionEncoder(connection, frameWriter);
- long originalMaxHeaderListSize =
- encoder.configuration().headersConfiguration().maxHeaderListSize();
-
- encoder.remoteSettings(new Http2Settings().maxHeaderListSize(1));
-
- assertEquals(originalMaxHeaderListSize,
- encoder.configuration().headersConfiguration().maxHeaderListSize());
- encoder.close();
- }
-
- @Test
- public void shouldRejectNonPositiveStreamLimit() {
- IllegalArgumentException zeroLimitException = assertThrows(IllegalArgumentException.class,
- () -> GrpcNettyMaxConcurrentStreamsLimiter.newPlaintextNegotiator(0));
- assertEquals("maxConcurrentStreams must be positive", zeroLimitException.getMessage());
- IllegalArgumentException negativeLimitException = assertThrows(IllegalArgumentException.class,
- () -> GrpcNettyMaxConcurrentStreamsLimiter.newPlaintextNegotiator(-1));
- assertEquals("maxConcurrentStreams must be positive", negativeLimitException.getMessage());
- }
-
- private static GrpcHttp2ConnectionHandler newGrpcHandler(Http2Connection connection) {
- Http2FrameWriter frameWriter = new DefaultHttp2FrameWriter();
- Http2ConnectionEncoder encoder =
- new DefaultHttp2ConnectionEncoder(connection, frameWriter);
- Http2ConnectionDecoder decoder = new DefaultHttp2ConnectionDecoder(
- connection, encoder, new DefaultHttp2FrameReader());
- return new GrpcHttp2ConnectionHandler(
- null, decoder, encoder, new Http2Settings(), NOOP_LOGGER) {
- };
- }
-}
diff --git a/framework/src/test/java/org/tron/common/application/NettyHttp2HeaderSecurityTest.java b/framework/src/test/java/org/tron/common/application/NettyHttp2HeaderSecurityTest.java
new file mode 100644
index 00000000000..6a4f4330f04
--- /dev/null
+++ b/framework/src/test/java/org/tron/common/application/NettyHttp2HeaderSecurityTest.java
@@ -0,0 +1,53 @@
+/*
+ * java-tron is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * java-tron is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with java-tron. If not, see .
+ */
+
+package org.tron.common.application;
+
+import static org.junit.Assert.assertEquals;
+
+import io.netty.handler.codec.http2.DefaultHttp2Connection;
+import io.netty.handler.codec.http2.DefaultHttp2ConnectionEncoder;
+import io.netty.handler.codec.http2.DefaultHttp2FrameWriter;
+import io.netty.handler.codec.http2.Http2Connection;
+import io.netty.handler.codec.http2.Http2ConnectionEncoder;
+import io.netty.handler.codec.http2.Http2FrameWriter;
+import io.netty.handler.codec.http2.Http2Settings;
+import org.junit.Test;
+
+/** Guards the netty HTTP/2 header-size behaviour the gRPC server relies on. */
+public class NettyHttp2HeaderSecurityTest {
+
+ /**
+ * CVE-2026-50560: SETTINGS_MAX_HEADER_LIST_SIZE tells the server what the client is willing to
+ * receive, so it must not shrink the server encoder's own limit. Otherwise a hostile client can
+ * advertise a tiny value and make every response-header write throw, which is a Rapid-Reset-like
+ * denial of service. Netty enforced the client value before 4.1.135.Final / 4.2.15.Final.
+ */
+ @Test
+ public void shouldIgnoreClientMaxHeaderListSizeOnServer() throws Exception {
+ Http2Connection connection = new DefaultHttp2Connection(true);
+ Http2FrameWriter frameWriter = new DefaultHttp2FrameWriter();
+ Http2ConnectionEncoder encoder =
+ new DefaultHttp2ConnectionEncoder(connection, frameWriter);
+ long originalMaxHeaderListSize =
+ encoder.configuration().headersConfiguration().maxHeaderListSize();
+
+ encoder.remoteSettings(new Http2Settings().maxHeaderListSize(1));
+
+ assertEquals(originalMaxHeaderListSize,
+ encoder.configuration().headersConfiguration().maxHeaderListSize());
+ encoder.close();
+ }
+}
diff --git a/framework/src/test/java/org/tron/common/utils/RandomGeneratorTest.java b/framework/src/test/java/org/tron/common/utils/RandomGeneratorTest.java
index 4de441d940d..34c7536ebd0 100644
--- a/framework/src/test/java/org/tron/common/utils/RandomGeneratorTest.java
+++ b/framework/src/test/java/org/tron/common/utils/RandomGeneratorTest.java
@@ -9,7 +9,6 @@
import java.util.List;
import java.util.stream.Collectors;
import lombok.extern.slf4j.Slf4j;
-import org.joda.time.DateTime;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
@@ -42,7 +41,7 @@ public void shuffle() {
final List witnessCapsuleListBefore = this.getWitnessList();
logger.info("updateWitnessSchedule,before: " + getWitnessStringList(witnessCapsuleListBefore));
final List witnessCapsuleListAfter = new RandomGenerator()
- .shuffle(witnessCapsuleListBefore, DateTime.now().getMillis());
+ .shuffle(witnessCapsuleListBefore, System.currentTimeMillis());
logger.info("updateWitnessSchedule,after: " + getWitnessStringList(witnessCapsuleListAfter));
}
diff --git a/framework/src/test/java/org/tron/core/BandwidthProcessorTest.java b/framework/src/test/java/org/tron/core/BandwidthProcessorTest.java
index cf652af3650..622d20ae7d2 100755
--- a/framework/src/test/java/org/tron/core/BandwidthProcessorTest.java
+++ b/framework/src/test/java/org/tron/core/BandwidthProcessorTest.java
@@ -5,8 +5,8 @@
import com.google.protobuf.Any;
import com.google.protobuf.ByteString;
import java.nio.charset.StandardCharsets;
+import java.time.ZonedDateTime;
import lombok.extern.slf4j.Slf4j;
-import org.joda.time.DateTime;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
@@ -64,8 +64,8 @@ public class BandwidthProcessorTest extends BaseTest {
TO_ADDRESS = Wallet.getAddressPreFixString() + "abd4b9367799eaa3197fecb144eb71de1e049abc";
ASSET_ADDRESS = Wallet.getAddressPreFixString() + "548794500882809695a8a687866e76d4271a3456";
ASSET_ADDRESS_V2 = Wallet.getAddressPreFixString() + "548794500882809695a8a687866e76d4271a7890";
- START_TIME = DateTime.now().minusDays(1).getMillis();
- END_TIME = DateTime.now().getMillis();
+ START_TIME = ZonedDateTime.now().minusDays(1).toInstant().toEpochMilli();
+ END_TIME = System.currentTimeMillis();
}
/**
@@ -616,7 +616,7 @@ public void sameTokenNameCloseConsumeSuccess() {
AccountType.Normal,
chainBaseManager.getDynamicPropertiesStore().getAssetIssueFee());
ownerCapsule.setBalance(10_000_000L);
- long expireTime = DateTime.now().getMillis() + 6 * 86_400_000;
+ long expireTime = System.currentTimeMillis() + 6 * 86_400_000;
ownerCapsule.setFrozenForBandwidth(2_000_000L, expireTime);
chainBaseManager.getAccountStore().put(ownerCapsule.getAddress().toByteArray(), ownerCapsule);
@@ -627,7 +627,7 @@ public void sameTokenNameCloseConsumeSuccess() {
AccountType.Normal,
chainBaseManager.getDynamicPropertiesStore().getAssetIssueFee());
toAddressCapsule.setBalance(10_000_000L);
- long expireTime2 = DateTime.now().getMillis() + 6 * 86_400_000;
+ long expireTime2 = System.currentTimeMillis() + 6 * 86_400_000;
toAddressCapsule.setFrozenForBandwidth(2_000_000L, expireTime2);
chainBaseManager.getAccountStore().put(toAddressCapsule.getAddress().toByteArray(),
toAddressCapsule);
@@ -731,7 +731,7 @@ public void sameTokenNameOpenConsumeSuccess() {
AccountType.Normal,
chainBaseManager.getDynamicPropertiesStore().getAssetIssueFee());
ownerCapsule.setBalance(10_000_000L);
- long expireTime = DateTime.now().getMillis() + 6 * 86_400_000;
+ long expireTime = System.currentTimeMillis() + 6 * 86_400_000;
ownerCapsule.setFrozenForBandwidth(2_000_000L, expireTime);
chainBaseManager.getAccountStore().put(ownerCapsule.getAddress().toByteArray(), ownerCapsule);
@@ -742,7 +742,7 @@ public void sameTokenNameOpenConsumeSuccess() {
AccountType.Normal,
chainBaseManager.getDynamicPropertiesStore().getAssetIssueFee());
toAddressCapsule.setBalance(10_000_000L);
- long expireTime2 = DateTime.now().getMillis() + 6 * 86_400_000;
+ long expireTime2 = System.currentTimeMillis() + 6 * 86_400_000;
toAddressCapsule.setFrozenForBandwidth(2_000_000L, expireTime2);
chainBaseManager.getAccountStore().put(toAddressCapsule.getAddress().toByteArray(),
toAddressCapsule);
@@ -816,7 +816,7 @@ public void sameTokenNameCloseTransferToAccountNotExist() {
AccountType.Normal,
chainBaseManager.getDynamicPropertiesStore().getAssetIssueFee());
ownerCapsule.setBalance(10_000_000L);
- long expireTime = DateTime.now().getMillis() + 6 * 86_400_000;
+ long expireTime = System.currentTimeMillis() + 6 * 86_400_000;
ownerCapsule.setFrozenForBandwidth(2_000_000L, expireTime);
chainBaseManager.getAccountStore().put(ownerCapsule.getAddress().toByteArray(), ownerCapsule);
@@ -827,7 +827,7 @@ public void sameTokenNameCloseTransferToAccountNotExist() {
AccountType.Normal,
chainBaseManager.getDynamicPropertiesStore().getAssetIssueFee());
toAddressCapsule.setBalance(10_000_000L);
- long expireTime2 = DateTime.now().getMillis() + 6 * 86_400_000;
+ long expireTime2 = System.currentTimeMillis() + 6 * 86_400_000;
toAddressCapsule.setFrozenForBandwidth(2_000_000L, expireTime2);
chainBaseManager.getAccountStore().delete(toAddressCapsule.getAddress().toByteArray());
diff --git a/framework/src/test/java/org/tron/core/WalletTest.java b/framework/src/test/java/org/tron/core/WalletTest.java
index 9dbab338b67..7215a287912 100644
--- a/framework/src/test/java/org/tron/core/WalletTest.java
+++ b/framework/src/test/java/org/tron/core/WalletTest.java
@@ -30,12 +30,12 @@
import com.google.protobuf.Any;
import com.google.protobuf.ByteString;
+import java.time.ZonedDateTime;
import java.util.ArrayList;
import java.util.Arrays;
import javax.annotation.Resource;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
-import org.joda.time.DateTime;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Ignore;
@@ -113,21 +113,29 @@ public class WalletTest extends BaseTest {
public static final long BLOCK_NUM_THREE = 3;
public static final long BLOCK_NUM_FOUR = 4;
public static final long BLOCK_NUM_FIVE = 5;
- public static final long BLOCK_TIMESTAMP_ONE = DateTime.now().minusDays(4).getMillis();
- public static final long BLOCK_TIMESTAMP_TWO = DateTime.now().minusDays(3).getMillis();
- public static final long BLOCK_TIMESTAMP_THREE = DateTime.now().minusDays(2).getMillis();
- public static final long BLOCK_TIMESTAMP_FOUR = DateTime.now().minusDays(1).getMillis();
- public static final long BLOCK_TIMESTAMP_FIVE = DateTime.now().getMillis();
+ public static final long BLOCK_TIMESTAMP_ONE =
+ ZonedDateTime.now().minusDays(4).toInstant().toEpochMilli();
+ public static final long BLOCK_TIMESTAMP_TWO =
+ ZonedDateTime.now().minusDays(3).toInstant().toEpochMilli();
+ public static final long BLOCK_TIMESTAMP_THREE =
+ ZonedDateTime.now().minusDays(2).toInstant().toEpochMilli();
+ public static final long BLOCK_TIMESTAMP_FOUR =
+ ZonedDateTime.now().minusDays(1).toInstant().toEpochMilli();
+ public static final long BLOCK_TIMESTAMP_FIVE = System.currentTimeMillis();
public static final long BLOCK_WITNESS_ONE = 12;
public static final long BLOCK_WITNESS_TWO = 13;
public static final long BLOCK_WITNESS_THREE = 14;
public static final long BLOCK_WITNESS_FOUR = 15;
public static final long BLOCK_WITNESS_FIVE = 16;
- public static final long TRANSACTION_TIMESTAMP_ONE = DateTime.now().minusDays(4).getMillis();
- public static final long TRANSACTION_TIMESTAMP_TWO = DateTime.now().minusDays(3).getMillis();
- public static final long TRANSACTION_TIMESTAMP_THREE = DateTime.now().minusDays(2).getMillis();
- public static final long TRANSACTION_TIMESTAMP_FOUR = DateTime.now().minusDays(1).getMillis();
- public static final long TRANSACTION_TIMESTAMP_FIVE = DateTime.now().getMillis();
+ public static final long TRANSACTION_TIMESTAMP_ONE =
+ ZonedDateTime.now().minusDays(4).toInstant().toEpochMilli();
+ public static final long TRANSACTION_TIMESTAMP_TWO =
+ ZonedDateTime.now().minusDays(3).toInstant().toEpochMilli();
+ public static final long TRANSACTION_TIMESTAMP_THREE =
+ ZonedDateTime.now().minusDays(2).toInstant().toEpochMilli();
+ public static final long TRANSACTION_TIMESTAMP_FOUR =
+ ZonedDateTime.now().minusDays(1).toInstant().toEpochMilli();
+ public static final long TRANSACTION_TIMESTAMP_FIVE = System.currentTimeMillis();
@Resource
private Wallet wallet;
private static Block block1;
diff --git a/framework/src/test/java/org/tron/core/actuator/ParticipateAssetIssueActuatorTest.java b/framework/src/test/java/org/tron/core/actuator/ParticipateAssetIssueActuatorTest.java
index 5c168f51bee..4af63285b1e 100755
--- a/framework/src/test/java/org/tron/core/actuator/ParticipateAssetIssueActuatorTest.java
+++ b/framework/src/test/java/org/tron/core/actuator/ParticipateAssetIssueActuatorTest.java
@@ -2,7 +2,7 @@
import com.google.protobuf.Any;
import com.google.protobuf.ByteString;
-import org.joda.time.DateTime;
+import java.time.ZonedDateTime;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
@@ -403,8 +403,8 @@ public void sameTokenNameOpenRightAssetIssue() {
*/
@Test
public void sameTokenNameCloseAssetIssueTimeRight() {
- DateTime now = DateTime.now();
- initAssetIssue(now.minusDays(1).getMillis(), now.getMillis());
+ ZonedDateTime now = ZonedDateTime.now();
+ initAssetIssue(now.minusDays(1).toInstant().toEpochMilli(), now.toInstant().toEpochMilli());
ParticipateAssetIssueActuator actuator = new ParticipateAssetIssueActuator();
actuator.setChainBaseManager(chainBaseManager).setAny(getContract(1000L));
@@ -436,8 +436,8 @@ public void sameTokenNameCloseAssetIssueTimeRight() {
@Test
public void sameTokenNameOpenAssetIssueTimeRight() {
chainBaseManager.getDynamicPropertiesStore().saveAllowSameTokenName(1);
- DateTime now = DateTime.now();
- initAssetIssue(now.minusDays(1).getMillis(), now.getMillis());
+ ZonedDateTime now = ZonedDateTime.now();
+ initAssetIssue(now.minusDays(1).toInstant().toEpochMilli(), now.toInstant().toEpochMilli());
ParticipateAssetIssueActuator actuator = new ParticipateAssetIssueActuator();
actuator.setChainBaseManager(chainBaseManager).setAny(getContract(1000L));
@@ -470,8 +470,8 @@ public void sameTokenNameOpenAssetIssueTimeRight() {
*/
@Test
public void sameTokenNameCloseAssetIssueTimeLeft() {
- DateTime now = DateTime.now();
- initAssetIssue(now.minusDays(1).getMillis(), now.getMillis());
+ ZonedDateTime now = ZonedDateTime.now();
+ initAssetIssue(now.minusDays(1).toInstant().toEpochMilli(), now.toInstant().toEpochMilli());
ParticipateAssetIssueActuator actuator = new ParticipateAssetIssueActuator();
actuator.setChainBaseManager(chainBaseManager).setAny(getContract(1000L));
@@ -504,8 +504,8 @@ public void sameTokenNameCloseAssetIssueTimeLeft() {
@Test
public void sameTokenNameOpenAssetIssueTimeLeft() {
chainBaseManager.getDynamicPropertiesStore().saveAllowSameTokenName(1);
- DateTime now = DateTime.now();
- initAssetIssue(now.minusDays(1).getMillis(), now.getMillis());
+ ZonedDateTime now = ZonedDateTime.now();
+ initAssetIssue(now.minusDays(1).toInstant().toEpochMilli(), now.toInstant().toEpochMilli());
ParticipateAssetIssueActuator actuator = new ParticipateAssetIssueActuator();
actuator.setChainBaseManager(chainBaseManager).setAny(getContract(1000L));
@@ -605,8 +605,9 @@ public void sameTokenNameOpenExchangeDevisibleTest() {
*/
@Test
public void sameTokenNameCloseNegativeAmountTest() {
- DateTime now = DateTime.now();
- initAssetIssue(now.minusDays(1).getMillis(), now.plusDays(1).getMillis());
+ ZonedDateTime now = ZonedDateTime.now();
+ initAssetIssue(now.minusDays(1).toInstant().toEpochMilli(),
+ now.plusDays(1).toInstant().toEpochMilli());
ParticipateAssetIssueActuator actuator = new ParticipateAssetIssueActuator();
actuator.setChainBaseManager(chainBaseManager).setAny(getContract(-999L));
@@ -639,8 +640,9 @@ public void sameTokenNameCloseNegativeAmountTest() {
@Test
public void sameTokenNameOpenNegativeAmountTest() {
chainBaseManager.getDynamicPropertiesStore().saveAllowSameTokenName(1);
- DateTime now = DateTime.now();
- initAssetIssue(now.minusDays(1).getMillis(), now.plusDays(1).getMillis());
+ ZonedDateTime now = ZonedDateTime.now();
+ initAssetIssue(now.minusDays(1).toInstant().toEpochMilli(),
+ now.plusDays(1).toInstant().toEpochMilli());
ParticipateAssetIssueActuator actuator = new ParticipateAssetIssueActuator();
actuator.setChainBaseManager(chainBaseManager).setAny(getContract(-999L));
@@ -675,8 +677,9 @@ public void sameTokenNameOpenNegativeAmountTest() {
*/
@Test
public void sameTokenNameCloseZeroAmountTest() {
- DateTime now = DateTime.now();
- initAssetIssue(now.minusDays(1).getMillis(), now.plusDays(1).getMillis());
+ ZonedDateTime now = ZonedDateTime.now();
+ initAssetIssue(now.minusDays(1).toInstant().toEpochMilli(),
+ now.plusDays(1).toInstant().toEpochMilli());
ParticipateAssetIssueActuator actuator = new ParticipateAssetIssueActuator();
actuator.setChainBaseManager(chainBaseManager).setAny(getContract(0));
@@ -709,8 +712,9 @@ public void sameTokenNameCloseZeroAmountTest() {
@Test
public void sameTokenNameOpenZeroAmountTest() {
chainBaseManager.getDynamicPropertiesStore().saveAllowSameTokenName(1);
- DateTime now = DateTime.now();
- initAssetIssue(now.minusDays(1).getMillis(), now.plusDays(1).getMillis());
+ ZonedDateTime now = ZonedDateTime.now();
+ initAssetIssue(now.minusDays(1).toInstant().toEpochMilli(),
+ now.plusDays(1).toInstant().toEpochMilli());
ParticipateAssetIssueActuator actuator = new ParticipateAssetIssueActuator();
actuator.setChainBaseManager(chainBaseManager).setAny(getContract(0));
@@ -746,8 +750,9 @@ public void sameTokenNameOpenZeroAmountTest() {
*/
@Test
public void sameTokenNameCloseNoExitOwnerTest() {
- DateTime now = DateTime.now();
- initAssetIssue(now.minusDays(1).getMillis(), now.plusDays(1).getMillis());
+ ZonedDateTime now = ZonedDateTime.now();
+ initAssetIssue(now.minusDays(1).toInstant().toEpochMilli(),
+ now.plusDays(1).toInstant().toEpochMilli());
ParticipateAssetIssueActuator actuator = new ParticipateAssetIssueActuator();
actuator.setChainBaseManager(chainBaseManager)
.setAny(getContractWithOwner(101, NOT_EXIT_ADDRESS));
@@ -782,8 +787,9 @@ public void sameTokenNameCloseNoExitOwnerTest() {
@Test
public void sameTokenNameOpenNoExitOwnerTest() {
chainBaseManager.getDynamicPropertiesStore().saveAllowSameTokenName(1);
- DateTime now = DateTime.now();
- initAssetIssue(now.minusDays(1).getMillis(), now.plusDays(1).getMillis());
+ ZonedDateTime now = ZonedDateTime.now();
+ initAssetIssue(now.minusDays(1).toInstant().toEpochMilli(),
+ now.plusDays(1).toInstant().toEpochMilli());
ParticipateAssetIssueActuator actuator = new ParticipateAssetIssueActuator();
actuator.setChainBaseManager(chainBaseManager)
.setAny(getContractWithOwner(101, NOT_EXIT_ADDRESS));
@@ -1310,8 +1316,9 @@ public void sameTokenNameOpenNotEnoughAssetTest() {
*/
@Test
public void sameTokenNameCloseNoneExistAssetTest() {
- DateTime now = DateTime.now();
- initAssetIssue(now.minusDays(1).getMillis(), now.plusDays(1).getMillis());
+ ZonedDateTime now = ZonedDateTime.now();
+ initAssetIssue(now.minusDays(1).toInstant().toEpochMilli(),
+ now.plusDays(1).toInstant().toEpochMilli());
ParticipateAssetIssueActuator actuator = new ParticipateAssetIssueActuator();
actuator.setChainBaseManager(chainBaseManager)
.setAny(getContract(1, "TTTTTTTTTTTT"));
@@ -1346,8 +1353,9 @@ public void sameTokenNameCloseNoneExistAssetTest() {
@Test
public void sameTokenNameOpenNoneExistAssetTest() {
chainBaseManager.getDynamicPropertiesStore().saveAllowSameTokenName(1);
- DateTime now = DateTime.now();
- initAssetIssue(now.minusDays(1).getMillis(), now.plusDays(1).getMillis());
+ ZonedDateTime now = ZonedDateTime.now();
+ initAssetIssue(now.minusDays(1).toInstant().toEpochMilli(),
+ now.plusDays(1).toInstant().toEpochMilli());
ParticipateAssetIssueActuator actuator = new ParticipateAssetIssueActuator();
actuator.setChainBaseManager(chainBaseManager)
.setAny(getContract(1, "TTTTTTTTTTTT"));
diff --git a/framework/src/test/java/org/tron/core/net/messagehandler/TransactionsMsgHandlerTest.java b/framework/src/test/java/org/tron/core/net/messagehandler/TransactionsMsgHandlerTest.java
index ed2121d360f..78af06e64bc 100644
--- a/framework/src/test/java/org/tron/core/net/messagehandler/TransactionsMsgHandlerTest.java
+++ b/framework/src/test/java/org/tron/core/net/messagehandler/TransactionsMsgHandlerTest.java
@@ -4,6 +4,7 @@
import com.google.protobuf.ByteString;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
+import java.time.ZonedDateTime;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@@ -14,7 +15,6 @@
import java.util.concurrent.RejectedExecutionException;
import lombok.Getter;
-import org.joda.time.DateTime;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
@@ -67,7 +67,7 @@ public void testProcessMessage() {
.setOwnerAddress(ByteString.copyFrom(ByteArray.fromHexString("121212a9cf")))
.setToAddress(ByteString.copyFrom(ByteArray.fromHexString("232323a9cf"))).build();
- long transactionTimestamp = DateTime.now().minusDays(4).getMillis();
+ long transactionTimestamp = ZonedDateTime.now().minusDays(4).toInstant().toEpochMilli();
Protocol.Transaction trx = Protocol.Transaction.newBuilder().setRawData(
Protocol.Transaction.raw.newBuilder().setTimestamp(transactionTimestamp)
.setRefBlockNum(1)
diff --git a/gradle/verification-metadata.xml b/gradle/verification-metadata.xml
index 6a3e641d5d6..2e30496116f 100644
--- a/gradle/verification-metadata.xml
+++ b/gradle/verification-metadata.xml
@@ -49,25 +49,25 @@
-
-
-
+
+
+
-
-
+
+
-
-
-
+
+
+
-
-
+
+
-
-
-
+
+
+
@@ -189,9 +189,9 @@
-
-
-
+
+
+
@@ -199,9 +199,9 @@
-
-
-
+
+
+
@@ -219,15 +219,15 @@
-
-
-
+
+
+
-
-
+
+
-
-
+
+
@@ -235,15 +235,15 @@
-
-
-
+
+
+
-
-
+
+
-
-
+
+
@@ -251,15 +251,15 @@
-
-
-
+
+
+
-
-
+
+
-
-
+
+
@@ -1171,76 +1171,76 @@
-
-
-
+
+
+
-
-
+
+
-
-
-
+
+
+
-
-
+
+
-
-
-
+
+
+
-
-
+
+
-
-
-
+
+
+
-
-
+
+
-
-
-
+
+
+
-
-
+
+
-
-
-
+
+
+
-
-
+
+
-
-
-
+
+
+
-
-
+
+
-
-
-
+
+
+
-
-
+
+
-
-
-
+
+
+
-
-
+
+
@@ -1251,18 +1251,18 @@
-
-
-
+
+
+
-
-
+
+
-
-
+
+
-
-
+
+
@@ -1528,14 +1528,6 @@
-
-
-
-
-
-
-
-
@@ -1684,11 +1676,37 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -1710,36 +1728,9 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
@@ -1792,6 +1783,11 @@
+
+
+
+
+
@@ -2408,6 +2404,14 @@
+
+
+
+
+
+
+
+
@@ -2424,6 +2428,14 @@
+
+
+
+
+
+
+
+
@@ -2448,6 +2460,11 @@
+
+
+
+
+
@@ -2612,20 +2629,20 @@
-
-
-
+
+
+
-
-
+
+
-
-
-
+
+
+
-
-
+
+
@@ -2647,16 +2664,26 @@
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/plugins/src/main/resources/logback.xml b/plugins/src/main/resources/logback.xml
index fa557f1a412..3f5eff3a1e0 100644
--- a/plugins/src/main/resources/logback.xml
+++ b/plugins/src/main/resources/logback.xml
@@ -3,16 +3,7 @@
-
-
-
-
- %d{HH:mm:ss.SSS} %-5level [%t] [%c{1}]\(%F:%L\) %m%n
-
-
- INFO
-
-
+