-
Notifications
You must be signed in to change notification settings - Fork 157
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
[tracking] RPC refactoring wishlist #4032
Labels
Comments
This was referenced Mar 6, 2024
This was referenced Mar 15, 2024
This was referenced Apr 2, 2024
Merged
Code snippets file for VSCode: // This should live somewhere like `${workspaceDir}/.vscode/rpc.code-snippets`
{
"rpc method": {
"prefix": "impl RpcMethod",
"body": [
"pub enum ${1:MethodName} {}",
"impl RpcMethod<${2:ARITY}> for $1 {",
"const NAME: &'static str = \"Filecoin.$1\";",
"const PARAM_NAMES: [&'static str; $2] = [$3];",
"const API_VERSION: ApiVersion = ApiVersion::${7:V0};",
"",
"type Params = ($4);",
"type Ok = $6;",
"",
"async fn handle(ctx: Ctx<impl Blockstore $8>, ($5): Self::Params) -> Result<Self::Ok, ServerError> {",
"$0",
"}", // fn handle
"}", // impl RpcMethod
]
},
"imports": {
"prefix": "use",
"body": [
"use crate::rpc::{reflect::SelfDescribingRpcModule, ApiVersion, Ctx, RPCState, RpcMethod, RpcMethodExt as _, ServerError};",
"use schemars::JsonSchema;"
]
},
} |
4 tasks
This was referenced Apr 12, 2024
4 tasks
lemmih
added
Priority: 4 - Low
Limited impact and can be implemented at any time
Type: Enhancement
labels
Aug 2, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
The motivating use-case is #4038.
While we're in the area we can do a lot of cleanup.
jsonrpsee
RpcModule
ergonomics #4007crate::rpc::Client
, removecrate::rpc_client::ApiInfo
.trait RpcMethod
.Ctx
rpc::types
are minimal - any structs used by only one e.ggas
API should live ingas.rs
, not intypes.rs
.types.rs
is only for types that are shared across APIsLotusJson
where possible.JsonSchema
where necessary.for_each_method
macro ingas.rs
.prelude
RpcTest
constructors should useRpcTest::basic_raw
, andRpcMethodExt::request
like this.forest-cli
calls shouldrpc::Client::from(api: ApiInfo)
and thenRpcMethodExt::call
on that.In the limit,
ApiInfo
can be removed, and replaced by anrpc::Client::from_env
methodforest-cli attach
calls should be removed, and tracked under Define pattern for callingtrait RpcMethod
inforest-cli attach
#4141auth_api
to usetrait RpcMethod
#4154beacon_api
to usetrait RpcMethod
#4155trait RpcMethod
inforest-cli attach
#4141 / refactor!: removeforest-cli attach
#4358beacon_api
to usetrait RpcMethod
#4155 (comment)crate::rpc_client::RpcRequest::params
should beVec<Value>
orRequestParameters
, and should have better error handling.HasLotusJson
HasLotusJson
HasLotusJson
forest/src/rpc/mpool_api.rs
Line 136 in f58b629
Note that only the first parameter is wrapped in
LotusJson
- it has separate CBOR and JSON representations.MessageSendSpec
, on the other hand, can just be deserialized normally.A misapplication of the
HasLotusJson
API has lead to the proliferation oflotus_json_with_self!
callsLotusJson<Vec<T>>
should NOT recurse: users should useLotusJson<Vec<LotusJson<T>>
LotusJson<ApiTipsetKey>
is wrongtrait RpcMethod
OpenRPC
document nice.crate::rpc::types
The text was updated successfully, but these errors were encountered: