-
Notifications
You must be signed in to change notification settings - Fork 817
Client: (WIP) rework CLI startup logic using RpcConfig (#3983) #4013
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
base: master
Are you sure you want to change the base?
Conversation
const opts: any = { | ||
rpcCors, | ||
if (rpcConfig.transport === 'ws') { | ||
const wsOpts: any = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it possible to add typing for this instead of casting to any
?
|
||
export type RPCNamespace = (typeof RPCNamespace)[keyof typeof RPCNamespace] | ||
|
||
export const RPCTransport = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the keys of this mapping and similar ones, we can switch to using lowercase key names, like here.
public static readonly DEFAULT_WS_ENGINE_ADDR = '0.0.0.0' | ||
public static readonly DEFAULT_RPC_PORT = 8545 | ||
public static readonly DEFAULT_ENGINE_PORT = 8551 | ||
public static readonly DEFAULT_WS_PORT = 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the default websocket port is 8546
and other defaults should be likely made consistent with any defaults that already exist in getArgs
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
This seems to be heading in the right direction, but make sure to work in small chunks and check the CI to catch any issues or bugs early and respond to them iteratively. |
Thank you! I'll look into it asap |
@@ -14,7 +14,7 @@ import { LevelDB } from '../src/execution/level.ts' | |||
import { generateVKTStateRoot } from '../src/util/vkt.ts' | |||
|
|||
import { helpRPC, startRPCServers } from './startRPC.ts' | |||
import { generateClientConfig, getArgs } from './utils.ts' | |||
import { generateClientConfig, generateRpcConfigs, getArgs } from './utils.ts' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
generateRpcConfigs
-> generateRpcConfig
(so: without the s
)
to align with generateClientConfig
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(also further down the line there are a few Configs
, can you please also rename consistently? Thanks! (we are a bit picky on naming things 🙂 ))
This PR starts addressing #3983 by refactoring the client CLI
Description
RpcConfig
class for RPC endpoints (eth/engine, http/ws)generateRpcConfigs()
func to generate all server configurations from CLI argsstartRPCServers()
to use these configs instead of cli argsrun()
function to improve testability:run()
now handles only CLI argument parsing, config generation, and dispatchstartClientAndServers()
function performs the client and RPC server startupThis is still a work in progress — if the current structure looks good, I’ll follow up with unit tests for the new helpers and config logic in a separate commit!