Skip to content

Remove undocumented ledger / ledger:N positional shorthand#2560

Merged
fnando merged 1 commit intomainfrom
remove-ledger-shorthand
May 6, 2026
Merged

Remove undocumented ledger / ledger:N positional shorthand#2560
fnando merged 1 commit intomainfrom
remove-ledger-shorthand

Conversation

@fnando
Copy link
Copy Markdown
Member

@fnando fnando commented May 5, 2026

What

Drop the undocumented ledger / ledger:N positional shorthand for UnresolvedMuxedAccount. Any command that takes an account argument (keys fund, keys address, tx sign, contract invoke --source-account, …) used to silently route to a connected Ledger device when given ledger or ledger:N. After this change, the only way to derive an address from a Ledger is the explicit --ledger flag.

UnresolvedMuxedAccount::Ledger(u32) is removed entirely. keys address/keys fund now derive the public key directly via signer::ledger::new(index).public_key() in their --ledger branch. resolve_muxed_account_sync collapses into resolve_muxed_account (the only async branch was Ledger), and several call sites lose now-unnecessary async/.await. The four dependent error variants (LedgerNotSupported, LedgerPrivateKeyRevealNotSupported, LedgerIsInvalidKeyName, and the ledger::Error From impl) become unreachable and are removed.

--sign-with-ledger and keys add ledger (the Secret::Ledger flow) are out of scope and untouched.

Closes #2559.

Why

The shorthand was introduced in #1627 and has been live since 2025-02-14, but it was never mentioned in --help, FULL_HELP_DOCS.md, the README, or any example. With #2557 introducing an explicit --ledger flag (and #2558 extending it to keys fund), the positional shorthand becomes a confusing and undocumented second way to reach the device — and one that can't be scoped per-command.

Known limitations

N/A

@github-project-automation github-project-automation Bot moved this to Backlog (Not Ready) in DevX May 5, 2026
Base automatically changed from keys-fund-ledger to main May 6, 2026 01:32
@fnando fnando force-pushed the remove-ledger-shorthand branch from cc17850 to d9a9170 Compare May 6, 2026 16:01
@fnando fnando marked this pull request as ready for review May 6, 2026 16:01
Copilot AI review requested due to automatic review settings May 6, 2026 16:01
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Removes the undocumented ledger / ledger:N positional shorthand routing in UnresolvedMuxedAccount, making Ledger address derivation available only via explicit per-command flags (e.g. keys address --ledger, keys fund --ledger). This simplifies account resolution by eliminating the only async branch (Ledger) and converting a number of call sites back to synchronous resolution.

Changes:

  • Remove UnresolvedMuxedAccount::Ledger(u32) and the ledger/ledger:N parsing path; collapse resolve_muxed_account_sync into resolve_muxed_account.
  • Update transaction-building / contract commands to use the new synchronous source_account() and resolve_muxed_account() APIs (dropping now-unnecessary async/.await).
  • Update Ledger-related tests and add unit coverage ensuring ledger/ledger:N are no longer recognized as special shorthand.

Reviewed changes

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

Show a summary per file
File Description
cmd/soroban-cli/src/tx/builder/asset.rs Switch issuer resolution to the new sync resolve_muxed_account.
cmd/soroban-cli/src/config/mod.rs Make source_account() synchronous and update callers accordingly.
cmd/soroban-cli/src/config/address.rs Remove Ledger shorthand parsing/variant; rename sync resolver to resolve_muxed_account; add unit tests for shorthand removal.
cmd/soroban-cli/src/commands/tx/op/mod.rs Make tx op dispatch synchronous (no remaining async dependency).
cmd/soroban-cli/src/commands/tx/op/add/mod.rs Remove async from run() and from add_op call flow.
cmd/soroban-cli/src/commands/tx/mod.rs Update tx operation execution to the new sync run().
cmd/soroban-cli/src/commands/tx/args.rs Convert source-account resolution and add_op to synchronous use of resolve_muxed_account.
cmd/soroban-cli/src/commands/snapshot/create.rs Use sync resolve_muxed_account for optional account resolution.
cmd/soroban-cli/src/commands/keys/public_key.rs Derive Ledger public key directly via signer::ledger::new(index).public_key() in the --ledger path.
cmd/soroban-cli/src/commands/contract/upload.rs Use sync config.source_account() when fetching sequence number.
cmd/soroban-cli/src/commands/contract/restore.rs Use sync config.source_account() when fetching sequence number.
cmd/soroban-cli/src/commands/contract/mod.rs Update contract id dispatch to sync run().
cmd/soroban-cli/src/commands/contract/invoke.rs Use sync config.source_account() during account fetch.
cmd/soroban-cli/src/commands/contract/id/wasm.rs Make run() sync and use sync config.source_account().
cmd/soroban-cli/src/commands/contract/id.rs Make run() sync and adjust wasm dispatch accordingly.
cmd/soroban-cli/src/commands/contract/extend.rs Use sync config.source_account() when fetching sequence number.
cmd/soroban-cli/src/commands/contract/deploy/wasm.rs Use sync config.source_account() for source-account type check.
cmd/soroban-cli/src/commands/contract/deploy/asset.rs Use sync config.source_account() when fetching sequence number.
cmd/crates/soroban-test/tests/it/integration/ledger/entry.rs Update tests to use sync resolve_muxed_account API.

@fnando fnando moved this from Backlog (Not Ready) to Needs Review in DevX May 6, 2026
@fnando fnando self-assigned this May 6, 2026
@fnando fnando enabled auto-merge (squash) May 6, 2026 16:06
@fnando fnando merged commit b59e1c0 into main May 6, 2026
212 checks passed
@fnando fnando deleted the remove-ledger-shorthand branch May 6, 2026 16:12
@github-project-automation github-project-automation Bot moved this from Needs Review to Done in DevX May 6, 2026
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.

Remove undocumented ledger / ledger:N positional shorthand

3 participants