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

gui, accrual: Implement accrual limit warning #2636

Conversation

jamescowens
Copy link
Member

@jamescowens jamescowens commented Feb 5, 2023

Closes #2635.

The design of this PR implements a NearRewardLimit, or AccrualNearLimit, which has to be propagated several layers through the architecture. Note that this method provides a CAmount threshold which represents a value that is less than the MaxReward of 16384 by two days of accrual at the current magnitude, or 1/2 of the MaxReward, whichever is greater. The first condition is motivated by the notion of giving someone 2 days notice to do an MRC before they start losing GRC to the accrual cap. The second deals with the corner case where a person's mag is so high that 2 days of accrual subtracted from the MaxReward would yield a nonsensical alerting value. The maximum magnitude is 32767, so the maximum per day GRC accrual is 8191.75. 2x that value is 16383.5, which means the alerting value would be 0.5 GRC, or essentially immediate. So the 1/2 of the MaxReward condition starts to constrain the warning time at approximately one half of the max magnitude. At max magnitude the alerting time will only be approximately one day.

The "out parameter" for the boolean in FormatAccrual is so that the Accrual() method does not have to be called more than once for the GUI update. This update is on a timer loop and is called repeatedly. Accrual is much heavier than AccrualNearLimit.

@jamescowens jamescowens force-pushed the implement_accrual_limit_warning branch from d32f346 to 2192e2c Compare February 6, 2023 01:39
@jamescowens jamescowens force-pushed the implement_accrual_limit_warning branch from 6c69009 to 0f512f8 Compare February 6, 2023 01:45
@jamescowens jamescowens self-assigned this Feb 6, 2023
@jamescowens jamescowens added this to the LaVerne milestone Feb 6, 2023
@jamescowens jamescowens marked this pull request as ready for review February 6, 2023 03:13
@jamescowens jamescowens requested review from iFoggz and removed request for barton2526 February 7, 2023 15:43
Copy link
Member

@iFoggz iFoggz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good Jim I do not see anything that stands out and I approve this for testing on testnet. I'm sure some magnitude whales on testnet can help with this testing.

@jamescowens jamescowens merged commit b9cc742 into gridcoin-community:development Feb 9, 2023
@jamescowens jamescowens deleted the implement_accrual_limit_warning branch March 3, 2023 21:01
jamescowens added a commit to jamescowens/Gridcoin-Research that referenced this pull request Mar 26, 2023
Added
 - key, wallet: HD wallets gridcoin-community#2540 (@div72)
 - ARMv8 SHA2 Intrinsics gridcoin-community#2612 (@barton2526)
 - build: vendor bdb 5.3 gridcoin-community#2620 (@div72)
 - scraper, gui: Add external adapter projects indication gridcoin-community#2625 (@jamescowens)
 - gui: implement INSUFFICIENT_MATURE_FUNDS status for the mrcmodel gridcoin-community#2628 (@jamescowens)
 - gui, accrual: Implement accrual limit warning gridcoin-community#2636 (@jamescowens)
 - rpc: add `getnodeaddresses` gridcoin-community#2646 (@Pythonix)
 - consensus: Add new checkpoints gridcoin-community#2651 (@barton2526)

Changed
 - voting: Optimize poll locks gridcoin-community#2619 (@jamescowens)
 - util: move threadinterrupt.{cpp,h} to util gridcoin-community#2613 (@Pythonix)
 - gui, voting: Update pool cpids and avw rules gridcoin-community#2624 (@jamescowens)
 - ci: bump python and setup-python action version gridcoin-community#2626 (@div72)
 - gui: Change text from username to name (real name or nickname) gridcoin-community#2633 (@jamescowens)
 - locale: Translation update, phase 1 gridcoin-community#2637 (@jamescowens)
 - gui: Change MRC too soon to submit error to be less confusing gridcoin-community#2645 (@jamescowens)
 - locale: Update translations prior to release (phase 2/2) gridcoin-community#2658 (@jamescowens)
 - gui: Enhance MRC request form to avoid fee boost field confusion gridcoin-community#2659 (@jamescowens)

Removed
none

Fixed
 - net: Turn net structures into dumb storage classes (backport) gridcoin-community#2561 (@Pythonix)
 - build: Include native_X.mk before X.mk gridcoin-community#2609 (@barton2526)
 - depends: fix OpenSSL for Darwin builds gridcoin-community#2610 (@div72)
 - build: Change actions runner image to Focal, Force Lint to use 22.04, Change cd runner version gridcoin-community#2611 (@barton2526)
 - gui: don't show datadir error msgbox if arg isn't specified gridcoin-community#2617 (@div72)
 - rpc: Repair auditsnapshotaccrual rpc function gridcoin-community#2621 (@jamescowens)
 - gui: Correct updateBeaconIcon() function in bitcoingui.cpp gridcoin-community#2622 (@jamescowens)
 - wallet: Strengthen CWalletTx::RevalidateTransactions gridcoin-community#2627 (@jamescowens)
 - test: Fix Wambiguous-reversed-operator compiler warning, drop boost::assign gridcoin-community#2632 (@barton2526)
 - gui: Fix wallet overview displaying lower-case poll name gridcoin-community#2640 (@delta1513)
 - Fix and optimize ResendWalletTransactions gridcoin-community#2642 (@jamescowens)
 - build(nsis): Write registry keys to HKLM instead of HKCU, Install shortcuts for all users, Fix INSTALLDIR removal bug gridcoin-community#2643 (@sitiom)
 - gui: Fix TransactionRecord::decomposeTransaction to properly display self-sidestake gridcoin-community#2647 (@jamescowens)
 - rpc: Fixed the RPC error when running `help voting` while syncing gridcoin-community#2649 (@delta1513)
 - build: Fix compilation with GCC 13 gridcoin-community#2653 (@theMarix)
 - rpc: Formatting - typo correction rpc help for listresearcheraccounts gridcoin-community#2654 (@PrestackI)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Wallet does not alert user if they have reached accrual limit
2 participants