Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

paras: initialize_para_now and ParachainsCache #4934

Merged
merged 1 commit into from
Feb 22, 2022

Conversation

pepyakin
Copy link
Contributor

This commit adds a new primitive called ParachainsCache to manipulate
the Parachains storage entry in a more convenient way.

Then, on top of that, this commit changes the logic of
initialize_para_now so that it is identical to what is used for
initialization of onboarding.

@github-actions github-actions bot added the A0-please_review Pull request needs code review. label Feb 16, 2022
@pepyakin pepyakin mentioned this pull request Feb 16, 2022
1 task
@pepyakin pepyakin added B0-silent Changes should not be mentioned in any release notes C1-low PR touches the given topic and has a low impact on builders. D3-trivial 🧸 PR contains trivial changes in a runtime directory that do not require an audit. labels Feb 16, 2022
@pepyakin
Copy link
Contributor Author

Current dependencies on/for this PR:

This comment was auto-generated by Graphite.

@pepyakin pepyakin force-pushed the pep-paras-initialize-now-refactors branch from 8a22999 to f80186a Compare February 21, 2022 15:14
@pepyakin pepyakin requested a review from ordian February 21, 2022 15:15
@pepyakin
Copy link
Contributor Author

Thanks for the suggestions, @ordian, fixed!

for (id, genesis_args) in &self.paras {
let code_hash = genesis_args.validation_code.hash();
<Pallet<T>>::increase_code_ref(&code_hash, &genesis_args.validation_code);
Copy link
Member

Choose a reason for hiding this comment

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

Previously, it didn't check for validation.code.0.is_empty(), but I assume this is never the case for the genesis otherwise it's borked?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, good point, I should've mentioned this explicitly in the description.

I did not care that much about this case. Ultimately, using empty wasm code will fail during candidate validation. However, this is not the only way a PVF can be broken: all PVFs with less than 4-8 bytes are broken. Many others greater than that are at least useless. I'd say vast majority of byte combination are not valid wasm files or compressed blobs. Hence there is no explicit check.

However, you question gave me a thought: we are using an empty value as a sentinel value for a code path that won't be reachable from here. So I think this particular case warrants an empty code check.

@pepyakin pepyakin force-pushed the pep-paras-initialize-now-refactors branch from f80186a to 92c0ce5 Compare February 21, 2022 17:31
This commit adds a new primitive called `ParachainsCache` to manipulate
the `Parachains` storage entry in a more convenient way.

Then, on top of that, this commit changes the logic of
`initialize_para_now` so that it is identical to what is used for
initialization of onboarding.
@pepyakin pepyakin force-pushed the pep-paras-initialize-now-refactors branch from 92c0ce5 to 2a2b2f1 Compare February 21, 2022 18:05
@pepyakin pepyakin merged commit ccf7f7f into master Feb 22, 2022
@pepyakin pepyakin deleted the pep-paras-initialize-now-refactors branch February 22, 2022 13:52
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A0-please_review Pull request needs code review. B0-silent Changes should not be mentioned in any release notes C1-low PR touches the given topic and has a low impact on builders. D3-trivial 🧸 PR contains trivial changes in a runtime directory that do not require an audit.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants