Skip to content

fix(eth/fetcher): correct propagated block broadcast handling#2472

Open
gzliudan wants to merge 5 commits into
XinFinOrg:dev-upgradefrom
gzliudan:fix-fetcher-insert
Open

fix(eth/fetcher): correct propagated block broadcast handling#2472
gzliudan wants to merge 5 commits into
XinFinOrg:dev-upgradefrom
gzliudan:fix-fetcher-insert

Conversation

@gzliudan

@gzliudan gzliudan commented Jul 17, 2026

Copy link
Copy Markdown
Collaborator

Proposed changes

Summary

Fix propagated block broadcast handling in the fetcher so outbound propagation metrics are recorded only when a send actually happens, and imported fast-broadcast blocks are announced after successful import.

This also simplifies the post-import M2 broadcast state by reusing the M2 detection result instead of carrying a separate fast-broadcast flag through the header retry path.

Changes

  • Remove unnecessary return statement.
  • Correct a typo in the propagated block log message.
  • Move broadcast and announce timer updates into the branches that actually send blocks.
  • Announce successfully imported fast-broadcast blocks so peers receive the hash notification.
  • Reuse the M2 state to drive post-import broadcast behavior and simplify the control flow.

Motivation and Impact

Previously, outbound fetcher timing metrics could be updated even when no broadcast was sent, and fast-broadcast blocks were propagated before import but not announced after import. This made metrics less accurate and skipped the expected hash announcement stage for successfully imported propagated blocks.

With this change, fetcher propagation metrics better reflect actual network sends, and imported propagated blocks follow the intended broadcast/announce flow while preserving the special M2 post-import broadcast behavior.

Types of changes

What types of changes does your code introduce to XDC network?
Put an in the boxes that apply

  • build: Changes that affect the build system or external dependencies
  • ci: Changes to CI configuration files and scripts
  • chore: Changes that don't change source code or tests
  • docs: Documentation only changes
  • feat: A new feature
  • fix: A bug fix
  • perf: A code change that improves performance
  • refactor: A code change that neither fixes a bug nor adds a feature
  • revert: Revert something
  • style: Changes that do not affect the meaning of the code
  • test: Adding missing tests or correcting existing tests

Impacted Components

Which parts of the codebase does this PR touch?
Put an in the boxes that apply

  • Consensus
  • Account
  • Network
  • Geth
  • Smart Contract
  • External components
  • Not sure (Please specify below)

Checklist

Put an in the boxes once you have confirmed below actions (or provide reasons on not doing so) that

  • This PR has sufficient test coverage (unit/integration test) OR I have provided reason in the PR description for not having test coverage
  • Tested on a private network from the genesis block and monitored the chain operating correctly for multiple epochs.
  • Provide an end-to-end test plan in the PR description on how to manually test it on the devnet/testnet.
  • Tested the backwards compatibility.
  • Tested with XDC nodes running this version co-exist with those running the previous version.
  • Relevant documentation has been updated as part of this PR
  • N/A

@coderabbitai

coderabbitai Bot commented Jul 17, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: dcabd5b7-4584-43cb-afb0-1dc4f07419f9

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@gzliudan
gzliudan force-pushed the fix-fetcher-insert branch 2 times, most recently from 16f4e17 to 940d9bd Compare July 17, 2026 16:00
@gzliudan gzliudan changed the title fix(eth/fetcher): align fetcher broadcast metrics with actual sends fix(eth/fetcher): align insert propagation and announce semantics Jul 17, 2026
@gzliudan
gzliudan force-pushed the fix-fetcher-insert branch 3 times, most recently from 2f78bbf to 2db3d4d Compare July 18, 2026 00:43
@gzliudan gzliudan changed the title fix(eth/fetcher): align insert propagation and announce semantics fix(eth/fetcher): correct propagated block broadcast handling Jul 18, 2026
@gzliudan
gzliudan force-pushed the fix-fetcher-insert branch from 2db3d4d to 438e1a0 Compare July 18, 2026 01:08
gzliudan added 5 commits July 19, 2026 19:11
Move propagation and announcement timer updates into the branches that actually broadcast blocks, so skipped broadcasts do not record outbound timing.
Announce fast-broadcast blocks after successful import so peers can receive the hash notification and outbound announce timing reflects actual sends.
Reuse the M2 state to drive post-import broadcast behavior and avoid carrying a separate fast-broadcast flag through header retry flow.
@gzliudan
gzliudan force-pushed the fix-fetcher-insert branch from 438e1a0 to 2cac6fe Compare July 19, 2026 11:11
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.

2 participants