Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Fix block validation, fetch retries, and peer contribution timestamps. A peer can currently refresh activity by announcing an unverified block, and an invalid block response can complete a fetch before validation. A short fetch timeout can also discard retry state, leaving later announcements suppressed by the INV cache.
lastInteractiveTimefrom BLOCK INV announcements or unconditional BLOCK dispatch. Update block interaction timestamps in the validated processing paths.blockRcvTimeonly for the actual provider of a useful block that is successfully processed, or a validated useful block with a missing parent that triggers synchronization. Announcers, old/known blocks, inactive-witness blocks, execution failures, and shutdown early returns receive no contribution credit.isBlockIdle()and share provider selection between initial and backup fetches. In-flight transaction requests no longer prevent block fetching; block and sync work still exclude a provider. Select eligible providers using the existing fetch-latency metric without excluding the only available source solely because it exceeds the short timeout.PeerStatusCheckusingADV_TIME_OUT.SYNC_FAILfor state-dependent sync execution failures while retaining provider-specific bad-data handling for deterministic signature/Merkle failures.Why are these changes required?
Peer activity should reflect validated interaction, and contribution should reflect useful block delivery. Fetch completion, retries, and timeout attribution must agree on whether a provider has fulfilled its request. These changes prevent invalid announcements from refreshing activity, bad responses from prematurely ending a fetch, and short timeouts or concurrent callbacks from losing retry state.
This PR has been tested by:
BlockMsgHandlerTest,InventoryMsgHandlerTest,AdvServiceTest,SyncServiceTest,TronNetDelegateTest,PeerConnectionTest, andP2pEventHandlerImplTest../gradlew checkstyleMain checkstyleTest: passed.p/java,p/security-audit,p/owasp-top-ten): seven changed production files scanned, zero findings or parsing errors.Follow up
Integration assumes the separate libp2p fixes from its
v2.3.0branch and theMessageCountconcurrency fix from another developer's PR are available. This PR does not update dependency versions. Normal sync-completion semantics and chain-summary request timeouts remain a separate change.Extra details
Targets
release_v4.8.3. Existing public method signatures, wire formats, database formats, and user configuration remain unchanged; new APIs are Java 8 compatible. The implementation covers block-fetch correctness and contribution semantics without introducing peer scoring or connection-rotation policies.