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

Turn rpc::Client::new into a sync fn by not performing the health check on creation #169

Merged
merged 3 commits into from
Mar 10, 2020
Merged

Conversation

romac
Copy link
Member

@romac romac commented Mar 10, 2020

See #168 for the rationale behind this change.

In addition, both methods now take ownership of the rpc::Address rather than cloning a reference. This avoids unnecessary clones when the caller already has ownership of the address.

  • Referenced an issue explaining the need for the change
  • Updated all relevant documentation in docs
  • Updated all code comments where relevant
  • Wrote tests
  • Updated CHANGES.md

…` method

In addition, both methods now take ownership of the `rpc::Address` rather
than cloning its  reference. This avoids unecessary clones when the caller
already has ownership of the address.
Copy link
Member

@liamsi liamsi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Integration tests contain a few places where the old method signature is used. Other than that the change makes sense. Maybe the new_healthy method isn't even necessary as callers could simply call health() themselves (e.g. as a form of heartbeat check).

@tarcieri
Copy link
Contributor

tarcieri commented Mar 10, 2020

Yeah, I do remember this feeling weird when I async-ified it. It's nice for constructors to be synchronous, I think.

+1 for removing the healthcheck entirely (which already happened, so seems good)

@codecov-io
Copy link

Codecov Report

Merging #169 into master will increase coverage by 0.04%.
The diff coverage is 0%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #169      +/-   ##
==========================================
+ Coverage   39.78%   39.82%   +0.04%     
==========================================
  Files          91       91              
  Lines        3283     3284       +1     
  Branches      491      475      -16     
==========================================
+ Hits         1306     1308       +2     
- Misses       1691     1692       +1     
+ Partials      286      284       -2
Impacted Files Coverage Δ
tendermint/src/rpc/client.rs 0% <0%> (ø) ⬆️
tendermint-lite/src/main.rs 0% <0%> (ø) ⬆️
tendermint-lite/src/requester.rs 0% <0%> (ø) ⬆️
tendermint/src/abci/data.rs 21.05% <0%> (-5.27%) ⬇️
tendermint/src/abci/transaction/hash.rs 29.03% <0%> (-3.23%) ⬇️
tendermint/src/node/id.rs 58.53% <0%> (-2.44%) ⬇️
tendermint/src/account.rs 45.31% <0%> (-1.57%) ⬇️
tendermint/src/net.rs 35.93% <0%> (-1.57%) ⬇️
tendermint/src/lite/verifier.rs 80.33% <0%> (+0.27%) ⬆️
tendermint/src/amino_types/proposal.rs 33.62% <0%> (+0.88%) ⬆️
... and 2 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 efadd8b...b6de8c2. Read the comment docs.

@romac
Copy link
Member Author

romac commented Mar 10, 2020

My bad, sorry.

Alright, I removed the new_healthy method, fixed the integration tests, and added a new test for the /healthy endpoint.

Unfortunately, some integration tests fail for me when running them with cargo test -- --ignored against tendermint node --proxy_app=kvstore(Tendermint 0.33.1-73c19bd6, latest master):

test rpc::health ... ok
test rpc::abci_query ... ok
test rpc::block_results ... FAILED
test rpc::abci_info ... FAILED
test rpc::genesis ... FAILED
test rpc::net_info ... ok
test rpc::block ... FAILED
test rpc::commit ... FAILED
test rpc::blockchain ... FAILED
test rpc::status_integration ... ok
Click here for the full log
failures:

---- rpc::block_results stdout ----
thread 'rpc::block_results' panicked at 'called `Result::unwrap()` on an `Err` value: Error { code: ParseError, message: "Parse error. Invalid JSON", data: Some("missing field `results` at line 11 column 3") }', src/libcore/result.rs:1188:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.

---- rpc::abci_info stdout ----
thread 'rpc::abci_info' panicked at 'called `Result::unwrap()` on an `Err` value: Error { code: ParseError, message: "Parse error. Invalid JSON", data: Some("parse error at line 11 column 5") }', src/libcore/result.rs:1188:5

---- rpc::genesis stdout ----
thread 'rpc::genesis' panicked at 'called `Result::unwrap()` on an `Err` value: Error { code: ParseError, message: "Parse error. Invalid JSON", data: Some("missing field `max_age` at line 17 column 9") }', src/libcore/result.rs:1188:5

---- rpc::block stdout ----
thread 'rpc::block' panicked at 'called `Result::unwrap()` on an `Err` value: Error { code: ParseError, message: "Parse error. Invalid JSON", data: Some("missing field `num_txs` at line 37 column 7") }', src/libcore/result.rs:1188:5

---- rpc::commit stdout ----
thread 'rpc::commit' panicked at 'called `Result::unwrap()` on an `Err` value: Error { code: ParseError, message: "Parse error. Invalid JSON", data: Some("missing field `num_txs` at line 37 column 7") }', src/libcore/result.rs:1188:5

---- rpc::blockchain stdout ----
thread 'rpc::blockchain' panicked at 'called `Result::unwrap()` on an `Err` value: Error { code: ParseError, message: "Parse error. Invalid JSON", data: Some("missing field `num_txs` at line 40 column 9") }', src/libcore/result.rs:1188:5


failures:
    rpc::abci_info
    rpc::block
    rpc::block_results
    rpc::blockchain
    rpc::commit
    rpc::genesis

test result: FAILED. 4 passed; 6 failed; 0 ignored; 0 measured; 0 filtered out

@liamsi
Copy link
Member

liamsi commented Mar 10, 2020

Failing integration tests could be related to #95 (issue #88).

@liamsi
Copy link
Member

liamsi commented Mar 10, 2020

Yeah, all these Parse error. Invalid JSON are because the RPC endpoints changed in tendermint (go) and we didn't catch up with the changes. #120 will help us to keep up with those.

Copy link
Member

@liamsi liamsi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍 We should prob. update the title of that PR.

@romac romac changed the title Rename async fn rpc::Client::new to new_healthy and add sync new method Turn rpc::Client::new into a sync fn by not performing the health check on creation Mar 10, 2020
@romac
Copy link
Member Author

romac commented Mar 10, 2020

Just updated the PR title.

@liamsi
Copy link
Member

liamsi commented Mar 10, 2020

If you want to be sure you didn't introduce a new problem, you can re-check the integration tests against 0.32.7 (together with the changes from #95 <- we should merge that one too).

@liamsi liamsi merged commit fd9a25a into informalsystems:master Mar 10, 2020
@romac romac deleted the rpc-client-new-sync branch March 10, 2020 14:35
liamsi added a commit that referenced this pull request Mar 10, 2020
brapse pushed a commit that referenced this pull request Mar 14, 2020
* Boilerplate: Add lite-node crate

- ran `abscissa new lite-node`
- added deps (Cargo.toml) and minimal changes to README.md
- add to root workspace

* Added config options & copied code into new app crate
- copied from tendermint-lite/src/main.rs to lite-node/src/command/start.rs

* Delete tendermint-lite: replaced by lite-node

* lite -> light

* minor improvements to comments / docs

minor improvements to comments / docs

* Fix a few merge hicks (catch up with latest changes from master)

rename some vars and more logical bisection in cmd

* fix rebasing hicks

* Bucky/abscissify adr (#148)

* adr-002 lite client (#54)

* adr-002 lite client

* finish adr

* address Dev's comments

* lite -> light

* Apply suggestions from code review

Co-Authored-By: Ismail Khoffi <Ismail.Khoffi@gmail.com>

* updates from review

* Apply suggestions from code review

Co-Authored-By: Ismail Khoffi <Ismail.Khoffi@gmail.com>

* update for better abstraction and latest changes

* note about detection

* update image. manager -> syncer

* update image

* update image

* More detailed diagram of lite client data flow (#106)

* refactor

* refactor into more adrs

* minor fixes from review

* sync adr-003 with latest and call it

* rust code blocks

Co-authored-by: Ismail Khoffi <Ismail.Khoffi@gmail.com>
Co-authored-by: jibrown <jackie.ilana.brown@gmail.com>

* working on adr-004

Co-authored-by: Ismail Khoffi <Ismail.Khoffi@gmail.com>
Co-authored-by: jibrown <jackie.ilana.brown@gmail.com>

* Dealing with the merging in master aftermath

* merged in master

* Fix merge master fallout (related to #169)

* Use `abscissa_tokio` and resolve merge conflicts

* New stable rust -> new clippy errs -> fixed

Co-authored-by: Ethan Buchman <ethan@coinculture.info>
Co-authored-by: jibrown <jackie.ilana.brown@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants