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

fix: Add default ports for net.Dial if missing in RPC URL #2360

Merged
merged 5 commits into from
Jun 19, 2024

Conversation

zivkovicmilos
Copy link
Member

Description

This PR fixes a bug with the http.Client, where the custom DialContext would fail if the specified RPC URL did not contain a port number (ex: https://rpc.gno.land).

I've added the default catch values, and removed useless error returns.

This additionally begs the question -- do we even want a custom dial context, given that we don't even use the features it provides?

Contributors' checklist...
  • Added new tests, or not needed, or not feasible
  • Provided an example (e.g. screenshot) to aid review or the PR is self-explanatory
  • Updated the official documentation or not needed
  • No breaking changes were made, or a BREAKING CHANGE: xxx message was included in the description
  • Added references to related issues and PRs
  • Provided any useful hints for running manual tests
  • Added new benchmarks to generated graphs, if any. More info here.

@zivkovicmilos zivkovicmilos added the 📦 🌐 tendermint v2 Issues or PRs tm2 related label Jun 15, 2024
@zivkovicmilos zivkovicmilos self-assigned this Jun 15, 2024
Copy link

codecov bot commented Jun 15, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 54.61%. Comparing base (6032b48) to head (4b561bf).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2360      +/-   ##
==========================================
- Coverage   54.62%   54.61%   -0.02%     
==========================================
  Files         582      582              
  Lines       78401    78366      -35     
==========================================
- Hits        42824    42797      -27     
+ Misses      32365    32360       -5     
+ Partials     3212     3209       -3     
Flag Coverage Δ
tm2 54.46% <100.00%> (+0.08%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@gfanton gfanton left a comment

Choose a reason for hiding this comment

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

LGTM

Generally speaking, a custom Dialer can be very useful for various purposes, such as mocking connections, creating middleware, and using custom transports like buffered connections or net.Pipe for internal clients. This can help avoid the need to secure the connection from external calls.

I've used all the previously mentioned dialers with gRPC when I was working on a mobile project. It was vital for me to be able to customize the dialer.

The problem here is that we cannot actually customize the Dialer. It's only wrapping a TCP Dialer, which seems a bit useless. The better approach would be to let the user pass their own Dialer and fall back on Go default Dialer, passing the remote address naturally without wrapping it inside the Dialer.

@zivkovicmilos zivkovicmilos merged commit 7b8a893 into master Jun 19, 2024
42 checks passed
@zivkovicmilos zivkovicmilos deleted the dev/zivkovicmilos/net-dial branch June 19, 2024 09:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
📦 🌐 tendermint v2 Issues or PRs tm2 related
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

4 participants