Closed mariopil closed 1 year ago
The latest updates on your projects. Learn more about Vercel for Git ↗︎
Name | Status | Preview | Comments | Updated (UTC) |
---|---|---|---|---|
eiger-nebula | ✅ Ready (Inspect) | Visit Preview | 💬 Add feedback | Sep 11, 2023 7:40am |
The problem is with stellar-xdr library, which only supports TransactionMetaV1 and V2, but futurenet returns V3
Hello ! I was trying to decode the transaction meta with the CLI for this transaction:
soroban lab xdr dec --type TransactionMeta --xdr "AAAAAwAAAAAAAAACAAAAAwAAAfUAAAAAAAAAAAbRlf87NqLU7oBCkYTRc1ioVphV0edho2S1lCvr8cGyDeC2s6dj/5wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAQAAAfUAAAAAAAAAAAbRlf87NqLU7oBCkYTRc1ioVphV0edho2S1lCvr8cGyDeC2s6dj/5wAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAAAAAAAAAAAAAAAAAMAAAAAAAAB9QAAAABkuvKlAAAAAAAAAAEAAAADAAAAAwAAAfUAAAAAAAAAAAbRlf87NqLU7oBCkYTRc1ioVphV0edho2S1lCvr8cGyDeC2s6dj/5wAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAAAAAAAAAAAAAAAAAMAAAAAAAAB9QAAAABkuvKlAAAAAAAAAAEAAAH1AAAAAAAAAAAG0ZX/Ozai1O6AQpGE0XNYqFaYVdHnYaNktZQr6/HBsgAjhvJvwP+cAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAAAAAAAAAAAAAAAAAADAAAAAAAAAfUAAAAAZLrypQAAAAAAAAAAAAAB9QAAAAAAAAAADvIyr2G+t9EXKjrTpfdOSF8aXW8xLMPEm8A7Xa2KejsNvS/BN6MAAAAAAfUAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAA"
It looks like CLI is using TransactionMeta
type for decoding , without any version suffix. The CLI (which is Rust) is able to parse the base64, which looks like is V3
(got it from laboratory):
Its curious, because if i try to parse by specifying TransactionMetaV3
explicitly, got an error:
soroban lab xdr dec --type TransactionMetaV3 --xdr "AAAAAwAAAAAAAAACAAAAAwAAAfUAAAAAAAAAAAbRlf87NqLU7oBCkYTRc1ioVphV0edho2S1lCvr8cGyDeC2s6dj/5wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAQAAAfUAAAAAAAAAAAbRlf87NqLU7oBCkYTRc1ioVphV0edho2S1lCvr8cGyDeC2s6dj/5wAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAAAAAAAAAAAAAAAAAMAAAAAAAAB9QAAAABkuvKlAAAAAAAAAAEAAAADAAAAAwAAAfUAAAAAAAAAAAbRlf87NqLU7oBCkYTRc1ioVphV0edho2S1lCvr8cGyDeC2s6dj/5wAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAAAAAAAAAAAAAAAAAMAAAAAAAAB9QAAAABkuvKlAAAAAAAAAAEAAAH1AAAAAAAAAAAG0ZX/Ozai1O6AQpGE0XNYqFaYVdHnYaNktZQr6/HBsgAjhvJvwP+cAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAAAAAAAAAAAAAAAAAADAAAAAAAAAfUAAAAAZLrypQAAAAAAAAAAAAAB9QAAAAAAAAAADvIyr2G+t9EXKjrTpfdOSF8aXW8xLMPEm8A7Xa2KejsNvS/BN6MAAAAAAfUAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAA"
error: decode: parsing xdr: xdr value invalid
Looks like there is an enum (not struct) called TransactionMeta which looks like could have the logic for automatically read a header and use the proper struct under the hood (See code here). I would try with that type , as seems is the same used by CLI, which is able to parse it :)
Indeed it works with a client, but doesn't work from the lib...
It's possible to generate output in json format so we could use the client to decode the xdr and the parse it :)
I've updated the Makefile.toml scripts. Transaction XDR results are parsed using the soroban client. For parsing the transactions and decoded XDRs js scripts are used (it's just very easy to parse jsons in js). I think the rust test files can be removed, Makefiles do the job good :)
To run the tests simply call cargo make run_test
in each contract directory.
PR is now ready to review. I've completely removed the Rust tests and added 3 makefiles that can be launched via cargo make
(one for each contract). There's also a script that runs all tests, integration_tests.sh
which is launched by github job. Currently the exit code of the this script is always 0 as the Raffle test is not working because of some futurenet issues.
Referenced issue
If applies, the issue this PR belongs to.
Summary of changes
First try on Rust automated tests implementation. Unfortunately there are issues with parsing transaction result meta XDR. The problem is with
stellar-xdr
library, which only supportsTransactionMetaV1
andV2
, but futurenet returnsV3
. Currently I don't have solution for this...Reviewer recommendations
How to make the review easier. i.e "Its a big PR and the recommendation is to go through each commit" or "In order to run the tests, execute ..."