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 ethereumjs/tx dependency with a fork that has ethers.js removed #5963

Conversation

avkos
Copy link
Contributor

@avkos avkos commented Mar 28, 2023

Description

Please include a summary of the changes and be sure to follow our Contribution Guidelines.

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.

@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Mar 28, 2023

Deploying with  Cloudflare Pages  Cloudflare Pages

Latest commit: 42d5b23
Status: ✅  Deploy successful!
Preview URL: https://04177be4.web3-js-docs.pages.dev
Branch Preview URL: https://ok-5948-replace-ethereumjs-t.web3-js-docs.pages.dev

View logs

@avkos avkos requested a review from jdevcs April 4, 2023 22:44
@jdevcs
Copy link
Contributor

jdevcs commented Apr 5, 2023

Great job @avkos +1
And because maintainability is sometimes more important than adding functionality. I suggest the following:

  • Add all the code, that is imported from ethereumjs, inside a folder with no code other than the imported one.

  • Add a readme file inside that folder that will keep track of the following:

    • The version (or the commit) of ethereumjs from which the code has been imported. We will need this for later to track changes and fix bugs.
    • What are the exact modifications done to every file, if any. (you can also do it this way for example: first push all the code taken from ethereumjs as-is without any modifications. So, we have a reference to track what exactly changed with further commits).
    • At every later update of the original code base (at ethereumjs) the corresponding folder could be updated and the readme file should give a detailed information about that update as well.
  • Import all the related tests from ethereumjs and place them under a specific folder that does not contain any other tests. (this could be done in another MR, I think).

I think this is a great idea

I kinda disagree, you don't want most of the code and updates from ethereumjs. Its very trivial part of code, which we should maintain from now on by refactoring it and adding only new features(new tx types and chains) which we care about.

Thanks everyone. We will maintain code added in this PR in future. Also if a readme file or comments are added for just tracking which version of eth/tx and eth/common lib were added it will be helpful for future maintainers to understand which imp bugs or upgrades are necessary in our lib by tracking eth/tx and eth/common ( just for info ).

Like, after release, we could refactor common and strip a lot of stuff.

@avkos @spacesailor24 For replacing functions : As we discussed in last team call eth/tx / eth/common functions have different implementation as compared to ours in some cases. so I'll suggest to continue use functions from eth/tx eth/common for now, so we have stable transaction functionality, and in near future we can refactor for reusing our functions or strip unused pieces.

@avkos
Copy link
Contributor Author

avkos commented Apr 5, 2023

@jdevcs I've added versions here:
TX
Common
RLP

@jdevcs
Copy link
Contributor

jdevcs commented Apr 6, 2023

Before merging pls check all tests should be passing in CI.

Copy link
Contributor

@Muhammad-Altabba Muhammad-Altabba left a comment

Choose a reason for hiding this comment

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

Great job!
However, I have a few questions...

And a tiny point: I think this error text was missed updating:

'Please provide the @ethereumjs/common object or the chain and hardfork property but not all together.',

@avkos avkos merged commit a53187c into 4.x Apr 10, 2023
@avkos avkos deleted the ok/5948-Replace-ethereumjs/tx-dependency-with-a-fork-that-has-ethers.js-removed branch April 10, 2023 22:34
This was referenced Apr 14, 2023
@jdevcs jdevcs mentioned this pull request Aug 11, 2023
4 tasks
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