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

Refactor on_container_author_noted hook to take a Vec #787

Merged
merged 14 commits into from
Jan 13, 2025

Conversation

tmpolaczyk
Copy link
Contributor

@tmpolaczyk tmpolaczyk commented Dec 18, 2024

To get a more accurate weight, it's better to have a function that takes a list of n chains to reward than to call a function n times.

Should be a refactor but there are some observable changes:

  • Block 0 of each container chain is no longer being rewarded. It's the genesis block and it's not created by a collator, so the collator shouldn't get any reward
  • The event order changes. In pseudocode:
// Previous order:
for para_id in paras { for pallet in pallets { pallet.emit_event(para_id) }}

// New order:
for pallet in pallets { for para_id in paras { pallet.emit_event(para_id) }}

Copy link
Contributor

github-actions bot commented Dec 18, 2024

WASM runtime size check:

Compared to target branch

dancebox runtime: 1420 KB (+4 KB) ⚠️

flashbox runtime: 824 KB (no changes) ✅

dancelight runtime: 2160 KB (+8 KB) ⚠️

container chain template simple runtime: 1124 KB (no changes) ✅

container chain template frontier runtime: 1400 KB (no changes) ✅

@tmpolaczyk tmpolaczyk marked this pull request as ready for review December 31, 2024 17:07
Copy link
Contributor

github-actions bot commented Jan 2, 2025

Coverage Report

(master)

@@                         Coverage Diff                          @@
##           master   tomasz-refactor-author-noted-vec      +/-   ##
====================================================================
- Coverage   65.15%                             65.14%   -0.01%     
  Files         330                                330              
+ Lines       57796                              57814      +18     
====================================================================
+ Hits        37655                              37660       +5     
+ Misses      20141                              20154      +13     
Files Changed Coverage
/chains/orchestrator-paras/runtime/dancebox/src/weights/pallet_author_noting.rs 53.66% (-2.75%)
/chains/orchestrator-paras/runtime/dancebox/src/weights/pallet_services_payment.rs 75.00% (+1.09%)
/chains/orchestrator-paras/runtime/flashbox/src/weights/pallet_author_noting.rs 34.15% (-1.75%)
/chains/orchestrator-paras/runtime/flashbox/src/weights/pallet_services_payment.rs 16.67% (+3.63%)
/chains/orchestrator-relays/runtime/dancelight/src/weights/pallet_author_noting.rs 34.15% (-0.06%)
/chains/orchestrator-relays/runtime/dancelight/src/weights/pallet_services_payment.rs 17.14% (+3.71%)
/pallets/author-noting/src/lib.rs 87.22% (-0.28%)
/pallets/author-noting/src/weights.rs 26.83% (-1.38%)
/pallets/inflation-rewards/src/lib.rs 90.37% (-0.14%)
/pallets/services-payment/src/lib.rs 89.94% (-0.03%)
/pallets/services-payment/src/weights.rs 14.58% (+1.54%)

Coverage generated Mon Jan 13 10:09:11 UTC 2025

@tmpolaczyk tmpolaczyk added B7-runtimenoteworthy Changes should be noted in any runtime-upgrade release notes D5-nicetohaveaudit⚠️ PR contains trivial changes to logic that should be properly reviewed. not-breaking Does not need to be mentioned in breaking changes labels Jan 3, 2025
Copy link
Collaborator

@girazoki girazoki left a comment

Choose a reason for hiding this comment

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

I think it looks good. Just double checking:

  • we dont need migrations
  • changing the order (iterate over paras vs iterate over pallets first) does not affect

Copy link
Contributor

@chexware chexware left a comment

Choose a reason for hiding this comment

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

Looks good to me!

Copy link
Contributor

@dimartiro dimartiro left a comment

Choose a reason for hiding this comment

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

Looks good to me! 👏

@tmpolaczyk tmpolaczyk merged commit 6520cda into master Jan 13, 2025
42 checks passed
@tmpolaczyk tmpolaczyk deleted the tomasz-refactor-author-noted-vec branch January 13, 2025 10:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
B7-runtimenoteworthy Changes should be noted in any runtime-upgrade release notes D5-nicetohaveaudit⚠️ PR contains trivial changes to logic that should be properly reviewed. not-breaking Does not need to be mentioned in breaking changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants