-
Notifications
You must be signed in to change notification settings - Fork 1k
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
[Neo Plugin RPCServer] Rpc parameters. Part I #3457
Conversation
This is part one of the system, other apis will be updated in coming prs. |
methods[name] = method.CreateDelegate<Func<JArray, object>>(handler); | ||
var attribute = method.GetCustomAttribute<RpcMethodAttribute>(); | ||
var attributeWithParams = method.GetCustomAttribute<RpcMethodWithParamsAttribute>(); | ||
if (attribute is null && attributeWithParams is null) continue; |
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 because i can not do all the convert in one pr, that will make this pr too large to review. thus still keep old attribute. Will be removed in the last pr of this task.
Remove comments
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 love this PR
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.
Could you fix the nullable warnings with a nullable directive?
* master: Update RpcServer.Blockchain.cs (neo-project#3458) # Conflicts: # src/Plugins/RpcServer/RpcServer.Blockchain.cs
fixed |
{ | ||
JToken key = Result.Ok_Or(() => _params[0], RpcError.InvalidParams.WithData($"Invalid Block Hash or Index: {_params[0]}")); | ||
bool verbose = _params.Count >= 2 && _params[1].AsBoolean(); |
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.
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.
Why don't you use a real JSON
library. I do it for REST
server. It auto converts and plugs into kestrel
server. Who ever made RPC plugin doesn't know how to use kestrel
.
Change JSON library is not the purpose of this pr. I dont know why it is using Neo.Json, but this pr will not handle that. Otherwise this pr would be not reviewable cause it will have two major tasks. We can update to kestrel in the future if possible, step by step, but small steps. |
Neo.Json is more strict than Newton.Json, so if using Newton.Json to create request, somewhere might be incompatible in some cases. |
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.
Tested OK.
Description
Our RPC server methods lacks clear definition on its parameters, thus making it very hard to define its behavior. Thus this pr add a new invoking system that enables us to invoke rpc methods with precise parameters.
Fixes #
Type of change
How Has This Been Tested?
Running existing tests.
Test Configuration:
Checklist: