Skip to content

Fix --sender flag ignored in publish/upgrade commands - #25016

Merged
stefan-mysten merged 2 commits into
MystenLabs:mainfrom
Talus-Network:fix/sender-flag-publish-upgrade
Jan 21, 2026
Merged

Fix --sender flag ignored in publish/upgrade commands#25016
stefan-mysten merged 2 commits into
MystenLabs:mainfrom
Talus-Network:fix/sender-flag-publish-upgrade

Conversation

@tuky191

@tuky191 tuky191 commented Jan 20, 2026

Copy link
Copy Markdown
Contributor

Description

Fixes a bug where the --sender flag was ignored when using --serialize-unsigned-transaction with sui client publish and sui client upgrade commands.

The TxProcessingArgs::sender field is documented as:

Set the transaction sender to this address. When not specified, the sender is inferred by finding the owner of the gas payment.

However, publish_command and upgrade_command were always inferring the sender from gas objects, never checking processing.sender. This caused the UpgradeCap to be transferred to the inferred address instead of the specified sender.

This was problematic for workflows where:

  • The transaction is serialized for later signing by a different party
  • The signer address differs from the address owning the gas objects

The fix makes the implementation match the documented behavior: check processing.sender first and only fall back to gas inference if not specified.

Test plan

Added test_publish_sender_flag_respected_in_serialized_transaction which:

  1. Creates a test cluster with two addresses (address_0 as active, address_1 as specified sender)
  2. Calls TestPublish with --serialize-unsigned-transaction and --sender address_1
  3. Verifies the transaction sender is address_1
  4. Verifies the UpgradeCap recipient in the PTB is address_1, not address_0
cargo test -p sui --test cli_tests test_publish_sender_flag_respected_in_serialized_transaction

Release notes

Check each box that your changes affect. If none of the boxes relate to your changes, release notes aren't required.

For each box you select, include information after the relevant heading that describes the impact of your changes that a user might notice and any actions they must take to implement updates.

  • Protocol:
  • Nodes (Validators and Full nodes):
  • gRPC:
  • JSON-RPC:
  • GraphQL:
  • CLI: The --sender flag is now correctly respected in sui client publish and sui client upgrade commands when used with --serialize-unsigned-transaction. Previously, the sender was incorrectly inferred from gas objects, ignoring the --sender flag.
  • Rust SDK:
  • Indexing Framework:

@vercel

vercel Bot commented Jan 20, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
sui-docs Ready Ready Preview, Comment Jan 21, 2026 10:57am
2 Skipped Deployments
Project Deployment Review Updated (UTC)
multisig-toolkit Ignored Ignored Preview Jan 21, 2026 10:57am
sui-kiosk Ignored Ignored Preview Jan 21, 2026 10:57am

Request Review

@stefan-mysten

Copy link
Copy Markdown
Contributor

Thanks @tuky191, I'll do a few updates and try to merge asap.

@stefan-mysten

stefan-mysten commented Jan 20, 2026

Copy link
Copy Markdown
Contributor

@tuky191 it appears that I cannot push on this PR. There's two things to fix

  1. run cargo fmt in crates/sui folder and commit those changes
  2. add
let sender = processing
    .sender
    .unwrap_or(context.infer_sender(&payment.gas).await?);

to SuiClientCommands::SerializedTx { and SuiClientCommands::Call cases as well.

Thanks again for your fix.

@tuky191

tuky191 commented Jan 21, 2026

Copy link
Copy Markdown
Contributor Author

Hey @stefan-mysten, thanks for looking into this. I have fixed the formatting, the CI should pass now.

@tuky191
tuky191 temporarily deployed to sui-typescript-aws-kms-test-env January 21, 2026 17:17 — with GitHub Actions Inactive
@stefan-mysten
stefan-mysten merged commit e082c0b into MystenLabs:main Jan 21, 2026
53 of 54 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants