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

Andymck/reward manifest additions #403

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

andymck
Copy link
Contributor

@andymck andymck commented Jun 7, 2024

This is an attempt to include the rewards per share in the rewards manifests.

The fields are represented as string types in this draft in an attempt to include the same precision in the protos as that used in the internal rewarder calculations. In the rewarder these values are represented as Decimal types.

On the IOT side the rewards per share values are rounded to a precision of 15. On the mobile side no rounding takes place and we end up with decimal value such as

dec!(1713882.1655472017013743978648)

If the corresponding proto field is represented as a float or double this corresponds to a f64 in rust and as such when going from the rewarder's internal decimal value to an f64 we will loose precision on the mobile rewards side. Any consumers of those protos will not be able to arrive at the same final reward values as the mobile rewarder generated.

Alternative options to consider:

  1. Represent the proto fields as floats, ignore any loss on the mobile values when going from decimal to float
  2. Refactor mobile rewarder to use a default precision same as IOT ( 15 ), represent the proto types as floats. This results in no loss of precision between internal rewarder values and external proto values
  3. Other?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants