Skip to content

feat!: support for multiple hash types#9

Merged
alanshaw merged 6 commits intomainfrom
feat/support-for-multiple-hash-types
Apr 26, 2023
Merged

feat!: support for multiple hash types#9
alanshaw merged 6 commits intomainfrom
feat/support-for-multiple-hash-types

Conversation

@alanshaw
Copy link
Member

This PR adds support for multiple hash types (like blake2b, as used by Filecoin).

To do this we make use of the "prefix" sent in bitswap wantlist responses. The prefix contains just the metadata of the CID. Instead of assuming the multihash hasher is sha256, we now inspect the prefix and hash using the specified hasher (if it exists). By default, only sha256 is supported (for smaller bundle), but in the CLI we also add blake2b.

Secondarily, this PR fixes a memory leak with many listeners being added to a passed abort controller which were never removed.

Thirdly, this PR moves the static fromNetwork factory function from the Dagula class into p2p.js (as an export). This allows users who are not using bitswap/libp2p (like freeway) to not end up with a massive bundle.

@alanshaw alanshaw requested a review from olizilla April 25, 2023 23:04
@alanshaw alanshaw changed the title feat: support for multiple hash types feat!: support for multiple hash types Apr 26, 2023
Copy link
Contributor

@olizilla olizilla left a comment

Choose a reason for hiding this comment

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

yah decent. I think land this first and i'll deal with it. I'm gonna be re-writing my PR #8 significantly anyway.

@alanshaw
Copy link
Member Author

Awesome, thanks! ❤️

@alanshaw alanshaw merged commit c147fdb into main Apr 26, 2023
@alanshaw alanshaw deleted the feat/support-for-multiple-hash-types branch April 26, 2023 10:22
olizilla pushed a commit that referenced this pull request May 1, 2023
🤖 I have created a release *beep* *boop*
---


##
[6.0.0](v5.0.0...v6.0.0)
(2023-05-01)


### ⚠ BREAKING CHANGES

* support for multiple hash types
([#9](#9))

### Features

* add walkUnixfsPath to emit nodes for each path segment
([#7](#7))
([6c0eed1](6c0eed1))
* getPath with carScope
([#8](#8))
([a613b45](a613b45))
* support for multiple hash types
([#9](#9))
([c147fdb](c147fdb))


### Other Changes

* publish from ci
([#13](#13))
([5df4116](5df4116))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.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.

2 participants