txnbuild: Add txnbuild helper for sending a payment to a smart contract#5642
Merged
tamirms merged 15 commits intostellar:masterfrom Apr 17, 2025
Merged
txnbuild: Add txnbuild helper for sending a payment to a smart contract#5642tamirms merged 15 commits intostellar:masterfrom
tamirms merged 15 commits intostellar:masterfrom
Conversation
Shaptic
reviewed
Mar 26, 2025
tamirms
commented
Mar 26, 2025
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR adds txnbuild helpers for sending a payment to a smart contract and for restoring an asset balance via a new restore footprint operation. It also updates fee handling and adjusts integration tests to use the new helper signatures while removing legacy fee parameters.
- Introduces NewAssetBalanceRestoration and NewPaymentToContract functions with configurable Soroban fee values.
- Updates integration tests to use the new Preflight functions without separate minFee values.
- Refactors code across txnbuild and integration tests to align with these helper changes.
Reviewed Changes
Copilot reviewed 22 out of 22 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| txnbuild/restore_footprint.go | Adds a helper for constructing asset balance restoration operations. |
| txnbuild/invoke_host_function.go | Adds a helper for constructing payment-to-contract operations with updated fee handling. |
| Integration tests (various files) | Adjust test calls to use the new helper function signatures by removing extra fee parameters. |
| Horizon integration tests | Update fee-bump and Preflight function calls to support the new txnbuild APIs. |
Comments suppressed due to low confidence (2)
services/horizon/internal/integration/integration.go:816
- Double-check that all callers of PreflightHostFunctions have been updated to handle the new signature returning a single value, as the removal of minFee could cause runtime issues if any outdated expectation remains.
return function
services/horizon/internal/integration/invokehostfunction_test.go:130
- [nitpick] Consider defining a named constant for 'HostFunctionTypeHostFunctionTypeUploadContractWasm' to improve code clarity and reduce potential typos in repeated usage.
assert.Equal(t, invokeHostFunctionOpJson.Function, "HostFunctionTypeHostFunctionTypeUploadContractWasm")
sreuland
reviewed
Apr 8, 2025
sreuland
reviewed
Apr 8, 2025
sreuland
reviewed
Apr 8, 2025
sreuland
reviewed
Apr 8, 2025
sreuland
reviewed
Apr 8, 2025
sreuland
reviewed
Apr 8, 2025
Co-authored-by: shawn <sreuland@users.noreply.github.com>
Contributor
Author
|
@sreuland can you take another look at the PR? |
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.
PR Checklist
PR Structure
otherwise).
services/friendbot, orallordocif the changes are broad or impact manypackages.
Thoroughness
.mdfiles, etc... affected by this change). Take a look in the
docsfolder for a given service,like this one.
Release planning
CHANGELOG.mdwithin the component folder structure. For example, if I changed horizon, then I updated (services/horizon/CHANGELOG.md. I add a new line item describing the change and reference to this PR. If I don't update a CHANGELOG, I acknowledge this PR's change may not be mentioned in future release notes.semver, or if it's mainly a patch change. The PR is targeted at the next
release branch if it's not a patch change.
What
Close https://github.com/stellar/go/issues/5626
Update txnbuild to support constructing SAC payments to contracts with default fees so that simulateTransaction calls to rpc are not necessary.
Also fixes a bug in txnbuild where the max fee in the transaction envelope did not include the additional soroban resource fee.
Why
see https://github.com/stellar/go/issues/5626
Known limitations
[N/A]