Fix TransactionBuilder.cloneFrom fee calculation #1478
Merged
Merged
Conversation
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
There was a problem hiding this comment.
Pull request overview
This PR fixes TransactionBuilder.cloneFrom for Soroban transactions by deriving baseFee from the inclusion fee only (excluding sorobanData.resourceFee), preventing the resource fee from being double-counted when rebuilding/cloning transactions.
Changes:
- Adjust
TransactionBuilder.cloneFromto subtract SorobanresourceFeebefore computing the per-operationbaseFee, and carrysorobanDatainto the cloned builder. - Add unit tests covering correct
baseFeederivation and malformed-fee edge handling. - Update reference docs source line links and add a changelog entry describing the fix.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/base/transaction_builder.ts | Fixes Soroban fee handling in cloneFrom and preserves sorobanData when cloning. |
| test/unit/base/transaction_builder.test.ts | Adds coverage for Soroban resourceFee exclusion and malformed-fee behavior. |
| docs/reference/core-transactions.md | Updates source links to reflect shifted line numbers after the implementation change. |
| CHANGELOG.md | Documents the Soroban cloneFrom fee derivation fix and sorobanData carry-over. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+309
to
+312
| // if this is a Soroban transaction, the resource fee is folded into the | ||
| // total fee and gets re-added on build(), so it has to be excluded before | ||
| // deriving the per-operation base fee | ||
| let sorobanData: xdr.SorobanTransactionData | undefined; |
| ).toBe(resourceFee); | ||
| }); | ||
|
|
||
| it("skips the resource fee subtraction when it would zero out the fee", () => { |
quietbits
approved these changes
Jun 12, 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.
What
baseFee