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(deps): unpin ethereumjs-abi@0.6,x ethereumjs-util@6.x #11972

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

legobeat
Copy link
Contributor

@legobeat legobeat commented Oct 23, 2024

Description

  • Unpin and dedupe ethereumjs-util and ethereumjs-abi while staying on legacy v6

  • Replace import { BN } from 'ethereumjs-util' with importing BN explicitly from either bn.js@4 or bn.js@5

    • Mixing the two is not safe and can cause breakage.
    • We don't get complete and correct typings with importing the old re-export
    • This adds both v4 and v5 as explicit dependencies - ideally v4 will be removed as transition to v5 concludes
    • Adds EIP-1191 address checksum algorithm support for toChecksumAddress()
    • Unblock relying on the ancient and deprecated ethereumjs-util@6.1.0
  • ethereumjs-util changelog

  • ethereumjs-util@v6.1.0...v6.2.0

Related issues

Blocking

Manual testing steps

Screenshots/Recordings

Before

After

Pre-merge author checklist

Pre-merge reviewer checklist

  • I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
  • I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.

Copy link
Contributor

CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes.

@legobeat legobeat added dependencies Pull requests that update a dependency file team-security Run Smoke E2E Triggers smoke e2e on Bitrise and removed team-lavamoat labels Oct 23, 2024

This comment was marked as outdated.

Copy link

socket-security bot commented Oct 23, 2024

New and removed dependencies detected. Learn more about Socket for GitHub ↗︎

Package New capabilities Transitives Size Publisher
npm/@types/bn.js@5.1.6 None 0 13.9 kB types

🚮 Removed packages: npm/bindings@1.5.0, npm/bip66@1.1.5, npm/drbg.js@1.0.1, npm/file-uri-to-path@1.0.0

View full report↗︎

@legobeat legobeat added Run Smoke E2E Triggers smoke e2e on Bitrise and removed Run Smoke E2E Triggers smoke e2e on Bitrise labels Oct 23, 2024
Copy link
Contributor

https://bitrise.io/ Bitrise

🔄🔄🔄 pr_smoke_e2e_pipeline started on Bitrise...🔄🔄🔄

Commit hash: ff87271
Build link: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/12a16554-a854-47b5-a15d-4c6da179c257

Note

  • This comment will auto-update when build completes
  • You can kick off another pr_smoke_e2e_pipeline on Bitrise by removing and re-applying the Run Smoke E2E label on the pull request

@legobeat legobeat marked this pull request as ready for review October 23, 2024 10:41
@legobeat legobeat requested review from a team as code owners October 23, 2024 10:41
yarn.lock Outdated Show resolved Hide resolved
@legobeat legobeat added Run Smoke E2E Triggers smoke e2e on Bitrise and removed Run Smoke E2E Triggers smoke e2e on Bitrise labels Oct 23, 2024
Copy link
Contributor

github-actions bot commented Oct 23, 2024

https://bitrise.io/ Bitrise

✅✅✅ pr_smoke_e2e_pipeline passed on Bitrise! ✅✅✅

Commit hash: b708bac
Build link: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/619aa4be-9711-4726-9e62-08968d39e035

Note

  • You can kick off another pr_smoke_e2e_pipeline on Bitrise by removing and re-applying the Run Smoke E2E label on the pull request

@legobeat legobeat marked this pull request as draft October 23, 2024 10:52
@legobeat legobeat force-pushed the deps-ethereumjs-6 branch 5 times, most recently from 6256e6b to 33737d5 Compare October 23, 2024 13:27
@legobeat legobeat added Run Smoke E2E Triggers smoke e2e on Bitrise and removed Run Smoke E2E Triggers smoke e2e on Bitrise labels Oct 23, 2024
@legobeat legobeat force-pushed the deps-ethereumjs-6 branch 2 times, most recently from 60ce3d0 to 0bdc3b9 Compare October 24, 2024 00:41
@legobeat legobeat added Run Smoke E2E Triggers smoke e2e on Bitrise and removed Run Smoke E2E Triggers smoke e2e on Bitrise labels Oct 24, 2024
Copy link
Contributor

github-actions bot commented Oct 24, 2024

https://bitrise.io/ Bitrise

✅✅✅ pr_smoke_e2e_pipeline passed on Bitrise! ✅✅✅

Commit hash: 59c0489
Build link: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/565f6320-9225-4aa9-866b-917e02df483c

Note

  • You can kick off another pr_smoke_e2e_pipeline on Bitrise by removing and re-applying the Run Smoke E2E label on the pull request

@legobeat legobeat added Run Smoke E2E Triggers smoke e2e on Bitrise team-wallet-framework team-mobile-platform and removed Run Smoke E2E Triggers smoke e2e on Bitrise labels Oct 24, 2024
Copy link
Contributor

github-actions bot commented Oct 24, 2024

https://bitrise.io/ Bitrise

✅✅✅ pr_smoke_e2e_pipeline passed on Bitrise! ✅✅✅

Commit hash: 5f089e9
Build link: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/8e0fd3c0-fde0-4611-aa39-bc51a4bd92be

Note

  • You can kick off another pr_smoke_e2e_pipeline on Bitrise by removing and re-applying the Run Smoke E2E label on the pull request

Copy link
Contributor

@Cal-L Cal-L left a comment

Choose a reason for hiding this comment

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

Left a comment

@@ -4,7 +4,7 @@ import StakeInputView from './StakeInputView';
import { renderScreen } from '../../../../../util/test/renderWithProvider';
import Routes from '../../../../../constants/navigation/Routes';
import { backgroundState } from '../../../../../util/test/initial-root-state';
import { BN } from 'ethereumjs-util';
import BN5 from 'bnjs5';
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you elaborate on the condition for when these would be replaced with bnjs4 vs bnjs5?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

  • The aliases bnjs4 and bnjs5 are declared in package.json. So there is no "magic" here.
  • This PR primary purpose is to do minimal changes on existing usage without causing breakage. The only migrations (like this) are done in unit tests to make the types line up.
  • As to what should be replaced, IMO we should strive to migrate off bn.js v4 (consolidating onto bn.js v5, or perhaps easing off the library entirely, though that's a bigger and longer track than this PR)

@legobeat legobeat requested a review from Cal-L October 25, 2024 02:00
github-merge-queue bot pushed a commit that referenced this pull request Oct 25, 2024
## **Description**

- Bump `json-rpc-middleware-stream` from `3.0.0` (2020-12-08) to
`^4.2.3` (2023-09-27)
- Hold at v4 to prevent breaking upgrade from `readable-stream` v2 to v3


## **Related issues**

- #11952 
- #11972 
  - #11932 

## **Manual testing steps**


## **Screenshots/Recordings**

### **Before**

### **After**

## **Pre-merge author checklist**

- [x] I’ve followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile
Coding
Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md).
- [x] I've completed the PR template to the best of my ability
- [x] I’ve included tests if applicable
- [x] I’ve documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [ ] I’ve applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.

## **Pre-merge reviewer checklist**

- [ ] I've manually tested the PR (e.g. pull and build branch, run the
app, test code being changed).
- [ ] I confirm that this PR addresses all acceptance criteria described
in the ticket it closes and includes the necessary testing evidence such
as recordings and or screenshots.
  - to get correct types
  - to prepare upgrading to versions which don't provide the re-export

- fix: vendor BNToHex and hexToBN in order to use bn.js v4
- fix: explicitly use either bn.js@4 and bn.js@5
  - Why mixing v4 and v5 is A Bad Thing: ethereumjs/ethereumjs-util#250
@legobeat legobeat added Run Smoke E2E Triggers smoke e2e on Bitrise and removed Run Smoke E2E Triggers smoke e2e on Bitrise labels Oct 25, 2024
Copy link
Contributor

github-actions bot commented Oct 25, 2024

https://bitrise.io/ Bitrise

❌❌❌ pr_smoke_e2e_pipeline failed on Bitrise! ❌❌❌

Commit hash: f3c5c2b
Build link: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/c4b05594-53a5-4ddb-8c5d-9272368191bd

Note

  • You can kick off another pr_smoke_e2e_pipeline on Bitrise by removing and re-applying the Run Smoke E2E label on the pull request

Tip

  • Check the documentation if you have any doubts on how to understand the failure on bitrise

Copy link

sonarcloud bot commented Oct 25, 2024

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file Run Smoke E2E Triggers smoke e2e on Bitrise team-mobile-platform team-security team-wallet-framework
Projects
Status: Needs dev review
Development

Successfully merging this pull request may close these issues.

3 participants