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

Introduce checked PerThing arithmetics #199

Open
ggwpez opened this issue Mar 21, 2023 · 1 comment · May be fixed by paritytech/substrate#14673 or #1936
Open

Introduce checked PerThing arithmetics #199

ggwpez opened this issue Mar 21, 2023 · 1 comment · May be fixed by paritytech/substrate#14673 or #1936
Assignees
Labels
C1-mentor A task where a mentor is available. Please indicate in the issue who the mentor could be. D0-easy Can be fixed primarily by duplicating and adapting code by an intermediate coder. I4-refactor Code needs refactoring. I5-enhancement An additional feature request. T1-FRAME This PR/Issue is related to core FRAME, the framework.

Comments

@ggwpez
Copy link
Member

ggwpez commented Mar 21, 2023

Some PerThing functions are prone to zero division panics. This requires the runtime code to pay close attention when calling them.
Instead of relying on proof comments we could add fallible checked functions for:

  • multiply_by_rational_with_rounding
  • rational_mul_correction

(there could be more, did not check all)

Context: paritytech/substrate#13660 (comment)

@juangirini juangirini transferred this issue from paritytech/substrate Aug 24, 2023
@the-right-joyce the-right-joyce added I4-refactor Code needs refactoring. I5-enhancement An additional feature request. C1-mentor A task where a mentor is available. Please indicate in the issue who the mentor could be. T1-FRAME This PR/Issue is related to core FRAME, the framework. D0-easy Can be fixed primarily by duplicating and adapting code by an intermediate coder. and removed I7-refactor labels Aug 25, 2023
@eagr
Copy link
Contributor

eagr commented Oct 12, 2023

Isn't multiply_by_rational_with_rounding already a checked function effectively?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C1-mentor A task where a mentor is available. Please indicate in the issue who the mentor could be. D0-easy Can be fixed primarily by duplicating and adapting code by an intermediate coder. I4-refactor Code needs refactoring. I5-enhancement An additional feature request. T1-FRAME This PR/Issue is related to core FRAME, the framework.
Projects
Status: Backlog
5 participants