-
Notifications
You must be signed in to change notification settings - Fork 721
off-by-one #1747
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
off-by-one #1747
Conversation
xlc
left a comment
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.
Better to have some integration test to cover this kind of errors.
Also should use saturated add
|
added integration tests. I don't think saturated add is the right semantics here because we do want to ensure the converted back balance >= the original balance. This means if +1 is an overflow, it should fail. |
|
But you are using |
|
Yeah, but when it becomes |
|
ok. in that case can you add some comments in the code to explain why return 0 on edge case is better? also should use |
Co-authored-by: Xiliang Chen <[email protected]>
* origin/master: (102 commits) Fix collect_fee (#1754) Update HEADER-GPL3 Update extrinsic-ordering-check-from-bin.yml (#1752) Update HEADER-GPL3 bump version (#1751) Remove homa-lite from karura runtime (#1744) off-by-one (#1747) Revert "simulate exchange rate (#1742)" (#1746) simulate exchange rate (#1742) bump version (#1743) refactor homa (#1648) Update stable asset (#1741) add more info to events (#1740) Fix mandala swap path error (#1736) update stable asset (#1738) remove unnecessary code (#1735) fix currency id testing (#1733) rework fee payment (#1687) Add Deposit for Setting Alternative Fee Swap Path (#1730) Add register_erc20_asset and update_erc20_asset (#1731) ... # Conflicts: # .github/workflows/coverage.yml.disabled # Cargo.lock # Cargo.toml
always transfer one more ksm to fix rounding issue
@shengda