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

Generate storage info for aura pallet #9371

Merged
10 commits merged into from
Sep 2, 2021
Merged

Generate storage info for aura pallet #9371

10 commits merged into from
Sep 2, 2021

Conversation

KiChjang
Copy link
Contributor

@KiChjang KiChjang commented Jul 18, 2021

@KiChjang KiChjang 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. D5-nicetohaveaudit ⚠️ PR contains trivial changes to logic that should be properly reviewed. labels Jul 18, 2021
@emostov
Copy link
Contributor

emostov commented Jul 19, 2021

just a reminder to update node-template runtime since it uses pallet-aura :)

if last_authorities != next_authorities {
let bounded = match next_authorities.try_into() {
Ok(v) => v,
Err(_) => return,
Copy link
Contributor

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 ?

Copy link
Contributor Author

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.

Copy link
Contributor

@apopiak apopiak left a 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

frame/aura/src/lib.rs Show resolved Hide resolved
Copy link
Contributor

@kianenigma kianenigma left a comment

Choose a reason for hiding this comment

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

LGTM

KiChjang and others added 2 commits August 17, 2021 20:44
Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
ghost pushed a commit that referenced this pull request Aug 30, 2021
* 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>
@gui1117
Copy link
Contributor

gui1117 commented Sep 1, 2021

needs to make CI happy, but looks good to me otherwise

@KiChjang
Copy link
Contributor Author

KiChjang commented Sep 2, 2021

bot merge

@ghost
Copy link

ghost commented Sep 2, 2021

Trying merge.

@ghost ghost merged commit 6d0c04d into master Sep 2, 2021
@ghost ghost deleted the kckyeung/bounded-aura branch September 2, 2021 01:24
This pull request was closed.
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. D5-nicetohaveaudit ⚠️ PR contains trivial changes to logic that should be properly reviewed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants