Lay3rLabs / avs-toolkit

MIT License
4 stars 1 forks source link

Improve network config in CLI tool #30

Open ethanfrey opened 10 hours ago

ethanfrey commented 10 hours ago

Currently there is a flag to switch between predefined local and testnet networks. However, we should allow more networks in the future (especially as we add event-specific networks, like layer-p, and update the testnet). We should also allow user to define their own endpoints (in real testnets/mainnet they want to chose the gRPC URL, not everyone on one).

Users should be able to set the chain config entirely via cli args / env vars / toml file. Maybe there is a toml file that defines some named networks that can easily be switched over (with some defaults for local and devnet). Not sure the best DevX here, let's discuss this more before building (starting with comments on the issue)

dakom commented 9 hours ago

I like this idea. The current config comes from a JSON file - that could easily be switched to TOML.

There isn't actually a hardcoded notion of "testnet" vs. "local" in the config - it could easily be extended to have "beta", "staging", etc.

I think as long as we require one variable called "remote" (or whatever, naming is hard!) - then everything can flow from that

So let's say it's "remote". If this var is set to "beta" then it will load the beta section from the config, and then a "BETA_GRPC_ENDPOINT" would override that setting. Basically, get rid of the hardcoded enum, just let it flow from the string setting.

In all cases, we could also have top-level optional overrides so passing --grpc-endpoint="example.com" would override it.

ethanfrey commented 8 hours ago

I like this general direction. Let's flesh it out a bit more before coding