MinaProtocol / mina

Mina is a cryptocurrency protocol with a constant size blockchain, improving scaling while maintaining decentralization and security.
https://minaprotocol.com
Apache License 2.0
2k stars 528 forks source link

Simplify Node Configuration #15783

Open martyall opened 5 months ago

martyall commented 5 months ago

The mina binary use a hybrid of configuration embedding methods:

It's generally considered best practice to not use compile time configuration. I have already done some work estimating how much of this we actually use, and it's really not that bad. See #15781 for a list of unused config that we could delete immediately.

Proposal to remove "fallback" searches for missing configuration

I noticed that some configuration options come with several "fallback" strategies. It's kind of an antipattern imo -- as the operator I would expect a precise value to be determined either via a single "sensible default" or if there is no sensible default, you should require me to give you the configuration directly. This was a pretty big foot gun when the daemon searches for the genesis ledger in multiple places, e.g.

let possible_paths base =
  List.map
    [ env_path
    ; brew_install_path
    ; s3_install_path
    ; autogen_path
    ; manual_install_path
    ] ~f:(fun d -> d ^/ base)

When allowed to search in multiple places, you might find the wrong one (which is exactly what happened). There may be other places people know of where we do this.

Proposal to document the configuration guidelines

If we're gonna eliminate compiled config, we need to place those options in one of the 3 other buckets listed. Personally I think 3 is too many (e.g. can we get away with env vars only? env vars + cli args?). Ideally guidelines should reflect easy deployment strategies and also ease of local development.

martyall commented 3 months ago

related to #15538