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

rename getFeeBid -> getInclusionFee, bugfixes #3838

Merged
merged 6 commits into from
Jul 20, 2023

Conversation

marta-lokhova
Copy link
Contributor

Extracting these changes from my flooding tess as there is no reason to bundle them together.

  • rename getFeeBid -> getIncusionFee; this improves readability and helps spot inclusion fee better
  • Resolves Fix transaction fee validation #3836
  • Updates tx queue limiter to return minimum full fee needed to evict, not just inclusion

I added some comments to help clarify when to use inclusion vs full fee. Reviewers, please help audit inclusion fee usage.

@@ -164,9 +164,13 @@ TxQueueLimiter::canAddTx(TransactionFrameBasePtr const& newTx,
computeBetterFee(
mLaneEvictedFeeBid[SurgePricingPriorityQueue::GENERIC_LANE],
*newTx));
// minFeeToBeatEvicted is the minimum _inclusion_ fee to evict txs. For
// reporting, return _full_ minimum fee
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe rename this to minInclusionFeeToBeatEvicted then?

@@ -164,9 +164,13 @@ TxQueueLimiter::canAddTx(TransactionFrameBasePtr const& newTx,
computeBetterFee(
mLaneEvictedFeeBid[SurgePricingPriorityQueue::GENERIC_LANE],
*newTx));
// minFeeToBeatEvicted is the minimum _inclusion_ fee to evict txs. For
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe also rename mLaneEvictedFeeBid to mLaneEvictedInclusionFee for consistency? I think we just need to get rid of fee bid everywhere eventually for the sake of consistency.

@@ -963,7 +965,7 @@ TxSetFrame::getTotalBids() const
total += std::accumulate(
phase.begin(), phase.end(), int64_t(0),
[&](int64_t t, TransactionFrameBasePtr const& tx) {
return t + tx->getFeeBid();
return t + tx->getInclusionFee();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shall we also rename this to getTotalInclusionFee?

@@ -303,6 +303,7 @@ int64_t getPoolWithdrawalAmount(int64_t amountPoolShares,
void maybeUpdateAccountOnLedgerSeqUpdate(LedgerTxnHeader const& header,
LedgerTxnEntry& account);

// Get min _inclusion_ fee needed for this transaction
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rename to getMinInclusionFee instead of comment?

@marta-lokhova
Copy link
Contributor Author

@dmkozh updated the PR based on your suggestions and rebased it as well. Let me know if it looks good.

@dmkozh
Copy link
Contributor

dmkozh commented Jul 20, 2023

r+ e019135

@latobarita latobarita merged commit 9b8a8d0 into stellar:master Jul 20, 2023
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fix transaction fee validation
3 participants