Visitar URL original
`tx edit` fails on transaction XDR that is wrapped across multiple lines · Issue #2773 · stellar/stellar-cli · GitHub
Skip to content

tx edit fails on transaction XDR that is wrapped across multiple lines #2773

Open

Description

@leighmcculloch

What version are you using?

stellar-cli 28.1.0 (d0b26d9, built from main).

What did you do?

I piped the same transaction into tx edit which happened to be wrapped. To take the editor out of the picture I set it to true.

Setup:

$ stellar network use testnet
$ stellar keys generate alice --fund
$ stellar keys generate bob --fund
$ stellar tx new payment --source alice --destination bob --amount 1 --build-only > tx.b64
$ fold -w 76 tx.b64 > tx-wrapped.b64
$ cat tx.b64
AAAAAgAAAACYBFySPwzWk0YGRnApY9uHkYcuA63OEUJfPCHS15r6LgAAAGQAS7YyAAAAAwAAAAAAAAAAAAAAAQAAAAAAAAABAAAAAAltWKzUF0DSf6FJTJjnjOMD4PvqdD4llwfRAPBJ8Q25AAAAAAAAAAAAAAABAAAAAAAAAAA=
$ cat tx-wrapped.b64
AAAAAgAAAACYBFySPwzWk0YGRnApY9uHkYcuA63OEUJfPCHS15r6LgAAAGQAS7YyAAAAAwAAAAAA
AAAAAAAAAQAAAAAAAAABAAAAAAltWKzUF0DSf6FJTJjnjOMD4PvqdD4llwfRAPBJ8Q25AAAAAAAA
AAAAAAABAAAAAAAAAAA=

Opened with stellar tx edit:

$ stellar tx edit < tx-wrapped.b64

What did you expect to see?

Both inputs to open in the editor, the same way tx decode, tx sign and the other tx commands accept the wrapped input. For example:

$ stellar tx decode < tx.b64
{"tx":{"tx":{"source_account":"GCMAIXESH4GNNE2GAZDHAKLD3ODZDBZOAOW44EKCL46CDUWXTL5C5RVI","fee":100,"seq_num":"21310949117919235","cond":"none","memo":"none","operations":[{"source_account":null,"body":{"payment":{"destination":"GAEW2WFM2QLUBUT7UFEUZGHHRTRQHYH35J2D4JMXA7IQB4CJ6EG3SVVN","asset":"native","amount":"1"}}}],"ext":"v0"},"signatures":[]}}
$ stellar tx decode < tx-wrapped.b64
{"tx":{"tx":{"source_account":"GCMAIXESH4GNNE2GAZDHAKLD3ODZDBZOAOW44EKCL46CDUWXTL5C5RVI","fee":100,"seq_num":"21310949117919235","cond":"none","memo":"none","operations":[{"source_account":null,"body":{"payment":{"destination":"GAEW2WFM2QLUBUT7UFEUZGHHRTRQHYH35J2D4JMXA7IQB4CJ6EG3SVVN","asset":"native","amount":"1"}}}],"ext":"v0"},"signatures":[]}}

What did you see instead?

The single-line input works but tx edit fails on the wrapped one:

$ stellar tx edit < tx.b64
AAAAAgAAAACYBFySPwzWk0YGRnApY9uHkYcuA63OEUJfPCHS15r6LgAAAGQAS7YyAAAAAwAAAAAAAAAAAAAAAQAAAAAAAAABAAAAAAltWKzUF0DSf6FJTJjnjOMD4PvqdD4llwfRAPBJ8Q25AAAAAAAAAAAAAAABAAAAAAAAAAA=
$ stellar tx edit < tx-wrapped.b64
❌ error: failed to fill whole buffer

Activity

  1. moved this to Backlog (Not Ready) in DevXon Oct 1, 2026
  2. duongynhi000005-oss commented on Oct 26, 2026

    @duongynhi000005-oss

    Hi! I would like to fix this issue.

    Root Cause

    In cmd/soroban-cli/src/commands/tx/edit.rs:

    1. Cmd::run reads piped input via stdin().read_line(&mut input)?, which stops at the first newline and truncates wrapped multi-line base64 XDR.
    2. xdr_to_json calls T::from_xdr_base64(xdr_string, ...) directly instead of stripping ASCII whitespace with super::xdr::SkipWhitespace + T::read_xdr_base64_to_end(&mut lim) like tx_envelope_from_input in cmd/soroban-cli/src/commands/tx/xdr.rs.

    Proposed Fix

    • Read all of stdin with stdin().read_to_string(&mut input)? in Cmd::run.
    • Update xdr_to_json to wrap xdr_string.as_bytes() in super::xdr::SkipWhitespace and decode via T::read_xdr_base64_to_end(&mut lim).
    • Add unit test xdr_to_json_accepts_multiline_wrapped_base64 verifying LF and CRLF line-wrapped transaction XDR.

    I have prepared and tested the fix on my fork branch duongynhi000005-oss/stellar-cli:fix/issue-2773-tx-edit-wrapped-xdr (commit 15c70c8a) and can open a PR as soon as this issue is assigned.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    • Status
      Backlog (Not Ready)

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions