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

[Merged by Bors] - build(deps): Bump github.com/multiformats/go-multiaddr from 0.14.0 to 0.15.0 #6744

Conversation

dependabot[bot]
Copy link
Contributor

@dependabot dependabot bot commented on behalf of github Feb 25, 2025

Bumps github.com/multiformats/go-multiaddr from 0.14.0 to 0.15.0.

Release notes

Sourced from github.com/multiformats/go-multiaddr's releases.

v0.15.0

Breaking Changes

  • There is no Multiaddr interface type.
  • Multiaddr is now a concrete type of []Component. Not an interface.
  • Empty Multiaddrs should be checked len(ma) == 0, exactly how slices should be checked with len(s) == 0 rather than s == nil.
  • Components do not implement Multiaddr as there is no Multiaddr to implement. The do implement a Multiaddrer interface that lets them convert to Multiaddrs.
  • Multiaddr can no longer be a key in a Map. If you want unique Multiaddrs, use string(Multiaddr.Bytes()) or Multiaddr.String() as the key, otherwise you can use the pointer value *Multiaddr.

Why?

This library has had multiple issues related to Multiaddr being an interface. Many methods use and return nil as the zero value, which behaves poorly when the user forgets to do a nil check on every returned value and attempts to call a method on the nil pointer. For example, using Split to split a Multiaddr and then using Join to rebuild the original Multiaddr historically would panic in case one side of the split was nil. Using an interface also leads to incorrect usages of == to check if two Multiaddrs were equal (would only work for pointer equality) and, likewise, incorrectly using Multiaddr as a key for a map.

Using an interface is typically done to provide a consistent API surface for multiple implementing types. In practice however, the Multiaddr interface was only implemented for multiaddr and component (with arguably some awkwardness when using a component as a Multiaddr).

The better approach is to use a concrete type for a Multiaddr. This lets pointer receiver methods work even if the pointer is nil, since the compiler already knows which function to call. Most methods now take a value rather than a pointer which avoids the issue of a nil pointer dereference completely.

What's changed

v0.15 refactors the codebase to make it much harder to hit nil pointer dereference panics.

It does so by taking a different approach to how we've treated multiaddrs in the past. Instead of attempting to make them a general datastructure, we focus on treating them as just an encoding scheme. Users of multiaddrs are expected to parse the multiaddr into some struct that is suitable for their use case, and use the multiaddr form when interoperating. By treating Multiaddrs as just an encoding scheme we can make a number of simplifications in the codebase. Specifically we now:

  • Remove the Multiaddr interface.
  • Make Multiaddr a concrete type of []Component

Migration

Refer to ./v015-MIGRATION.md for breaking changes and migration tips

Full Changelog: multiformats/go-multiaddr@v0.14.0...v0.15.0

Commits
  • 30b45fb chore: release v0.15.0 (#266)
  • 4d1f355 refactor: Backwards compatible Encapsulate/Decapsulate/Join/NewComponent (#272)
  • 2ac523b refactor: keep same api as v0.14.0 for SplitFirst/SplitLast (#271)
  • 4abf520 Merge pull request #268 from multiformats/uci/update-go
  • e41d519 chore!: bump go.mod to Go 1.23 and run go fix
  • 46805b0 refactor: Follows up on #261 (#264)
  • 1ef63b5 refactor!: make the API harder to misuse (#261)
  • d19cf5d build(deps): bump golang.org/x/crypto from 0.18.0 to 0.31.0 (#259)
  • See full diff in compare view

Dependabot compatibility score

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


Dependabot commands and options

You can trigger Dependabot actions by commenting on this PR:

  • @dependabot rebase will rebase this PR
  • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
  • @dependabot merge will merge this PR after your CI passes on it
  • @dependabot squash and merge will squash and merge this PR after your CI passes on it
  • @dependabot cancel merge will cancel a previously requested merge and block automerging
  • @dependabot reopen will reopen this PR if it is closed
  • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
  • @dependabot show <dependency name> ignore conditions will show all of the ignore conditions of the specified dependency
  • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)

@dependabot dependabot bot requested a review from dshulyak as a code owner February 25, 2025 01:17
@dependabot dependabot bot added dependencies Pull requests that update a dependency file go Pull requests that update Go code labels Feb 25, 2025
@dependabot dependabot bot force-pushed the dependabot/go_modules/github.com/multiformats/go-multiaddr-0.15.0 branch from f7e032d to abfb3d0 Compare February 25, 2025 09:24
Bumps [github.com/multiformats/go-multiaddr](https://github.com/multiformats/go-multiaddr) from 0.14.0 to 0.15.0.
- [Release notes](https://github.com/multiformats/go-multiaddr/releases)
- [Commits](multiformats/go-multiaddr@v0.14.0...v0.15.0)

---
updated-dependencies:
- dependency-name: github.com/multiformats/go-multiaddr
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
@dependabot dependabot bot force-pushed the dependabot/go_modules/github.com/multiformats/go-multiaddr-0.15.0 branch from abfb3d0 to 0c226f6 Compare February 28, 2025 09:32
@fasmat
Copy link
Member

fasmat commented Feb 28, 2025

bors merge

spacemesh-bors bot pushed a commit that referenced this pull request Feb 28, 2025
… 0.15.0 (#6744)

Bumps [github.com/multiformats/go-multiaddr](https://github.com/multiformats/go-multiaddr) from 0.14.0 to 0.15.0.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a href="https://github.com/multiformats/go-multiaddr/releases">github.com/multiformats/go-multiaddr's releases</a>.</em></p>
<blockquote>
<h2>v0.15.0</h2>
<h2>Breaking Changes</h2>
<ul>
<li>There is no <code>Multiaddr</code> interface type.</li>
<li>Multiaddr is now a concrete type of <code>[]Component</code>. Not an interface.</li>
<li>Empty Multiaddrs should be checked <code>len(ma) == 0</code>, exactly how slices should be checked with <code>len(s) == 0</code> rather than <code>s == nil</code>.</li>
<li>Components do not implement <code>Multiaddr</code> as there is no <code>Multiaddr</code> to implement. The do implement a <code>Multiaddrer</code> interface that lets them convert to Multiaddrs.</li>
<li><code>Multiaddr</code> can no longer be a key in a Map. If you want unique Multiaddrs, use <code>string(Multiaddr.Bytes())</code> or <code>Multiaddr.String()</code> as the key, otherwise you can use the pointer value <code>*Multiaddr</code>.</li>
</ul>
<h2>Why?</h2>
<p>This library has had multiple issues related to Multiaddr being an interface. Many methods use and return nil as the zero value, which behaves poorly when the user forgets to do a nil check on every returned value and attempts to call a method on the nil pointer. For example, using Split to split a Multiaddr and then using Join to rebuild the original Multiaddr historically would panic in case one side of the split was nil. Using an interface also leads to incorrect usages of == to check if two Multiaddrs were equal (would only work for pointer equality) and, likewise, incorrectly using Multiaddr as a key for a map.</p>
<p>Using an interface is typically done to provide a consistent API surface for multiple implementing types. In practice however, the Multiaddr interface was only implemented for multiaddr and component (with arguably some awkwardness when using a component as a Multiaddr).</p>
<p>The better approach is to use a concrete type for a Multiaddr. This lets pointer receiver methods work even if the pointer is nil, since the compiler already knows which function to call. Most methods now take a value rather than a pointer which avoids the issue of a nil pointer dereference completely.</p>
<h2>What's changed</h2>
<p>v0.15 refactors the codebase to make it much harder to hit nil pointer dereference panics.</p>
<p>It does so by taking a different approach to how we've treated multiaddrs in the past. Instead of attempting to make them a general datastructure, we focus on treating them as just an encoding scheme. Users of multiaddrs are expected to parse the multiaddr into some struct that is suitable for their use case, and use the multiaddr form when interoperating. By treating Multiaddrs as just an encoding scheme we can make a number of simplifications in the codebase. Specifically we now:</p>
<ul>
<li>Remove the Multiaddr interface.</li>
<li>Make Multiaddr a concrete type of []Component</li>
</ul>
<h2>Migration</h2>
<p>Refer to <a href="https://github.com/multiformats/go-multiaddr/blob/master/v015-MIGRATION.md">./v015-MIGRATION.md</a> for breaking changes and migration tips</p>
<p><strong>Full Changelog</strong>: <a href="https://github.com/multiformats/go-multiaddr/compare/v0.14.0...v0.15.0">https://github.com/multiformats/go-multiaddr/compare/v0.14.0...v0.15.0</a></p>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="https://github.com/multiformats/go-multiaddr/commit/30b45fbe13b3a116675a49a799d13d18a9306f60"><code>30b45fb</code></a> chore: release v0.15.0 (<a href="https://redirect.github.com/multiformats/go-multiaddr/issues/266">#266</a>)</li>
<li><a href="https://github.com/multiformats/go-multiaddr/commit/4d1f3557e51fc0723cb338e2f621594d63b891a2"><code>4d1f355</code></a> refactor: Backwards compatible Encapsulate/Decapsulate/Join/NewComponent (<a href="https://redirect.github.com/multiformats/go-multiaddr/issues/272">#272</a>)</li>
<li><a href="https://github.com/multiformats/go-multiaddr/commit/2ac523b0a26d6ce052095d0b4dbda8e3df75ed3d"><code>2ac523b</code></a> refactor: keep same api as v0.14.0 for SplitFirst/SplitLast (<a href="https://redirect.github.com/multiformats/go-multiaddr/issues/271">#271</a>)</li>
<li><a href="https://github.com/multiformats/go-multiaddr/commit/4abf52057874e2710909a1ac80cf61ace7dde09a"><code>4abf520</code></a> Merge pull request <a href="https://redirect.github.com/multiformats/go-multiaddr/issues/268">#268</a> from multiformats/uci/update-go</li>
<li><a href="https://github.com/multiformats/go-multiaddr/commit/e41d519be1b9956ee36a677db45e034607cee8e7"><code>e41d519</code></a> chore!: bump go.mod to Go 1.23 and run go fix</li>
<li><a href="https://github.com/multiformats/go-multiaddr/commit/46805b01c4bdfe1bf0ac0cd8382ce7eb653aa77b"><code>46805b0</code></a> refactor: Follows up on <a href="https://redirect.github.com/multiformats/go-multiaddr/issues/261">#261</a> (<a href="https://redirect.github.com/multiformats/go-multiaddr/issues/264">#264</a>)</li>
<li><a href="https://github.com/multiformats/go-multiaddr/commit/1ef63b53f8bb117708f7b156bb00b0ff0ad503eb"><code>1ef63b5</code></a> refactor!: make the API harder to misuse (<a href="https://redirect.github.com/multiformats/go-multiaddr/issues/261">#261</a>)</li>
<li><a href="https://github.com/multiformats/go-multiaddr/commit/d19cf5da7dc590c829b9a4b329341ea8847d4d2a"><code>d19cf5d</code></a> build(deps): bump golang.org/x/crypto from 0.18.0 to 0.31.0 (<a href="https://redirect.github.com/multiformats/go-multiaddr/issues/259">#259</a>)</li>
<li>See full diff in <a href="https://github.com/multiformats/go-multiaddr/compare/v0.14.0...v0.15.0">compare view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=github.com/multiformats/go-multiaddr&package-manager=go_modules&previous-version=0.14.0&new-version=0.15.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)


</details>

Co-authored-by: Matthias <[email protected]>
Copy link

codecov bot commented Feb 28, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 76.9%. Comparing base (2a8b58d) to head (35e9472).
Report is 1 commits behind head on develop.

✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##           develop   #6744   +/-   ##
=======================================
  Coverage     76.8%   76.9%           
=======================================
  Files          369     369           
  Lines        50277   50277           
=======================================
+ Hits         38639   38681   +42     
+ Misses        9426    9392   -34     
+ Partials      2212    2204    -8     

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

@spacemesh-bors
Copy link

Build failed:

@fasmat
Copy link
Member

fasmat commented Feb 28, 2025

flaky TestHare

bors merge

spacemesh-bors bot pushed a commit that referenced this pull request Feb 28, 2025
… 0.15.0 (#6744)

Bumps [github.com/multiformats/go-multiaddr](https://github.com/multiformats/go-multiaddr) from 0.14.0 to 0.15.0.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a href="https://github.com/multiformats/go-multiaddr/releases">github.com/multiformats/go-multiaddr's releases</a>.</em></p>
<blockquote>
<h2>v0.15.0</h2>
<h2>Breaking Changes</h2>
<ul>
<li>There is no <code>Multiaddr</code> interface type.</li>
<li>Multiaddr is now a concrete type of <code>[]Component</code>. Not an interface.</li>
<li>Empty Multiaddrs should be checked <code>len(ma) == 0</code>, exactly how slices should be checked with <code>len(s) == 0</code> rather than <code>s == nil</code>.</li>
<li>Components do not implement <code>Multiaddr</code> as there is no <code>Multiaddr</code> to implement. The do implement a <code>Multiaddrer</code> interface that lets them convert to Multiaddrs.</li>
<li><code>Multiaddr</code> can no longer be a key in a Map. If you want unique Multiaddrs, use <code>string(Multiaddr.Bytes())</code> or <code>Multiaddr.String()</code> as the key, otherwise you can use the pointer value <code>*Multiaddr</code>.</li>
</ul>
<h2>Why?</h2>
<p>This library has had multiple issues related to Multiaddr being an interface. Many methods use and return nil as the zero value, which behaves poorly when the user forgets to do a nil check on every returned value and attempts to call a method on the nil pointer. For example, using Split to split a Multiaddr and then using Join to rebuild the original Multiaddr historically would panic in case one side of the split was nil. Using an interface also leads to incorrect usages of == to check if two Multiaddrs were equal (would only work for pointer equality) and, likewise, incorrectly using Multiaddr as a key for a map.</p>
<p>Using an interface is typically done to provide a consistent API surface for multiple implementing types. In practice however, the Multiaddr interface was only implemented for multiaddr and component (with arguably some awkwardness when using a component as a Multiaddr).</p>
<p>The better approach is to use a concrete type for a Multiaddr. This lets pointer receiver methods work even if the pointer is nil, since the compiler already knows which function to call. Most methods now take a value rather than a pointer which avoids the issue of a nil pointer dereference completely.</p>
<h2>What's changed</h2>
<p>v0.15 refactors the codebase to make it much harder to hit nil pointer dereference panics.</p>
<p>It does so by taking a different approach to how we've treated multiaddrs in the past. Instead of attempting to make them a general datastructure, we focus on treating them as just an encoding scheme. Users of multiaddrs are expected to parse the multiaddr into some struct that is suitable for their use case, and use the multiaddr form when interoperating. By treating Multiaddrs as just an encoding scheme we can make a number of simplifications in the codebase. Specifically we now:</p>
<ul>
<li>Remove the Multiaddr interface.</li>
<li>Make Multiaddr a concrete type of []Component</li>
</ul>
<h2>Migration</h2>
<p>Refer to <a href="https://github.com/multiformats/go-multiaddr/blob/master/v015-MIGRATION.md">./v015-MIGRATION.md</a> for breaking changes and migration tips</p>
<p><strong>Full Changelog</strong>: <a href="https://github.com/multiformats/go-multiaddr/compare/v0.14.0...v0.15.0">https://github.com/multiformats/go-multiaddr/compare/v0.14.0...v0.15.0</a></p>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="https://github.com/multiformats/go-multiaddr/commit/30b45fbe13b3a116675a49a799d13d18a9306f60"><code>30b45fb</code></a> chore: release v0.15.0 (<a href="https://redirect.github.com/multiformats/go-multiaddr/issues/266">#266</a>)</li>
<li><a href="https://github.com/multiformats/go-multiaddr/commit/4d1f3557e51fc0723cb338e2f621594d63b891a2"><code>4d1f355</code></a> refactor: Backwards compatible Encapsulate/Decapsulate/Join/NewComponent (<a href="https://redirect.github.com/multiformats/go-multiaddr/issues/272">#272</a>)</li>
<li><a href="https://github.com/multiformats/go-multiaddr/commit/2ac523b0a26d6ce052095d0b4dbda8e3df75ed3d"><code>2ac523b</code></a> refactor: keep same api as v0.14.0 for SplitFirst/SplitLast (<a href="https://redirect.github.com/multiformats/go-multiaddr/issues/271">#271</a>)</li>
<li><a href="https://github.com/multiformats/go-multiaddr/commit/4abf52057874e2710909a1ac80cf61ace7dde09a"><code>4abf520</code></a> Merge pull request <a href="https://redirect.github.com/multiformats/go-multiaddr/issues/268">#268</a> from multiformats/uci/update-go</li>
<li><a href="https://github.com/multiformats/go-multiaddr/commit/e41d519be1b9956ee36a677db45e034607cee8e7"><code>e41d519</code></a> chore!: bump go.mod to Go 1.23 and run go fix</li>
<li><a href="https://github.com/multiformats/go-multiaddr/commit/46805b01c4bdfe1bf0ac0cd8382ce7eb653aa77b"><code>46805b0</code></a> refactor: Follows up on <a href="https://redirect.github.com/multiformats/go-multiaddr/issues/261">#261</a> (<a href="https://redirect.github.com/multiformats/go-multiaddr/issues/264">#264</a>)</li>
<li><a href="https://github.com/multiformats/go-multiaddr/commit/1ef63b53f8bb117708f7b156bb00b0ff0ad503eb"><code>1ef63b5</code></a> refactor!: make the API harder to misuse (<a href="https://redirect.github.com/multiformats/go-multiaddr/issues/261">#261</a>)</li>
<li><a href="https://github.com/multiformats/go-multiaddr/commit/d19cf5da7dc590c829b9a4b329341ea8847d4d2a"><code>d19cf5d</code></a> build(deps): bump golang.org/x/crypto from 0.18.0 to 0.31.0 (<a href="https://redirect.github.com/multiformats/go-multiaddr/issues/259">#259</a>)</li>
<li>See full diff in <a href="https://github.com/multiformats/go-multiaddr/compare/v0.14.0...v0.15.0">compare view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=github.com/multiformats/go-multiaddr&package-manager=go_modules&previous-version=0.14.0&new-version=0.15.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)


</details>

Co-authored-by: Matthias <[email protected]>
@spacemesh-bors
Copy link

Pull request successfully merged into develop.

Build succeeded:

@spacemesh-bors spacemesh-bors bot changed the title build(deps): Bump github.com/multiformats/go-multiaddr from 0.14.0 to 0.15.0 [Merged by Bors] - build(deps): Bump github.com/multiformats/go-multiaddr from 0.14.0 to 0.15.0 Feb 28, 2025
@spacemesh-bors spacemesh-bors bot closed this Feb 28, 2025
Copy link
Contributor Author

dependabot bot commented on behalf of github Feb 28, 2025

OK, I won't notify you again about this release, but will get in touch when a new version is available. If you'd rather skip all updates until the next major or minor version, let me know by commenting @dependabot ignore this major version or @dependabot ignore this minor version. You can also ignore all major, minor, or patch releases for a dependency by adding an ignore condition with the desired update_types to your config file.

If you change your mind, just re-open this PR and I'll resolve any conflicts on it.

@spacemesh-bors spacemesh-bors bot deleted the dependabot/go_modules/github.com/multiformats/go-multiaddr-0.15.0 branch February 28, 2025 11:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file go Pull requests that update Go code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant