Developer Guide¶
Thank you for contributing to the development of java-tron source code!
Whether it is a minor bug fix or a major feature enhancement, we value your contributions.
On GitHub, you can:
- Track issues
- Contribute code
- Suggest improvements
- Request new features
- Collaborate on maintaining documentation
If you plan to contribute to java-tron development, please follow the process below.
Contribution Process Overview¶
- Fork the Repository Fork the java-tron repository to your personal account.
- Modify Code Create a new branch from the develop branch and begin implementation.
- Submit Changes Commit your changes with clear commit messages.
- Create a Pull Request (PR) Push your changes to your forked repository and submit a PR to the official repository.
- Code Review and Merge Maintainers will review your PR based on the Code Review Guidelines and merge it into the main branch if it meets the requirements.
Submission Rules¶
- Minor Fixes You can directly submit a PR, but ensure it includes a complete description.
- Major Changes For complex architectural or logic changes, please first submit a TRON Improvement Proposal (TIP) in the TIP repository, detailing the motivation and implementation plan. Refer to the TIP Specification.
- Early PR Submission We encourage developers to submit PRs early, even if the feature is not yet complete. This notifies the community that the associated TIP issue has entered the In Progress state.
- Development Branch
All development should be based on the
developbranch, followed by a PR submission.
Branch Management¶
The java-tron repository includes the following main branch types:
developBranch- Used for daily development
- Accepts merges exclusively from contributor forks and
release-*branches - When preparing a new release, a
release-*branch is created from this branch
masterBranch- Used only for releases
- Only merges from
release-*andhotfix-*branches
release-*Branch- Created from
developfor version finalization and regression testing - Merged into
masterbranch after regression testing - Retained permanently as a point-in-time release snapshot
- Bug fixes are merged directly into this branch and synchronized back to
develop
- Created from
feature-*Branch- Created from
developfor new feature development - Merged back into
developafter feature completion - Can be maintained long-term
- Created from
hotfix-*Branch- Created from
masterfor urgent bug fixes - Must be merged back into both
masteranddevelopto ensure consistency
- Created from
Code Submission Process¶
1. Fork and Clone the Repository¶
git clone https://github.com/yourname/java-tron.git
cd java-tron
git remote add upstream https://github.com/tronprotocol/java-tron.git
upstreamrefers to the official repository. The name can be customized, butupstreamis the conventional choice
2. Sync Upstream Code¶
git fetch upstream
git checkout develop
git merge upstream/develop --no-ff
The
--no-ffflag prevents fast-forward merges, preserving a clear record of the merge event in the commit history.
3. Create a Development Branch¶
git checkout -b feature/branch_name develop
4. Commit Changes¶
git add .
git commit -m "commit message"
5. Push the Branch¶
git push origin feature/branch_name
6. Create a Pull Request¶
From your own repository, submit a Pull Request (PR) to tronprotocol/java-tron.
It’s recommended to select the options in the red box, setting develop branch of the tronprotocol/java-tron as the base branch and your forked repository’s branch as the compare branch.
Code Review Guidelines¶
The only way to merge code into java-tron is through a Pull Request (PR). All PRs must be reviewed before merging.
Review Process¶
- Reviewers are responsible for verifying the PR's objectives and technical impact.
- For PRs lacking descriptions or with excessive changes, reviewers may request additional clarification.
- Reviewers check code style, feature completeness, and test coverage.
- Reviewers should remain polite, respectful, and follow up promptly.
Feature Validation¶
- For Bug Fixes
- Reviewers must attempt to reproduce the reported issue to validate the effectiveness of the fix.
- It’s recommended that submitters provide unit tests that fail before the fix and pass after.
- New Feature PRs
- Reviewers should test the new feature and provide feedback.
- All new code must include unit tests.
Code Specification Requirements¶
- Adhere to automated code formatting standards before submission.
- Self-test before submission.
- Pass standardized tests.
CI Tools:
- Sonar: Static code analysis
- Travis CI: Continuous integration checks
Once all checks pass, maintainers will review and merge into develop.
Coding Standards - Follow the Google Java Style Guide - All PRs must be based on the
developbranch
Branch Naming Conventions¶
masteranddevelopare fixed names.- Version development branches are named by version number and version name (e.g.,
GreatVoyage-v4.8.0(Kant)). hotfix/*: For urgent fixes ( e.g.,hotfix/typo).feature/*: For new feature development (e.g.,feature/new-resource-model).
Pull Request Specifications¶
- One PR should address a single issue.
- Avoid excessively large changes.
- Title: Briefly describe the PR’s purpose.
- Description: Provide detailed information for reviewers.
- Specify areas where feedback is needed.
Commit Message Specifications¶
Recommended format:
<type>(<scope>): <subject>
<body>
<footer>
Commit Types¶
feat: New featurefix: Bug fixdocs: Documentation changesstyle: Formatting changes (no functional changes)refactor: Code refactoringtest: Test code changeschore: Other (e.g., task assignments)
Subject Specifications¶
- Limit to 50 characters; do not end with a period.
- Use the imperative mood in the subject line (e.g.,
fix, instead offixes/fixed). - Start with a lowercase letter.
- Avoid meaningless commits.
Example:
feat(block): optimize the block-producing logic
1. increase the priority for acquiring synchronization lock
2. add interruption exception handling in block-producing thread
Closes #1234
Handling Special Cases¶
- Submitter Not Following Up
- Contact after a few days; if no response, the PR may be closed or continued by others.
- Submitter Refactoring While Fixing Bugs
- Small-scale refactoring is acceptable.
- Large-scale changes should be split into separate PRs or at least separate commits.
- Submitter Rejects Feedback
- Reviewers may close the PR.
Conduct¶
Please maintain respect and constructiveness to foster a positive community atmosphere.