Skip to content

Conversation

@iovoid
Copy link
Contributor

@iovoid iovoid commented Dec 11, 2025

Motivation

Currently one of the hive tests is failing, with the log Sync failed to find target block header, aborting.

This is because currently we only retry 5 times and (for low-latency scenarios like a testnet) without delay between the attempts. If the header isn't immediately available, we abort.

Description

This solves the problem by introducing a retry-with-delay logic.

The currently existing logic in request_block_headers_from_hash is removed since it now becomes redundant.

Checklist

  • Updated STORE_SCHEMA_VERSION (crates/storage/lib.rs) if the PR includes breaking changes to the Store requiring a re-sync.

@iovoid iovoid requested a review from a team as a code owner December 11, 2025 15:10
@github-actions github-actions bot added the L1 Ethereum client label Dec 11, 2025
@github-actions
Copy link

github-actions bot commented Dec 11, 2025

Lines of code report

Total lines added: 14
Total lines removed: 1
Total lines changed: 15

Detailed view
+----------------------------------------------+-------+------+
| File                                         | Lines | Diff |
+----------------------------------------------+-------+------+
| ethrex/crates/networking/p2p/peer_handler.rs | 1737  | -1   |
+----------------------------------------------+-------+------+
| ethrex/crates/networking/p2p/sync.rs         | 1380  | +14  |
+----------------------------------------------+-------+------+

return Ok(());
}
attempts += 1;
tokio::time::sleep(Duration::from_millis(200)).await;
Copy link
Contributor

Choose a reason for hiding this comment

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

This is a lot of time to sleep. Maybe you should try an exponential backoff?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added in 2d7e667

return Ok(());
}
attempts += 1;
tokio::time::sleep(Duration::from_millis(200)).await;
Copy link
Contributor

Choose a reason for hiding this comment

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

Ditto.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added in 2d7e667

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

L1 Ethereum client

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

4 participants