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

Research a possible integration of zecwallet-light-cli into Zebra #4181

Closed
oxarbitrage opened this issue Apr 23, 2022 · 5 comments
Closed

Research a possible integration of zecwallet-light-cli into Zebra #4181

oxarbitrage opened this issue Apr 23, 2022 · 5 comments
Assignees
Labels
C-user-research Category: Tickets related to or arising from user studies

Comments

@oxarbitrage
Copy link
Contributor

zecwallet-light-cli is a zcash command line wallet written in rust.

It was briefly tested against a lightwalletd server backed up by a zebra node in the context of #3655 (comment)

However, zecwallet-light-cli is also a library which could be potentially used by zebra to run integration tests.

This ticket will be used to investigate if an integration will worth and how much will be needed.

@oxarbitrage
Copy link
Contributor Author

zecwallet-light-cli is a library so it can theoretically be inserted as a dependency into zebra. However, doing this is a dependency nightmare. I am not going to describe the details but just mention that it uses old and modified version of librustzcash. Other dependencies are also so old that had major refactoring. I got lost in that task so i changed my approach to see we can still get something from this.

So i went the other way around and left the dependencies as they are for now and added a dirty test in the cli to connect to a lightwalletd server running locally backed with a zebra node. The code for this is at oxarbitrage/zecwallet-light-cli#1

Now, i think those tests found some bugs, or they might be bugs in the tests themselves but i will like to make sure.

The test for get_taddress_txids fails with:

thread 'lightclient::zebra_tests::zebra_backed_lightwalletd' panicked at 'called `Result::unwrap()` on an `Err` value: Status { code: Unknown, message: "-32602: Invalid params: invalid type: map, expected a sequence.", metadata: MetadataMap { headers: {"server": "nginx/1.14.0 (Ubuntu)", "date": "Sat, 23 Apr 2022 20:35:52 GMT", "content-type": "application/grpc", "content-length": "0"} } }', lib/src/lightclient/zebra_tests.rs:63:71

And the test for get_taddress_balance fails with:

thread 'lightclient::zebra_tests::zebra_backed_lightwalletd' panicked at 'called `Result::unwrap()` on an `Err` value: Status { code: Unknown, message: "json: cannot unmarshal array into Go struct field ZcashdRpcReplyGetaddressbalance.Balance of type int64", metadata: MetadataMap { headers: {"server": "nginx/1.14.0 (Ubuntu)", "date": "Sat, 23 Apr 2022 20:40:09 GMT", "content-type": "application/grpc", "content-length": "0"} } }', lib/src/lightclient/zebra_tests.rs:68:63

This is against the current zebra main.

Didn't tested utxos call as it is not merged into main so is not available. When called, the error will be the following which is ok:

thread 'lightclient::zebra_tests::zebra_backed_lightwalletd' panicked at 'called `Result::unwrap()` on an `Err` value: Status { code: Unknown, message: "-32601: Method not found", metadata: MetadataMap { headers: {"server": "nginx/1.14.0 (Ubuntu)", "date": "Sat, 23 Apr 2022 20:50:37 GMT", "content-type": "application/grpc", "content-length": "0"} } }', lib/src/lightclient/zebra_tests.rs:76:58

there are also other calls that i didn't tested.

@oxarbitrage
Copy link
Contributor Author

I tested a branch with getaddressutxos available.

This not fail but it returns an empty response for a taddress that should have utxos available:

Code used:

    // build an utxo request
    let utxos =  GetAddressUtxosArg {
        addresses: vec!["t3Vz22vK5z2LcKEdg16Yv4FFneEL1zg9ojd".to_string()],
        start_height: 1,
        max_entries: 0,
    };

    // success but empty
    let response = client.get_address_utxos(utxos).await.unwrap().into_inner();
    println!("{:?}", response);

Output:

GetAddressUtxosReplyList { address_utxos: [] }

@teor2345
Copy link
Contributor

#4130 could be a good way to find and fix these RPC response format bugs?

@ftm1000 ftm1000 added C-user-research Category: Tickets related to or arising from user studies S-needs-triage Status: A bug report needs triage labels Apr 25, 2022
@teor2345
Copy link
Contributor

The test for get_taddress_txids fails with ... Invalid params: invalid type: map, expected a sequence

This is now bug #4216

And the test for get_taddress_balance fails with ... json: cannot unmarshal array into Go struct field ZcashdRpcReplyGetaddressbalance.Balance of type int64

This is fixed by PR #4217

This not fail but it returns an empty response for a taddress that should have utxos available:

This is now bug #4220.

If you can find a RPC query that reproduces the missing UTXOs above, please add it to #4220.

@oxarbitrage
Copy link
Contributor Author

This ticket helped to find the above bugs but there is a way that we can do the same (#4253) without using zecwallet-light-cli. We will not integrate in the short run.

@ftm1000 ftm1000 removed the S-needs-triage Status: A bug report needs triage label May 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-user-research Category: Tickets related to or arising from user studies
Projects
None yet
Development

No branches or pull requests

3 participants