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

feat: support Uint8Array input in place of Buffer #13

Merged
merged 6 commits into from
Jun 24, 2020

Conversation

Gozala
Copy link
Contributor

@Gozala Gozala commented Jun 8, 2020

With this change all the Buffer inputs were replaced by Uint8Array which is backwards compatible since Buffer is a subclass.

This does make an assumption that "bytes" encoder used to take Buffer|string here:

var encode = function (val, buffer, offset) {
var oldOffset = offset
var len = bufferLength(val)
varint.encode(len, buffer, offset)
offset += varint.encode.bytes
if (Buffer.isBuffer(val)) val.copy(buffer, offset)
else buffer.write(val, offset, len)
offset += len
encode.bytes = offset - oldOffset
return buffer
}

Fixes #12

@welcome
Copy link

welcome bot commented Jun 8, 2020

Thank you for submitting this PR!
A maintainer will be here shortly to review it.
We are super grateful, but we are also overloaded! Help us by making sure that:

  • The context for this PR is clear, with relevant discussion, decisions
    and stakeholders linked/mentioned.

  • Your contribution itself is clear (code comments, self-review for the
    rest) and in its best form. Follow the code contribution
    guidelines

    if they apply.

Getting other community members to do a review would be great help too on complex PRs (you can ask in the chats/forums). If you are unsure about something, just leave us a comment.
Next steps:

  • A maintainer will triage and assign priority to this PR, commenting on
    any missing things and potentially assigning a reviewer for high
    priority items.

  • The PR gets reviews, discussed and approvals as needed.

  • The PR is merged by maintainers when it has been approved and comments addressed.

We currently aim to provide initial feedback/triaging within two business days. Please keep an eye on any labelling actions, as these will indicate priorities and status of your contribution.
We are very grateful for your contribution!

@Gozala Gozala requested a review from achingbrain June 8, 2020 22:50
src/compile/encodings.js Outdated Show resolved Hide resolved
@Gozala Gozala requested a review from hugomrdias June 9, 2020 16:59
test/nested.js Show resolved Hide resolved
@Gozala
Copy link
Contributor Author

Gozala commented Jun 10, 2020

I have propagated changes from the ipfs-utils and addressed comments from @hugomrdias

I do not understand what is the problem here https://codecov.io/gh/ipfs/protons/compare/3b5276f052f2e17c2d806d27cd9a88e156588977...8ee9c9febd7c8e1e0d348a53a15c03721d81ce25 navigating to that URL does not really provide any info. Any help on resolving that would be greatly appreciated.

.travis.yml Show resolved Hide resolved
@Gozala
Copy link
Contributor Author

Gozala commented Jun 15, 2020

@rvagg I have added node 14 as requested. Tried adding 'current' as well but Travis seems unable to resolve that on on windows and failing.

@achingbrain @hugomrdias is there anything else I need to do to get this merged ?

I also have no clue what to do regarding codecov failure there. Going there this is what I see
image

Clicking around doesn't provide much info either & I'm really not sure how any of these changes affect coverage.

Copy link
Member

@achingbrain achingbrain left a comment

Choose a reason for hiding this comment

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

LGTM.

Could you please open a draft PR against js-ipfs with this change in the dep tree so we can see that it's not going to inadvertently break anything? You may need to push branches to a few repos to make sure all the versions of protons align.

@Gozala
Copy link
Contributor Author

Gozala commented Jun 16, 2020

@achngbrain this is what this pull attempt to do ipfs/js-ipfs#3070

@Gozala
Copy link
Contributor Author

Gozala commented Jun 18, 2020

@achingbrain you've asked me yesterday to update libp2p with new protons to ensure things don't break. I've started looking into it and found out that there quite few other dependencies more levels deep:

https://www.npmjs.com/package/protons

However we also discovered that even though I am not updating libp2p and those other dependencies bundle ends up with my patched version (I'm guessing because version is the same):

image

That is to suggest that all IPFS tests run with protons changes.

So is there anything else needs to be done to land this ? If so could you please let me know ?

Thanks

@achingbrain achingbrain merged commit 6c7add4 into ipfs:master Jun 24, 2020
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.

Accept Uint8Array in place of Buffer
4 participants