op-service: RPC server wraps http-util server now, and factor out RPC handler#14491
op-service: RPC server wraps http-util server now, and factor out RPC handler#14491protolambda merged 2 commits intodevelopfrom
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## develop #14491 +/- ##
===========================================
+ Coverage 78.11% 85.41% +7.29%
===========================================
Files 178 121 -57
Lines 10667 5985 -4682
===========================================
- Hits 8333 5112 -3221
+ Misses 2143 861 -1282
+ Partials 191 12 -179
Flags with carried forward coverage won't be shown. Click here to find out more. |
axelKingsley
left a comment
There was a problem hiding this comment.
This PR is a little difficult to confidently validate, since there are a lot of pieces that are being organized, and there is not one specific Feature-Goal being accomplished here. The additional comments throughout are appreciated!
The tests all pass, and I see you've added new ones, so I am good to approve.
This make it easy to create a tool that can host a single server endpoint that provides multiple RPCs, each matching a test-actor, chain, etc.
I don't think I see a test matching this particular use-case? Can you give an example of what the endpoints would look like in this scenario?
In the server tests, there's: and similar in the auth-test. |
… handler (ethereum-optimism#14491) * op-service: RPC server wraps http-util server now, and factor out RPC handler * op-service: fix sub-test name
Description
This PR:
httputil.Serverrpc.Serveraroundhttputil.Serverrpc.Serveras ahttp.HandlerThe
rpc.NewServerpublic API is still mostly the same. Options are passed down to the RPC handler. A new from-config constructor allows for further customization.The
WithAPIsoption is no longer there: RPC APIs should be registered to the server with the method, not as option. The server can be started after adding the RPCs to ensure they are available. Or the RPCs can be added later, since they are just new additional routes, not conflicting with the HTTP server lifetime.Tests
Additional context
This make it easy to create a tool that can host a single server endpoint that provides multiple RPCs, each matching a test-actor, chain, etc.
Metadata