-
Notifications
You must be signed in to change notification settings - Fork 1.6k
paras: initialize_para_now
and ParachainsCache
#4934
Conversation
Current dependencies on/for this PR:
This comment was auto-generated by Graphite. |
8a22999
to
f80186a
Compare
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); |
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.
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?
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.
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.
f80186a
to
92c0ce5
Compare
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.
92c0ce5
to
2a2b2f1
Compare
This commit adds a new primitive called
ParachainsCache
to manipulatethe
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 forinitialization of onboarding.