-
Notifications
You must be signed in to change notification settings - Fork 38
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
Predict when the next reward will be farmed #206
Conversation
- This is a probabilistic function based on the amount of space pledged by farmer w.r.t the total space pledged. Also considered the last reward timestamp to give an idea as to when can a farmer expect the next reward.
- Boxed the large field `raw_config to reduce the total size of the enum. Suppressed `#[warn(clippy::large_enum_variant)]` warning. - Add the widget drawn using DrawingArea object considering its suitable appearance in both light & dark themes. - Implement that in Relm4 code style. - Integrated the widget into RunningView frontend page. - Also added a testing feature to try how it works by toggling the FarmDetails button.
- Commented the test button logic to see how the progress bar works. - Total space pledged function added to backend so as to calculate it fetching the TSP metrics.
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.
Some comments are minor and stylistic, some are more significant. Can discuss synchronously if needed.
- Rectified tests in test_format_eta function in src/frontend/utils - Receive chain constants into RunningView FE on each block import via sending separate event. - Receive space_pledged from backend rather than frontend.
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.
It is taking way too much time for me to review this PR comparing to just doing it myself at this point. I'll use it as a reference and create another one with correct implementation.
let (current_solution_range, max_pieces_in_sector) = | ||
consensus_node.total_space_pledged_chain_constants()?; |
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.
Neither current solution range nor max pieces in sector are actually constants. And even if they were, it would make much more sense to send all of this in initialization notification instead.
Okay. |
Replaced with #230 |
Background
The issue titled "Predict when the next reward will be farmed" discusses the potential to provide users (farmers) with predictions on when they can expect to receive rewards based on on-chain data regarding space pledged and the last farming reward payment timestamp. This prediction could then be displayed to the user as having a high/low probability of receiving a reward with descriptions like "today", "in about an hour", or "any time now".
Description
This PR adds:
slot_probability
(from frontend),current_solution_range
,max_pieces_in_sector
(from backend).calculate_expected_reward_duration_from_now
function to calculate the ETA for next reward payment.