Skip to content

Wrap large fee transactions with fee bump transaction#2382

Open
mootz12 wants to merge 8 commits intomainfrom
add-fee-wrap
Open

Wrap large fee transactions with fee bump transaction#2382
mootz12 wants to merge 8 commits intomainfrom
add-fee-wrap

Conversation

@mootz12
Copy link
Contributor

@mootz12 mootz12 commented Feb 10, 2026

What

  • Create a helper method for transaction simulation, signing, and sending logic
  • Wrap transaction in fee bump transaction if fee is larger than u32::MAX
    • Minor integration test organization for fee related tests
  • Add warning during tx simulate if transaction needs a fee bump transaction
  • Make logging more consistent across TX types

Output for fee bump transaction during invoke and other Soroban commands:

$ stellar contract invoke --inclusion-fee 2000 --resource-fee 4294967195 --id TEST -- set_data --value 2                                                                                                                               
ℹ️  Simulating transaction…
ℹ️  Signing transaction: b81bec30c4ea3769724b305926dd0eca4297f51c8af4bd32971f8f7f410706b5
⚠️  Wrapping transaction with a fee bump transaction due to a fee of 429.4971195 XLM.
ℹ️  Signing fee bump transaction: 878f3da8a9578f10fd6e786c74ddf408ccdf9056b753aa37f59df7898f030672
🌎 Sending transaction…
✅ Transaction submitted successfully!
🔗 https://stellar.expert/explorer/testnet/tx/878f3da8a9578f10fd6e786c74ddf408ccdf9056b753aa37f59df7898f030672
📅 CDT3IOTFNVCFL7UGBULSNPQF7HWZ4ISCO5YSZNOC76YL4UDZJQNG7PNG - Success - Event: TestEvent (test_event), topic: "data", data: 2

Output for simulation that exceeds u32::MAX:

$ stellar tx simulate AAAAAgAAAADnzmJ1TfL9/vrRDswUSxrxwnqYiElhLU1AHL9VkxpDvf///5sAAZqUAAAAHAAAAAAAAAAAAAAAAQAAAAAAAAAYAAAAAAAAAAHntDplbURV/oYNFya+BfntniJCd3EstcL/sL5QeUwabwAAAAhzZXRfZGF0YQAAAAEAAAADAAAAAgAAAAAAAAAAAAAAAA==
⚠️  The transaction fee of 858.9950377 is too large and needs to be wrapped in a fee bump transaction.
AAAAAgAAAADnzmJ1TfL9/vrRDswUSxrxwnqYiElhLU1AHL9VkxpDvQAAAAAAAZqUAAAAHAAAAAAAAAAAAAAAAQAAAAAAAAAYAAAAAAAAAAHntDplbURV/oYNFya+BfntniJCd3EstcL/sL5QeUwabwAAAAhzZXRfZGF0YQAAAAEAAAADAAAAAgAAAAAAAAABAAAAAAAAAAIAAAAGAAAAAee0OmVtRFX+hg0XJr4F+e2eIkJ3cSy1wv+wvlB5TBpvAAAAFAAAAAEAAAAHu0IxLmH9Swk39i9/ueSRuTbCBvufPF4Y2iwLm5y2ijsAAAABAAAABgAAAAHntDplbURV/oYNFya+BfntniJCd3EstcL/sL5QeUwabwAAAA4AAAAFa2V5XzEAAAAAAAABAAYjtgAAAAAAAABQAAAAAAAAPnMAAAAA

For the logging update, here is a standard invoke command:

$ stellar contract invoke --id P25 -- set_data --value 2                 
ℹ️  Simulating transaction…
ℹ️  Signing transaction: 161c6c55abe7000894c76d5288c8bfaaa4c8551e3892b422c794abc25d8a42e6
🌎 Sending transaction…
✅ Transaction submitted successfully!
🔗 https://stellar.expert/explorer/testnet/tx/161c6c55abe7000894c76d5288c8bfaaa4c8551e3892b422c794abc25d8a42e6
📅 CDT3IOTFNVCFL7UGBULSNPQF7HWZ4ISCO5YSZNOC76YL4UDZJQNG7PNG - Success - Event: TestEvent (test_event), topic: "data", data: 2

And the deploy from WASM file command:

$ stellar contract deploy --wasm ./target/wasm32v1-none/test-wasms/test_custom_account.wasm
ℹ️  Uploading contract WASM…
ℹ️  Simulating transaction…
ℹ️  Signing transaction: a9257b088a8b25921e38d1e64af90893020899b62ff7a6077beeb205a9d8163c
🌎 Sending transaction…
✅ Transaction submitted successfully!
🔗 https://stellar.expert/explorer/testnet/tx/a9257b088a8b25921e38d1e64af90893020899b62ff7a6077beeb205a9d8163c
ℹ️  Deploying contract using wasm hash 876a6321fa231cff3d760995cfb5a8947188dd6c49967baa5ef9f095870af9be
ℹ️  Simulating transaction…
ℹ️  Signing transaction: a881b41064c96c097d5d0f3723673ae0673642e5ab74fe38579d4880693a0bbe
🌎 Sending transaction…
✅ Transaction submitted successfully!
🔗 https://stellar.expert/explorer/testnet/tx/a881b41064c96c097d5d0f3723673ae0673642e5ab74fe38579d4880693a0bbe
🔗 https://lab.stellar.org/r/testnet/contract/CA6OERGEHWPN4OHLS7L2XDJGVSFE5Y24H2DAFEHX37GGFBOXY3G2LM62
✅ Deployed!
CA6OERGEHWPN4OHLS7L2XDJGVSFE5Y24H2DAFEHX37GGFBOXY3G2LM62

Why

Closes #2314

Known limitations

  • We currently have no way to notify user of transaction fees (or potentially have them acknowledge them). If the fees are high and they have the XLM, it will submit
  • The combined logic for transaction submission is likely doing some unnecessary work for commands like upload when attempting to sign soroban auth entries. Going to address this is a follow-up PR, but I think it is OK as is.

Copilot AI review requested due to automatic review settings February 10, 2026 14:20
@github-project-automation github-project-automation bot moved this to Backlog (Not Ready) in DevX Feb 10, 2026
Comment on lines -89 to -98
/// Create a transaction for restoring any data in the `restore_preamble` field of the `SimulateTransactionResponse`.
///
/// # Errors
pub fn restore_txn(&self) -> Result<Option<Transaction>, Error> {
if let Some(restore_preamble) = &self.sim_res.restore_preamble {
restore(self.transaction(), restore_preamble).map(Option::Some)
} else {
Ok(None)
}
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

restore flow was dead code, so removed. Not necessary after P23

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we may need to reconsider this, and make sure we're trying restoring data: #2029 (comment)

Copy link
Contributor Author

@mootz12 mootz12 Feb 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are we OK adding this back in that issue if it's needed? The code was unused.

@mootz12 mootz12 changed the title Add fee wrap Wrap large fee transactions with fee bump transaction Feb 10, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds automatic fee-bump wrapping support to Soroban transaction submission flows so transactions with total fees exceeding u32::MAX can still be signed and sent, and surfaces a user warning during tx simulate when a fee bump would be required.

Changes:

  • Introduces a shared sim_sign_and_send_tx helper to centralize simulate → assemble → sign → send logic across multiple commands.
  • Updates assembly/signing to support fee-bump envelopes when required (fee > u32::MAX), including hashing/signing fee-bump transactions.
  • Reorganizes and extends integration tests around fee behavior, including validating fee-bump usage.

Reviewed changes

Copilot reviewed 16 out of 16 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
cmd/soroban-cli/src/utils.rs Adds fee bump transaction hashing helper for signing.
cmd/soroban-cli/src/tx.rs Adds sim_sign_and_send_tx helper; wraps signed tx in fee bump when needed.
cmd/soroban-cli/src/signer/mod.rs Adds signing support for fee bump envelopes and refactors signing logic.
cmd/soroban-cli/src/resources.rs Expands allowable --resource-fee range to i64-scale values.
cmd/soroban-cli/src/config/mod.rs Adds sign_fee_bump for fee bump envelope signing.
cmd/soroban-cli/src/commands/tx/simulate.rs Emits warning when simulation indicates a fee bump is needed.
cmd/soroban-cli/src/commands/contract/{upload,restore,invoke,extend}.rs Switches to shared sim/sign/send helper.
cmd/soroban-cli/src/commands/contract/deploy/{asset,wasm}.rs Switches to shared sim/sign/send helper.
cmd/soroban-cli/src/assembled.rs Tracks required fee-bump fee and sets inner tx fee to 0 when overflow; updates unit tests accordingly.
cmd/crates/soroban-test/tests/it/integration/fees.rs Consolidates fee-related integration tests and adds fee bump coverage.
cmd/crates/soroban-test/tests/it/integration/fee_stats.rs Removes standalone fee stats integration test file (moved into fees.rs).
cmd/crates/soroban-test/tests/it/integration.rs Updates integration module list to use consolidated fees module.

mootz12 and others added 2 commits February 10, 2026 09:29
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@mootz12 mootz12 requested a review from a team February 10, 2026 14:56
@mootz12 mootz12 requested a review from fnando February 11, 2026 20:17
}

if let Some(url) = utils::lab_url_for_contract(&network, &contract_id) {
print.linkln(url);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The generic sim_sign_and_send_tx only logs the block explorer transaction URL and "Transaction submitted successfully!". The contract-specific Lab URL is lost.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, misread this originally, thought this was just the stellar expert link.

Per comment on print.checkln("Deployed!");, updating both wasm and asset logs to do the following:

ℹ️  Deploying contract using wasm hash 47cc4c626c7a08aea93d4ee5287735bb8a218c46a6497831ac15d8539b4b6434
ℹ️  Simulating transaction…
ℹ️  Signing transaction: df074c8fbd3b5b3344fedb04f69b0a6d22fe4a100c272a42a7447425ec6a9449
🌎 Sending transaction…
✅ Transaction submitted successfully!
🔗 https://stellar.expert/explorer/testnet/tx/df074c8fbd3b5b3344fedb04f69b0a6d22fe4a100c272a42a7447425ec6a9449
🔗 https://lab.stellar.org/r/testnet/contract/CCOJXK5ASRFN6TU3EBTMVN4I6T4DLYNSPSNNOZ7RDWYLOGK6J7GXNIKT
✅ Deployed!
CCOJXK5ASRFN6TU3EBTMVN4I6T4DLYNSPSNNOZ7RDWYLOGK6J7GXNIKT

@mootz12 mootz12 requested a review from fnando February 12, 2026 21:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Backlog (Not Ready)

Development

Successfully merging this pull request may close these issues.

Allow resource fees exceeding u32::MAX

2 participants