-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Generate storage info for aura pallet #9371
Conversation
just a reminder to update node-template runtime since it uses pallet-aura :) |
frame/aura/src/lib.rs
Outdated
if last_authorities != next_authorities { | ||
let bounded = match next_authorities.try_into() { | ||
Ok(v) => v, | ||
Err(_) => return, |
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 should at least log an error, on_new_session shouldn't really be allowed to fail to set the authorities.
I don't know what is consequences of this if it happens.
Maybe better to use a WeakBoundedVec no ?
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.
In #8640, what we did instead is to truncate the authorities so that we're only left with the first n number of authorities, where n is the value of T::MaxAuthorities
. I guess a WeakBoundedVec would work here as well -- it'll just mean that no additional authorities can be inserted, a removal must happen in order to reduce the number back down to n or below it.
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 mostly fine, not sure about just assuming the length is correct without checking/logging
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
Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
* Migrate Aura pallet to BoundedVec Implementing issue #8629 * Fixed aura tests after BoundedVec change * Moved Vec to BoundedVec in authority-discovery * Merging into the main branch * Added MaxEncodedLen to crypto Need this without full_crypto to be able to add generate_store_info * Add generate_store_info for aura * Adding changes to Slot to add MaxEncodedLen * Adding generate_store_info to authority discovery * fmt * removing panics in runtime if vec size too large * authority-discovery: Remove panics in runtime Can happen if vec size is too large, so truncate the vec in that case * Adding logging when I truncate Vecs * Got the sign the other way around * Reverting pallet_aura changes This is already being addressed by PR #9371 * Change BoundedVec to WeakBoundedVec More robust implementation following @thiolliere recommendation. Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>
needs to make CI happy, but looks good to me otherwise |
bot merge |
Trying merge. |
Part of paritytech/polkadot-sdk#323.
polkadot companion: paritytech/polkadot#3487