-
Notifications
You must be signed in to change notification settings - Fork 18
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
beautify TuxedoGenesisConfig
#128
Conversation
I approved this earlier because it is certainly a big improvement over what we have previously. But with the genesis extrinsics shaping up in #123 and #127, I wonder if we should forbid runtime developers from manually creating outputs directly, and rather require them to only create genesis extrinsics, which will specify the genesis utxos as their outputs. I think that requiring genesis transactions encourages the genesis block authors to communicate some semantics to the posterity of their chain. And it also makes the genesis block read more like a creation myth. |
@JoshOrndorff I might agree on the fact that we should put Transactions in the GenesisBuilder, rather than Outputs, as we currently do. |
Agreed |
Signed-off-by: muraca <mmuraca247@gmail.com>
8a7d59e
to
02a463f
Compare
Perhaps this is a good time to address some technical debt that Andrew and I introduced early on in order to keep prototyping quickly. Ideally, the genesis extrinsics for a given chain would be specified in the chain spec. If you look at the Substrate node template or other FRAME chains, they do this. All the genesis state is specified directly in the chain spec. So if I want to launch a node template with my own initial balances or staking authorities, I only edit the chain spec, no need to re-compile anything. This is what we want in Tuxedo too (except it will be genesis transactions, not genesis state.) The current design where we hard-code it all in the Regarding the piece-specific helper function, I totally support that idea. Those functions could be called form the chain spec. |
…doGenesisConfig::default` implementation Signed-off-by: muraca <mmuraca247@gmail.com>
5c4bddb
to
7088c0d
Compare
Signed-off-by: muraca <mmuraca247@gmail.com>
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.
I'm pretty happy with the design here. There are just a couple last things that still seems a little out-of-place to me.
One is the tests in the runtime. Are they just creating some random genesis config and then testing that it was put in the storage correctly? Do they have much to do with the runtime itself?
I guess at minimum they should be moved to a tests.rs file in the runtime, but I wonder if they can just be deleted entirely. Now that the genesis config is better expressed.
Second is the function development_genesis_config()
. I'm very happy that this is no longer in the impl Default
block. It is already a huge improvement. But I wonder if moving it all the way to the node is too much. What if we put it in the runtime in a dedicated genesis.rs file. I can imagine that in the future we may want to add other similar functions. For example on that takes list of endowed_addresses
or something. I followed this pattern of having a genesis module in the runtime back in the Substrate recipes days, and it worked well. Here are Five runtimes that all follow the pattern to see what I mean. https://github.com/JoshOrndorff/recipes/tree/master/runtimes
I defaulted to that as it is what the substrate template does, with closures.
I see the value of this. The genesis should be tied to the runtime in my opinion as well.
I see the value of testing the genesis config works as expected, and this function is actually testing the |
Signed-off-by: muraca <mmuraca247@gmail.com>
resolves #23
New syntax is:
Tuxedo/tuxedo-template-runtime/src/lib.rs
Lines 121 to 128 in 02a463f
This is done by leveraging functions written ad-hoc.
Tuxedo/wardrobe/money/src/lib.rs
Lines 80 to 93 in 02a463f
TuxedoGenesisConfig
has been moved totuxedo-core/src/genesis.rs
, while the runtime typeRuntimeGenesisConfig
, the tests and the function that replaces the Default trait implementation have been moved totuxedo-template-runtime/src/genesis.rs
.