zingolabs / zingolib_original

ZingoLib
MIT License
1 stars 1 forks source link

Update deps #4

Closed AloeareV closed 2 years ago

AloeareV commented 2 years ago

Updating dependencies. New version of tonic has breaking changes to tls code. Currently attempt to refactor to new paradigm fails to handshake.

zancas commented 2 years ago

Hmmm.... I ran:

./keygen.sh && cargo test lightclient::tests::aborted_resync -- --nocapture

running 1 test
GRPC Server listening on: 127.0.0.1:21420. With datadir /tmp/test21420.Nn9oNbaAWoAZ
2022-04-25T20:46:23.407320Z  INFO zecwalletlitelib::lightclient: Created new wallet!
2022-04-25T20:46:23.407359Z  INFO zecwalletlitelib::lightclient: Created LightClient to https://localhost:21420/
2022-04-25T20:46:23.407377Z  INFO zecwalletlitelib::lightclient::tests: About to mine!
[lib/src/grpc_connector.rs:49] &new_self.uri = https://localhost:21420/
2022-04-25T20:46:23.806102Z DEBUG rustls::anchors: add_parsable_certificates processed 1 valid and 0 invalid certs
2022-04-25T20:46:23.806325Z TRACE hyper::client::pool: checkout waiting for idle connection: ("https", [::1]:21420)
2022-04-25T20:46:23.806399Z TRACE hyper::client::connect::http: Http::connect; scheme=Some("https"), host=Some("localhost"), port=Some(Port(21420))
thread 'lightclient::tests::aborted_resync' panicked at 'called `Result::unwrap()` on an `Err` value: Custom { kind: Uncategorized, error: "failed to lookup address information: Name or service not known" }', lib/src/lightclient/test_server.rs:118:69
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
2022-04-25T20:46:23.806530Z DEBUG hyper::client::connect::dns: resolving host="localhost"
2022-04-25T20:46:23.806835Z DEBUG hyper::client::connect::http: connecting to [::1]:21420
2022-04-25T20:46:23.807023Z TRACE mio::poll: registering event source with poller: token=Token(1), interests=READABLE | WRITABLE
2022-04-25T20:46:23.807084Z TRACE mio::poll: deregistering event source from poller
2022-04-25T20:46:23.807117Z TRACE hyper::client::connect::http: connect error for [::1]:21420: ConnectError("tcp connect error", Os { code: 111, kind: ConnectionRefused, message: "Connection refused" })
2022-04-25T20:46:23.807134Z DEBUG hyper::client::connect::http: connecting to 127.0.0.1:21420
2022-04-25T20:46:23.807177Z TRACE mio::poll: registering event source with poller: token=Token(16777217), interests=READABLE | WRITABLE
2022-04-25T20:46:23.807219Z TRACE mio::poll: deregistering event source from poller
2022-04-25T20:46:23.807241Z TRACE hyper::client::connect::http: connect error for 127.0.0.1:21420: ConnectError("tcp connect error", Os { code: 111, kind: ConnectionRefused, message: "Connection refused" })
2022-04-25T20:46:23.807282Z TRACE hyper::client::pool: checkout dropped for ("https", [::1]:21420)
thread 'lightclient::tests::aborted_resync' panicked at 'called `Result::unwrap()` on an `Err` value: "Error with response: Status { code: Unavailable, message: \"error trying to connect: tcp connect error: Connection refused (os error 111)\", source: Some(hyper::Error(Connect, ConnectError(\"tcp connect error\", Os { code: 111, kind: ConnectionRefused, message: \"Connection refused\" }))) }"', lib/src/lightclient/test_server.rs:183:28
test lightclient::tests::aborted_resync ... FAILED

failures:

failures:
    lightclient::tests::aborted_resync

test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 41 filtered out; finished in 0.57s

error: test failed, to rerun pass '-p zecwalletlitelib --lib'
zancas commented 2 years ago

I think this chunk of the above error message is the place where the bug is first detected:

thread 'lightclient::tests::aborted_resync' panicked at 'called `Result::unwrap()` on an `Err` value: Custom { kind: Uncategorized, error: "failed to lookup address information: Name or service not known" }', lib/src/lightclient/test_server.rs:118:69
AloeareV commented 2 years ago

By the way, examples are from https://github.com/hyperium/tonic/blob/master/examples/src/tls/client_rustls.rs and https://github.com/hyperium/tonic/blob/master/examples/src/tls/server_rustls.rs. This should get commented into the code at some point, or rebased into commit messages, or something.

There are also a number of comments copied directly from the examples, that are getting more and more inaccurate over time, and will also be fixed at some point.

AloeareV commented 2 years ago

Examples were found via https://github.com/hyperium/tonic/issues/891.

AloeareV commented 2 years ago

Why does this commit: 88dffe32bd99628710c5537ddb4b6aa14956fbb5 remove the Cargo.lock (which was updated in the previous commit)?

I believe there was a merge conflict inside the lock during rebase, that I didn't want to spend the time to resolve, and so I just removed the file and re-added it in a later commit.

zancas commented 2 years ago

I think it makes sense for me to hop back on this topic once the HTTP tests are passing/reasonable?

dannasessha commented 2 years ago

Thank you for inviting me to review and work on the branch!

A couple notes. I've added a couple issues after discussion with @AloeareV, one is more long-term, and one I will probably work on for an initial contribution.

With the current commit of this branch I can run cargo tarpaulin --avoid-cfg-tarpaulin in order to get tarpaulin to succeed, and it yields 63.58% coverage, 4034/6345 lines covered - which seems like a great start!

I'll also check against the dev branch this branch is forked from and compare, to look toward making sure new or changed code is still covered, or newly covered.

codecov-commenter commented 2 years ago

Codecov Report

Merging #4 (a0c075a) into dev (fae6abf) will increase coverage by 0.49%. The diff coverage is 86.62%.

@@            Coverage Diff             @@
##              dev       #4      +/-   ##
==========================================
+ Coverage   63.57%   64.06%   +0.49%     
==========================================
  Files          29       29              
  Lines        6322     6445     +123     
==========================================
+ Hits         4019     4129     +110     
- Misses       2303     2316      +13     
Impacted Files Coverage Δ
cli/src/lib.rs 0.00% <0.00%> (ø)
cli/src/main.rs 0.00% <0.00%> (ø)
lib/src/commands.rs 0.13% <0.00%> (ø)
lib/src/lightwallet/wallet_transactions.rs 75.87% <ø> (ø)
lib/src/lightwallet/data.rs 38.09% <26.31%> (-0.04%) :arrow_down:
lib/src/blaze/trial_decryptions.rs 81.25% <71.87%> (ø)
lib/src/blaze/fetch_compact_blocks.rs 84.21% <75.00%> (ø)
lib/src/lightclient.rs 60.69% <75.47%> (+0.60%) :arrow_up:
lib/src/grpc_connector.rs 78.97% <88.76%> (+1.55%) :arrow_up:
lib/src/lightclient/test_server.rs 88.00% <91.83%> (-0.11%) :arrow_down:
... and 10 more

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 3b2ef3a...a0c075a. Read the comment docs.

AloeareV commented 2 years ago

Codecov report is broken on PR view for this, but can be viewed by comparing commits (this url: https://app.codecov.io/gh/zingolabs/zecwalletlitelib/compare/dev...update_deps/tree)