Skip to content

feat: support muxed (M…) source accounts in the contract invoke pipeline - #2694

Open
Galmanus wants to merge 1 commit into
stellar:mainfrom
Galmanus:fix/2645-muxed-source-invoke
Open

feat: support muxed (M…) source accounts in the contract invoke pipeline#2694
Galmanus wants to merge 1 commit into
stellar:mainfrom
Galmanus:fix/2645-muxed-source-invoke

Conversation

@Galmanus

Copy link
Copy Markdown

What

contract invoke --source-account M… and token transfer --from M… now work end-to-end (simulate → sign → submit). The shared invoke pipeline's sequence-number lookup uses the source's underlying G… account id (MuxedAccount::account_id()) instead of handing the M… strkey to a G-only ed25519 parser. The up-front token transfer guard for muxed sources is removed.

Why

Fixes #2645. Only the underlying account exists on ledger, so the get_account lookup at invoke.rs:352 aborted with a raw strkey DecodeError for any muxed source.

One deviation from the issue's direction, with evidence

The issue suggests the muxed form should keep flowing into the SEP-41 transfer(from, …) argument. Empirically the host rejects that: on a protocol-27 quickstart, a muxed from fails simulation with HostError: Error(Value, UnexpectedType) — consistent with muxed accounts not being valid authorizers (see the ruling in #2534), and from must require_auth. So token transfer resolves a muxed --from to its underlying G… account for the transfer argument, while a muxed --to still flows through as-is and preserves the mux id in the argument and events. Happy to adjust if there's a supported way to carry the mux id on the from side.

Testing

Against a local protocol-27 quickstart:

  • invoke_with_muxed_source_accountcontract invoke --source-account M… --sign-with-key test --send=yes succeeds end-to-end (an M-literal carries no secret, so signing goes through the identity, per the issue's acceptance note).
  • transfer_from_muxed_sourcetoken transfer --from M… --sign-with-key test succeeds and moves the balance (replaces the previous muxed-rejection test).
  • Full integration::token::transfer suite: 9 passed. cargo clippy -p soroban-cli and cargo fmt --check clean.

The shared invoke pipeline handed the source account's strkey to a G-only
ed25519 parser when looking up the sequence number, so `contract invoke
--source-account M…` (and `token transfer --from M…`) aborted with a raw
strkey DecodeError. Only the underlying account exists on ledger, so the
lookup now uses the source's underlying G… account id.

`token transfer` no longer rejects a muxed `--from` up front. The `from`
argument resolves to the underlying G… account: `from` must authorize the
transfer, muxed accounts are not valid authorizers, and the host rejects a
muxed `from` in simulation with `Error(Value, UnexpectedType)`. A muxed
`--to` still flows through as-is, preserving the mux id.

Fixes stellar#2645
Copilot AI balanced review requested due to automatic review settings August 22, 2026 10:35
@github-project-automation github-project-automation Bot moved this to Backlog (Not Ready) in DevX Aug 22, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds end-to-end muxed source-account support to contract invocation and token transfers.

Changes:

  • Uses the underlying G… account for sequence lookup and transaction sourcing.
  • Resolves muxed transfer senders to their underlying authorizing account.
  • Adds integration coverage for muxed contract invocation and token transfers.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
cmd/soroban-cli/src/commands/token/transfer.rs Supports muxed --from accounts.
cmd/soroban-cli/src/commands/contract/invoke.rs Fixes sequence lookup for muxed sources.
cmd/crates/soroban-test/tests/it/integration/token/transfer.rs Tests transfers from muxed sources.
cmd/crates/soroban-test/tests/it/integration/hello_world.rs Tests invocation with a muxed source.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

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.

Support muxed (M…) source accounts in the contract invoke pipeline

2 participants