-
Notifications
You must be signed in to change notification settings - Fork 246
fix: ensure consistent network ID usage in P2P subscriber #2884
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
The latest Buf updates on your PR. Results from workflow CI / buf-check (pull_request).
|
Summary of ChangesHello @tac0turtle, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request standardizes the generation and usage of network identifiers within the P2P subscriber setup. By centralizing the derivation of the Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
|
Claude finished @tac0turtle's task —— View job Claude finished @tac0turtle's task —— View job Code Review Complete ✓I've completed a comprehensive review of this PR. Here's my detailed feedback: SummaryThis PR standardizes network ID usage in the P2P subscriber by ensuring the subscriber, server, and exchange all derive their network ID consistently from Verdict: ✅ Approve with minor observation What ChangedBefore:
After:
Detailed Analysis1. Code Quality & Architecture ✅Strengths:
Observation:
2. Correctness & Bug Fix ✅Critical Fix Identified: This PR fixes a potential network mismatch bug:
Location: pkg/sync/sync_service.go:256-266 // OLD (BUGGY):
// Subscriber: syncService.genesis.ChainID + "-" + syncType
// Server/Exchange: p2p.Info() chainID + "-" + syncType
// NEW (CORRECT):
_, _, chainID, err := syncService.p2p.Info()
networkID := syncService.getNetworkID(chainID) // Used by all components3. Error Handling & Resilience ✅
4. Performance & Resource Efficiency ✅Improvement:
5. Testing & Reliability
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request refactors the P2P infrastructure setup to ensure consistent usage of the network ID for both the P2P subscriber and server. The change correctly centralizes fetching the chainID from the p2p client, removing redundant code and an unused helper function (getChainID). This improves code clarity, maintainability, and consistency. The changes are well-executed and address the described issue. I have added one minor suggestion to improve an error message for better debuggability.
| if err != nil { | ||
| return nil, fmt.Errorf("error while fetching the network: %w", err) | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The error message "error while fetching the network" is a bit vague. A more specific message, such as "error while fetching p2p info", would be more descriptive of what syncService.p2p.Info() does and would aid in debugging, as the function primarily retrieves information from the p2p client rather than performing a network fetch.
| if err != nil { | |
| return nil, fmt.Errorf("error while fetching the network: %w", err) | |
| } | |
| if err != nil { | |
| return nil, fmt.Errorf("error while fetching p2p info: %w", err) | |
| } |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2884 +/- ##
==========================================
+ Coverage 64.76% 64.81% +0.05%
==========================================
Files 81 81
Lines 7350 7347 -3
==========================================
+ Hits 4760 4762 +2
+ Misses 2049 2043 -6
- Partials 541 542 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
alpe
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With this change, we would have 2 different networks for headers and data.
uAck
true, im not sure that is what we want. will double checl |
true, im not sure that is what we want. will double check |
|
talking to hlib it seems this change is actually needed. The rollout of this will be breaking, nodes not on the same version wont be able to sync all the data. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I read above that it is breaking. I think it warrants a changelog then.
|
oh nvm this isnt breaking. its only breaking if you are using a incorrect genesis file loocally, otherwise the network is the same |
* main: build(deps): Bump mdast-util-to-hast from 13.2.0 to 13.2.1 in /docs in the npm_and_yarn group across 1 directory (#2900) refactor(block): centralize timeout in client (#2903) build(deps): Bump the all-go group across 2 directories with 3 updates (#2898) chore: bump default timeout (#2902) fix: revert default db (#2897) refactor: remove obsolete // +build tag (#2899) fix:da visualiser namespace (#2895) refactor: omit unnecessary reassignment (#2892) build(deps): Bump the all-go group across 5 directories with 6 updates (#2881) chore: fix inconsistent method name in retryWithBackoffOnPayloadStatus comment (#2889) fix: ensure consistent network ID usage in P2P subscriber (#2884) build(deps): Bump golangci/golangci-lint-action from 9.0.0 to 9.1.0 (#2885) build(deps): Bump actions/checkout from 5 to 6 (#2886)
Overview
closes #1020
align usage of network info