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

CID equality #208

Closed
achingbrain opened this issue Oct 15, 2022 · 2 comments · Fixed by #215
Closed

CID equality #208

achingbrain opened this issue Oct 15, 2022 · 2 comments · Fixed by #215
Labels

Comments

@achingbrain
Copy link
Member

We compare CIDs in our tests in lots (and lots) of places. E.g:

assert.deepEqual(cid1, cid2)

With v10 these checks have started failing where one of these CIDs has been read out of a byte array and does not occupy the entire byte array because of the now enumerable byteOffset property, for example here, blocking ipld/js-dag-pb#59.

achingbrain added a commit that referenced this issue Oct 15, 2022
From #203

> I would like to also address byteOffset, byteLength fields. I don't think they were a bad idea, it's just I was not allowed to complete implementation of that idea.

Given that the feature is incomplete and untested, remove it for
now and if it's required it can be implemented fully in the future.

Fixes #208

BREAKING CHANGE: The CID class no longer has `.byteOffset` and `.byteLength` properties - these can be accessed via the `.bytes` property instead
achingbrain added a commit that referenced this issue Oct 15, 2022
From #203

> I would like to also address byteOffset, byteLength fields. I don't think they were a bad idea, it's just I was not allowed to complete implementation of that idea.

Given that the feature is incomplete and untested, remove it for
now and if it's required it can be implemented fully in the future.

Fixes #208

BREAKING CHANGE: The CID class no longer has `.byteOffset` and `.byteLength` properties - these can be accessed via the `.bytes` property instead
@Gozala
Copy link
Contributor

Gozala commented Oct 16, 2022

That probably can be easily fixed by turning these to getters that just return this.bytes.byteOffset / this.bytes.byteLength

// ArrayBufferView
/** @readonly */
this.byteOffset = bytes.byteOffset
/** @readonly */
this.byteLength = bytes.byteLength

achingbrain added a commit that referenced this issue Oct 17, 2022
Fixes #208 by converting `.byteOffset` and `.byteLength` properties
to getters.

Supersedes #210
Gozala added a commit that referenced this issue Oct 17, 2022
Gozala added a commit that referenced this issue Oct 17, 2022
* fix: convert byteOffset and byteLength to getters

Fixes #208 by converting `.byteOffset` and `.byteLength` properties
to getters.

Supersedes #210

* Apply suggestions from code review

* Update test/test-cid.spec.js

Co-authored-by: Irakli Gozalishvili <contact@gozala.io>
github-actions bot pushed a commit that referenced this issue Oct 17, 2022
## [10.0.1](v10.0.0...v10.0.1) (2022-10-17)

### Bug Fixes

* convert byteOffset and byteLength to getters ([#215](#215)) ([4e09490](4e09490)), closes [#208](#208) [#210](#210)
@github-actions
Copy link

🎉 This issue has been resolved in version 10.0.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment