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

Replace Buffer with uint8array #6004

Closed
wants to merge 38 commits into from

Conversation

mpetrunic
Copy link
Contributor

@mpetrunic mpetrunic commented Apr 11, 2023

Description

Alternative to #6005

Replaces all usage of Buffer with Uint8Array.
Pros:

  • even smaller build without the need for polyfill
  • if we don't do it now it needs to wait for 5.x
    Cons:
  • some tests are falling and I don't have time to investigate those as I'm going on a vacation
  • break some API

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist for 1.x:

  • I have selected the correct base branch.
  • I have performed a self-review of my own code.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have made corresponding changes to the documentation.
  • My changes generate no new warnings.
  • Any dependent changes have been merged and published in downstream modules.
  • I ran npm run dtslint with success and extended the tests and types if necessary.
  • I ran npm run test:cov and my test cases cover all the lines and branches of the added code.
  • I ran npm run build with success.
  • I have tested the built dist/web3.min.js in a browser.
  • I have tested my code on the live network.
  • I have checked the Deploy Preview and it looks correct.
  • I have updated the CHANGELOG.md file in the root folder.

Checklist for 4.x:

  • I have selected the correct 4.x base branch.
  • Within the description, the feature or issue is discussed in detail or an issue is linked.
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas.
  • I have added any required tests for the changes I made
  • I have made corresponding changes to the documentation
  • Any dependent changes have been merged and published in downstream modules.
  • I ran yarn successfully
  • I ran yarn lint successfully
  • I ran yarn build:web successfully
  • I ran yarn test:unit successfully
  • I ran yarn test:integration successfully
  • I ran compile:contracts successfully
  • I have tested my code.
  • I have updated the corresponding CHANGELOG.md file in the packages I have edited.

@mpetrunic mpetrunic mentioned this pull request Apr 11, 2023
31 tasks
@mpetrunic mpetrunic changed the title Feat/replace buffer with uint8array Replace Buffer with uint8array Apr 11, 2023
@luu-alex
Copy link
Contributor

luu-alex commented Apr 12, 2023

This is a breaking change but I think replacing buffer is the forward, we don't want to be reliant on polyfills so there isn't complications with browser apps. If we decide to move forward, since marin is going on vacation I can take over the PR or go to another team member.

If we want browser apps to be working for next RC, we can merge #6005 for a temporary fix so users wont be facing browser issues. Then we can work on removing buffers completely.

@spacesailor24
Copy link
Contributor

spacesailor24 commented Apr 12, 2023

I would agree that the less config the end user has to do, the better

If this replaces #6005, then we should copy over the removal of @types/node

@mpetrunic
Copy link
Contributor Author

I would agree that the less config the end user has to do, the better

If this replaces #6005, then we should copy over the removal of @types/node

Yeah sorry about that, it was very old branch that I rebased on top of ethereumjs branch and the commits are a bit mangled. If you want to pursue this PR, I would suggest creating new branch out of 4.x and cherry-picking the last two commits onto the new branch

Copy link
Contributor

@jdevcs jdevcs left a comment

Choose a reason for hiding this comment

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

+1
Replacing buffer with uint8arry change in current time as we can include breaking changes and it will help end users for webpacking.

@luu-alex luu-alex mentioned this pull request Apr 18, 2023
2 tasks
@avkos
Copy link
Contributor

avkos commented Apr 18, 2023

+1 we need to do this. I think we need to create an issue to finish these changes if we don't have it yet.

@luu-alex
Copy link
Contributor

@avkos #6026 i have picked it up today 👍

@avkos
Copy link
Contributor

avkos commented Apr 19, 2023

@luu-alex Please close this issue when you finish #6026

@luu-alex luu-alex mentioned this pull request Apr 24, 2023
31 tasks
@avkos avkos closed this Apr 25, 2023
@jdevcs jdevcs mentioned this pull request Jun 2, 2023
@jdevcs
Copy link
Contributor

jdevcs commented Jun 2, 2023

Changes of this PR were merged via #6033

@mpetrunic mpetrunic deleted the feat/replace-buffer-with-uint8array branch October 31, 2023 13:35
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.

5 participants