Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
181 changes: 181 additions & 0 deletions .github/workflows/pr-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,181 @@
name: PR Check

on:
pull_request:
branches: [ 'develop', 'release_**' ]
types: [ opened, edited, synchronize, reopened ]

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: true

jobs:
pr-lint:
name: PR Lint
runs-on: ubuntu-latest

steps:
- name: Check PR title format
uses: actions/github-script@v7
with:
script: |
const title = context.payload.pull_request.title;
const errors = [];
// Title should not be empty or too short
if (!title || title.trim().length < 10) {
errors.push('PR title is too short (minimum 10 characters).');
}
// Title should not exceed 72 characters
if (title.length > 72) {
errors.push(`PR title is too long (${title.length}/72 characters).`);
}
// Title should follow conventional format: type: description
// Allowed types: feat, fix, refactor, docs, style, test, chore, ci, perf, build, revert
const conventionalRegex = /^(feat|fix|refactor|docs|style|test|chore|ci|perf|build|revert)(\(.+\))?:\s.+/;
if (!conventionalRegex.test(title)) {
errors.push(
'PR title must follow conventional format: `type: description`\n' +
'Allowed types: feat, fix, refactor, docs, style, test, chore, ci, perf, build, revert\n' +
'Example: `feat: add new transaction validation`'
);
}
if (errors.length > 0) {
const message = '### PR Title Check Failed\n\n' + errors.map(e => `- ${e}`).join('\n');
core.setFailed(message);
} else {
core.info('PR title format is valid.');
}
- name: Check PR description
uses: actions/github-script@v7
with:
script: |
const body = context.payload.pull_request.body;
if (!body || body.trim().length < 20) {
core.setFailed(
'### PR Description Check Failed\n\n' +
'PR description is too short or empty. Please describe what this PR does and why.'
);
} else {
core.info('PR description is valid.');
}
build:
name: Build (JDK ${{ matrix.java }} / ${{ matrix.arch }})
runs-on: ${{ matrix.runner }}
strategy:
fail-fast: false
matrix:
include:
- java: '8'
runner: ubuntu-latest
arch: x86_64
- java: '17'
runner: ubuntu-24.04-arm
arch: aarch64

steps:
- uses: actions/checkout@v4

- name: Set up JDK ${{ matrix.java }}
uses: actions/setup-java@v4
with:
java-version: ${{ matrix.java }}
distribution: 'temurin'

- name: Cache Gradle packages
uses: actions/cache@v4
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-${{ matrix.arch }}-gradle-${{ hashFiles('**/*.gradle', '**/gradle-wrapper.properties') }}
restore-keys: ${{ runner.os }}-${{ matrix.arch }}-gradle-

- name: Build
run: ./gradlew clean build -x test

checkstyle:
name: Checkstyle
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Set up JDK 8
uses: actions/setup-java@v4
with:
java-version: '8'
distribution: 'temurin'

- name: Cache Gradle packages
uses: actions/cache@v4
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle', '**/gradle-wrapper.properties') }}
restore-keys: ${{ runner.os }}-gradle-

- name: Run Checkstyle
run: ./gradlew :framework:checkstyleMain :framework:checkstyleTest :plugins:checkstyleMain

- name: Upload Checkstyle reports
if: failure()
uses: actions/upload-artifact@v4
with:
name: checkstyle-reports
path: |
framework/build/reports/checkstyle/
plugins/build/reports/checkstyle/
test:
name: Unit Tests (JDK ${{ matrix.java }} / ${{ matrix.arch }})
runs-on: ${{ matrix.runner }}
needs: build
timeout-minutes: 60
strategy:
fail-fast: false
matrix:
include:
- java: '8'
runner: ubuntu-latest
arch: x86_64
- java: '17'
runner: ubuntu-24.04-arm
arch: aarch64

steps:
- uses: actions/checkout@v4

- name: Set up JDK ${{ matrix.java }}
uses: actions/setup-java@v4
with:
java-version: ${{ matrix.java }}
distribution: 'temurin'

- name: Cache Gradle packages
uses: actions/cache@v4
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-${{ matrix.arch }}-gradle-${{ hashFiles('**/*.gradle', '**/gradle-wrapper.properties') }}
restore-keys: ${{ runner.os }}-${{ matrix.arch }}-gradle-

- name: Run tests
run: ./gradlew test

- name: Upload test reports
if: failure()
uses: actions/upload-artifact@v4
with:
name: test-reports-${{ matrix.arch }}
path: |
**/build/reports/tests/
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
</h4>

<p align="center">
<a href="https://gitter.im/tronprotocol/allcoredev"><img src="https://img.shields.io/gitter/room/tronprotocol/java-tron.svg"></a>
<a href="https://discord.gg/hqKvyAM"><img src="https://img.shields.io/badge/chat-on%20discord-7289da.svg"></a>
<a href="https://codecov.io/gh/tronprotocol/java-tron"><img src="https://codecov.io/gh/tronprotocol/java-tron/branch/develop/graph/badge.svg" /></a>
<a href="https://github.com/tronprotocol/java-tron/issues"><img src="https://img.shields.io/github/issues/tronprotocol/java-tron.svg"></a>
<a href="https://github.com/tronprotocol/java-tron/pulls"><img src="https://img.shields.io/github/issues-pr/tronprotocol/java-tron.svg"></a>
Expand Down Expand Up @@ -84,7 +84,7 @@ The java-tron project comes with several runnable artifacts and helper scripts f
| Deployment Tier | CPU Cores | Memory | High-performance SSD Storage | Network Downstream |
|--------------------------|-------|--------|---------------------------|-----------------|
| FullNode (Minimum) | 8 | 16 GB | 200 GB ([Lite](https://tronprotocol.github.io/documentation-en/using_javatron/litefullnode/#lite-fullnode)) | ≥ 5 MBit/sec |
| FullNode (Stable) | 8 | 32 GB | 200 GB (Lite) 3.5 TB (Full) | ≥ 5 MBit/sec |
| FullNode (Stable) | 8 | 32 GB | 200 GB (Lite) / 3.5 TB (Full) | ≥ 5 MBit/sec |
| FullNode (Recommend) | 16+ | 32 GB+ | 4 TB | ≥ 50 MBit/sec |
| Super Representative | 32+ | 64 GB+ | 4 TB | ≥ 50 MBit/sec |

Expand Down Expand Up @@ -201,14 +201,14 @@ Thank you for considering to help out with the source code! If you'd like to con

# Resources

- [Medium](https://medium.com/@coredevs) - java-tron's official technical articles are published here.
- [Documentation](https://tronprotocol.github.io/documentation-en/) and [TRON Developer Hub](https://developers.tron.network/) serve as java-tron’s primary documentation websites.
- [TronScan](https://tronscan.org/) - TRON main network blockchain browser.
- [Nile Test Network](https://nileex.io/) - Forward-looking testnet for developers to experience.
- [Shasta Test Network](https://shasta.tronex.io/) - Stable testnet that closely mirrors Mainnet features, providing a realistic testing environment .
- [Wallet-cli](https://github.com/tronprotocol/wallet-cli) - TRON network wallet using command line.
- [TIP](https://github.com/tronprotocol/tips) - TRON Improvement Proposal (TIP) describes standards for the TRON network.
- [TP](https://github.com/tronprotocol/tips/tree/master/tp) - TRON Protocol (TP) describes standards already implemented in TRON network but not published as a TIP.
- [Medium](https://medium.com/@coredevs) — Official technical articles from the java-tron core development team.
- [Documentation](https://tronprotocol.github.io/documentation-en/) and [TRON Developer Hub](https://developers.tron.network/) — Primary documentation for java-tron developers.
- [TronScan](https://tronscan.org/#/) TRON mainnet blockchain explorer.
- [Nile Test Network](http://nileex.io/) — A stable test network for TRON development and testing.
- [Shasta Test Network](https://shasta.tronex.io/) — A stable test network mirroring mainnet features.
- [Wallet-cli](https://github.com/tronprotocol/wallet-cli) — Command-line wallet for the TRON network.
- [TIP](https://github.com/tronprotocol/tips) TRON Improvement Proposals describing standards for the TRON network.
- [TP](https://github.com/tronprotocol/tips/tree/master/tp) TRON Protocols already implemented but not yet published as TIPs.

# Integrity Check

Expand Down
5 changes: 1 addition & 4 deletions common/src/main/java/org/tron/core/Constant.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@
public class Constant {

//config for testnet, mainnet, beta
public static final String TESTNET_CONF = "config.conf";

//config for junit test
public static final String TEST_CONF = "config-test.conf";
public static final String NET_CONF = "config.conf";

// locate in storageDbDirectory, store the db infos,
// now only has the split block number
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ private File getConfigFile() {
if (isNoneBlank(parameter.getShellConfFileName())) {
confFilePath = parameter.getShellConfFileName();
} else {
confFilePath = Constant.TESTNET_CONF;
confFilePath = Constant.NET_CONF;
}

File confFile = new File(confFilePath);
Expand All @@ -81,7 +81,7 @@ private File getConfigFile() {
public void reload() {
logger.debug("Reloading ... ");
Config config = Configuration.getByFileName(parameter.getShellConfFileName(),
Constant.TESTNET_CONF);
Constant.NET_CONF);

updateActiveNodes(config);

Expand Down
2 changes: 1 addition & 1 deletion framework/src/main/java/org/tron/program/FullNode.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public class FullNode {
*/
public static void main(String[] args) {
ExitManager.initExceptionHandler();
Args.setParam(args, Constant.TESTNET_CONF);
Args.setParam(args, Constant.NET_CONF);
CommonParameter parameter = Args.getInstance();

LogService.load(parameter.getLogbackPath());
Expand Down
6 changes: 6 additions & 0 deletions framework/src/test/java/org/tron/common/TestConstants.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package org.tron.common;

public class TestConstants {

public static final String TEST_CONF = "config-test.conf";
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;
import org.tron.common.TestConstants;
import org.tron.common.backup.BackupManager.BackupStatusEnum;
import org.tron.common.backup.message.KeepAliveMessage;
import org.tron.common.backup.socket.BackupServer;
import org.tron.common.backup.socket.UdpEvent;
import org.tron.common.parameter.CommonParameter;
import org.tron.common.utils.PublicMethod;
import org.tron.core.Constant;
import org.tron.core.config.args.Args;

public class BackupManagerTest {
Expand All @@ -30,7 +30,8 @@ public class BackupManagerTest {

@Before
public void setUp() throws Exception {
Args.setParam(new String[] {"-d", temporaryFolder.newFolder().toString()}, Constant.TEST_CONF);
Args.setParam(new String[] {"-d", temporaryFolder.newFolder().toString()},
TestConstants.TEST_CONF);
CommonParameter.getInstance().setBackupPort(PublicMethod.chooseRandomPort());
manager = new BackupManager();
backupServer = new BackupServer(manager);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
import org.junit.Test;
import org.junit.rules.TemporaryFolder;
import org.junit.rules.Timeout;
import org.tron.common.TestConstants;
import org.tron.common.backup.socket.BackupServer;
import org.tron.common.parameter.CommonParameter;
import org.tron.common.utils.PublicMethod;
import org.tron.core.Constant;
import org.tron.core.config.args.Args;


Expand All @@ -26,7 +26,8 @@ public class BackupServerTest {

@Before
public void setUp() throws Exception {
Args.setParam(new String[]{"-d", temporaryFolder.newFolder().toString()}, Constant.TEST_CONF);
Args.setParam(new String[]{"-d", temporaryFolder.newFolder().toString()},
TestConstants.TEST_CONF);
CommonParameter.getInstance().setBackupPort(PublicMethod.chooseRandomPort());
List<String> members = new ArrayList<>();
members.add("127.0.0.2");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;
import org.tron.common.TestConstants;
import org.tron.common.parameter.RateLimiterInitialization;
import org.tron.core.Constant;
import org.tron.core.config.args.Args;

public class ArgsTest {
Expand All @@ -23,7 +23,7 @@ public class ArgsTest {
public void init() throws IOException {
Args.setParam(new String[] {"--output-directory",
temporaryFolder.newFolder().toString(), "--p2p-disable", "true",
"--debug"}, Constant.TEST_CONF);
"--debug"}, TestConstants.TEST_CONF);
}

@After
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import org.junit.Before;
import org.junit.Test;
import org.tron.common.BaseTest;
import org.tron.core.Constant;
import org.tron.common.TestConstants;
import org.tron.core.Wallet;
import org.tron.core.config.args.Args;
import org.tron.core.exception.ContractExeException;
Expand All @@ -25,7 +25,7 @@ public class InheritanceTest extends BaseTest {
private static boolean init;

static {
Args.setParam(new String[]{"--output-directory", dbPath(), "--debug"}, Constant.TEST_CONF);
Args.setParam(new String[]{"--output-directory", dbPath(), "--debug"}, TestConstants.TEST_CONF);
OWNER_ADDRESS = Wallet.getAddressPreFixString() + "abd4b9367799eaa3197fecb144eb71de1e049abc";
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
import org.junit.Before;
import org.junit.Test;
import org.tron.common.BaseTest;
import org.tron.common.TestConstants;
import org.tron.common.runtime.vm.DataWord;
import org.tron.core.Constant;
import org.tron.core.Wallet;
import org.tron.core.config.args.Args;
import org.tron.core.exception.ContractExeException;
Expand All @@ -28,7 +28,7 @@ public class InternalTransactionComplexTest extends BaseTest {

static {
Args.setParam(new String[]{"--output-directory", dbPath(), "--debug", "--support-constant"},
Constant.TEST_CONF);
TestConstants.TEST_CONF);
OWNER_ADDRESS = Wallet.getAddressPreFixString() + "abd4b9367799eaa3197fecb144eb71de1e049abc";
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
import org.junit.Before;
import org.junit.Test;
import org.tron.common.BaseTest;
import org.tron.common.TestConstants;
import org.tron.common.runtime.vm.DataWord;
import org.tron.core.Constant;
import org.tron.core.Wallet;
import org.tron.core.capsule.BlockCapsule;
import org.tron.core.capsule.TransactionCapsule;
Expand Down Expand Up @@ -45,7 +45,7 @@ public class ProgramResultTest extends BaseTest {

static {
Args.setParam(new String[]{"--output-directory", dbPath(), "--debug", "--support-constant"},
Constant.TEST_CONF);
TestConstants.TEST_CONF);
OWNER_ADDRESS = Wallet.getAddressPreFixString() + "abd4b9367799eaa3197fecb144eb71de1e049abc";
TRANSFER_TO = Wallet.getAddressPreFixString() + "548794500882809695a8a687866e76d4271a1abc";
}
Expand Down
Loading
Loading