-
Notifications
You must be signed in to change notification settings - Fork 1
A0-4022: Reduced multi block contract migration weight by 4 #2
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -411,8 +411,9 @@ pub mod pallet { | |
| use migration::MigrateResult::*; | ||
|
|
||
| loop { | ||
| let (result, weight) = Migration::<T>::migrate(remaining_weight); | ||
| remaining_weight.saturating_reduce(weight); | ||
| const reduced_weight_factor: u64 = 4; | ||
| let (result, weight) = Migration::<T>::migrate(remaining_weight.saturating_div(reduced_weight_factor)); | ||
| remaining_weight.saturating_reduce(weight.saturating_mul(reduced_weight_factor)); | ||
|
|
||
| match result { | ||
| // There is not enough weight to perform a migration, or make any progress, we | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think that this is actually not correct to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You are probably right, we could |
||
|
|
||
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
saturating_reduceis weird xD it requiresOneand it's suspicious that it is more effective thatsaturating_sub(because that's my guess for the only reason for such a function)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 think it's actually less effective, it's only that
saturating_suboutputs a value andsaturating_reducemutates self. But why the hell issaturating_reduceimplemented the way it is I have no idea