SteemPlus 2.18 - Maximum available SP for delegation is inaccurate in busysteemCreated with Sketch.

in #utopian-io6 years ago

Project Information

Expected behavior

When a delegator delegates parts of his SP to an account, the maximum available SP for delegation should be presented as the difference of his total SP minus his total delegated SP minus 5.000.

Actual behavior

When pressing the "Delegate" button in busy, the maximum available SP for delegation is incorrect wherein it is expressed in this formula: Max available SP = Total SP of the Delegator - Total delegated SP/Outgoing delegation of the account to be delegated - 5.000. With that formula, there are three possible scenarios that would occur which are as follows:

  • Max available SP = Total SP of the delegator - 5.000, if the account to be delegated doesn't have an outgoing delegation.
  • Max available SP > 0, if the outgoing delegation of the account to be delegated is less than the delegator's Total SP.
  • Max available SP = 0, if the outgoing delegation of the account to be delegated is greater than the delegator's total SP.

How to reproduce

  • Go to busy.org and make sure that SteemPlus plug-in is switched for use in busy.org.
  • Go to the profile of the account you want to delegate SP.
  • Click the Wallet of that account.
  • Click the Delegate button.
  • The bug would appear for which the maximum available SP for delegation is incorrect.

Recording Of The Bug

In these three recordings, I am the delegator with a Total SP of 715.014 and my total delegated SP of 450.794 is not considered in the computation.

  • Max Available SP = Total SP of the delegator - 5.000
    Account to be delegated @mightypanda (for example), and doesn't have any outgoing delegation.

  • Max available SP > 0
    Account to be delegated @stoodkev (for example), with a total delegated SP of 604.860

  • Max available SP = 0
    Account to be delegated: @utopian-io (for example), with a total delegated SP = 3276.120

Environment

  • Browser version: Chromium Version 58.0.2988.0
  • App/Plugin version: SteemPlus 2.18
  • Device: HP Notebook
  • Operating system: Windows 10 64-bit

Issue

In delegate.js, the codes in 137-140, the formula for obtaining the maximum available SP that the user can delegate is shown.

      function getMaxSP(){
        var myVests = parseFloat(steem.formatter.vestToSteem(myAccountDelegation.vesting_shares.replace(' VESTS',''), globalP.totalVests, globalP.totalSteem) * 100) / 100;
        var maxSP = myVests - totalOutgoingDelegation - 5.000;

        return (maxSP > 0 ? maxSP.toFixed(3) : 0);
      }

With that, the amount for totalOutgoingDelegation is obtained from the account to be delegated instead of the delegator. Perhaps, the issue is found in the codes in line 88,

if(totalOutgoingDelegation===-1&&(regexWalletBusy.test(window.location.href)||regexWalletSteemit.test(window.location.href))&&retryCountDelegate<20)

GitHub Account

https://github.com/josephace135

GitHub Issue

In Issue 124, the project owner @steem-plus had fixed the bug.

Sort:  

Thank you for contributing to Utopian!

Joseph, you've proven to be an Ace :)

This is some incredible bug report. You described exactly what is expected and how it didn't behave as expected, you go into details about why the error is presented the way it is, you added 3 short and extremly informative videos demonstrating the problem. You reported and waited for it to be fixed before submitting to Utopian. I honestly enjoyed reviewing this bug Joseph. Excellent job, I put in a word for this to be picked as staff pick ;)

Your contribution has been evaluated according to Utopian policies and guidelines, as well as a predefined set of questions pertaining to the category.

To view those questions and the relevant answers related to your post, click here.


Need help? Write a ticket on https://support.utopian.io/.
Chat with us on Discord.
[utopian-moderator]

Thank you so much for the appreciation and compliment @achiron. :)

Hey @josephace135
Thanks for contributing on Utopian.
We’re already looking forward to your next contribution!

Want to chat? Join us on Discord https://discord.gg/h52nFrV.

Vote for Utopian Witness!

Coin Marketplace

STEEM 0.23
TRX 0.12
JST 0.029
BTC 67104.23
ETH 3509.43
USDT 1.00
SBD 3.21