-
Notifications
You must be signed in to change notification settings - Fork 51
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
Implement pallet-data-preservers #341
Conversation
Add migration Add genesis data to pallet data preservers
Coverage Report@@ Coverage Diff @@
## master tomasz-pallet-data-preservers +/- ##
=================================================================
+ Coverage 73.76% 73.95% +0.19%
+ Files 89 91 +2
+ Lines 20241 20482 +241
=================================================================
+ Hits 14929 15146 +217
+ Misses 5312 5336 +24
|
.iter() | ||
.map(|(para_id, _genesis_data, boot_nodes)| (*para_id, boot_nodes.clone())) | ||
.collect(); | ||
let para_ids: Vec<_> = para_ids |
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.
is this to filter those not having bootnodes? if so please right a comment
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.
No, it's because I removed the bootnodes from the registrar genesis config, now bootnodes are part of the data preservers genesis.
para_id: ParaId, | ||
boot_nodes: BoundedVec<BoundedVec<u8, T::MaxBootNodeUrlLen>, T::MaxBootNodes>, | ||
) -> DispatchResult { | ||
T::SetBootNodesOrigin::ensure_origin(origin, ¶_id)?; |
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.
looks good :)
|
||
impl<T: Config> Pallet<T> { |
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.
We probably need a trait here that is able to access bootnodes for a paraId
runtime/dancebox/src/lib.rs
Outdated
@@ -767,6 +772,105 @@ impl pallet_services_payment::Config for Runtime { | |||
type WeightInfo = pallet_services_payment::weights::SubstrateWeight<Runtime>; | |||
} | |||
|
|||
pub struct DanceboxContainerChainManagerOrRootOrigin<T, RootOrigin> { |
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.
It might be easier to implement something like this in the pallet, and wrap it in a struct: https://github.com/paritytech/polkadot-sdk/blob/1f2ccaea05c8508f5cc916f8ae0ba60c102c5cf3/polkadot/runtime/common/src/paras_registrar/mod.rs#L540
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.
Looks good, but I need to implement try_origin
instead of ensure_origin
for the trait, let's see if I can adapt it somehow.
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.
@tmpolaczyk check 160e00c, revert it if you find it less clean, I do find it cleaner than what we had
runtime/dancebox/src/lib.rs
Outdated
|
||
fn check_valid_for_collating(para_id: ParaId) -> DispatchResult { | ||
// To be able to call mark_valid_for_collating, a container chain must have bootnodes | ||
if DataPreservers::boot_nodes(para_id).len() > 0 { |
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.
You can probably add this as a trait that is implemented for the data-preservers palet, and you pass this as config in the registrar pallet. That way you can return an error of the pallet itself
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.
LGTM! if benchmarks are still to run please do
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.
LGTM
Implement V0 of pallet-data-preservers, will not support data providers or payments yet. The container chain manager (or root) is expected to set the list of bootnodes manually.
Also, change mark_valid_for_collating extrinisic, now it will fail if the container chain does not have any bootnodes.