Fix tx simulate re-assembly dropping auth and double-counting fees - #2666
Merged
Conversation
fnando
force-pushed
the
reassemble-auth-and-fee
branch
from
August 4, 2026 11:40
f8ef108 to
15cb765
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes tx simulate reassembly to preserve recorded authorization correctly and avoid resource-fee inflation.
Changes:
- Replaces existing auth when explicit recording mode is requested.
- Subtracts an existing resource fee before applying the simulated fee.
- Adds focused unit tests for auth and fee behavior.
leighmcculloch
approved these changes
Aug 4, 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
Fixes two bugs in
assemble()(cmd/soroban-cli/src/assembled.rs) that surface whentx simulateruns on an envelope that is already assembled or partially authorized.Recorded auth is no longer dropped. The requested auth mode is now threaded into
assemble(). When an explicit record mode (--auth-mode=root/non-root) is used, the simulation-recorded authorization entries replace the entries already on the transaction. Forenforce/ unset, the previous behavior is kept: auth is only filled in when the operation has none, so caller-provided entries are preserved.The resource fee is no longer double-counted. If the incoming transaction already carries
SorobanTransactionData(extV1) whoseresource_feeis folded intoraw.fee, that amount is now subtracted from the inclusion fee before adding the simulated resource fee (only whenraw.fee > resource_fee), mirroring the JS SDK'sassembleTransactionguard.Why
Re-simulating an already-assembled/partially-authorized envelope — e.g. re-recording a partially authorized transaction to capture non-root sub-invocation auth — previously silently discarded freshly recorded auth and inflated the fee. Fixes #2603.
Known limitations
When a record mode is requested but the simulation returns empty recorded auth, existing entries are fully replaced (cleared) to match what was recorded — the "full replace" reading of the issue.