SteemPlus is a lightweight browser extension adding new features to your Steemit/Busy experience: - Voting slider for minnows - Possibility to filter (by tag/resteem/reputation) and sort ( by date/payout/votes) - Switch between Busy Steemit and Steemd by keyboard shortcuts - Delegation of Steem Power directly from the wallet
GNU General Public License v3.0
27
stars
32
forks
source link
Maximum available SP for delegation is inaccurate in busy #124
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.
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,
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
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.
https://youtu.be/OHOAxnogT2A
https://youtu.be/Y5N4wiEb6vs
https://youtu.be/Cz44DxC6nCk
Environment
Issue
In delegate.js, the codes in 137-140, the formula for obtaining the maximum available SP that the user can delegate is shown.
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)