Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates Soroban transaction fee handling in rpc.assembleTransaction() to avoid double-counting resourceFee when re-assembling a transaction that already has Soroban data attached.
Changes:
- Adjust
assembleTransaction()fee calculation to subtract any pre-existing SorobanresourceFeebefore cloning/building the transaction. - Add unit tests covering re-assembly and pre-existing Soroban data fee scenarios.
- Document the fix in the changelog.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
src/rpc/transaction.ts |
Updates fee handling during transaction assembly to prevent resourceFee being counted twice. |
test/unit/transaction.test.ts |
Adds tests to ensure fees remain stable across re-assembly and with pre-existing Soroban data. |
CHANGELOG.md |
Notes the fix and the updated responsibility for applying resourceFee. |
Comments suppressed due to low confidence (2)
src/rpc/transaction.ts:94
- The fee-related comment above
TransactionBuilder.cloneFromis now inaccurate: the code no longer addsminResourceFeetofeehere, and instead relies onTransactionBuilder.build()to incorporateresourceFeefrom the Soroban transaction data. Please update/remove this comment so it reflects the current behavior (classic fee may be adjusted by subtracting any pre-existingresourceFee, then passed through as-is).
// automatically update the tx fee that will be set on the resulting tx to
// the sum of 'classic' fee provided from incoming tx.fee and minResourceFee
// provided by simulation.
//
// 'classic' tx fees are measured as the product of tx.fee * 'number of
// operations', In soroban contract tx, there can only be single operation
// in the tx, so can make simplification of total classic fees for the
// soroban transaction will be equal to incoming tx.fee + minResourceFee.
CHANGELOG.md:11
- Grammar nit in changelog entry: "as its now" should be "as it's now" (and consider rephrasing to "Removed adding
resourceFeeinassembleTransaction..." for clarity).
* Removed `resourceFee` adding in `assembleTransaction` as its now handled by `TransactionBuilder.build()`.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Size Change: +16.1 kB (+0.04%) Total Size: 45.1 MB
|
quietbits
approved these changes
Mar 3, 2026
Shaptic
approved these changes
Mar 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
resourceFeeinTransaction.feedue toresourceFeenow being handled inTransactionBuilder.build()rpc.assembleTransaction()now checks if therawtransaction has already been simulated and subtractsxdr.SorobanTransactionData.resourceFee()if the resultingTransaction.feeremains greater than 0.