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
Apply refund to fee bump fee charged #4228
Conversation
// Now set update feeCharged on the fee bump. We don't have access to | ||
// the refund value here, but we can calculate it using the pre and post | ||
// feeCharged of mInnerTx. | ||
int64_t refund = preRefundFeeCharged - mInnerTx->getResult().feeCharged; |
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.
This is a kinda hacky, but it does make sure that any adjustment done to the inner fee charged is also applied to the feeBump feeCharged. We could also just expose the refund from mSorobanExtension
in TransactionFrame
instead, which would be cleaner.
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.
Using mSorobanExtension
isn't trivial though because there are some cases where the refund is skipped - account doesn't exist or liabilities are too high, so that will also need to be taken into account.
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.
yeah this looks pretty foot gunny:
- inner tx's
feeCharged
should be 0 in this case (consistent with classic) - modifying inner tx from the outside like that is brittle
I would recommend refactoring code a bit (maybe add a new virtual function to deal with this)
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.
I think we may be mixing up some terminology between mInnerTx's result vs the innerResultPair of the feeBump result here so just to clarify -
-
Are you saying that
mResult.result.innerResultPair().result.feeCharged
is always 0 in classic? Because that's not true. Here is an example xdr for a payment fee bump where the inner feeCharged isn't 0. And if you're referring tomInnerTx->getResult().feeCharged
this also isn't 0 in classic afaict. -
For your second point, we are not modifying the innerTx's result. We are only modifying the
innerResultPair
of the feeBump result.
2bfc88d
to
67f1ccf
Compare
67f1ccf
to
4739b5e
Compare
r+ 8af4005 |
Description
Resolves #4188
Checklist
clang-format
v8.0.0 (viamake format
or the Visual Studio extension)