Refactor duplication in overlay RPC
- Dominant language
- Rust
- Stars
- 441
- Forks
- 149
- PR merge metrics
- No merged PRs in 30d
Description
There is quite a duplication code when implementing the base RPC endpoints for every network.
For example, we can see that most of the code in [history rpc ](https://github.com/ethereum/trin/blob/master/trin-history/src/jsonrpc.rs) overlaps with [beacon rpc](https://github.com/ethereum/trin/blob/master/trin-beacon/src/jsonrpc.rs). With the implementation of the State network, this duplication will increase.
I think one piece of refactoring that we want here is to make the common methods generics, i.e. accepting generic `network` and `content_key`/`content_value` arguments. Then we can extract those methods in a separate common module in a way that every network crate has access to it.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by comparing trin-history/src/jsonrpc.rs with trin-beacon/src/jsonrpc.rs, focusing on the duplicated base RPC endpoints and their network and content-key/value handling. Trace how the State network would use these endpoints and identify an appropriate shared module. Done means the common behavior is shared by the network crates without duplicated implementations, with existing RPC behavior preserved.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- api, backend
- Issue type
- Refactor
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100