feat: support muxed (M…) source accounts in the contract invoke pipeline - #2694
Open
Galmanus wants to merge 1 commit into
Open
feat: support muxed (M…) source accounts in the contract invoke pipeline#2694Galmanus wants to merge 1 commit into
Galmanus wants to merge 1 commit into
Conversation
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
Contributor
There was a problem hiding this comment.
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.
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.
What
contract invoke --source-account M…andtoken transfer --from M…now work end-to-end (simulate → sign → submit). The shared invoke pipeline's sequence-number lookup uses the source's underlyingG…account id (MuxedAccount::account_id()) instead of handing theM…strkey to a G-only ed25519 parser. The up-fronttoken transferguard for muxed sources is removed.Why
Fixes #2645. Only the underlying account exists on ledger, so the
get_accountlookup atinvoke.rs:352aborted with a raw strkeyDecodeErrorfor 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 muxedfromfails simulation withHostError: Error(Value, UnexpectedType)— consistent with muxed accounts not being valid authorizers (see the ruling in #2534), andfrommustrequire_auth. Sotoken transferresolves a muxed--fromto its underlyingG…account for thetransferargument, while a muxed--tostill 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 thefromside.Testing
Against a local protocol-27 quickstart:
invoke_with_muxed_source_account—contract invoke --source-account M… --sign-with-key test --send=yessucceeds end-to-end (an M-literal carries no secret, so signing goes through the identity, per the issue's acceptance note).transfer_from_muxed_source—token transfer --from M… --sign-with-key testsucceeds and moves the balance (replaces the previous muxed-rejection test).integration::token::transfersuite: 9 passed.cargo clippy -p soroban-cliandcargo fmt --checkclean.