gnolang / gno

Gno: An interpreted, stack-based Go virtual machine to build succinct and composable apps + Gno.land: a blockchain for timeless code and fair open-source
https://gno.land/
Other
839 stars 342 forks source link

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

Closed zivkovicmilos closed 1 week ago

zivkovicmilos commented 1 week ago

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... - [x] Added new tests, or not needed, or not feasible - [x] Provided an example (e.g. screenshot) to aid review or the PR is self-explanatory - [x] Updated the official documentation or not needed - [x] 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](https://gnoland.github.io/benchmarks), if any. More info [here](https://github.com/gnolang/gno/blob/master/.benchmarks/README.md).
codecov[bot] commented 1 week ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

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

Additional details and impacted files ```diff @@ 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](https://app.codecov.io/gh/gnolang/gno/pull/2360/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=gnolang) | Coverage Δ | | |---|---|---| | [tm2](https://app.codecov.io/gh/gnolang/gno/pull/2360/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=gnolang) | `54.46% <100.00%> (+0.08%)` | :arrow_up: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=gnolang#carryforward-flags-in-the-pull-request-comment) to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.