-
Notifications
You must be signed in to change notification settings - Fork 378
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
fix(tm2): deduct gas fee after runTx #3209
base: master
Are you sure you want to change the base?
Conversation
Codecov ReportAttention: Patch coverage is
📢 Thoughts on this report? Let us know! |
- when gasFeeCollector return error, both Error and Log of result set to res - If gas-fee amount is zero, return error with ErrInsufficientFee
Testcase includes error case and success case - Error Case 1. If UnknownAddress, return error with UnknownAddressError msg 2. If Invalid gas fee, return error with InsufficientFeeError msg 3. If not enough funds, return error with InsufficientFundsError msg 4. If fee denom are invalid, panic - Success Case 1. If success, gasFeeCollector return error with nil and result IsOK, and FeeCollectorAddress get (used gas * fee.Amount) from account balance
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.
In the meeting, I received confirmation that the concerning issues cannot occur. LGTM
remove: review/triage-pending
flag
- as issue that is state already updated even deduct gas fee is failed - change deduct gas fee timing to before state update
Update as new issues are discovered. Issue:After processing a trasaction, if there are not enough assets for the gas fee, it is treated as a failure, but the status change is applied. Cause:After executing the runMsgs function in the runTx function, Fix:
|
resolve #1070 #1067
This PR changes when and how gas fees are collected during transaction processing.
BREAKING CHANGE: need to modify the gas-fee value in your testcode to avoid the insufficient fund failure
As-Is
When : Collect the gas fee before the
AnteHandler
validates the signature of the transaction.How: Sends the quantity of
gas-fee
that is set in the transaction from the originCaller's account to the `FeeCollectorAddress.To-Be
When : Collect the gas fee immediately after the
runTx
function execution is terminated in theDeliverTx
function (the final gas quantity used to process the Transaction is known at the end of the runTx function).How : Sends the amount of
gas-fee
set in the transaction multiplied by the gas used from the originCaller's account to theFeeCollectorAddress
.Implementation
DeductFees
).Concerns
InsufficientFundsError
. If an error is returned, the fee will not be collected, but since the transaction processing was done using a vm in therunTx
function, it looks like the default fee may be required.Contributors' checklist...
BREAKING CHANGE: xxx
message was included in the description