Commit 2aa1d0e
fix(p2p): warn when peer status is ahead (lambdaclass#432)
## 🗒️ Description / Motivation
- Logs a warning when a peer’s status response reports a head slot
higher than the local head.
- Makes it easier for operators to identify when a node is behind its
peers.
- Completes the status-response observability requested in lambdaclass#211.
## What Changed
- Updated `crates/net/p2p/src/req_resp/handlers.rs`.
- Added a structured warning containing:
- Peer ID
- Peer head slot
- Local head slot
- Slot gap
- The warning is emitted before range synchronization begins.
## Correctness / Behavior Guarantees
- Status responses at or behind the local head do not produce a warning.
- Existing `BlocksByRange` synchronization behavior is unchanged.
- The change only adds observability and does not alter peer selection,
request ranges, or block processing.
## Tests Added / Run
- No new tests were added because this is a logging-only change.
- Ran `cargo fmt --all -- --check` — clean.
- P2P lint and unit tests were started, but interrupted while compiling
RocksDB.
- `git diff --check` — clean.
## Related Issues / PRs
- Closes lambdaclass#211
- Related to lambdaclass#193
- Builds on lambdaclass#351
## ✅ Verification Checklist
- [x] Ran `make fmt` — clean
- [x] Ran `make lint` (clippy with `-D warnings`) — clean
- [x] Ran `cargo test --workspace --release` — all passing
---------
Co-authored-by: Tomás Grüner <47506558+MegaRedHand@users.noreply.github.com>
Co-authored-by: Pablo Deymonnaz <pdeymon@fi.uba.ar>1 parent 60a2567 commit 2aa1d0e
1 file changed
Lines changed: 8 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
171 | 171 | | |
172 | 172 | | |
173 | 173 | | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
174 | 182 | | |
175 | 183 | | |
176 | 184 | | |
| |||
0 commit comments