Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
746abf9
refactor(framework): remove unused Wallet.getMerkleTreeOfBlock and Wa…
bladehan1 Apr 8, 2026
0fe5d6f
fix(api): replace Class.forName with whitelist in RateLimiterServlet
bladehan1 Apr 8, 2026
0980488
perf(api): optimize block JSON serialization in printBlockList and pr…
bladehan1 Mar 6, 2026
5080779
fix(api): handle JSONException in checkGetParam and reduce Solidity l…
bladehan1 Apr 8, 2026
508cf88
feat(api): add length guard for hexToBigInteger to prevent CPU DoS
bladehan1 Apr 9, 2026
29be3db
fix(api): relax hexToBigInteger length limit, improve tests and code …
bladehan1 Apr 16, 2026
7e966c9
fix(api): address PR review feedback on style and defensive defaults
bladehan1 Apr 16, 2026
88b7f26
test(api): add printBlockToJSON with-transactions and decimal BigInte…
bladehan1 Apr 16, 2026
5b67bf6
fix(api): address PR review feedback – log levels, limiter fallback, …
bladehan1 Apr 17, 2026
ac05ea8
test(api): clean up test style and add missing coverage
bladehan1 Apr 17, 2026
f0a8f0f
test(framework): consolidate and stabilize CredentialsTest (#6614)
3for Apr 21, 2026
4c6df2d
refactor(api): move block-number length guard to JsonRpcApiUtil
bladehan1 Apr 21, 2026
3d41716
fix(api): restore fail-fast for unknown rate limiter adapter
bladehan1 Apr 21, 2026
f200e1f
test(api): verify visible flag in printBlockToJSON
bladehan1 Apr 21, 2026
f4f7412
test(api): revert goalless ByteArrayTest changes out of PR scope
bladehan1 Apr 21, 2026
db91a72
test(api): harden printBlockToJSON tests against drift
bladehan1 Apr 21, 2026
a437574
fix(api): validate block number range in parseBlockNumber
bladehan1 Apr 22, 2026
0fdf579
style(api): use Arrays.asList for typed adapter whitelist
bladehan1 Apr 22, 2026
a4aaeca
chore: fix outdated content across docs/ and root-level docs (#6662)
Little-Peony Apr 27, 2026
ba2b77f
fix(trie): make TrieImpl.insert() idempotent for duplicate key-value …
halibobo1205 Apr 27, 2026
d3050f9
ci(coverage): gate changed-line coverage (#6706)
bladehan1 Apr 27, 2026
23a3fcb
style(api): rename throwTronError helper to rateLimiterInitError
bladehan1 Apr 27, 2026
a1727f0
Merge remote-tracking branch 'upstream/develop' into feat/opt-api
bladehan1 Apr 27, 2026
c977f82
refactor(config): replace manual parsing with ConfigBeanFactory bindi…
vividctrlalt Apr 28, 2026
636667a
feat(plugins): migrate keystore CLI from FullNode to Toolkit (#6637)
barbatos2011 Apr 28, 2026
ee83102
Merge remote-tracking branch 'upstream/develop' into feat/opt-api
bladehan1 Apr 28, 2026
6f63a8c
fix(db): resolve resource leakage in CheckPointV2Store `close()` (#6688)
warku123 Apr 28, 2026
980c707
fix(framework): fix SolidityNode shutdown and improve test quality (#…
Little-Peony Apr 28, 2026
9fcf3c5
Merge remote-tracking branch 'upstream/develop' into feat/opt-api
bladehan1 Apr 28, 2026
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
118 changes: 93 additions & 25 deletions .github/workflows/pr-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,68 @@ jobs:
echo "base_xmls=$BASE_XMLS" >> "$GITHUB_OUTPUT"
echo "pr_xmls=$PR_XMLS" >> "$GITHUB_OUTPUT"

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'

- name: Changed-line coverage (diff-cover)
id: diff-cover
env:
BASE_REF: ${{ github.event.pull_request.base.ref }}
run: |
set -euo pipefail
pip install --quiet 'diff-cover==9.2.0'

# Ensure the base branch ref is available locally for diff-cover.
git fetch --no-tags origin "+refs/heads/${BASE_REF}:refs/remotes/origin/${BASE_REF}"

PR_XMLS=$(find coverage/pr -name "jacocoTestReport.xml" | sort)
SRC_ROOTS=$(find . -type d -path '*/src/main/java' \
-not -path './coverage/*' -not -path './.git/*' | sort)
if [ -z "$SRC_ROOTS" ]; then
echo "No src/main/java directories found; cannot run diff-cover." >&2
exit 1
fi

set +e
diff-cover $PR_XMLS \
--compare-branch="origin/${BASE_REF}" \
--src-roots $SRC_ROOTS \
--fail-under=0 \
--json-report=diff-cover.json \
--markdown-report=diff-cover.md
DIFF_RC=$?
set -e

if [ ! -f diff-cover.json ]; then
echo "diff-cover did not produce JSON report (exit=${DIFF_RC})." >&2
exit 1
fi

TOTAL_NUM_LINES=$(jq -r '.total_num_lines // 0' diff-cover.json)
if [ "${TOTAL_NUM_LINES}" = "0" ]; then
echo "No changed Java source lines; skipping changed-line gate."
echo "changed_line_coverage=NA" >> "$GITHUB_OUTPUT"
else
CHANGED_LINE_COVERAGE=$(jq -r '.total_percent_covered // empty' diff-cover.json)
if [ -z "$CHANGED_LINE_COVERAGE" ]; then
echo "Unable to parse changed-line coverage from diff-cover.json."
exit 1
fi
echo "changed_line_coverage=${CHANGED_LINE_COVERAGE}" >> "$GITHUB_OUTPUT"
fi

{
echo "### Changed-line Coverage (diff-cover)"
echo ""
if [ -f diff-cover.md ] && [ -s diff-cover.md ]; then
cat diff-cover.md
else
echo "_diff-cover produced no report._"
fi
} >> "$GITHUB_STEP_SUMMARY"

- name: Aggregate base coverage
id: jacoco-base
uses: madrapps/jacoco-report@v1.7.2
Expand All @@ -288,6 +350,7 @@ jobs:
min-coverage-overall: 0
min-coverage-changed-files: 0
skip-if-no-changes: true
comment-type: summary
title: '## Base Coverage Snapshot'
update-comment: false

Expand All @@ -300,14 +363,15 @@ jobs:
min-coverage-overall: 0
min-coverage-changed-files: 0
skip-if-no-changes: true
comment-type: summary
title: '## PR Code Coverage Report'
update-comment: false

- name: Enforce coverage gates
env:
BASE_OVERALL_RAW: ${{ steps.jacoco-base.outputs.coverage-overall }}
PR_OVERALL_RAW: ${{ steps.jacoco-pr.outputs.coverage-overall }}
PR_CHANGED_RAW: ${{ steps.jacoco-pr.outputs.coverage-changed-files }}
CHANGED_LINE_RAW: ${{ steps.diff-cover.outputs.changed_line_coverage }}
run: |
set -euo pipefail

Expand All @@ -329,7 +393,7 @@ jobs:
# 1) Parse metrics from jacoco-report outputs
BASE_OVERALL="$(sanitize "$BASE_OVERALL_RAW")"
PR_OVERALL="$(sanitize "$PR_OVERALL_RAW")"
PR_CHANGED="$(sanitize "$PR_CHANGED_RAW")"
CHANGED_LINE="$(sanitize "$CHANGED_LINE_RAW")"

if ! is_number "$BASE_OVERALL" || ! is_number "$PR_OVERALL"; then
echo "Failed to parse coverage values: base='${BASE_OVERALL}', pr='${PR_OVERALL}'."
Expand All @@ -340,18 +404,18 @@ jobs:
DELTA=$(awk -v pr="$PR_OVERALL" -v base="$BASE_OVERALL" 'BEGIN { printf "%.4f", pr - base }')
DELTA_OK=$(compare_float "${DELTA} >= ${MAX_DROP}")

CHANGED_STATUS="SKIPPED (no changed coverage value)"
CHANGED_OK=1
if [ -n "$PR_CHANGED" ] && [ "$PR_CHANGED" != "NaN" ]; then
if ! is_number "$PR_CHANGED"; then
echo "Failed to parse changed-files coverage: changed='${PR_CHANGED}'."
exit 1
fi
CHANGED_OK=$(compare_float "${PR_CHANGED} > ${MIN_CHANGED}")
if [ "$CHANGED_OK" -eq 1 ]; then
CHANGED_STATUS="PASS (> ${MIN_CHANGED}%)"
if [ "$CHANGED_LINE" = "NA" ]; then
CHANGED_LINE_OK=1
CHANGED_LINE_STATUS="SKIPPED (no changed Java source lines)"
elif [ -z "$CHANGED_LINE" ] || [ "$CHANGED_LINE" = "NaN" ] || ! is_number "$CHANGED_LINE"; then
echo "Failed to parse changed-line coverage: changed-line='${CHANGED_LINE}'."
exit 1
else
CHANGED_LINE_OK=$(compare_float "${CHANGED_LINE} > ${MIN_CHANGED}")
if [ "$CHANGED_LINE_OK" -eq 1 ]; then
CHANGED_LINE_STATUS="PASS (> ${MIN_CHANGED}%)"
else
CHANGED_STATUS="FAIL (<= ${MIN_CHANGED}%)"
CHANGED_LINE_STATUS="FAIL (<= ${MIN_CHANGED}%)"
fi
fi

Expand All @@ -361,13 +425,20 @@ jobs:
OVERALL_STATUS="FAIL (< ${MAX_DROP}%)"
fi

if [ "$CHANGED_LINE" = "NA" ]; then
CHANGED_LINE_DISPLAY="NA"
else
CHANGED_LINE_DISPLAY="${CHANGED_LINE}%"
fi

METRICS_TEXT=$(cat <<EOF
Changed Files Coverage: ${PR_CHANGED}%
Changed-line Coverage: ${CHANGED_LINE_DISPLAY}
PR Overall Coverage: ${PR_OVERALL}%
Base Overall Coverage: ${BASE_OVERALL}%
Delta (PR - Base): ${DELTA}%
Changed Files Gate: ${CHANGED_STATUS}
Changed-line Gate: ${CHANGED_LINE_STATUS}
Overall Delta Gate: ${OVERALL_STATUS}
Note: Changed-line uses LINE coverage (diff-cover); Overall/Delta use INSTRUCTION coverage (jacoco-report). The two counters are not directly comparable.
EOF
)

Expand All @@ -376,12 +447,14 @@ jobs:
{
echo "### Coverage Gate Metrics"
echo ""
echo "- Changed Files Coverage: ${PR_CHANGED}%"
echo "- Changed-line Coverage: ${CHANGED_LINE_DISPLAY}"
echo "- PR Overall Coverage: ${PR_OVERALL}%"
echo "- Base Overall Coverage: ${BASE_OVERALL}%"
echo "- Delta (PR - Base): ${DELTA}%"
echo "- Changed Files Gate: ${CHANGED_STATUS}"
echo "- Changed-line Gate: ${CHANGED_LINE_STATUS}"
echo "- Overall Delta Gate: ${OVERALL_STATUS}"
echo ""
echo "_Note: Changed-line uses LINE coverage (diff-cover); Overall/Delta use INSTRUCTION coverage (jacoco-report). The two counters are not directly comparable._"
} >> "$GITHUB_STEP_SUMMARY"

# 4) Decide CI pass/fail
Expand All @@ -391,14 +464,9 @@ jobs:
exit 1
fi

if [ -z "$PR_CHANGED" ] || [ "$PR_CHANGED" = "NaN" ]; then
echo "No changed-files coverage value detected, skip changed-files gate."
exit 0
fi

if [ "$CHANGED_OK" -ne 1 ]; then
echo "Coverage gate failed: changed files coverage must be > 60%."
echo "changed=${PR_CHANGED}%"
if [ "$CHANGED_LINE_OK" -ne 1 ]; then
echo "Coverage gate failed: changed-line coverage must be > 60%."
echo "changed-line=${CHANGED_LINE}%"
exit 1
fi

Expand Down
6 changes: 3 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ We would like all developers to follow a standard development flow and coding st
2. Review the code before submission.
3. Run standardized tests.

`Sonar`-scanner and `Travis CI` continuous integration scanner will be automatically triggered when a pull request has been submitted. When a PR passes all the checks, the **java-tron** maintainers will then review the PR and offer feedback and modifications when necessary. Once adopted, the PR will be closed and merged into the `develop` branch.
`Sonar`-scanner and CI checks (GitHub Actions) will be automatically triggered when a pull request has been submitted. When a PR passes all the checks, the **java-tron** maintainers will then review the PR and offer feedback and modifications when necessary. Once adopted, the PR will be closed and merged into the `develop` branch.

We are glad to receive your pull requests and will try our best to review them as soon as we can. Any pull request is welcome, even if it is for a typo.

Expand All @@ -161,7 +161,7 @@ Please make sure your submission meets the following code style:
- The code must have passed the Sonar scanner test.
- The code has to be pulled from the `develop` branch.
- The commit message should start with a verb, whose initial should not be capitalized.
- The commit message should be less than 50 characters in length.
- The commit message title should be between 10 and 72 characters in length.



Expand Down Expand Up @@ -196,7 +196,7 @@ The message header is a single line that contains succinct description of the ch
The `scope` can be anything specifying place of the commit change. For example: `framework`, `api`, `tvm`, `db`, `net`. For a full list of scopes, see [Type and Scope Reference](#type-and-scope-reference). You can use `*` if there isn't a more fitting scope.

The subject contains a succinct description of the change:
1. Limit the subject line, which briefly describes the purpose of the commit, to 50 characters.
1. Limit the subject line, which briefly describes the purpose of the commit, to 72 characters (minimum 10).
2. Start with a verb and use first-person present-tense (e.g., use "change" instead of "changed" or "changes").
3. Do not capitalize the first letter.
4. Do not end the subject line with a period.
Expand Down
81 changes: 0 additions & 81 deletions build.md

This file was deleted.

18 changes: 15 additions & 3 deletions chainbase/src/main/java/org/tron/core/db/TronDatabase.java
Original file line number Diff line number Diff line change
Expand Up @@ -76,13 +76,25 @@ public void reset() {
@Override
public void close() {
logger.info("******** Begin to close {}. ********", getName());
doClose();
logger.info("******** End to close {}. ********", getName());
}

/**
* Releases writeOptions and dbSource (best-effort, exceptions logged at WARN).
* Subclasses with extra resources should override {@link #close()} and call
* {@code doClose()} directly — not {@code super.close()} — to avoid duplicated logs.
*/
protected void doClose() {
try {
writeOptions.close();
} catch (Exception e) {
logger.warn("Failed to close writeOptions in {}.", getName(), e);
}
try {
dbSource.closeDB();
} catch (Exception e) {
logger.warn("Failed to close {}.", getName(), e);
} finally {
logger.info("******** End to close {}. ********", getName());
logger.warn("Failed to close dbSource in {}.", getName(), e);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,20 +62,16 @@ public void updateByBatch(Map<byte[], byte[]> rows) {
this.dbSource.updateByBatch(rows, writeOptions);
}

/**
* close the database.
*/
@Override
public void close() {
logger.debug("******** Begin to close {}. ********", getName());
try {
writeOptions.close();
dbSource.closeDB();
} catch (Exception e) {
logger.warn("Failed to close {}.", getName(), e);
} finally {
logger.debug("******** End to close {}. ********", getName());
logger.warn("Failed to close writeOptions in {}.", getName(), e);
}
doClose();
logger.debug("******** End to close {}. ********", getName());
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,12 @@ public HttpRateLimiterItem(ConfigObject asset) {
strategy = asset.get("strategy").unwrapped().toString();
params = asset.get("paramString").unwrapped().toString();
}

public HttpRateLimiterItem(String component, String strategy, String params) {
this.component = component;
this.strategy = strategy;
this.params = params;
}
}


Expand All @@ -93,5 +99,11 @@ public RpcRateLimiterItem(ConfigObject asset) {
strategy = asset.get("strategy").unwrapped().toString();
params = asset.get("paramString").unwrapped().toString();
}

public RpcRateLimiterItem(String component, String strategy, String params) {
this.component = component;
this.strategy = strategy;
this.params = params;
}
}
}
3 changes: 2 additions & 1 deletion common/src/main/java/org/tron/core/config/Configuration.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ public static com.typesafe.config.Config getByFileName(

private static void resolveConfigFile(String fileName, File confFile) {
if (confFile.exists()) {
config = ConfigFactory.parseFile(confFile);
config = ConfigFactory.parseFile(confFile)
.withFallback(ConfigFactory.defaultReference());
} else if (Thread.currentThread().getContextClassLoader().getResourceAsStream(fileName)
!= null) {
config = ConfigFactory.load(fileName);
Expand Down
Loading
Loading