-
Notifications
You must be signed in to change notification settings - Fork 1.2k
fix: MN port validation on mainnet is broken after 6627 #6664
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
WalkthroughThe validation logic for the service port in Tip ⚡️ Faster reviews with caching
Enjoy the performance boost—your workflow just got faster. 📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (1)
🧰 Additional context used🪛 Cppcheck (2.10-2)src/test/evo_netinfo_tests.cpp[error] 14-14: There is an unknown macro here somewhere. Configuration is required. If BOOST_FIXTURE_TEST_SUITE is a macro then please configure it. (unknownMacro) ⏰ Context from checks skipped due to timeout of 90000ms (4)
🔇 Additional comments (5)
✨ Finishing Touches
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
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.
Actionable comments posted: 0
🧹 Nitpick comments (1)
src/evo/netinfo.cpp (1)
40-44
: Optional: Simplify nested if/else for brevity
For a more concise style, you can combine both branches into a single condition:-if (IsNodeOnMainnet()) { - if (service.GetPort() != default_port_main) { - return NetInfoStatus::BadPort; - } -} else if (service.GetPort() == default_port_main) { - return NetInfoStatus::BadPort; -} +if ((IsNodeOnMainnet() && service.GetPort() != default_port_main) || + (!IsNodeOnMainnet() && service.GetPort() == default_port_main)) { + return NetInfoStatus::BadPort; +}
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
src/evo/netinfo.cpp
(1 hunks)
🧰 Additional context used
🪛 GitHub Actions: Check Potential Conflicts
src/evo/netinfo.cpp
[error] 1-1: Merge conflict detected in this file. Conflicting PR #6629 affects this file.
⏰ Context from checks skipped due to timeout of 90000ms (3)
- GitHub Check: x86_64-pc-linux-gnu_multiprocess / Build depends
- GitHub Check: x86_64-apple-darwin / Build depends
- GitHub Check: x86_64-pc-linux-gnu / Build depends
🔇 Additional comments (2)
src/evo/netinfo.cpp (2)
1-86
: Resolve merge conflicts with PR #6629
A merge conflict was detected in this file with changes from PR #6629. Please ensure that the MN port validation fix here and any other updates introduced by #6629 are correctly merged so no logic is lost or duplicated.🧰 Tools
🪛 GitHub Actions: Check Potential Conflicts
[error] 1-1: Merge conflict detected in this file. Conflicting PR #6629 affects this file.
40-44
: Correctly restored mainnet port validation logic
This change accurately reverts the port validation to its pre-#6627 state: on mainnet only the default port is accepted, and the default mainnet port is prohibited off-mainnet, preserving the intended behavior.
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.
LGTM 20afc99
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.
This condition is a bit messy because
Consider refactoring such as: if (fbool port_is_mainnet = service.GetPort() == default_port_main; IsNodeOnMainet() == port_is_mainnet) {...} Otherwise it's too messy |
@knst I don't mind retaining the condition as proposed here, was moreso interested in having the test changes from the commit incorporated to expand coverage. |
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.
utACK 2e8c7ef
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.
utACK 2e8c7ef
Issue being fixed or feature implemented
#6627 broke MN port validation on mainnet -
develop
fails withbad-protx-netinfo-port
for a completely valid protxWhat was done?
Implement it the way it was before https://github.com/dashpay/dash/pull/6627/files#diff-0998f8dfc4c1089e90cbaafe9607b361035b904cd103df31e3c2339a3cbf790dL1189-L1195
How Has This Been Tested?
Sync on mainnet
Breaking Changes
n/a
Checklist: