docs: module-level doc-comment for math.rs normalization flow (#699) - #729
Merged
Kingsman-99 merged 1 commit intoAug 30, 2026
Merged
Conversation
|
@gabrielujelistic-collab Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Explain the normalization flow in
math.rsmodule docSummary
Closes #699
contracts/split/src/math.rshad a short module-level doc comment describingwhy amounts are normalised, but it did not explain the normalization flow
— the three-stage pipeline that every token amount goes through. This PR
expands the
//!module documentation with an explicit "Normalization flow"section so contributors understand the contract's invariant: split math is
always performed in canonical 7-decimal units, never in native token units.
What changed
math.rsmodule doc withthe three stages:
unit and are never trusted for cross-token math as-is.
normalize_amountscales to the fixedCANONICAL_DECIMALS(7) representation; all share/ratio/fee/overflowarithmetic happens here.
denormalize_amountreverses the scalingbefore any
token::Client::transfer().intentional integer truncation when a higher-decimal token is downscaled),
and that negative inputs are rejected.
The existing per-function
///docs onnormalize_amount/denormalize_amountare unchanged.
Verification
Documentation-only change; no code affected. (As noted on the other split
PRs,
cargo checkonmaincurrently fails for unrelated, pre-existing reasons— unimplemented helpers/error variants from other open issues — so CI red here
is not caused by this change.)
closes #699