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

fix!: remove ipc from default used packages #5978

Merged
merged 11 commits into from
Apr 11, 2023

Conversation

mpetrunic
Copy link
Contributor

@mpetrunic mpetrunic commented Mar 31, 2023

Description

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

Fixes #5977

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.

Signed-off-by: Marin Petrunic <marin.petrunic@gmail.com>
@cloudflare-workers-and-pages
Copy link

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

Deploying with  Cloudflare Pages  Cloudflare Pages

Latest commit: d52cb6e
Status: ✅  Deploy successful!
Preview URL: https://496b4513.web3-js-docs.pages.dev
Branch Preview URL: https://fix---remove-ipc-from-defaul.web3-js-docs.pages.dev

View logs

Signed-off-by: Marin Petrunic <marin.petrunic@gmail.com>
@mpetrunic
Copy link
Contributor Author

@spacesailor24 @jdevcs This wont work since loading ipc conditionally in request manager breaks default webpack configuration. Could we convert ipc to plugin and than add support in RequestManager when registering plugin?

@jdevcs
Copy link
Contributor

jdevcs commented Apr 3, 2023

@spacesailor24 @jdevcs This wont work since loading ipc conditionally in request manager breaks default webpack configuration. Could we convert ipc to plugin and than add support in RequestManager when registering plugin?

If we follow current plugin architecture, my understanding is, plugin functionality should be on top of existing building blocks of web3 4x lib ( providers, requestmanager, context.. or eth or contracts ) and not modifying core behavior by using core features it self ( else it will be cyclic ) , and IPC is among building blocks of our lib.

But another way of decoupling it can be: removing all IPC references from 4.x and releasing it as independent package and doing some refactoring in 4.x.. As long as its in compliance with EIP1193 users should be able to inject it in web3 4x. What will you suggest, about refactoring before full release? or just add webpack guide for users.

@mpetrunic
Copy link
Contributor Author

@spacesailor24 @jdevcs This wont work since loading ipc conditionally in request manager breaks default webpack configuration. Could we convert ipc to plugin and than add support in RequestManager when registering plugin?

If we follow current plugin architecture, my understanding is, plugin functionality should be on top of existing building blocks of web3 4x lib ( providers, requestmanager, context.. or eth or contracts ) and not modifying core behavior by using core features it self ( else it will be cyclic ) , and IPC is among building blocks of our lib.

But another way of decoupling it can be: removing all IPC references from 4.x and releasing it as independent package and doing some refactoring in 4.x.. As long as its in compliance with EIP1193 users should be able to inject it in web3 4x. What will you suggest, about refactoring before full release? or just add webpack guide for users.

Honestly, I think I need couple of hours to refactor that^^

@spacesailor24
Copy link
Contributor

@mpetrunic as @jdevcs mentioned, the only plugin we have successfully implement as of yet adds a layer of functionality ontop of web3.js, but doesn't change it's internals. While I think a plugin like this should be supported, the major difficulty comes from making it type safe

In my time of maintaing web3.js, I don't remember anyone coming to us in regards of the ipc provider. So, I think removing it from the standard web3 offering and having a seperate package supported via EIP1193 probably won't make much of a difference to majority of our users

Signed-off-by: Marin Petrunic <marin.petrunic@gmail.com>
@github-actions
Copy link

github-actions bot commented Apr 5, 2023

Bundle Stats

Hey there, this message comes from a github action that helps you and reviewers to understand how these changes affect the size of this project's bundle.

As this PR is updated, I'll keep you updated on how the bundle size is impacted.

Total

Asset Old size New size Diff Diff %
Total 723 KB 721 KB -2.51 KB -0.35%
View detailed bundle breakdown

Added

No assets were added

Removed

No assets were removed

Bigger

No assets were bigger

Smaller

Asset Old size New size Diff Diff %
../lib/commonjs/providers.exports.d.ts 191 bytes 148 bytes -43 bytes -22.51%

Unchanged

Asset Old size New size Diff Diff %
web3.min.js 706 KB 704 KB -2.42 KB -0.34%
../lib/commonjs/index.d.ts 8.48 KB 8.43 KB -50 bytes -0.58%
../lib/commonjs/accounts.d.ts 3.66 KB 3.66 KB 0 0.00%
../lib/commonjs/types.d.ts 2.4 KB 2.4 KB 0 0.00%
../lib/commonjs/abi.d.ts 1000 bytes 1000 bytes 0 0.00%
../lib/commonjs/web3.d.ts 808 bytes 808 bytes 0 0.00%
../lib/commonjs/eth.exports.d.ts 280 bytes 280 bytes 0 0.00%
../lib/commonjs/version.d.ts 60 bytes 60 bytes 0 0.00%

@codecov
Copy link

codecov bot commented Apr 5, 2023

Codecov Report

Merging #5978 (d52cb6e) into 4.x (a53187c) will decrease coverage by 0.02%.
The diff coverage is 100.00%.

Additional details and impacted files
@@            Coverage Diff             @@
##              4.x    #5978      +/-   ##
==========================================
- Coverage   85.83%   85.82%   -0.02%     
==========================================
  Files         156      156              
  Lines        7413     7406       -7     
  Branches     2010     2008       -2     
==========================================
- Hits         6363     6356       -7     
  Misses       1050     1050              
Flag Coverage Δ
UnitTests 85.82% <100.00%> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
web3 ∅ <ø> (∅)
web3-core ∅ <ø> (∅)
web3-errors ∅ <ø> (∅)
web3-eth ∅ <ø> (∅)
web3-eth-abi ∅ <ø> (∅)
web3-eth-accounts ∅ <ø> (∅)
web3-eth-contract ∅ <ø> (∅)
web3-eth-ens ∅ <ø> (∅)
web3-eth-iban ∅ <ø> (∅)
web3-eth-personal ∅ <ø> (∅)
web3-net ∅ <ø> (∅)
web3-providers-http ∅ <ø> (∅)
web3-providers-ipc ∅ <ø> (∅)
web3-providers-ws ∅ <ø> (∅)
web3-rpc-methods ∅ <ø> (∅)
web3-utils ∅ <ø> (∅)
web3-validator ∅ <ø> (∅)

Signed-off-by: Marin Petrunic <marin.petrunic@gmail.com>
Signed-off-by: Marin Petrunic <marin.petrunic@gmail.com>
Signed-off-by: Marin Petrunic <marin.petrunic@gmail.com>
Signed-off-by: Marin Petrunic <marin.petrunic@gmail.com>
mpetrunic and others added 2 commits April 5, 2023 16:06
Signed-off-by: Marin Petrunic <marin.petrunic@gmail.com>
@luu-alex
Copy link
Contributor

luu-alex commented Apr 6, 2023

Changelog needs to be updated

Signed-off-by: Marin Petrunic <marin.petrunic@gmail.com>
Copy link
Contributor

@avkos avkos left a comment

Choose a reason for hiding this comment

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

It looks like integration IPC tests always fail.

@Muhammad-Altabba
Copy link
Contributor

It looks like integration IPC tests always fail.

Actually, those 2 tests are failing for all new MRs.
However, I just created an issue for this: #5996

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.

Looks great!
I just have one suggestion/question.
Thanks for your contribution.

@mpetrunic mpetrunic merged commit e75582e into 4.x Apr 11, 2023
@mpetrunic mpetrunic deleted the fix!--remove-ipc-from-default-used-packages branch April 11, 2023 16:06
@jdevcs jdevcs mentioned this pull request Apr 14, 2023
spacesailor24 pushed a commit that referenced this pull request Apr 18, 2023
* fix!: ipc provider no longer installed by default

Signed-off-by: Marin Petrunic <marin.petrunic@gmail.com>

* conditional require

Signed-off-by: Marin Petrunic <marin.petrunic@gmail.com>

* use ipc provider as injected eip1193 provider

Signed-off-by: Marin Petrunic <marin.petrunic@gmail.com>

* fix integration tests

Signed-off-by: Marin Petrunic <marin.petrunic@gmail.com>

* fix integration tests

Signed-off-by: Marin Petrunic <marin.petrunic@gmail.com>

* fuix integration tests

Signed-off-by: Marin Petrunic <marin.petrunic@gmail.com>

* fix cypress config

Signed-off-by: Marin Petrunic <marin.petrunic@gmail.com>

* fix web3 test

Signed-off-by: Marin Petrunic <marin.petrunic@gmail.com>

* update changelog

Signed-off-by: Marin Petrunic <marin.petrunic@gmail.com>

---------

Signed-off-by: Marin Petrunic <marin.petrunic@gmail.com>
Copy link

@jonesk7734 jonesk7734 left a comment

Choose a reason for hiding this comment

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

😃

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.

8 participants