paritytech / substrate

Substrate: The platform for blockchain innovators
Apache License 2.0
8.39k stars 2.65k forks source link

Introduce `checked_div` for `PerThings` and `checked_rational_mul_correction` #14673

Open Gioyik opened 1 year ago

Gioyik commented 1 year ago

Fixes paritytech/polkadot-sdk#199

Introduces checked_div and checked_rational_mul_correction

Notes:

Gioyik commented 1 year ago

there are many panic! in the fixed_point.rs file that I think can be moved to the safe and unchecked_ function logic.

@ggwpez do you think it's fine to make the switch in those files and include it in this PR or those should stay as panic!?

kianenigma commented 1 year ago

bot fmt

command-bot[bot] commented 1 year ago

@kianenigma https://gitlab.parity.io/parity/mirrors/substrate/-/jobs/3320751 was started for your command "$PIPELINE_SCRIPTS_DIR/commands/fmt/fmt.sh". Check out https://gitlab.parity.io/parity/mirrors/substrate/-/pipelines?page=1&scope=all&username=group_605_bot to know what else is being executed currently.

Comment bot cancel 1-78f2445a-1362-4601-9d6a-9cd93bf5bc56 to cancel this command or bot cancel to cancel all commands in this pull request.

command-bot[bot] commented 1 year ago

@kianenigma Command "$PIPELINE_SCRIPTS_DIR/commands/fmt/fmt.sh" has finished. Result: https://gitlab.parity.io/parity/mirrors/substrate/-/jobs/3320751 has finished. If any artifacts were generated, you can download them from https://gitlab.parity.io/parity/mirrors/substrate/-/jobs/3320751/artifacts/download.

Gioyik commented 1 year ago

now there are checked_ functions with Result<>. One question, in these two calls:

https://github.com/paritytech/substrate/blob/gio/checked_fn/primitives/arithmetic/src/per_things.rs#L482 https://github.com/paritytech/substrate/blob/gio/checked_fn/primitives/arithmetic/src/per_things.rs#L495

do we want to replace with the checked version of the function?

paritytech-cicd-pr commented 1 year ago

The CI pipeline was cancelled due to failure one of the required jobs. Job name: test-linux-stable Logs: https://gitlab.parity.io/parity/mirrors/substrate/-/jobs/3321459

paritytech-cicd-pr commented 1 year ago

The CI pipeline was cancelled due to failure one of the required jobs. Job name: test-linux-stable-int Logs: https://gitlab.parity.io/parity/mirrors/substrate/-/jobs/3321465