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

Optimize Insufficient TRX Error Message of Multi-Sign Transaction #5736

Open
lxcmyf opened this issue Feb 27, 2024 · 8 comments
Open

Optimize Insufficient TRX Error Message of Multi-Sign Transaction #5736

lxcmyf opened this issue Feb 27, 2024 · 8 comments
Assignees

Comments

@lxcmyf
Copy link
Contributor

lxcmyf commented Feb 27, 2024

Rationale

Currently, when users try to query the maximum delegated bandwidth through the /wallet/getcandelegatedmaxsize interface, they find that the bandwidth margin is sufficient. However, when using the /wallet/delegateresource interface for delegateing resource, they may encounter an error message "Account resource insufficient error." After investigation, it was found that the actual reason for this error is not insufficient bandwidth resources, but insufficient transaction (TRX) balance in the account. This is because this transaction is a multi signature transaction, and the transaction cost of the multi signature operation needs to be deducted from the TRX balance of the account.

The current issue lies in the broad and sometimes inaccurate definition of the exception thrown. This can lead to confusion and misunderstanding among users, who may wrongly believe that they need to purchase more bandwidth resources instead of simply topping up their TRX balance.

To address this, we propose two solutions:

  1. Replacing the Exception Type: Currently, there is an exception type called "BalanceInsufficientException", which can be used instead of the previously misreported "AccountResourceInsufficientException", insufficient TRX balance for multi-signature transactions.
  2. Extending the Existing Exception Type: Alternatively, we can expand the meaning of the current exception type to include the possibility of insufficient TRX balance, perhaps by adding an "or" clause to its description.

Implementation

Solution 1: Replacing the exception type

  • Identify the current exception class being thrown for the "Account resource insufficient" error.

  • Currently, there is an exception type called "BalanceInsufficientException", which can be used instead of the previously misreported "AccountResourceInsufficientException", specifically for the case of insufficient TRX balance for multi-signature transactions.

  • Update the relevant code paths within the specific implementation to throw this new exception type when the TRX balance is insufficient.

  • Update the error handling and messaging systems to recognize and display the new exception type with an appropriate error message.

Solution 2: Extending the Existing Exception Type

  • Identify the current exception class being thrown for the "Account resource insufficient" error.

  • Modify the exception class's description or message to include the possibility of insufficient TRX balance for multi-signature transactions, perhaps by adding an "or" clause.

  • Update the relevant code paths within the specific implementation to throw this modified exception when either the bandwidth resources or the TRX balance is insufficient.

  • Update the error handling and messaging systems to recognize and display the modified exception with an appropriate error message.

Either solution would help improve the user experience by providing a more accurate and useful error message in the case of insufficient TRX balance for multi-signature transactions.

@CarlChaoCarl
Copy link
Contributor

Nice, I support option one

@halibobo1205
Copy link
Contributor

Nice, I support option one

+1, The error message is clear

@lxcmyf lxcmyf changed the title Improving Error Messaging for getcandelegatedmaxsize Interface Improving Error Messaging for delegateresource Interface Feb 28, 2024
@tomatoishealthy
Copy link
Contributor

Is it possible to determine the account type during the query and return the correct amount of available resources?

@lxcmyf
Copy link
Contributor Author

lxcmyf commented Feb 28, 2024

Is it possible to determine the account type during the query and return the correct amount of available resources?

@tomatoishealthy
This may not be related to the account type, as this transaction is a multi signature transaction, so an additional deduction of account TRX is required, and this fee consumption is not deducted from the available bandwidth of the account.

@lxcmyf lxcmyf changed the title Improving Error Messaging for delegateresource Interface Improving Error Messaging description for Resource Delegating transactions in multi sign scenarios Mar 2, 2024
@lxcmyf lxcmyf changed the title Improving Error Messaging description for Resource Delegating transactions in multi sign scenarios Improving Error Messaging description for Resource Delegating in multi sign scenarios Mar 2, 2024
@lxcmyf lxcmyf changed the title Improving Error Messaging description for Resource Delegating in multi sign scenarios Improving Error Messaging description for transactions in multi sign scenarios Mar 2, 2024
@lxcmyf lxcmyf changed the title Improving Error Messaging description for transactions in multi sign scenarios Optimize error message of Multi-sign Transactions Mar 4, 2024
@lxcmyf
Copy link
Contributor Author

lxcmyf commented Mar 12, 2024

Considering that the abnormal information thrown by option 2 may cause ambiguity, option 1 will be used to optimize this issue.

@lxcmyf lxcmyf changed the title Optimize error message of Multi-sign Transactions Optimize TRX insufficient error message of multi-sign transaction Mar 18, 2024
@lxcmyf lxcmyf changed the title Optimize TRX insufficient error message of multi-sign transaction Optimize Insufficient TRX Error Message of Multi-Sign Transaction Mar 18, 2024
@abn2357
Copy link

abn2357 commented Jun 24, 2024

Considering that the abnormal information thrown by option 2 may cause ambiguity, option 1 will be used to optimize this issue.
@lxcmyf
Option 1 is also my choose. But I have another question, whether the error message can contain the information of minimum quantity of TRX the account should have.

@lxcmyf
Copy link
Contributor Author

lxcmyf commented Jun 28, 2024

@YuMenGuan
It's feasible, good advice.

@lxcmyf
Copy link
Contributor Author

lxcmyf commented Jul 23, 2024

For this issue, further assessment will be conducted on the current error message return mechanism to identify the most suitable improvement direction. Ensuring better compatibility in future version updates is a priority.

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

No branches or pull requests

5 participants