question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Failure to decode transaction XDR

See original GitHub issue

Describe the bug Latest SDK (stellar-dotnet-sdk version 7.1.30) not able to decode ResultXdr

To Reproduce Run code:

using System;
using System.Linq;
using System.Threading.Tasks;
using stellar_dotnet_sdk;
using Xunit;
using stellar_dotnet_sdk.xdr;

namespace Tests
{
    public class DecodeFail
    {
        [Fact]
        public async Task FailsToDecodeTx()
        {
            var server = new Server("https://horizon-testnet.stellar.org/");
            var txPage = await server.Transactions
                .ForLedger(349089)
                .Limit(100)
                .IncludeFailed(true)
                .Execute();

            //http://testnet.stellarchain.io/tx/a6751fc111031c878041c781d7da8ceab06ebd2497d51d7bfe31106c8c22717d
            var tx = txPage.Records
                .Single(x=>x.Hash == "a6751fc111031c878041c781d7da8ceab06ebd2497d51d7bfe31106c8c22717d");
            var xdr = Convert.FromBase64String(tx.ResultXdr);
            TransactionResult.Decode(new XdrDataInputStream(xdr));
        }
    }
}


And receive error:

Tests.DecodeFail.FailsToDecodeTx

System.Exception: Unknown enum value: 1

System.Exception
Unknown enum value: 1
   at stellar_dotnet_sdk.xdr.PublicKeyType.Decode(XdrDataInputStream stream)
   at stellar_dotnet_sdk.xdr.PublicKey.Decode(XdrDataInputStream stream)
   at stellar_dotnet_sdk.xdr.AccountID.Decode(XdrDataInputStream stream)
   at stellar_dotnet_sdk.xdr.ClaimOfferAtom.Decode(XdrDataInputStream stream)
   at stellar_dotnet_sdk.xdr.ManageOfferSuccessResult.Decode(XdrDataInputStream stream)
   at stellar_dotnet_sdk.xdr.ManageBuyOfferResult.Decode(XdrDataInputStream stream)
   at stellar_dotnet_sdk.xdr.OperationResult.OperationResultTr.Decode(XdrDataInputStream stream)
   at stellar_dotnet_sdk.xdr.OperationResult.Decode(XdrDataInputStream stream)
   at stellar_dotnet_sdk.xdr.TransactionResult.TransactionResultResult.Decode(XdrDataInputStream stream)
   at stellar_dotnet_sdk.xdr.TransactionResult.Decode(XdrDataInputStream stream)
   at Tests.DecodeFail.FailsToDecodeTx() in D:\Projects\Swisschain\Sirius.Integrations.Stellar\tests\Tests\DecodeFail.cs:line 27
   at Xunit.Sdk.TestInvoker`1.<>c__DisplayClass48_1.<<InvokeTestMethodAsync>b__1>d.MoveNext() in C:\Dev\xunit\xunit\src\xunit.execution\Sdk\Frameworks\Runners\TestInvoker.cs:line 264
--- End of stack trace from previous location ---
   at Xunit.Sdk.ExecutionTimer.AggregateAsync(Func`1 asyncAction) in C:\Dev\xunit\xunit\src\xunit.execution\Sdk\Frameworks\ExecutionTimer.cs:line 48
   at Xunit.Sdk.ExceptionAggregator.RunAsync(Func`1 code) in C:\Dev\xunit\xunit\src\xunit.core\Sdk\ExceptionAggregator.cs:line 90

Expected behavior No error occured

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:9

github_iconTop GitHub Comments

2reactions
Kirbyrawrcommented, Oct 11, 2021

Should be fixed, please confirm when you can.

1reaction
avolkov-devcommented, Oct 12, 2021

The issue is fixed on nuget version 7.2.0. Thanks a lot!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Transaction Malformed
"detail": "Horizon could not decode the transaction envelope in this request. A transaction should be an XDR TransactionEnvelope struct encoded using base64 ...
Read more >
Failure when submitting transactions to Horizon · Issue #455
I get this error when submitting the transaction envelope obtained from POST/builder to bridge. This gets timed-out but XLM gets transfered ...
Read more >
Error occurs when decoding XDR with ...
Error can be seen while trying to decode the stellar XDR with Golang as switch '2' is not valid enum value ... Transaction...
Read more >
How can i decode and get relevant data from envelope_xdr
1 Answer. const transaction = new StellarSdk. Transaction(txenv); This will decode an transaction envelope XDR object to a Transaction object ( ...
Read more >
XDR format details / documentation
While continuing to parse the transactions from an XLM server, we encountered another stumbling block. Hopefully the answer to this one is quick ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found