-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Conversation
Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>
Proposals::<T>::iter().try_for_each(|(_, prop)| | ||
if validators.iter().all(|v| !prop.validators.contains(v)) { | ||
Ok(()) | ||
} else { | ||
Err(Error::<T>::ValidatorAlreadyRegistered) | ||
} | ||
)?; |
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.
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.
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.
Versus looking through all proposals proactively, which really has no bounds as far as I can tell.
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.
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)?; |
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.
This seems like it should be the last check among these checks since there is an iterator inside
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.
I didn't look at this like a production pallet. For test pallet, at high level, seems fine.
* 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>
No description provided.