-
Notifications
You must be signed in to change notification settings - Fork 124
Apply inclusion fee and resource fee to simulated tx correctly #2355
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
Conversation
leighmcculloch
left a comment
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.
👋🏻 Little concerned we're working around and covering a bug, take a look inline.
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.
Pull request overview
This PR fixes a bug in how transaction fees are calculated when simulating and assembling Stellar transactions. Previously, the code was overriding the inclusion fee instead of properly adding it to the resource fee.
Changes:
- Changed
resource_feeparameter type fromu64toi64to match XDR spec, with validation to ensure non-negative values - Fixed fee calculation to sum inclusion fee and resource fee instead of taking the maximum
- Applied user-specified resource fee to the transaction_data structure when provided
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| cmd/soroban-cli/src/resources.rs | Changed resource_fee type to i64 with range validation, matching XDR specification |
| cmd/soroban-cli/src/assembled.rs | Fixed fee calculation logic, removed DEFAULT_TRANSACTION_FEES constant, properly applies resource_fee to transaction_data, added comprehensive tests for edge cases |
Co-authored-by: Leigh <[email protected]>
Co-authored-by: Copilot <[email protected]>
What
We were overriding inclusion fee and not applying resource fee inputs to the simulated transaction