Skip to content

Commit a9809b5

Browse files
authored
Merge pull request #4594 from tronprotocol/release_v4.5.2
Release v4.5.2 merge to master
2 parents 85f7278 + 2d88f6e commit a9809b5

File tree

97 files changed

+2583
-697
lines changed

Some content is hidden

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

97 files changed

+2583
-697
lines changed
Lines changed: 28 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,28 @@
1-
<!-- Please answer these questions before submitting your issue. Thanks! -->
2-
3-
### 1. What did you do?
4-
<!--If possible, provide a recipe for reproducing the error. -->
5-
6-
7-
### 2. What did you expect to see?
8-
9-
10-
11-
### 3. What did you see instead?
12-
13-
1+
---
2+
name: Ask a question
3+
about: Something is unclear
4+
title: ''
5+
labels: ''
6+
assignees: ''
7+
8+
---
9+
10+
<!-- Please answer these questions before submitting your issue. Thanks! -->
11+
12+
### System information
13+
14+
java-tron version: `java -jar FullNode.jar -v`
15+
OS & Version: Windows/Linux/OSX
16+
17+
18+
### 1. What did you do?
19+
<!--If possible, provide a recipe for reproducing the error. -->
20+
21+
22+
### 2. What did you expect to see?
23+
24+
25+
26+
### 3. What did you see instead?
27+
28+
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
---
2+
name: Report a bug
3+
about: Create a report to help us improve
4+
title: ''
5+
labels: ''
6+
assignees: ''
7+
8+
---
9+
10+
#### System information
11+
12+
java-tron version: `java -jar FullNode.jar -v`
13+
OS & Version: Windows/Linux/OSX
14+
Commit hash : (if `develop`)
15+
16+
#### Expected behaviour
17+
18+
19+
#### Actual behaviour
20+
21+
22+
#### Steps to reproduce the behaviour
23+
24+
25+
#### Backtrace
26+
27+
````
28+
[backtrace]
29+
````
30+
31+
When submitting logs: please submit them as text and not screenshots.
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
---
2+
name: Request a feature
3+
about: Suggest an idea for this project
4+
title: ''
5+
labels: ''
6+
assignees: ''
7+
8+
---
9+
10+
# Rationale
11+
12+
Why should this feature exist?
13+
What are the use-cases?
14+
15+
# Implementation
16+
17+
Do you have ideas regarding the implementation of this feature?
18+
Are you willing to implement this feature?

README.md

Lines changed: 57 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -63,48 +63,73 @@ TRON is a project dedicated to building the infrastructure for a truly decentral
6363
TRON enables large-scale development and engagement. With over 2000 transactions per second (TPS), high concurrency, low latency, and massive data transmission. It is ideal for building decentralized entertainment applications. Free features and incentive systems allow developers to create premium app experiences for users.
6464

6565
# Building the source
66-
Building java-tron requires `git` and `Oracle JDK 1.8` to be installed, other JDK versions are not supported yet. It is recommended to operate on `Linux` and `OSX` operating systems.
66+
Building java-tron requires `git` and `Oracle JDK 1.8` to be installed, other JDK versions are not supported yet. Make sure you operate on `Linux` and `MacOS` operating systems.
6767

68-
## Getting the Source Code
68+
Clone the repo and switch to the `master` branch
6969

7070
```bash
7171
$ git clone https://github.com/tronprotocol/java-tron.git
72+
$ cd java-tron
7273
$ git checkout -t origin/master
7374
```
74-
75-
## Build
76-
75+
then run the following command to build java-tron, the `FullNode.jar` file can be found in `java-tron/build/libs/` after build successful.
7776
```bash
78-
$ cd java-tron
7977
$ ./gradlew clean build -x test
8078
```
8179

82-
The `FullNode.jar` file can be found in `java-tron/build/libs/FullNode.jar` after build successful.
8380

8481
# Running java-tron
82+
Running java-tron requires `Oracle JDK 1.8` to be installed, other JDK versions are not supported yet. Make sure you operate on `Linux` and `MacOS` operating systems.
8583

8684
Get the mainnet configurate file: [main_net_config.conf](https://github.com/tronprotocol/tron-deployment/blob/master/main_net_config.conf), other network configuration files can be find [here](https://github.com/tronprotocol/tron-deployment).
85+
## Hardware Requirements
86+
Minimum:
87+
* CPU with 8 cores
88+
* 16GB RAM
89+
* 1TB free storage space to sync the Mainnet
8790

91+
Recommended:
92+
* CPU with 16+ cores(32+ cores for a super representative)
93+
* 32GB+ RAM(64GB+ for a super representative)
94+
* High Performance SSD with at least 1.5TB free space
95+
* 100+ MB/s download Internet service
8896

89-
* **Running a full node for mainnet**
90-
Full node has full historical data, it is the entry point into the TRON network , it can be used by other processes as a gateway into the TRON network via HTTP and GRPC endpoints. You can interact with the TRON network through full node:transfer assets, deploy contracts, interact with contracts and so on. `-c ` parameter specifies a configuration file to run a full node:
97+
98+
## Running a full node for mainnet
99+
Full node has full historical data, it is the entry point into the TRON network , it can be used by other processes as a gateway into the TRON network via HTTP and GRPC endpoints. You can interact with the TRON network through full node:transfer assets, deploy contracts, interact with contracts and so on. `-c ` parameter specifies a configuration file to run a full node:
91100
```bash
92-
$ java -jar FullNode.jar -c main_net_config.conf
101+
$ nohup java -Xms9G -Xmx9G -XX:ReservedCodeCacheSize=256m \
102+
-XX:MetaspaceSize=256m -XX:MaxMetaspaceSize=512m \
103+
-XX:MaxDirectMemorySize=1G -XX:+PrintGCDetails \
104+
-XX:+PrintGCDateStamps -Xloggc:gc.log \
105+
-XX:+UseConcMarkSweepGC -XX:NewRatio=2 \
106+
-XX:+CMSScavengeBeforeRemark -XX:+ParallelRefProcEnabled \
107+
-XX:+HeapDumpOnOutOfMemoryError \
108+
-XX:+UseCMSInitiatingOccupancyOnly -XX:CMSInitiatingOccupancyFraction=70 \
109+
-jar FullNode.jar -c main_net_config.conf >> start.log 2>&1 &
93110
```
94-
* **Running a super representative node for mainnet**
95-
Adding the `--witness` parameter to the startup command, full node will run as a super representative node. The super representative node supports all the functions of the full node and also supports block production. Before running, make sure you have a super representative account and get votes from others,once the number of obtained votes ranks in the top 27, your super representative node will participate in block production.
111+
## Running a super representative node for mainnet
112+
Adding the `--witness` parameter to the startup command, full node will run as a super representative node. The super representative node supports all the functions of the full node and also supports block production. Before running, make sure you have a super representative account and get votes from others,once the number of obtained votes ranks in the top 27, your super representative node will participate in block production.
96113

97-
Fill in the private key of super representative address into the `localwitness` list in the `main_net_config.conf`, here is an example:
114+
Fill in the private key of super representative address into the `localwitness` list in the `main_net_config.conf`, here is an example:
98115
```
99116
localwitness = [
100117
650950B193DDDDB35B6E48912DD28F7AB0E7140C1BFDEFD493348F02295BD812
101118
]
102119
```
103120

104-
then run the following command to start the node:
105-
```bash
106-
$ java -jar FullNode.jar --witness -c main_net_config.conf
107-
```
121+
then run the following command to start the node:
122+
```bash
123+
$ nohup java -Xms9G -Xmx9G -XX:ReservedCodeCacheSize=256m \
124+
-XX:MetaspaceSize=256m -XX:MaxMetaspaceSize=512m \
125+
-XX:MaxDirectMemorySize=1G -XX:+PrintGCDetails \
126+
-XX:+PrintGCDateStamps -Xloggc:gc.log \
127+
-XX:+UseConcMarkSweepGC -XX:NewRatio=2 \
128+
-XX:+CMSScavengeBeforeRemark -XX:+ParallelRefProcEnabled \
129+
-XX:+HeapDumpOnOutOfMemoryError \
130+
-XX:+UseCMSInitiatingOccupancyOnly -XX:CMSInitiatingOccupancyFraction=70 \
131+
-jar FullNode.jar --witness -c main_net_config.conf >> start.log 2>&1 &
132+
```
108133

109134
## Quick Start Tool
110135
An easier way to build and run java-tron is to use `start.sh`, `start.sh` is a quick start script written in shell language, you can use it to build and run java-tron quickly and easily.
@@ -116,16 +141,16 @@ Here are some common use cases of the scripting tool
116141

117142
For more details, please refer to the tool [guide](./shell.md).
118143

119-
## Run inside Docker container
144+
## Run inside Docker container
120145

121146
One of the quickest ways to get `java-tron` up and running on your machine is by using Docker:
122147
```shell
123148
$ docker run -d --name="java-tron" \
124-
-v /your_path/output-directory:/java-tron/output-directory \
125-
-v /your_path/logs:/java-tron/logs \
126-
-p 8090:8090 -p 18888:18888 -p 50051:50051 \
127-
tronprotocol/java-tron \
128-
-c /java-tron/config/main_net_config.conf
149+
-v /your_path/output-directory:/java-tron/output-directory \
150+
-v /your_path/logs:/java-tron/logs \
151+
-p 8090:8090 -p 18888:18888 -p 50051:50051 \
152+
tronprotocol/java-tron \
153+
-c /java-tron/config/main_net_config.conf
129154
```
130155

131156
This will mount the `output-directory` and `logs` directories on the host, the docker.sh tool can also be used to simplify the use of docker, see more [here](docker/docker.md).
@@ -138,9 +163,8 @@ This will mount the `output-directory` and `logs` directories on the host, the d
138163
[tronprotocol/allcoredev](https://gitter.im/tronprotocol/allcoredev) is the official Gitter channel for developers.
139164

140165
# Contribution
141-
If you'd like to contribute to java-tron, please read the following instructions.
166+
Thank you for considering to help out with the source code! If you'd like to contribute to java-tron, please see the [Contribution Guide](./CONTRIBUTING.md) for more details.
142167

143-
- [Contribution](./CONTRIBUTING.md)
144168

145169
# Resources
146170
* [Medium](https://medium.com/@coredevs) java-tron's official technical articles are published there.
@@ -153,3 +177,11 @@ If you'd like to contribute to java-tron, please read the following instructions
153177

154178
# License
155179
java-tron is released under the [LGPLv3 license](https://github.com/tronprotocol/java-tron/blob/master/LICENSE).
180+
181+
182+
183+
The minimum hardware requirements are `CPU with 8 cores`,`16GB RAM` and `1TB free storage space` to sync the Mainnet, the recommended hardware requirements:
184+
* CPU with 16+ cores(32+ cores for a super representative)
185+
* 32+ GB RAM(64+ GB for a super representative)
186+
* High Performance SSD with at least 1.5TB free space
187+
* 100+ MB/s download Internet service

Tron protobuf protocol document.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2019,7 +2019,7 @@ message `SmartContract` has mutiple attributes and nested message `ABI`
20192019
TOO_MANY_PEERS = 0x04;
20202020
DUPLICATE_PEER = 0x05;
20212021
INCOMPATIBLE_PROTOCOL = 0x06;
2022-
NULL_IDENTITY = 0x07;
2022+
RANDOM_ELIMINATION = 0x07;
20232023
PEER_QUITING = 0x08;
20242024
UNEXPECTED_IDENTITY = 0x09;
20252025
LOCAL_IDENTITY = 0x0A;

chainbase/src/main/java/org/tron/common/storage/leveldb/LevelDbDataSourceImpl.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,7 @@ public Map<byte[], byte[]> getNext(byte[] key, long limit) {
352352
}
353353
}
354354

355+
@Override
355356
public Map<WrappedByteArray, byte[]> prefixQuery(byte[] key) {
356357
resetDbLock.readLock().lock();
357358
try (DBIterator iterator = getDBIterator()) {

chainbase/src/main/java/org/tron/common/storage/rocksdb/RocksDbDataSourceImpl.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -431,6 +431,7 @@ public Map<byte[], byte[]> getNext(byte[] key, long limit) {
431431
}
432432
}
433433

434+
@Override
434435
public Map<WrappedByteArray, byte[]> prefixQuery(byte[] key) {
435436
if (quitIfNotAlive()) {
436437
return null;

chainbase/src/main/java/org/tron/common/utils/WalletUtil.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,4 +131,12 @@ public static byte[] getSelector(byte[] data) {
131131
return ret;
132132
}
133133

134+
public static Long isLong(String s) {
135+
try {
136+
return Long.parseLong(s);
137+
} catch (NumberFormatException ignored) {
138+
return null;
139+
}
140+
}
141+
134142
}

chainbase/src/main/java/org/tron/core/db/TransactionStore.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@ private TransactionCapsule getTransactionFromBlockStore(byte[] key, long blockNu
5252

5353
private TransactionCapsule getTransactionFromKhaosDatabase(byte[] key, long high) {
5454
List<KhaosBlock> khaosBlocks = khaosDatabase.getMiniStore().getBlockByNum(high);
55+
if (khaosBlocks == null) {
56+
return null;
57+
}
5558
for (KhaosBlock bl : khaosBlocks) {
5659
for (TransactionCapsule e : bl.getBlk().getTransactions()) {
5760
if (e.getTransactionId().equals(Sha256Hash.wrap(key))) {

chainbase/src/main/java/org/tron/core/db/TronDatabase.java

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -110,13 +110,7 @@ public T getUnchecked(byte[] key) {
110110
}
111111

112112
public Map<WrappedByteArray, byte[]> prefixQuery(byte[] key) {
113-
Map<WrappedByteArray, byte[]> result = new HashMap<>();
114-
if (dbSource.getClass() == LevelDbDataSourceImpl.class) {
115-
result = ((LevelDbDataSourceImpl) dbSource).prefixQuery(key);
116-
} else if (dbSource.getClass() == RocksDbDataSourceImpl.class) {
117-
result = ((RocksDbDataSourceImpl) dbSource).prefixQuery(key);
118-
}
119-
return result;
113+
return dbSource.prefixQuery(key);
120114
}
121115

122116
public abstract boolean has(byte[] key);

0 commit comments

Comments
 (0)