elucidsoft / dotnet-stellar-sdk

Stellar API SDK for .NET 6.x
Apache License 2.0
116 stars 54 forks source link

MemoTooLongException #280

Closed OttoVT closed 3 years ago

OttoVT commented 4 years ago

Describe the bug When trying to get a memo of a transaction in prod with a hash which equals to "63f4f14bd1c6cd4efeb677e412b618d49527e42cb2bdb3db9bb458b6485f7bf2", I receive an Exception:

stellar_dotnet_sdk.MemoTooLongException: 'text must be <= 28 bytes. length=38' at stellar_dotnet_sdk.MemoText..ctor(String text) at stellar_dotnet_sdk.Memo.Text(String text) at stellar_dotnet_sdk.responses.TransactionResponse.get_Memo()

Here is the link in explorer: (https://laboratory.stellar.org/#explorer?resource=transactions&endpoint=single&values=eyJ0cmFuc2FjdGlvbiI6IjYzZjRmMTRiZDFjNmNkNGVmZWI2NzdlNDEyYjYxOGQ0OTUyN2U0MmNiMmJkYjNkYjliYjQ1OGI2NDg1ZjdiZjIifQ%3D%3D&network=public)

To Reproduce Steps to reproduce the behavior: 1) Execute the next code: stellar-dotnet-sdk version 5.0.36

var server = new Server("https://horizon.stellar.org"); var transactions = await server.Transactions.ForLedger(blockNumber) .IncludeFailed(true) .Limit(_limit) .Execute();

var memoXdr = transactions[25].Memo.ToXdr(); //Expecte the exception here

Expected behavior Well, the thing is that memo for this particular transaction is "�\"<r~=Zp\u0016���8��y��i�". Also, this transaction has a field "successful": true. I guess this is a bug in Stellar Protocol. ??) The expected behavior is not to have such an exception.

Screenshots image

Desktop (please complete the following information):

Additional context stellar-dotnet-sdk version 5.0.36

Kirbyrawr commented 4 years ago

Hi, checking now!

Kirbyrawr commented 4 years ago

I think you are right it sounds like a bug in the protocol, i will talk to the team, thanks for the heads up

Kirbyrawr commented 4 years ago

Forget my last comment, talked to other maintainer and we found that we are decoding it wrongly, i will keep you updated.

Kirbyrawr commented 4 years ago

Hi, i uploaded a branch already to fix this issue, my teammate should look into it to verify is the way to proceed in this case.

Thanks for the report!

https://github.com/elucidsoft/dotnet-stellar-sdk/tree/memo-length-fix

OttoVT commented 4 years ago

You are welcome ). Thanks for the quick fix!

Kirbyrawr commented 4 years ago

I suggest that you don't use that branch till we merge, i'm looking into it more to be sure that all is ok : )!

elucidsoft commented 4 years ago

Sorry for the delay, we will be fixing and merging these changes shortly.

Kirbyrawr commented 3 years ago

Hi, the issue is fixed, waiting for a release but it-s merged already since days ago, sorry for the confusion.

elucidsoft commented 3 years ago

This will go into the 6.0 Release