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

chain-spec-builder: Do not swallow unknown fields #4873

Open
skunert opened this issue Jun 25, 2024 · 2 comments
Open

chain-spec-builder: Do not swallow unknown fields #4873

skunert opened this issue Jun 25, 2024 · 2 comments

Comments

@skunert
Copy link
Contributor

skunert commented Jun 25, 2024

Follow up of #4685.

We should not swallow any fields when modifying existing chain-specs. Currently para_id and relaychain fields would not be present in the output chain spec.

@CrackTheCode016
Copy link
Contributor

I believe the cause is due to the existing chain spec being parsed via ChainSpec::from_json, which assumes no extensions / custom fields, aka just the default config.

To ensure any fields can be preserved, we can simply parse the file via fs::read, then serde_json::read_slice, merge in place, versus converting to ChainSpec. Other option is to hardcode them as part of the default config but not sure we want that.

@bkchr
Copy link
Member

bkchr commented Jun 27, 2024

Or we could just keep the original json file around, continue using from_json and when the operation is finished we merge back the new chainspec to the original file.

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

No branches or pull requests

3 participants