-
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
Remove reporting mode #5092
Remove reporting mode #5092
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #5092 +/- ##
=========================================
+ Coverage 74.9% 76.1% +1.3%
=========================================
Files 768 760 -8
Lines 63134 61489 -1645
Branches 8846 8135 -711
=========================================
- Hits 47269 46810 -459
+ Misses 15865 14679 -1186
|
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.
Great effort 🙇 I'm leaving just a few questions to absolutely make sure we don't break Clio 👍
@@ -136,9 +136,8 @@ enum error_code_i { | |||
rpcINVALID_LGR_RANGE = 79, | |||
rpcEXPIRED_VALIDATOR_LIST = 80, | |||
|
|||
// Reporting | |||
rpcFAILED_TO_FORWARD = 90, | |||
rpcREPORTING_UNSUPPORTED = 91, |
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 used by Clio.
We can either leave this code be or replace it in Clio with a Clio-native code instead.
The latter would slightly change the output of the 'subscribe' RPC which uses this error code.
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.
Looks like we are going to use our own error code on Clio's side. 👍
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 suggest to just keep these two in ErrorCodes.h
, at least for the time being - since this is libxrpl include, there's a reasonable expectation that it defines the rippled API.
Also, these names belong to API version 2, even if unused. So removing them is an API breaking change. I'm happy to compromise to rename rpcREPORTING_UNSUPPORTED
to a more generic name (keeping the error code 91).
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.
Renaming the rpcREPORTING_UNSUPPORTED
is an option but i suppose we want to keep the associated error strings as they are to avoid breaking the API.. in that case the output of Clio will remain with 'reportingMode' in the output. We can live with that. Hopefully can be properly addressed with OpenAPI later.
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.
In this case @thejohnfreeman would it be OK to leave the above two definitions rpcFAILED_TO_FORWARD = 90
and rpcREPORTING_UNSUPPORTED = 91
, and just update the comment to indicate that they belong to API and are used by Clio ?
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.
Ok. I'll restore these two values and add 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.
On further research, it appears that Clio uses only rpcREPORTING_UNSUPPORTED
, so I'll restore only that one.
@@ -381,8 +278,7 @@ GRPCServerImpl::CallData<Request, Response>::clientIsUnlimited() | |||
if (!getUser()) | |||
return false; | |||
auto clientIp = getClientIpAddress(); | |||
auto proxiedIp = getProxiedClientIpAddress(); |
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.
Are we sure this is only used when in reporting mode? This wont break Clio's unlimited use of gRPC, right?
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 can't prove it, but I think it is. I don't think there is any other gRPC client in practice. This will return true
for all clients it did before, plus some more. In fact, this would have returned false
for a reporting mode client acting on behalf of another client. If Clio is unlimited, that must be because it is not configured as a proxy, right?
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.
Clio needs its IP in the secure_gateway
of the [port_grpc]
. I'm not sure if that makes it a proxy or what but without it we get tooBusy
sometimes. Keep in mind that Clio uses the X-User
header to get unlimited role. I'm not sure how any of that relates to this but from your explanation it sounds like some separate thing.
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.
Clio is the client.
With reporting mode, the configuration looks like this:
non-reporting rippled <--> reporting rippled <--> app
In this scenario, when the app sends a request to the reporting server, and it doesn't have that information, it forwards the request to the non-reporting server. In that forwarded request, the reporting server is the client, and the app is the proxied client.
If Clio is not attaching the correct field (client_ip
) to indicate it is forwarding a request on behalf of a proxied client, then it will never be throttled as long as its address (the client address) is in the list of secure gateways.
(Yes, this is confusing. Clio is the "client" in this code block, with its address in the clientIP
variable, but the message's client_ip
field names the "proxied client".)
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.
For forwarding to rippled
what we do with the real client's IP is
if (forwardToRippledClientIp) {
connectionBuilder.addHeader(
{boost::beast::http::field::forwarded, fmt::format("for={}", *forwardToRippledClientIp)}
);
}
and we also set the X-User
to either clio_admin
or clio_user
depending whether the connection is an admin
one (in Clio terms).
However this has nothing to do with gRPC.
For the gRPC connection we don't set the client_ip
field but we do set the user
to ETL
(probably does nothing).
What happens if you don't add Clio's IP to the list of secure gateways, Clio itself gets throttled. Makes sense.
Note that Clio is not doing any gRPC forwarding for Clio's clients, gRPC is only used by Clio to get the data for Clio's use.
# Each ETL source specified must have gRPC enabled (by adding a [port_grpc] | ||
# section to the config). It is recommended to add a secure_gateway entry to | ||
# the gRPC section, in order to bypass the server's rate limiting. | ||
# This section needs to be added to the config of the ETL source, not | ||
# the config of the reporting node. In the example below, the | ||
# reporting server is running at 127.0.0.1. Multiple IPs can be | ||
# specified in secure_gateway via a comma separated list. | ||
# | ||
# [port_grpc] | ||
# ip = 0.0.0.0 | ||
# port = 50051 | ||
# secure_gateway = 127.0.0.1 |
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.
@godexsoft should this stanza be left in, but changed to refer to Clio instead of "reporting node"?
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 think it would be helpful for operators setting up their ETL nodes, yes 👍
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.
👍
Builds and passes all tests, but I have not yet tested compatibility with Clio. Asking for help from the Clio team with that.