Skip to content

Conversation

@fnando
Copy link
Member

@fnando fnando commented Aug 5, 2025

When build_only is specified, skip the should_send_tx check that could prevent transaction assembly and building.

What

Close #2109.

# before
$ stellar contract invoke --id hello --build-only -- hello --to 'fnando'
ℹ️ Simulation identified as read-only. Send by rerunning with `--send=yes`.
["Hello","fnando"]

# after
$ stellar contract invoke --id hello --build-only -- hello --to 'fnando'
AAAAAgAAAADYcrin+iEjGmimHUdHO1ayN/n4bkbl6AqSvsit9+nL8QAAAGQAC0v9AAAACAAAAAAAAAAAAAAAAQAAAAAAAAAYAAAAAAAAAAE6MO1DdzCGq9XRsczB3lcR8GiBJQcHysbuKULvAtrpAAAAAAVoZWxsbwAAAAAAAAEAAAAOAAAABmZuYW5kbwAAAAAAAAAAAAAAAAAA

$ pbpaste | stellar xdr decode --type TransactionEnvelope
{"tx":{"tx":{"source_account":"GDMHFOFH7IQSGGTIUYOUORZ3K2ZDP6PYNZDOL2AKSK7MRLPX5HF7DEA4","fee":100,"seq_num":"3179774742626312","cond":"none","memo":"none","operations":[{"source_account":null,"body":{"invoke_host_function":{"host_function":{"invoke_contract":{"contract_address":"CA5DB3KDO4YINK6V2GY4ZQO6K4I7A2EBEUDQPSWG5YUUF3YC3LUQAB2P","function_name":"hello","args":[{"string":"fnando"}]}},"auth":[]}}}],"ext":"v0"},"signatures":[]}}

Why

Because build-only implies getting the xdr back, so it makes no sense detecting invocations as read-only in this case.

Known limitations

N/A

When build_only is specified, skip the should_send_tx check that could
prevent transaction assembly and building.
@github-project-automation github-project-automation bot moved this to Backlog (Not Ready) in DevX Aug 5, 2025
Copy link
Collaborator

@elizabethengelman elizabethengelman left a comment

Choose a reason for hiding this comment

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

LGTM! 🎉

One comment inline, that doesn't have to be addressed in this PR, just an idea.

@fnando fnando merged commit af99b6e into main Aug 5, 2025
35 checks passed
@fnando fnando deleted the invoke-build-only branch August 5, 2025 17:57
@github-project-automation github-project-automation bot moved this from Backlog (Not Ready) to Done in DevX Aug 5, 2025
.await?;
let should_send = self.should_send_tx(&assembled.sim_res)?;

let should_send = if self.fee.build_only {
Copy link
Member

Choose a reason for hiding this comment

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

If build only is specified, I would expect no simulation to be taking place. Somethiing still doesn't seem right about the flow in this command.

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.

--build-only not respected without --send=yes on stellar contract invoke

4 participants