Skip to content

fix(net): sync p2p fixes from libp2p release-v2.3.0 (part 4) - #7125

Merged
kuny0707 merged 1 commit into
tronprotocol:release_v4.8.3from
317787106:feature/p2p_v230_migration_v4
Nov 24, 2026
Merged

kuny0707 merged 1 commit into
tronprotocol:release_v4.8.3from
317787106:feature/p2p_v230_migration_v4

Conversation

@317787106

Copy link
Copy Markdown
Collaborator

What does this PR do?

Synchronize java-tron's in-tree :p2p module with the five libp2p PRs merged after java-tron #7098, based on release_v4.8.3. The source comparison on release-v2.3.0 runs from 94dbc75896dc68c72934276c8d3143b4a3540363 through 18da461f1312cb7d7c8d13dccf992e5f78a55a36.

Upstream PR Merged commit Change
libp2p #181 d6292c8 Limit inbound keepalive PINGs per connection and close excessive senders with BAD_PROTOCOL.
libp2p #182 d55df73 Skip malformed node records, find valid roots among coexisting TXT records, preserve unrelated root TXT values, probe configured Route53 zones, and order root publication after dependencies. Propagation timeout and interruption now fail publication.
libp2p #183 49c8b24 Sample UDP rejection logs by reason, bound packet previews, and summarize suppressed samples periodically and on decoder removal.
libp2p #184 f4a69fe Expand pending inbound HELLO capacity to 1016 ordinary / 1024 total, reject pre-HELLO frames declaring 1024 bytes or more, and use small receive allocations until HELLO completes.
libp2p #185 18da461 Remove foreign-network STATUS results, update the shared discovery candidate's network ID, and filter cached candidates against the configured network.

Retain java-tron's blocked-IP policy, logging field convention, deterministic math substitutions, and existing test coverage. Adapt three existing DNS tests to the new behavior, and update the README's source revision and connection/logging limits.

Why are these changes required?

Unbounded inbound PING replies and repeated UDP rejection logs can consume networking resources. The previous pending-HELLO capacity was easy to exhaust, while unverified connections could retain large receive buffers and incomplete frames. The new pre-handshake limits apply to both directions and trusted peers, with established peers retaining their existing frame limit.

Malformed or coexisting TXT records could prevent DNS synchronization or publication, and publication could expose a root before its dependencies. Route53 startup also required global zone-listing access even with a configured zone. Foreign-network STATUS probes could feed unusable nodes into both the probe and discovery-fallback candidate paths.

This PR has been tested by:

Local validation on macOS ARM64 / JDK 17:

  • ./gradlew clean build -x test --console=plain passed, including FullNode, standalone P2P and tools packaging, P2P main/test Checkstyle, and protobuf lint.
  • ./gradlew test :framework:checkstyleMain :framework:checkstyleTest :plugins:checkstyleMain --console=plain passed: 5,977 tests, 16 skipped, zero failures/errors. This includes all 684 P2P tests (4 skipped).
  • bash .github/scripts/check_math_usage.sh passed with no output.
  • git diff --cached --check passed. No dependencies or generated sources are changed.

Regression coverage includes PING bursts and per-connection allowances, HELLO deadlines and slot release, pre-handshake frame boundaries and real TCP receive allocations, foreign-network STATUS probes and discovery fallback, UDP log preview/counter/task cleanup, malformed node records, coexisting root TXT records, root selection, and Route53 publication ordering, timeout and interruption. Three existing java-tron DNS tests were adapted to the changed query and record-handling behavior.

Follow up

Run the CI matrix on JDK 8 / x86_64 and JDK 17 / aarch64.

Extra details

The per-IP pending limit remains two and the HELLO deadline remains 10 seconds. PING limiting retains Guava's default burst behavior. STATUS network mismatches do not apply an IP-wide ban; a later matching discovery update can make the endpoint eligible again. DNS provider regressions use SDK stubs.

Port libp2p PRs tronprotocol#181-185 from release-v2.3.0 after java-tron tronprotocol#7098:
- tronprotocol#181 d6292c8: limit inbound PINGs per connection
- tronprotocol#182 d55df73: correct DNS TXT handling and publication ordering
- tronprotocol#183 49c8b24: rate limit UDP rejection logs and bound packet previews
- tronprotocol#184 f4a69fe: expand HELLO capacity and bound pre-handshake frames
- tronprotocol#185 18da461: exclude cross-network STATUS candidates

Retain java-tron's blocked-IP policy, logger convention and existing
regressions. Migrate upstream tests, adapt DNS fixtures to the new
behavior, and update source provenance and networking limits.
@github-actions
github-actions Bot requested a review from xxo1shine November 24, 2026 04:21
@317787106
317787106 requested a review from 3for November 24, 2026 04:23
@317787106 317787106 added this to the GreatVoyage-v4.8.3 milestone Nov 24, 2026

@SeriousCoding789 SeriousCoding789 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It brings libp2p #181–#185 into java-tron's p2p module exactly as upstream wrote them

@kuny0707
kuny0707 merged commit 7143c0d into tronprotocol:release_v4.8.3 Nov 24, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants