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
f0a8f0f
test(framework): consolidate and stabilize CredentialsTest (#6614)
3for Apr 21, 2026
aa8006d
feat(http): add Jetty SizeLimitHandler to enforce request body size l…
bladehan1 Mar 19, 2026
e81cef5
feat(http) : wait for HttpService startup future in SizeLimitHandlerTest
bladehan1 Mar 19, 2026
9fc6a29
feat(http): add independent maxMessageSize for HTTP and JSON-RPC
bladehan1 Mar 23, 2026
adb49d6
opt(checkstyle): optimize checkstyle
bladehan1 Apr 1, 2026
2cc14e2
change(config): update default size
bladehan1 Apr 2, 2026
e182fb2
test(framework): align ArgsTest with 4M defaults
bladehan1 Apr 2, 2026
e0df7d4
test(http): doc for default value
bladehan1 Apr 3, 2026
baa4d88
fix(api): use httpMaxMessageSize in checkBodySize instead of gRPC limit
bladehan1 Apr 9, 2026
cd1ebad
test(http): add chunked transfer and zero-limit tests for SizeLimitHa…
bladehan1 Apr 10, 2026
8c539d1
refactor(config): use getMemorySize() for size limit configs
bladehan1 Apr 10, 2026
757470c
fix(config): allow zero value for maxMessageSize parameters
bladehan1 Apr 10, 2026
0b45cbb
test(http): verify checkBodySize consistency with SizeLimitHandler
bladehan1 Apr 10, 2026
c28405c
fix(config): correct comment from "positive" to "non-negative"
bladehan1 Apr 10, 2026
c8bacc8
fix(http): add safe default for maxRequestSize and fix misleading var…
bladehan1 Apr 14, 2026
8938c52
test(config): add maxMessageSize parsing and zero-value documentation
bladehan1 Apr 14, 2026
aea0be8
test(http): add real JSON-RPC integration test and clean up SizeLimit…
bladehan1 Apr 15, 2026
58c258d
refactor(http): replace reflection with @VisibleForTesting accessor a…
bladehan1 Apr 16, 2026
f360750
test(http): address review comments - assertThrows, ASCII punctuation…
bladehan1 Apr 20, 2026
bb14edd
fix(config): cap http/jsonrpc maxMessageSize at Integer.MAX_VALUE
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
5cdcebd
refactor(framework): extract parseMaxMessageSize helper
bladehan1 Apr 27, 2026
d3050f9
ci(coverage): gate changed-line coverage (#6706)
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
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
19c6674
Merge upstream/develop into feat/request_size
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 @@ -211,11 +211,19 @@ public class CommonParameter {
@Getter
@Setter
public long maxConnectionAgeInMillis;
// Refers to RPC (gRPC) max message size; see httpMaxMessageSize / jsonRpcMaxMessageSize
// below for the HTTP / JSON-RPC counterparts.
@Getter
@Setter
public int maxMessageSize;
@Getter
@Setter
public long httpMaxMessageSize;
@Getter
@Setter
public long jsonRpcMaxMessageSize;
@Getter
@Setter
public int maxHeaderListSize;
@Getter
@Setter
Expand Down
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;
}
}
}
Loading
Loading