-
Notifications
You must be signed in to change notification settings - Fork 21
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
Conversation
3b129f2
to
2974d19
Compare
2974d19
to
762f9f4
Compare
packages/upload-client/src/index.js
Outdated
@@ -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 |
There was a problem hiding this comment.
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.
@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. |
packages/upload-client/src/index.js
Outdated
@@ -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() |
There was a problem hiding this comment.
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
There was a problem hiding this 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.
e4a8ba9
to
c14fce3
Compare
forgot to update lock file 😓 |
🤖 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).
Upgrades lib in
upload-client
to use PieceCidv2