forest
forest copied to clipboard
Support different `/rpc/vX` paths in `RpcMethod`
trait RpcMethod assumes that each method will be exposed on one (and only one) endpoint:
https://github.com/ChainSafe/forest/blob/07576ded7933fa85ca623eb8ef84c3a4fb77eb22/src/rpc/reflect/mod.rs#L74-L75.
This was fine for a while because methods weren't different between endpoints, and we ignore HTTP paths as a matter of course.
For #4424 and #4038 we need to start being path-aware again:
- (relatively) low-cost to support v0 methods.
- prepare our architecture for future API path changes
- this is required for us to emit OpenRPC documents per-path, which we want to support #4038
This issue covers the design and implementation of this work
- [x]
trait RpcMethodallows multiple paths
We can- const API_VERSION: ApiVersion; + const API_PATHS: &[ApiPath];const assertfor uniqueness and inhabitedness etc where we need (or usenunny::slice![..]). - [ ] our server code hoists the correct methods to the correct paths.
- [ ]
forest-tool api comparetests allAPI_PATHSfor each method. - [x] our openrpc code segregates by path, and we get rid of our tagging logic
- [x]
forest-tool shed openrpcaccepts a path to dump out.
- [x]
@lemmih Is this still relevant?
It improves compatibility with Lotus, and it's simple to implement. We should still pursue this even though it's a low-priority issue.
This is blocking https://github.com/ChainSafe/forest/issues/4424
Some RPC methods(StateSectorPreCommitInfo, StateWaitMsg) behave differently between v0 and v1 endpoints.
Does it make sense to continue maintaining v0? It may just be technical debt moving forward
It is still unclear whether the v0 endpoints are required. They are not used by Curio but they may be used by exchanges.
We will not be pursuing the V0 methods any further. In any case this may still be required in future for V3 and beyond.
This can probably be deprioritized in the meantime (p4?)
There was related work in this PR:
- #4516
But our tests failed, due to:
- schema mismatches
-
Some RPC methods behave differently between v0 and v1 endpoints.
It's important that I get a complete schema to autogenerate from for the test suite.
We will not be pursuing the V0 methods any further
Should we leave the existing methods in @ansermino?
Approach for this is to move all possible methods to v1, fixing breaks as we find them
@aatifsyed Please also open a tracking issue for V1 incompatible methods