Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

soroban-cli: xdr dec results in downcast error for valid xdr #670

Closed
leighmcculloch opened this issue May 31, 2023 · 1 comment
Closed
Labels
bug Something isn't working

Comments

@leighmcculloch
Copy link
Member

leighmcculloch commented May 31, 2023

What version are you using?

v0.8.0

What did you do?

soroban lab xdr dec \
    --type TransactionEnvelope \
    --xdr AAAAAgAAAAB/+rzugobS5qPnSeG0CVkULwRl5Cc9kcg/XUHIdb4yCQAPQkAAAAHHAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAABAAAAABB90WssODNIgi6BHveqzxTRmIpvAFRyVNM+Hm2GVuCcAAAAAAAAAADUMzT2qToPBg3PknXD1EvFboyl8UexTQeoQmbHCGOYgwAAABdIdugAAAAAAAAAAAJ1vjIJAAAAQPR0KSBc+o4+MepdKaLIJxVHFrpal/ZDuVptfmz59KDleWyvavj/TUMOIwdB1supznkZPBvs56BEgMMsQqlyPwGGVuCcAAAAQEu+jREyXoJNXjyUqkHPeqL6uu+bHd0u69Ezvl++PcDnTiIqS2PGy9Ub4wFDsKGP1K6CE89fXDp3VXlwVrcBNgQ=

What did you expect to see?

The transaction. Similar output as stellar-xdr v0.0.16, which is able to decode the tx:

echo -n 'AAAAAgAAAAB/+rzugobS5qPnSeG0CVkULwRl5Cc9kcg/XUHIdb4yCQAPQkAAAAHHAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAABAAAAABB90WssODNIgi6BHveqzxTRmIpvAFRyVNM+Hm2GVuCcAAAAAAAAAADUMzT2qToPBg3PknXD1EvFboyl8UexTQeoQmbHCGOYgwAAABdIdugAAAAAAAAAAAJ1vjIJAAAAQPR0KSBc+o4+MepdKaLIJxVHFrpal/ZDuVptfmz59KDleWyvavj/TUMOIwdB1supznkZPBvs56BEgMMsQqlyPwGGVuCcAAAAQEu+jREyXoJNXjyUqkHPeqL6uu+bHd0u69Ezvl++PcDnTiIqS2PGy9Ub4wFDsKGP1K6CE89fXDp3VXlwVrcBNgQ=' \
    | stellar-xdr +next decode --type TransactionEnvelope --output json-formatted
{
  "tx": {
    "tx": {
      "source_account": {
        "ed25519": "7ffabcee8286d2e6a3e749e1b40959142f0465e4273d91c83f5d41c875be3209"
      },
      "fee": 1000000,
      "seq_num": 1954210119681,
      "cond": {
        "time": {
          "min_time": 0,
          "max_time": 0
        }
      },
      "memo": "none",
      "operations": [
        {
          "source_account": {
            "ed25519": "107dd16b2c383348822e811ef7aacf14d1988a6f00547254d33e1e6d8656e09c"
          },
          "body": {
            "create_account": {
              "destination": {
                "public_key_type_ed25519": "d43334f6a93a0f060dcf9275c3d44bc56e8ca5f147b14d07a84266c708639883"
              },
              "starting_balance": 100000000000
            }
          }
        }
      ],
      "ext": "v0"
    },
    "signatures": [
      {
        "hint": "75be3209",
        "signature": "f47429205cfa8e3e31ea5d29a2c827154716ba5a97f643b95a6d7e6cf9f4a0e5796caf6af8ff4d430e230741d6cba9ce79193c1bece7a04480c32c42a9723f01"
      },
      {
        "hint": "8656e09c",
        "signature": "4bbe8d11325e824d5e3c94aa41cf7aa2fabaef9b1ddd2eebd133be5fbe3dc0e74e222a4b63c6cbd51be30143b0a18fd4ae8213cf5f5c3a7755797056b7013604"
      }
    ]
  }
}

What did you see instead?

thread 'main' panicked at 'Mismatch between definition and access of type. Could not downcast to TypeId { t: 15612724387334937870 }, need to downcast to TypeId { t: 15667337675743493382 }
', /Users/leighmcculloch/.cargo/registry/src/github.com-1ecc6299db9ec823/clap-4.1.11/src/parser/error.rs:30:9

Originally reported on Discord by @ElliotFriend at:

@leighmcculloch leighmcculloch added the bug Something isn't working label May 31, 2023
@stellarsaur
Copy link
Contributor

Seems to be fixed (based on latest changes on main):

./target/debug/soroban lab xdr dec --type TransactionEnvelope \
    --xdr AAAAAgAAAAB/+rzugobS5qPnSeG0CVkULwRl5Cc9kcg/XUHIdb4yCQAPQkAAAAHHAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAABAAAAABB90WssODNIgi6BHveqzxTRmIpvAFRyVNM+Hm2GVuCcAAAAAAAAAADUMzT2qToPBg3PknXD1EvFboyl8UexTQeoQmbHCGOYgwAAABdIdugAAAAAAAAAAAJ1vjIJAAAAQPR0KSBc+o4+MepdKaLIJxVHFrpal/ZDuVptfmz59KDleWyvavj/TUMOIwdB1supznkZPBvs56BEgMMsQqlyPwGGVuCcAAAAQEu+jREyXoJNXjyUqkHPeqL6uu+bHd0u69Ezvl++PcDnTiIqS2PGy9Ub4wFDsKGP1K6CE89fXDp3VXlwVrcBNgQ=
TransactionEnvelope(
    Tx(
        TransactionV1Envelope {
            tx: Transaction {
                source_account: Ed25519(
                    Uint256(7ffabcee8286d2e6a3e749e1b40959142f0465e4273d91c83f5d41c875be3209),
                ),
                fee: 1000000,
                seq_num: SequenceNumber(
                    1954210119681,
                ),
                cond: Time(
                    TimeBounds {
                        min_time: TimePoint(
                            0,
                        ),
                        max_time: TimePoint(
                            0,
                        ),
                    },
                ),
                memo: None,
                operations: VecM(
                    [
                        Operation {
                            source_account: Some(
                                Ed25519(
                                    Uint256(107dd16b2c383348822e811ef7aacf14d1988a6f00547254d33e1e6d8656e09c),
                                ),
                            ),
                            body: CreateAccount(
                                CreateAccountOp {
                                    destination: AccountId(
                                        PublicKeyTypeEd25519(
                                            Uint256(d43334f6a93a0f060dcf9275c3d44bc56e8ca5f147b14d07a84266c708639883),
                                        ),
                                    ),
                                    starting_balance: 100000000000,
                                },
                            ),
                        },
                    ],
                ),
                ext: V0,
            },
            signatures: VecM(
                [
                    DecoratedSignature {
                        hint: SignatureHint(75be3209),
                        signature: Signature(
                            BytesM(f47429205cfa8e3e31ea5d29a2c827154716ba5a97f643b95a6d7e6cf9f4a0e5796caf6af8ff4d430e230741d6cba9ce79193c1bece7a04480c32c42a9723f01),
                        ),
                    },
                    DecoratedSignature {
                        hint: SignatureHint(8656e09c),
                        signature: Signature(
                            BytesM(4bbe8d11325e824d5e3c94aa41cf7aa2fabaef9b1ddd2eebd133be5fbe3dc0e74e222a4b63c6cbd51be30143b0a18fd4ae8213cf5f5c3a7755797056b7013604),
                        ),
                    },
                ],
            ),
        },
    ),
)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants