fix: Add feePayer logic in txQ#7613
Conversation
58a9693 to
c6f58e5
Compare
c6f58e5 to
5688ef6
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #7613 +/- ##
=========================================
- Coverage 82.0% 82.0% -0.0%
=========================================
Files 1007 1007
Lines 76890 76925 +35
Branches 8971 8979 +8
=========================================
+ Hits 63049 63059 +10
- Misses 13832 13857 +25
Partials 9 9
🚀 New features to boost your workflow:
|
| else | ||
| { | ||
| sleAccountBump->setFieldAmount(sfBalance, accountBalance - potentialAccountSpend); | ||
| sleFeePayerBump->setFieldAmount(sfBalance, balance - totalFee); |
There was a problem hiding this comment.
🟡 Severity: MEDIUM
The fee payer's test-view balance is reduced only by their aggregate queued fees (totalFee), but ignores their own queued potentialSpend from their personal transaction queue. A fee payer with a large queued payment can appear to have more available balance than they will actually have, allowing delegated transactions into the queue whose fees exceed the payer's real post-spend capacity.
Helpful? Add 👍 / 👎
💡 Fix Suggestion
Suggestion: The fee payer's own queued potentialSpend (from transactions where the fee payer acts as the account) must also be deducted from their test-view balance. To fix this:
-
After computing
totalFee(around lines 1059-1072), add a new block that looks up the fee payer's own queued transactions inbyAccount_[feePayer](whenfeePayer != account) and sums theirpotentialSpend()into a new variable, e.g.feePayerOwnSpend. -
Update the balance gate check at line 1124 to also account for the fee payer's own potential spend: change
totalFee >= balanceto(totalFee + feePayerOwnSpend) >= balance(and similarly for the reserve check). -
At line 1159, change
balance - totalFeetobalance - totalFee - feePayerOwnSpend(clamped appropriately to avoid underflow), so the test-view balance reflects both the fees owed as a delegate payer and the fee payer's own queued transaction spend.
This ensures that a fee payer who has queued large payments under their own account cannot appear to have more available balance than they will actually have after those payments execute.
|
This PR has conflicts, please resolve them in order for the PR to be reviewed. |
High Level Overview of Change
Because the delegated transactions are paid by the
sfDelegate, but notsfAccount:Context of Change
API Impact
libxrplchange (any change that may affectlibxrplor dependents oflibxrpl)