Skip to content
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

Fix people chain spec parsing in chainspec generator #305

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

s0me0ne-unkn0wn
Copy link
Contributor

I think it was just forgotten when people chain was added.

  • Does not require a CHANGELOG entry

@@ -90,6 +90,8 @@ pub fn from_json_file(filepath: &str, supported: String) -> Result<Box<dyn Chain
Ok(Box::new(GluttonKusamaChainSpec::from_json_file(path)?)),
x if x.starts_with("encointer-kusama") =>
Ok(Box::new(EncointerKusamaChainSpec::from_json_file(path)?)),
x if x.starts_with("people-kusama") =>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, I just wonder why coretime-kusama is also missing, could you add it also?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we could extract these IFs for chain-id matching out of the common.rs (it is not really common) to the main.rs and e.g. join it with supported networks cfg here: https://github.com/polkadot-fellows/runtimes/blob/main/chain-spec-generator/src/main.rs#L39

@xlc
Copy link
Contributor

xlc commented May 9, 2024

slightly unrelated, why do we even need to maintain the chain spec generator in the runtime repo? it is only going to be used once (for production runtimes). for dev/testing purpose, we will use the westend/rococo runtime in the polkadot-sdk repo

besides, why do we need another chain spec generator at all? to my understanding, the polkadot-sdk already provides a chain spec generator cli and it should work. there will be additional chain spec editing needed but it can be just a simple script

https://github.com/open-web3-stack/XCQ/blob/dc572745ffb54edfb0de2ce038121b11855e2c6e/Makefile#L24-L25

@bkontur
Copy link
Contributor

bkontur commented May 9, 2024

slightly unrelated, why do we even need to maintain the chain spec generator in the runtime repo? it is only going to be used once (for production runtimes). for dev/testing purpose, we will use the westend/rococo runtime in the polkadot-sdk repo

besides, why do we need another chain spec generator at all? to my understanding, the polkadot-sdk already provides a chain spec generator cli and it should work. there will be additional chain spec editing needed but it can be just a simple script

https://github.com/open-web3-stack/XCQ/blob/dc572745ffb54edfb0de2ce038121b11855e2c6e/Makefile#L24-L25

Maybe I am missing something, but I think we won't need it, but we need to bump sp-genesis-builder with 'get_preset' feature first, which I also need here: #298

@xlc
Copy link
Contributor

xlc commented May 9, 2024

I only spend 2 minutes reading the related code so my understanding could be wrong. But the preset feature appears to be overengineered to me. Why the runtime needs to know some network preset? If you check my poc runtime, it is using a version of polkadot-sdk without the preset feature. All I need to do is use jq or whatever tool to edit the chainspec json to do the modification needed and that's it. Yeah we don't get nice Rust type check but does it matter? again, it is one off thing and the chainspec generator can validate the chainspec json.

@s0me0ne-unkn0wn
Copy link
Contributor Author

for dev/testing purpose, we will use the westend/rococo runtime in the polkadot-sdk repo

That's not a universal solution. I'm currently doing experiments with people chain on kusama-local relay (and that's how I came across this bug), and we also have guys in the ecosystem whose Rococo and Kusama runtimes significantly diverged over time, and they need a tool to test against the proper relay. In that sense, the chainspec generator is just a convenient tool to drop into a zombienet config and let it do the job.

@xlc
Copy link
Contributor

xlc commented May 9, 2024

we have a chain spec generator in polkadot-sdk and I see no reason why it wouldn't be enough

@github-actions github-actions bot requested a review from bkontur May 10, 2024 09:14
Copy link

Review required! Latest push from author must always be reviewed

@s0me0ne-unkn0wn
Copy link
Contributor Author

@bkontur you mean something like this? (see the last changes)

@bkontur
Copy link
Contributor

bkontur commented May 13, 2024

@bkontur you mean something like this? (see the last changes)

Yes, nice, exactly. With actual chain-spec-generator setup, at least we won't forget to add this stuff when adding new chains.

@bkontur bkontur mentioned this pull request May 22, 2024
4 tasks
@bkchr
Copy link
Contributor

bkchr commented Jun 24, 2024

besides, why do we need another chain spec generator at all? to my understanding, the polkadot-sdk already provides a chain spec generator cli and it should work. there will be additional chain spec editing needed but it can be just a simple script

Yes, the chain spec generator here was introduced when the feature wasn't ready yet in the SDK repo. As the chain spec generator there is now ready, we could start using it here.

I only spend 2 minutes reading the related code so my understanding could be wrong. But the preset feature appears to be overengineered to me. Why the runtime needs to know some network preset?

Because people can do modifications and start the runtime easily using a given genesis. It is basically the same feature as before when running a node with --chain my-cool-whatever-spec. Yes, you could also achieve this with some bash script that does some replacements etc. However, I think it is easier to read this way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants