Open steinerkelvin opened 1 year ago
I think I could take this one.
@steinerkelvin can you provide an example of what might go in ~/.kindelia/genesis/cafe0004.kdl
? and cafe0005.kdl
?
is it different than kindelia_core/genesis.kdl
?
btw, initial_peers
is already defined per-network as of #235. See default.toml.
Yeap, it's kindelia_core/genesis.kdl
.
~/.kindelia/genesis/0xCAFE00XX.kdl
would store an specific version of kindelia_core/genesis.kdl
.
[node.networks.0xCAFE0004]
genesis_code = '~/.kindelia/genesis/cafe0004.kdl'
It occurs to me that the path of the genesis block file could be deterministic (automagic) based on network ID.
Eg for [node.networks.0xCAFE0004]
the node would automatically look for the matching file ~/.kindelia/genesis/0xCAFE0004.kdl
and print an error with the path if not found. So it is not necessary to specify genesis_code
(line 2 above goes away) and that's one less thing to possibly get wrong in the config.
Of course it sacrifices flexibility in terms of naming and path. So that's the tradeoff.
Counter-argument is that the deterministic approach is more regular and predictable. Less chance for users to screw up and use the wrong genesis block for a given network.
thoughts?
I will start with the deterministic approach because it is a bit faster to impl and after make it configurable if that is the consensus.
I think is fine to do it deterministically. Less bloat and it could be added in the future as an optional field if it feels necessary.
It's interesting to be able to associate both with the network id in the node configuration.