Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Use weight constants:: in the weight template #11215

Closed
ggwpez opened this issue Apr 13, 2022 · 4 comments
Closed

Use weight constants:: in the weight template #11215

ggwpez opened this issue Apr 13, 2022 · 4 comments
Labels
J0-enhancement An additional feature request. U3-nice_to_have Issue is worth doing eventually. Z1-easy Can be fixed primarily by duplicating and adapting code by an intermediate coder Z6-mentor An easy task where a mentor is available. Please indicate in the issue who the mentor could be.

Comments

@ggwpez
Copy link
Member

ggwpez commented Apr 13, 2022

The weight template currently outputs something like (x as Weight) which is semantically not very clear.
Changing this to (x * constants::WEIGHT_PER_NANOS) with the correct units would be much better.

One possible approach:

  • Write a function that correctly formats the weight, eg. 38_000_000 becomes 38_000 * WEIGHT_PER_NANOS
  • PS: Better call this function directly from the template

WEIGHT_PER_NANOS is probably the only one that we can use, as it would otherwise use float point multiplication.

@ggwpez ggwpez added J0-enhancement An additional feature request. U3-nice_to_have Issue is worth doing eventually. Z6-mentor An easy task where a mentor is available. Please indicate in the issue who the mentor could be. Z1-easy Can be fixed primarily by duplicating and adapting code by an intermediate coder labels Apr 13, 2022
@hzy1919
Copy link
Contributor

hzy1919 commented Apr 14, 2022

@ggwpez hi , I am attempting this issue.

@ggwpez
Copy link
Member Author

ggwpez commented Apr 14, 2022

Ok great @hzy1919 !

I added some possible was of implementation. Should be rather easy.

@hzy1919
Copy link
Contributor

hzy1919 commented Apr 18, 2022

@ggwpez Thanks for your help! I commit a PR #11233 .

@ggwpez
Copy link
Member Author

ggwpez commented May 12, 2022

Will be drastically changed after #10918 anyway. We can think of a better format in there.

@ggwpez ggwpez closed this as completed May 12, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
J0-enhancement An additional feature request. U3-nice_to_have Issue is worth doing eventually. Z1-easy Can be fixed primarily by duplicating and adapting code by an intermediate coder Z6-mentor An easy task where a mentor is available. Please indicate in the issue who the mentor could be.
Projects
None yet
Development

No branches or pull requests

2 participants