Skip to content

Commit

Permalink
rm exp_ RPC API infrastructure; had no actual RPC endpoints (#2635)
Browse files Browse the repository at this point in the history
* rm exp_ RPC API infrastructure; had no actual RPC endpoints

* update command-line flag descriptions
  • Loading branch information
tersec authored Sep 18, 2024
1 parent 0ee8e61 commit 3fb2e08
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 55 deletions.
6 changes: 2 additions & 4 deletions nimbus/config.nim
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,6 @@ type
## RPC flags
Eth ## enable eth_ set of RPC API
Debug ## enable debug_ set of RPC API
Exp ## enable exp_ set of RPC API

DiscoveryType* {.pure.} = enum
None
Expand Down Expand Up @@ -451,7 +450,7 @@ type
name: "rpc" }: bool

rpcApi {.
desc: "Enable specific set of RPC API (available: eth, debug, exp)"
desc: "Enable specific set of RPC API (available: eth, debug)"
defaultValue: @[]
defaultValueDesc: $RpcFlag.Eth
name: "rpc-api" }: seq[string]
Expand All @@ -462,7 +461,7 @@ type
name: "ws" }: bool

wsApi {.
desc: "Enable specific set of Websocket RPC API (available: eth, debug, exp)"
desc: "Enable specific set of Websocket RPC API (available: eth, debug)"
defaultValue: @[]
defaultValueDesc: $RpcFlag.Eth
name: "ws-api" }: seq[string]
Expand Down Expand Up @@ -702,7 +701,6 @@ proc getRpcFlags(api: openArray[string]): set[RpcFlag] =
case item.toLowerAscii()
of "eth": result.incl RpcFlag.Eth
of "debug": result.incl RpcFlag.Debug
of "exp": result.incl RpcFlag.Exp
else:
error "Unknown RPC API: ", name=item
quit QuitFailure
Expand Down
15 changes: 5 additions & 10 deletions nimbus/rpc.nim
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import
./rpc/jwt_auth,
./rpc/cors,
./rpc/rpc_server,
./rpc/experimental,
./rpc/oracle,
./rpc/server_api,
./nimbus_desc,
Expand All @@ -33,7 +32,6 @@ export
jwt_auth,
cors,
rpc_server,
experimental,
oracle,
server_api

Expand All @@ -49,7 +47,7 @@ func combinedServer(conf: NimbusConf): bool =
conf.httpServerEnabled and
conf.shareServerWithEngineApi

proc installRPC(server: RpcServer,
func installRPC(server: RpcServer,
nimbus: NimbusNode,
conf: NimbusConf,
com: CommonRef,
Expand All @@ -65,9 +63,6 @@ proc installRPC(server: RpcServer,
# if RpcFlag.Debug in flags:
# setupDebugRpc(com, nimbus.txPool, server)

if RpcFlag.Exp in flags:
setupExpRpc(com, server)

server.rpc("admin_quit") do() -> string:
{.gcsafe.}:
nimbus.state = NimbusState.Stopping
Expand All @@ -79,12 +74,12 @@ proc newRpcWebsocketHandler(): RpcWebSocketHandler =
wsserver: WSServer.new(rng = rng),
)

proc newRpcHttpHandler(): RpcHttpHandler =
func newRpcHttpHandler(): RpcHttpHandler =
RpcHttpHandler(
maxChunkSize: DefaultChunkSize,
)

proc addHandler(handlers: var seq[RpcHandlerProc],
func addHandler(handlers: var seq[RpcHandlerProc],
server: RpcHttpHandler) =

proc handlerProc(request: HttpRequestRef):
Expand All @@ -100,7 +95,7 @@ proc addHandler(handlers: var seq[RpcHandlerProc],

handlers.add handlerProc

proc addHandler(handlers: var seq[RpcHandlerProc],
func addHandler(handlers: var seq[RpcHandlerProc],
server: RpcWebSocketHandler) =

proc handlerProc(request: HttpRequestRef):
Expand Down Expand Up @@ -130,7 +125,7 @@ proc addHandler(handlers: var seq[RpcHandlerProc],

handlers.add handlerProc

proc addHandler(handlers: var seq[RpcHandlerProc],
func addHandler(handlers: var seq[RpcHandlerProc],
server: GraphqlHttpHandlerRef) =

proc handlerProc(request: HttpRequestRef):
Expand Down
17 changes: 0 additions & 17 deletions nimbus/rpc/experimental.nim

This file was deleted.

24 changes: 0 additions & 24 deletions tests/test_configuration.nim
Original file line number Diff line number Diff line change
Expand Up @@ -111,18 +111,6 @@ proc configurationMain*() =
let cx = cc.getRpcFlags()
check { RpcFlag.Eth, RpcFlag.Debug } == cx

let dd = makeConfig(@["--rpc-api:eth", "--rpc-api:exp"])
let dx = dd.getRpcFlags()
check { RpcFlag.Eth, RpcFlag.Exp } == dx

let ee = makeConfig(@["--rpc-api:eth,exp"])
let ex = ee.getRpcFlags()
check { RpcFlag.Eth, RpcFlag.Exp } == ex

let ff = makeConfig(@["--rpc-api:eth,debug,exp"])
let fx = ff.getRpcFlags()
check { RpcFlag.Eth, RpcFlag.Debug, RpcFlag.Exp } == fx

test "ws-api":
let conf = makeTestConfig()
let flags = conf.getWsFlags()
Expand All @@ -140,18 +128,6 @@ proc configurationMain*() =
let cx = cc.getWsFlags()
check { RpcFlag.Eth, RpcFlag.Debug } == cx

let dd = makeConfig(@["--ws-api:eth", "--ws-api:exp"])
let dx = dd.getWsFlags()
check { RpcFlag.Eth, RpcFlag.Exp } == dx

let ee = makeConfig(@["--ws-api:eth,exp"])
let ex = ee.getWsFlags()
check { RpcFlag.Eth, RpcFlag.Exp } == ex

let ff = makeConfig(@["--ws-api:eth,exp,debug"])
let fx = ff.getWsFlags()
check { RpcFlag.Eth, RpcFlag.Debug, RpcFlag.Exp } == fx

test "protocols":
let conf = makeTestConfig()
let flags = conf.getProtocolFlags()
Expand Down

0 comments on commit 3fb2e08

Please sign in to comment.