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

Adds propose parachain pallet #2243

Merged
merged 8 commits into from
Jan 12, 2021
Merged

Adds propose parachain pallet #2243

merged 8 commits into from
Jan 12, 2021

Conversation

bkchr
Copy link
Member

@bkchr bkchr commented Jan 11, 2021

No description provided.

@bkchr bkchr added 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. labels Jan 11, 2021
bkchr and others added 2 commits January 11, 2021 17:51
Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>
Comment on lines +208 to +214
Proposals::<T>::iter().try_for_each(|(_, prop)|
if validators.iter().all(|v| !prop.validators.contains(v)) {
Ok(())
} else {
Err(Error::<T>::ValidatorAlreadyRegistered)
}
)?;
Copy link
Member

Choose a reason for hiding this comment

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

This is pretty aggressive, if I were writing a production pallet, i would try to catch this error on approval. If i approve a pallet, an the validator is already registered in the system, then it would fail. This should prevent any duplicate registrations from getting into the pallet.

Copy link
Member

Choose a reason for hiding this comment

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

Versus looking through all proposals proactively, which really has no bounds as far as I can tell.

Copy link
Member Author

Choose a reason for hiding this comment

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

I see what you mean. However, even on approval we should still iterate over all approved proposals to search for validators.

I hope that this pallet never gets used for anything than for this test network, so I think it is okay to be "aggressive" 🙈

Either::Right(who) => Some(who),
};

Self::is_approved_or_scheduled(para_id)?;
Copy link
Member

Choose a reason for hiding this comment

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

This seems like it should be the last check among these checks since there is an iterator inside

Copy link
Member

@shawntabrizi shawntabrizi left a comment

Choose a reason for hiding this comment

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

I didn't look at this like a production pallet. For test pallet, at high level, seems fine.

@bkchr bkchr merged commit cafe755 into master Jan 12, 2021
@bkchr bkchr deleted the bkchr-propose-parachain branch January 12, 2021 10:25
xlc pushed a commit to xlc/polkadot that referenced this pull request Jan 26, 2021
* Adds propose parachain pallet

* Update runtime/rococo/src/propose_parachain.rs

Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>

* Fix runtime benchmarks

* Get rid of staking

* Fix benchmarking feature..

* Remove accidentally added crate

* Bump Rococo spec_version

Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>
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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants