-
Notifications
You must be signed in to change notification settings - Fork 751
Description
Current situation
Right now in cardano-testnet, we offer the user to pass its own:
And we also propose not to pass any of these things:
| getDefaultGenesisBatch |
Then, depending on whether the user passed its own file or not (we refer to the former case as using "a custom file"), we:
- generate a node configuration file if the user did not specify one
- generate genesis files if the user did not specify custom ones (actually we overwrite the ones generated by create-testnet-data).
Problem
There's a design decision to be made when using files passed by the user, because there is a tension between avoiding confusion and providing more service (at the risk of some confusion).
Let me list the different scenarios. I am here ignoring the case where cardano-testnet generates all files (which is the case of most tests in cardano-testnet-test), because we're concerned with the scenario where the user wants some customization.
- We avoid confusion at all costs and ask the user to provide the node configuration file and all genesis files. In terms of code, this would consist of merging those two arguments into one being
data UserFiles = Nothing | Just NodeConfigFileand reading the genesis files from the corresponding fields in the node configuration file. In this setup, ideally, the sole purpose of createSPOGenesisAndFiles woul dbe to generate keys withcreate-testnet-data(but the genesis files created bycreate-testnet-datawould be entirely discarded). - We keep being able to supply a node configuration separately from the genesis files. This is the current state: we generate a node configuration file if the user doesn't pass one, and the same for genesis files. The genesis files (shelley, alonzo, conway) should either all be supplied or all generated. As soon as you want to pass one custom genesis file, all generation-features provided by
cardano-testnetfor this genesis file (e.g. total supply in Shelley genesis file, dreps in Conway genesis file) are lost. In this scenario, we need to track that there is no conflict between fields of the node configuration file and the provided genesis files (either the node configuration field is absent, or it points to the genesis file provided by the user). - Like 2. but we have the possibility of specifying genesis files individually. So you can for example have the Shelley genesis file generated, while passing a custom Conway file. This was the initial state of cardano-testnet: Use user-specified genesis files (if any) instead of the one generated by create-testnet-data #6132, for example see this commit. There is a risk of confusion, because if you pass a custom genesis file, you lose the generation capabilities for this file. So, say, you want to pass a custom Shelley genesis file, then you'll lose that
cardano-testnetfills it with the total supply. - Like 3., but we expose more flags to tune the generation behavior, so that users have less often the need to pass custom genesis files. For example right now, we don't expose
create-testnet-data's option to create committee members at thecardano-testnetlevel (look how it is neither in the fields of CardanoTestnetOptions nor in the fields of GenesisOptions. This works well withcreate-testnet-datafeatures that it takes templates as input and modifies them (see e.g. here for the committee members)
Opinion and UX
In terms of maintenance, option 1. above is simpler for the API/CLI team (there are less conflicts to check), and it is also the simplest design to convey to users. However, I (@smelc) believe we're not providing much value to the user if we do that. If, as soon as cardano-testnet's defaults doesn't suit you, you are tasked with providing the node configuration file and the three genesis files; well that's not very nice: we leave the user on his/her own.
To a lesser extent, the same applies to option 2. As soon as the user wants one custom genesis configuration file, he is tasked with coming up with three of them, losing much of our generation support. This is what happened to @sourabhxyz here and from his comment, this was surprising.
In terms of maintenance, option 3. is roughly similar to option 2. while providing the user with more fine-grained control. I also think that having one origin per genesis file is a more obvious API. We don't have to explain that passing one custom genesis file means having to pass the UserProvidedOrigin origin for the entire batch (for example I think this wasn't to obvious to @sourabhxyz in his initial reaction to this design). This option does require more checks between the node configuration file and the custom genesis files.
Option 4. is probably the nicest one to the user, but it requires that we streamline the design of CardanoTestnetOptions and GenesisOptions (for example, right now, why is the options for dreps in CardanoTestnetOptions? whereas it affects the Conway genesis). We would also need to explain/mention those options in cardano-testnet's main entry point (e.g. cardanoTestnet right now). With this option, we acknowledge that it is inevitable to have some confusion when providing a good service to the user. In my opinion, this possible source of confusion is acceptable, because users that are going to call cardanoTestnet programmatically (or call the cardano-testnet executable) are anyway power users and call deal with understanding diffs in genesis files.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status