-
Notifications
You must be signed in to change notification settings - Fork 384
Use rounded up computation when calculating fee #1511
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
Merged
girazoki
merged 8 commits into
master
from
xcm-transactor-change-fee-calculation-to-floating
May 20, 2022
Merged
Use rounded up computation when calculating fee #1511
girazoki
merged 8 commits into
master
from
xcm-transactor-change-fee-calculation-to-floating
May 20, 2022
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
crystalin
approved these changes
May 16, 2022
notlesh
reviewed
May 16, 2022
pallets/xcm-transactor/src/lib.rs
Outdated
| let weight_fee = | ||
| fee_per_second.saturating_mul(weight as u128) / (WEIGHT_PER_SECOND as u128); | ||
| return weight_fee; | ||
| // We use perbill to be more precise over floating point mults |
Contributor
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.
Suggested change
| // We use perbill to be more precise over floating point mults | |
| // We use perbill to be more precise over fixed point mults |
Contributor
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.
Or maybe more generally "decimal" mults
notlesh
reviewed
May 16, 2022
notlesh
reviewed
May 16, 2022
…ange-fee-calculation-to-floating
notlesh
reviewed
May 19, 2022
notlesh
reviewed
May 19, 2022
notlesh
approved these changes
May 19, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
A0-pleasereview
Pull request needs code review.
B7-runtimenoteworthy
Changes should be noted in any runtime-upgrade release notes
D3-trivial
PR contains trivial changes in a runtime directory that do not require an audit
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What does it do?
Changes the way to calculate fee based on weight to match what usually chains do, i.e., round up if the decimal part of the floating point number is above half. We were not doing this before, and therefore our integer mult/division resulted always in rounding down.
What important points reviewers should know?
Is there something left for follow-up PRs?
What alternative implementations were considered?
Are there relevant PRs or issues in other repositories (Substrate, Polkadot, Frontier, Cumulus)?
What value does it bring to the blockchain users?