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

refactor: don't depend on multihash features #3514

Merged
merged 13 commits into from
Mar 30, 2023

Conversation

thomaseizinger
Copy link
Contributor

@thomaseizinger thomaseizinger commented Feb 27, 2023

Description

All we need from the multihash is for it to be a data structure that we pass around. We only ever use the identity "hasher" and the sha256 hasher. Those are easily implemented without depending the (fairly heavy) machinery in multihash.

Unfortunately, this patch by itself does not yet lighten our dependency tree because multiaddr activates those features unconditionally. I opened a companion PR for this: multiformats/rust-multiaddr#77.

multiformats/rust-multiaddr#77 is another breaking change and we are trying to delay those at the moment. However, it will (hopefully) land eventually which should then be much easier to implement.

Fixes #3276.

Notes

Links to any relevant issues

Open Questions

Change checklist

  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • A changelog entry has been made in the appropriate crates

@mergify

This comment was marked as resolved.

@mergify
Copy link
Contributor

mergify bot commented Mar 12, 2023

This pull request has merge conflicts. Could you please resolve them @thomaseizinger? 🙏

@thomaseizinger
Copy link
Contributor Author

Friendly ping @mxinden.

@thomaseizinger
Copy link
Contributor Author

According to the Rust API evolution RFC, removing features from a dependency is not a breaking change because each crate should activate all features they depend on themselves. See https://rust-lang.github.io/rfcs/1105-api-evolution.html#minor-change-altering-the-use-of-cargo-features.

Copy link
Member

@mxinden mxinden left a comment

Choose a reason for hiding this comment

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

Overall I am OK with this change. I understand the reasoning. I am a bit afraid of making hard-to-debug errors anywhere here.

identity/src/peer_id.rs Show resolved Hide resolved
protocols/kad/src/behaviour/test.rs Outdated Show resolved Hide resolved
protocols/kad/src/behaviour/test.rs Outdated Show resolved Hide resolved
protocols/kad/src/query/peers/closest.rs Outdated Show resolved Hide resolved
protocols/kad/src/query/peers/closest.rs Outdated Show resolved Hide resolved
protocols/kad/src/query/peers/closest/disjoint.rs Outdated Show resolved Hide resolved
protocols/kad/src/record.rs Outdated Show resolved Hide resolved
protocols/kad/src/record/store/memory.rs Outdated Show resolved Hide resolved
@thomaseizinger
Copy link
Contributor Author

@mxinden Please take another look.

Copy link
Member

@mxinden mxinden left a comment

Choose a reason for hiding this comment

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

Thanks for the follow-ups. Looks good to me.

@mergify mergify bot merged commit dfa7bd6 into master Mar 30, 2023
@mergify mergify bot deleted the refactor/no-multihash-derive branch March 30, 2023 17:47
mergify bot pushed a commit that referenced this pull request Jun 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Don't depend on the multihash identity feature
2 participants