Skip to content
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

Use CountedStorageMap instead of StorageMap for Jurors in court pallet #707

Merged
merged 5 commits into from
Jul 18, 2022

Conversation

vivekvpandya
Copy link
Contributor

@vivekvpandya vivekvpandya commented Jul 12, 2022

@vivekvpandya vivekvpandya added the s:review-needed The pull request requires reviews label Jul 12, 2022
@vivekvpandya vivekvpandya self-assigned this Jul 12, 2022
Copy link
Member

@Chralt98 Chralt98 left a comment

Choose a reason for hiding this comment

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

According to this the CountedStorageMap allows to count() without going throughout the full iterator. This is a performance optimisation. There speaks nothing against this change to me. Cool @vivekvpandya !

@vivekvpandya
Copy link
Contributor Author

According to this the CountedStorageMap allows to count() without going throughout the full iterator. This is a performance optimisation. There speaks nothing against this change to me. Cool @vivekvpandya !

Actually it must be using a small variable (storage) to track the count. But I think it should be fine given runtime benefit.
Also this is suggestion from audit people, so thanks to them!

Copy link
Member

@maltekliemann maltekliemann left a comment

Choose a reason for hiding this comment

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

Yeah, looks good to me!

@maltekliemann maltekliemann added s:accepted This pull request is ready for merge and removed s:review-needed The pull request requires reviews labels Jul 12, 2022
@sea212
Copy link
Member

sea212 commented Jul 12, 2022

Before merging, please verify if a storage migration is required. The count probably is initialized at 0, although there already might be storage elements present.

zrml/court/src/migrations.rs Outdated Show resolved Hide resolved
zrml/court/src/migrations.rs Outdated Show resolved Hide resolved
zrml/court/src/migrations.rs Outdated Show resolved Hide resolved
@maltekliemann maltekliemann added s:review-needed The pull request requires reviews and removed s:accepted This pull request is ready for merge labels Jul 14, 2022
@maltekliemann maltekliemann self-requested a review July 16, 2022 14:37
Copy link
Member

@maltekliemann maltekliemann left a comment

Choose a reason for hiding this comment

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

Thanks for the changes! Looks good to me. 👍

@vivekvpandya vivekvpandya merged commit 789d565 into main Jul 18, 2022
@sea212 sea212 deleted the audit-1-3 branch July 18, 2022 08:32
@sea212 sea212 added s:accepted This pull request is ready for merge and removed s:review-needed The pull request requires reviews labels Jul 18, 2022
@sea212 sea212 added this to the v0.3.5 milestone Jul 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
s:accepted This pull request is ready for merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants