-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Validate grpc port info in GRPCServer ctor #4728
Conversation
…ormation in ServerHandler. Pass the responsibility of grpc port information validation to GRPCServer constructor. Both GRPCServer and ServerHandler are created during the construction of Application instance. Introduce a constant (SECTION_PORT_GRPC) for port_grpc configuration section Replace all usages of "port_grpc" raw string with a constant Created macros for "port_ws", "port_rpc" and "port_peer" for unit test files. Removed unused imports in some files
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 is only a partial review after taking a quick glance
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.
One minor suggestion. Also, please merge in the latest develop branch.
src/ripple/core/ConfigSections.h
Outdated
@@ -101,6 +101,8 @@ struct ConfigSection | |||
#define SECTION_SWEEP_INTERVAL "sweep_interval" | |||
#define SECTION_NETWORK_ID "network_id" | |||
|
|||
#define SECTION_PORT_GRPC "port_grpc" |
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.
Most of the definitions in this list are alphabetical. Could you move this one to slot in alphabetically with the bulk of them?
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 last 6 #defines
are not in alphabetical order, I've fixed them too
This is being held until 2.1.0 (so should be merged in ~Jan 2024) |
@ckeshava confirmed this is ready from his perspective; adding |
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## develop #4728 +/- ##
===========================================
- Coverage 61.50% 61.49% -0.01%
===========================================
Files 797 797
Lines 70131 70131
Branches 36244 36245 +1
===========================================
- Hits 43136 43130 -6
- Misses 19755 19759 +4
- Partials 7240 7242 +2 ☔ View full report in Codecov by Sentry. |
@ckeshava @legleux - did you confirm that this PR, as-is, fully fixes the issue reported in #4557 (comment)? Specifically:
In all of those cases, with this PR, the node will successfully boot with a correctly configured grpc_port, right? |
See updated message below. |
The commit message should not have 👍 With this PR,
when However, Here's output from startup completely omitting
|
Thanks. I think that's ok - in fact it's probably what we want, as the change should be 100% backward-compatible with any existing working cfg. |
Suggested commit message (updated):
|
@legleux Thanks for verifying the output of this PR! I was not able to look into this one for the past few days |
) Prior to this commit, `port_grpc` could not be added to the [server] stanza. Instead of validating gRPC IP/Port/Protocol information in ServerHandler, validate grpc port info in GRPCServer constructor. This should not break backwards compatibility. gRPC-related config info must be in a section (stanza) called [port_gprc]. * Close XRPLF#4015 - That was an alternate solution. It was decided that with relaxed validation, it is not necessary to rename port_grpc. * Fix XRPLF#4557
High Level Overview of Change
Fix #4015, #4557: GRPCServer and ServerHandler are created during the construction of Application instance. Do not validate GRPC IP/Port/Protocol information in ServerHandler. Instead, pass the responsibility of grpc port information validation to GRPCServer constructor. This ensures that configuration file can specify the port_grpc section.
Context of Change
Based on suggestions from @ximinez , I implemented this code change. @cjcobb23 suggests an alternative solution to the same issue #4015
I welcome any other suggestions too. I felt this is a clean way to handle this problem without breaking backwards compatibility.
Type of Change
This pertains to renaming of variables inside the codebase. It should suffice to test it through the existing unit tests.