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: upgrade fr32-sha2-256-trunc-254-padded-binary-tree-multihash #997

Merged
merged 3 commits into from
Oct 26, 2023

Conversation

vasco-santos
Copy link
Contributor

@vasco-santos vasco-santos commented Oct 24, 2023

Upgrades lib in upload-client to use PieceCidv2

@@ -13,7 +13,7 @@ export { Store, Upload, UnixFS, CAR }
export * from './sharding.js'

const CONCURRENT_REQUESTS = 3
const PIECE_MULTIHASH_SIZE = PieceHasher.prefix.length + PieceHasher.size
const PIECE_MULTIHASH_SIZE = PieceHasher.prefix.length + 1 + PieceHasher.size
Copy link
Contributor

Choose a reason for hiding this comment

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

This is no longer correct as size will vary based on padding applied.

@Gozala
Copy link
Contributor

Gozala commented Oct 25, 2023

@vasco-santos I think error occurs because of the buffer overflow, that is supplied Uint8Array is smaller than amount of bytes been written into it. I'll test that hypothesis and will see if I can make tests case for fr32...hash to improve error messages.

@@ -133,6 +133,8 @@ async function uploadBlockStream(conf, blocks, options = {}) {
const digestBytes = new Uint8Array(PIECE_MULTIHASH_SIZE)
hasher.write(bytes)
hasher.digestInto(digestBytes, 0, true)
// TODO: should we?
// hasher.free()
Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah calling free will allow memory used by WASM to be reclaimed

Copy link
Contributor

@Gozala Gozala left a comment

Choose a reason for hiding this comment

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

Not sure why tests are failing, but changes look good to me.

@vasco-santos
Copy link
Contributor Author

Not sure why tests are failing, but changes look good to me.

forgot to update lock file 😓

@vasco-santos vasco-santos marked this pull request as ready for review October 26, 2023 19:34
@vasco-santos vasco-santos merged commit f6828ec into main Oct 26, 2023
14 checks passed
@vasco-santos vasco-santos deleted the fix/upgrade-fr32-sha2-256-lib branch October 26, 2023 19:39
vasco-santos pushed a commit that referenced this pull request Oct 27, 2023
🤖 I have created a release *beep* *boop*
---


##
[11.0.0](upload-client-v10.1.0...upload-client-v11.0.0)
(2023-10-27)


### ⚠ BREAKING CHANGES

* filecoin client to use new capabilities
* filecoin capabilities

### Bug Fixes

* add missing ContentNotFound definition for filecoin offer failure
([c0b97bf](c0b97bf))
* add missing filecoin submit success and failure types
([c0b97bf](c0b97bf))
* client tests
([b0d9c3f](b0d9c3f))
* fix arethetypesworking errors in all packages
([#1004](#1004))
([2e2936a](2e2936a))
* package.json files excludes 'src' and includes .js and .js.map in dist
for packages that now export their module from dist
([#1012](#1012))
([d2537de](d2537de))
* type errors
([c0b97bf](c0b97bf))
* upgrade fr32-sha2-256-trunc-254-padded-binary-tree-multihash
([#997](#997))
([f6828ec](f6828ec))


### Code Refactoring

* filecoin capabilities
([c0b97bf](c0b97bf))
* filecoin client to use new capabilities
([b0d9c3f](b0d9c3f))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).
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