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

Subtract refund from feeCharged #4171

Merged
merged 3 commits into from
Jan 30, 2024
Merged

Conversation

sisuresh
Copy link
Contributor

Description

Resolves #4161

Checklist

  • Reviewed the contributing document
  • Rebased on top of master (no merge commits)
  • Ran clang-format v8.0.0 (via make format or the Visual Studio extension)
  • Compiles
  • Ran all tests
  • If change impacts performance, include supporting evidence per the performance document

@@ -813,6 +813,8 @@ TransactionFrame::refundSorobanFee(AbstractLedgerTxn& ltxOuter)
return;
}

getResult().feeCharged -= feeRefund;
Copy link
Contributor

Choose a reason for hiding this comment

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

No chance of feeCharged going negative here, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There should be no way for this to happen because we always initialize feeCharged to the charged fee. If it were to go negative due to a bug (feeCharged is a int64), it wouldn't be catastrophic from a core perspective because we don't use the value, but would definitely need to be fixed.

Copy link
Contributor

@MonsieurNicolas MonsieurNicolas left a comment

Choose a reason for hiding this comment

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

looks good but it looks like a test file changed?

@sisuresh
Copy link
Contributor Author

sisuresh commented Jan 30, 2024

looks good but it looks like a test file changed?

The second commit modifies an existing test to make sure that feeCharged does not take the refund into account during tx queue validation. This is an adjacent check to the main change in this PR.

@MonsieurNicolas
Copy link
Contributor

r+ 2048569

@latobarita latobarita merged commit cb2a373 into stellar:master Jan 30, 2024
15 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.

feeCharged in TransactionResult does not take refund into account.
5 participants