Skip to content
This repository has been archived by the owner on Aug 11, 2021. It is now read-only.

fix: replace node buffers with uint8arrays #69

Merged
merged 3 commits into from
Aug 4, 2020

Conversation

achingbrain
Copy link
Member

@achingbrain achingbrain commented Aug 4, 2020

This module now accepts Uint8Arrays as well as node Buffers and
returns Uint8Arrays. Internally it converts non-Buffers into Buffers
because the ethereum libs require that.

BREAKING CHANGES:

This module now accepts Uint8Arrays as well as node Buffers and
returns Uint8Arrays.  Internally it converts non-Buffers into Buffers
because the ethereum libs require that.

BREAKING CHANGES:

- `util.serialize` returns a `Uint8Array`
- `util.cid` returns `CID`s with a breaking API change - see multiformats/js-cid#117 for changes
@achingbrain achingbrain requested review from vmx and rvagg August 4, 2020 14:31
@achingbrain achingbrain changed the title fix: replace node buffers with unit8arrays fix: replace node buffers with uint8arrays Aug 4, 2020
@codecov
Copy link

codecov bot commented Aug 4, 2020

Codecov Report

Merging #69 into master will decrease coverage by 0.13%.
The diff coverage is 94.11%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #69      +/-   ##
==========================================
- Coverage   99.37%   99.24%   -0.14%     
==========================================
  Files          20       20              
  Lines         801      792       -9     
==========================================
- Hits          796      786      -10     
- Misses          5        6       +1     
Impacted Files Coverage Δ
util/createTrieResolver.js 97.77% <ø> (-0.05%) ⬇️
util/createUtil.js 95.00% <85.71%> (-5.00%) ⬇️
eth-account-snapshot/test/resolver.spec.js 100.00% <100.00%> (ø)
eth-block-list/test/resolver.spec.js 100.00% <100.00%> (ø)
eth-block/test/resolver.spec.js 100.00% <100.00%> (ø)
eth-state-trie/test/resolver.spec.js 98.92% <100.00%> (-0.03%) ⬇️
eth-storage-trie/test/resolver.spec.js 98.92% <100.00%> (-0.03%) ⬇️
eth-tx-trie/test/resolver.spec.js 98.30% <100.00%> (-0.06%) ⬇️
eth-tx/test/resolver.spec.js 100.00% <100.00%> (ø)
util/createResolver.js 96.42% <100.00%> (-0.13%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8dc22d8...3c7a6ac. Read the comment docs.

Copy link
Member

@vmx vmx left a comment

Choose a reason for hiding this comment

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

@achingbrain I guess we still need to use Buffer due to the underlying Ethereum library?

@vmx
Copy link
Member

vmx commented Aug 4, 2020

Nevermind, you write about that in the commit message.

@vmx vmx merged commit a8fc4f5 into master Aug 4, 2020
@vmx vmx deleted the fix/replace-buffers-with-uint8arrays branch August 4, 2020 16:42
* @returns {Object}
*/
deserialize,
deserialize: (serialized) => {
Copy link
Member

Choose a reason for hiding this comment

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

Is this change because upstream only supports Buffers and they also support arrays of Buffers?

Probably needs a const { Buffer } = require('buffer') too, right?

Copy link
Member Author

Choose a reason for hiding this comment

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

Good spot, I've PR'd it in: #70

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants