Skip to content

Fix TransactionBuilder.cloneFrom fee calculation #1478

Merged
Ryang-21 merged 1 commit into
masterfrom
fix-tx-clone-from
Jun 12, 2026
Merged

Fix TransactionBuilder.cloneFrom fee calculation #1478
Ryang-21 merged 1 commit into
masterfrom
fix-tx-clone-from

Conversation

@Ryang-21

Copy link
Copy Markdown
Contributor

What

  • TransactionBuilder.cloneFrom now correctly subtracts the SorbanData.resourceFee when deriving the original baseFee

Copilot AI review requested due to automatic review settings June 12, 2026 18:07
@github-project-automation github-project-automation Bot moved this to Backlog (Not Ready) in DevX Jun 12, 2026
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Credits must be used to enable repository wide code reviews.

Copilot AI left a comment

Copy link
Copy Markdown

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 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.cloneFrom to subtract Soroban resourceFee before computing the per-operation baseFee, and carry sorobanData into the cloned builder.
  • Add unit tests covering correct baseFee derivation 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", () => {
@Ryang-21 Ryang-21 merged commit f8a0a7f into master Jun 12, 2026
12 checks passed
@Ryang-21 Ryang-21 deleted the fix-tx-clone-from branch June 12, 2026 20:26
@github-project-automation github-project-automation Bot moved this from Backlog (Not Ready) to Done in DevX Jun 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants